private void updateMemDisplay() { if (product != null) { long storageMem = product.getRawStorageSize(productSubsetDef); double factor = 1.0 / (1024 * 1024); double megas = MathUtils.round(factor * storageMem, 10); if (megas > memWarnLimit) { memLabel.setForeground(MEM_LABEL_WARN_COLOR); } else { memLabel.setForeground(MEM_LABEL_NORM_COLOR); } memLabel.setText(MEM_LABEL_TEXT + megas + "M"); } else { memLabel.setText(" "); } }
private void updateUIState(ParamChangeEvent event) { if (updatingUI.compareAndSet(false, true)) { try { if (event != null && canUseGeoCoordinates(product)) { final String parmName = event.getParameter().getName(); if (parmName.startsWith("geo_")) { final GeoPos geoPos1 = new GeoPos((Float) paramNorthLat1.getValue(), (Float) paramWestLon1.getValue()); final GeoPos geoPos2 = new GeoPos((Float) paramSouthLat2.getValue(), (Float) paramEastLon2.getValue()); updateXYParams(geoPos1, geoPos2); } else if (parmName.startsWith("source_x") || parmName.startsWith("source_y")) { syncLatLonWithXYParams(); } } int x1 = ((Number) paramX1.getValue()).intValue(); int y1 = ((Number) paramY1.getValue()).intValue(); int x2 = ((Number) paramX2.getValue()).intValue(); int y2 = ((Number) paramY2.getValue()).intValue(); int sx = ((Number) paramSX.getValue()).intValue(); int sy = ((Number) paramSY.getValue()).intValue(); updateSubsetDefRegion(x1, y1, x2, y2, sx, sy); Dimension s = productSubsetDef.getSceneRasterSize( product.getSceneRasterWidth(), product.getSceneRasterHeight()); subsetWidthLabel.setText(String.valueOf(s.getWidth())); subsetHeightLabel.setText(String.valueOf(s.getHeight())); int sliderBoxX1 = x1 / thumbNailSubSampling; int sliderBoxY1 = y1 / thumbNailSubSampling; int sliderBoxX2 = x2 / thumbNailSubSampling; int sliderBoxY2 = y2 / thumbNailSubSampling; int sliderBoxW = sliderBoxX2 - sliderBoxX1 + 1; int sliderBoxH = sliderBoxY2 - sliderBoxY1 + 1; Rectangle box = getScaledRectangle(new Rectangle(sliderBoxX1, sliderBoxY1, sliderBoxW, sliderBoxH)); imageCanvas.setSliderBoxBounds(box); } finally { updatingUI.set(false); } } }