public GeoCoding getGeoCoding() { return raster.getGeoCoding(); }
/** * Returns whether or not a raster can return a pixel position from a given geographical position. * * @param raster the raster to be checked * * @return <code>true</code> if the given raster can return a pixel position */ public static boolean canGetPixelPos(final RasterDataNode raster) { return raster != null && raster.getGeoCoding() != null && raster.getGeoCoding().canGetPixelPos(); }
@Override public Object getCoordinateReferenceSystem() { final GeoCoding geoCoding = rasters[0].getGeoCoding(); if (geoCoding != null) { return ImageManager.getModelCrs(geoCoding); } return null; }
@Override public boolean isApplicable(LayerSourcePageContext pageContext) { ProductSceneView view = pageContext.getAppContext().getSelectedProductSceneView(); RasterDataNode raster = view.getRaster(); return raster.getGeoCoding() instanceof MapGeoCoding || raster.getGeoCoding() instanceof CrsGeoCoding; }
protected String getCSName(final RasterDataNode raster) { final String csName; final GeoCoding geoCoding = raster.getGeoCoding(); if (geoCoding instanceof MapGeoCoding || geoCoding instanceof CrsGeoCoding) { csName = geoCoding.getMapCRS().getName().toString(); } else { csName = "Satellite coordinates"; } return csName; }
@Override protected boolean mustHandleSelectionChange() { final RasterDataNode raster = getRaster(); return super.mustHandleSelectionChange() || (raster != null && geoCoding != raster.getGeoCoding()); }
private GeoCoding getSourceGeoCoding(final RasterDataNode sourceBand) { if (orthorectify && sourceBand.canBeOrthorectified()) { return createOrthorectifier(sourceBand); } else { return sourceBand.getGeoCoding(); } }
@Override protected boolean mustHandleSelectionChange() { final RasterDataNode raster = getRaster(); return super.mustHandleSelectionChange() || (raster != null && _geoCoding != raster.getGeoCoding()); }
/** * Gets a {@link Pointing} if one is available for this raster. * The methods calls {@link #createPointing()} if a pointing has not been set so far or if its {@link GeoCoding} changed * since the last creation of this raster's {@link Pointing} instance. * * @return the pointing object, or null if a pointing is not available */ public Pointing getPointing() { if (pointing == null || pointing.getGeoCoding() == getGeoCoding()) { pointing = createPointing(); } return pointing; }
private void collectCompatibleRasterDataNodes(CoordinateReferenceSystem thisCrs, RasterDataNode[] bands, Collection<RasterDataNode> rasterDataNodes) { for (RasterDataNode node : bands) { CoordinateReferenceSystem otherCrs = ImageManager.getModelCrs(node.getGeoCoding()); // For GeoTools, two CRS where unequal if the authorities of their CS only differ in version // This happened with the S-2 L1C CRS, namely an EPSG:32615. Here one authority's version was null, // the other "7.9". Extremely annoying to debug and find out :-( (nf, Feb 2013) if (CRS.equalsIgnoreMetadata(thisCrs, otherCrs) || haveCommonReferenceIdentifiers(thisCrs, otherCrs)) { rasterDataNodes.add(node); } } }
@Override protected void updateEnableState(ProductSceneView view) { RasterDataNode raster = view.getRaster(); GeoCoding geoCoding = raster.getGeoCoding(); setEnabled(isGeographicLatLon(geoCoding)); }
@Override public void pixelPosChanged(ImageLayer baseImageLayer, int pixelX, int pixelY, int currentLevel, boolean pixelPosValid, MouseEvent e) { PixelPos pixelPos = computeLevelZeroPixelPos(baseImageLayer, pixelX, pixelY, currentLevel); GeoPos geoPos = view.getRaster().getGeoCoding().getGeoPos(pixelPos, null); updateCursorOverlays(geoPos, view); }
@Override public void nodeChanged(final ProductNodeEvent event) { if (Product.PROPERTY_NAME_GEOCODING.equals(event.getPropertyName())) { if (event.getSourceNode() instanceof Product) { _geoCoding = getProduct().getGeoCoding(); } else { _geoCoding = getRaster().getGeoCoding(); } updateComponents(); } }
/** * Creates a {@link Pointing} applicable for this raster. * * @return the pointing object, or null if a pointing is not available */ protected Pointing createPointing() { if (getGeoCoding() == null || getProduct() == null) { return null; } final PointingFactory factory = getProduct().getPointingFactory(); if (factory == null) { return null; } return factory.createPointing(this); }
@Override public void nodeChanged(final ProductNodeEvent event) { if (Product.PROPERTY_NAME_GEOCODING.equals(event.getPropertyName())) { if (event.getSourceNode() instanceof Product) { geoCoding = getProduct().getGeoCoding(); } else { geoCoding = getRaster().getGeoCoding(); } updateComponents(); } }
public Pointing createPointing(RasterDataNode raster) { final Product product = raster.getProduct(); if (raster.getName().toLowerCase().indexOf("_nadir") != -1) { return new TiePointGridPointing(raster.getGeoCoding(), toZenithTiePointGrid(product, EnvisatConstants.AATSR_SUN_ELEV_NADIR_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_SUN_AZIMUTH_NADIR_DS_NAME), toZenithTiePointGrid(product, EnvisatConstants.AATSR_VIEW_ELEV_NADIR_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_VIEW_AZIMUTH_NADIR_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_ALTITUDE_DS_NAME)); } else if (raster.getName().toLowerCase().indexOf("_fward") != -1) { return new TiePointGridPointing(raster.getGeoCoding(), toZenithTiePointGrid(product, EnvisatConstants.AATSR_SUN_ELEV_FWARD_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_SUN_AZIMUTH_FWARD_DS_NAME), toZenithTiePointGrid(product, EnvisatConstants.AATSR_VIEW_ELEV_FWARD_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_VIEW_AZIMUTH_FWARD_DS_NAME), product.getTiePointGrid(EnvisatConstants.AATSR_ALTITUDE_DS_NAME)); } return null; }
public Pointing createPointing(RasterDataNode raster) { final Product product = raster.getProduct(); return new TiePointGridPointing(raster.getGeoCoding(), product.getTiePointGrid(EnvisatConstants.MERIS_SUN_ZENITH_DS_NAME), product.getTiePointGrid(EnvisatConstants.MERIS_SUN_AZIMUTH_DS_NAME), product.getTiePointGrid(EnvisatConstants.MERIS_VIEW_ZENITH_DS_NAME), product.getTiePointGrid(EnvisatConstants.MERIS_VIEW_AZIMUTH_DS_NAME), product.getTiePointGrid(EnvisatConstants.MERIS_DEM_ALTITUDE_DS_NAME)); } }
@Override public void updateState(final CommandEvent event) { final ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView(); boolean enabled = false; if (view != null) { final RasterDataNode raster = view.getRaster(); if (raster != null && raster.getGeoCoding() != null) { Product product = raster.getProduct(); int numMasks = product.getMaskGroup().getNodeCount(); enabled = numMasks > 0; } } setEnabled(enabled); }
@Override public void paintOverlay(LayerCanvas canvas, Rendering rendering) { if (geoPosition == null || !geoPosition.isValid()) { return; } final GeoCoding geoCoding = sceneView.getRaster().getGeoCoding(); if (!geoCoding.canGetPixelPos()) { return; } final Product product = sceneView.getRaster().getProduct(); final PixelPos pixelPos = geoCoding.getPixelPos(geoPosition, null); if (!pixelPos.isValid() || !product.containsPixel(pixelPos)) { return; } final Viewport viewport = canvas.getViewport(); drawCursor(rendering.getGraphics(), viewport, pixelPos); }
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); } } } }