/** * Constructs a new pixel info view. */ public PixelInfoView(BasicApp app) { super(new BorderLayout()); this.app = app; _displayFilterListener = createDisplayFilterListener(); _productNodeListener = createProductNodeListener(); dockablePaneMap = new HashMap<DockablePaneKey, DockablePane>(5); geolocModel = new PixelInfoViewTableModel(new String[]{"Coordinate", "Value", "Unit"}); scanlineModel = new PixelInfoViewTableModel(new String[]{"Time", "Value", "Unit"}); bandModel = new PixelInfoViewTableModel(new String[]{"Band", "Value", "Unit"}); tiePointModel = new PixelInfoViewTableModel(new String[]{"Tie Point Grid", "Value", "Unit"}); flagModel = new PixelInfoViewTableModel(new String[]{"Flag", "Value",}); modelUpdater = new PixelInfoViewModelUpdater(geolocModel, scanlineModel, bandModel, tiePointModel, flagModel, this); updateService = new PixelInfoUpdateService(modelUpdater); createUI(); }
@Override public void run() { if (clearRasterTableSelection) { pixelInfoView.clearSelectionInRasterTables(); } geolocModel.fireTableDataChanged(); scanlineModel.fireTableDataChanged(); bandModel.fireTableDataChanged(); tiePointModel.fireTableDataChanged(); flagModel.fireTableDataChanged(); } });
private void updateFlagPixelValues() { final boolean available = isSampleValueAvailable(levelZeroX, levelZeroY, _pixelPosValid); if (flagModel.getRowCount() != getFlagRowCount()) { resetFlagTableModel(); } int rowIndex = 0; for (Band band : currentFlagBands) { long pixelValue = available ? ProductUtils.getGeophysicalSampleLong(band, _pixelX, _pixelY, _level) : 0; for (int j = 0; j < band.getFlagCoding().getNumAttributes(); j++) { if (available) { MetadataAttribute attribute = band.getFlagCoding().getAttributeAt(j); int mask = attribute.getData().getElemInt(); flagModel.updateValue(String.valueOf((pixelValue & mask) == mask), rowIndex); } else { flagModel.updateValue(_INVALID_POS_TEXT, rowIndex); } rowIndex++; } } }
private void updateScanLineValues() { final ProductData.UTC utcStartTime = currentProduct.getStartTime(); final ProductData.UTC utcEndTime = currentProduct.getEndTime(); if (utcStartTime == null || utcEndTime == null || !isSampleValueAvailable(0, levelZeroY, true)) { scanlineModel.updateValue("No date information", 0); scanlineModel.updateValue("No time information", 1); } else { final float pY = levelZeroY + pixelInfoView.getPixelOffsetY(); final ProductData.UTC utcCurrentLine = ProductUtils.getScanLineTime(currentProduct, pY); final Calendar currentLineTime = utcCurrentLine.getAsCalendar(); final String dateString = String.format("%1$tF", currentLineTime); final String timeString = String.format("%1$tI:%1$tM:%1$tS:%1$tL %1$Tp", currentLineTime); scanlineModel.updateValue(dateString, 0); scanlineModel.updateValue(timeString, 1); } }
resetTableModels(); if (bandModel.getRowCount() != getBandRowCount()) { resetTableModels();
private void updateBandPixelValues() { Band[] bands = currentProduct.getBands(); int rowIndex = 0; for (final Band band : bands) { if (shouldDisplayBand(band)) { bandModel.updateValue(getPixelString(band), rowIndex); rowIndex++; } } }
private void resetTiePointGridTableModel() { tiePointModel.clear(); if (currentRaster != null) { final int numTiePointGrids = currentProduct.getNumTiePointGrids(); for (int i = 0; i < numTiePointGrids; i++) { final TiePointGrid tiePointGrid = currentProduct.getTiePointGridAt(i); tiePointModel.addRow(tiePointGrid.getName(), "", tiePointGrid.getUnit()); } } }
private void updateTiePointGridPixelValues() { final int numTiePointGrids = currentProduct.getNumTiePointGrids(); int rowIndex = 0; for (int i = 0; i < numTiePointGrids; i++) { final TiePointGrid grid = currentProduct.getTiePointGridAt(i); tiePointModel.updateValue(grid.getPixelString(levelZeroX, levelZeroY), rowIndex); rowIndex++; } }
private void resetGeolocTableModel() { geolocModel.clear(); if (currentRaster != null) { final GeoCoding geoCoding = currentRaster.getGeoCoding(); geolocModel.addRow("Image-X", "", "pixel"); geolocModel.addRow("Image-Y", "", "pixel"); if (geoCoding != null) { geolocModel.addRow("Longitude", "", "degree"); geolocModel.addRow("Latitude", "", "degree"); if (geoCoding instanceof MapGeoCoding) { final MapGeoCoding mapGeoCoding = (MapGeoCoding) geoCoding; final String mapUnit = mapGeoCoding.getMapInfo().getMapProjection().getMapUnit(); geolocModel.addRow("Map-X", "", mapUnit); geolocModel.addRow("Map-Y", "", mapUnit); } else if (geoCoding instanceof CrsGeoCoding) { String xAxisUnit = geoCoding.getMapCRS().getCoordinateSystem().getAxis(0).getUnit().toString(); String yAxisUnit = geoCoding.getMapCRS().getCoordinateSystem().getAxis(1).getUnit().toString(); geolocModel.addRow("Map-X", "", xAxisUnit); geolocModel.addRow("Map-Y", "", yAxisUnit); } } } }
geolocModel.updateValue(tix, 0); geolocModel.updateValue(tiy, 1); if (geoCoding != null) { geolocModel.updateValue(tgx, 2); geolocModel.updateValue(tgy, 3); if (geoCoding instanceof MapGeoCoding || geoCoding instanceof CrsGeoCoding) { geolocModel.updateValue(tmx, 4); geolocModel.updateValue(tmy, 5);
private void resetBandTableModel() { bandModel.clear(); if (currentRaster != null) { final int numBands = currentProduct.getNumBands(); for (int i = 0; i < numBands; i++) { final Band band = currentProduct.getBandAt(i); if (shouldDisplayBand(band)) { bandModel.addRow(band.getName(), "", band.getUnit()); } } } }
private void resetFlagTableModel() { flagModel.clear(); if (currentRaster != null) { for (Band band : currentFlagBands) { final FlagCoding flagCoding = band.getFlagCoding(); final int numFlags = flagCoding.getNumAttributes(); final String bandNameDot = band.getName() + "."; for (int j = 0; j < numFlags; j++) { String name = bandNameDot + flagCoding.getAttributeAt(j).getName(); flagModel.addRow(name, "", ""); } } } }