@Override public boolean isApplicable(LayerSourcePageContext pageContext) { ProductSceneView view = SnapApp.getDefault().getSelectedProductSceneView(); RasterDataNode raster = view.getRaster(); return raster.getGeoCoding() instanceof MapGeoCoding || raster.getGeoCoding() instanceof CrsGeoCoding; }
private String getKey(RasterDataNode rasterDataNode) { return rasterDataNode.getGeoCoding().toString() + " " + rasterDataNode.getRasterWidth() + " " + rasterDataNode.getRasterHeight(); }
@Override protected boolean getActionEnabledState(ProductSceneView view) { RasterDataNode raster = view.getRaster(); return isGeographicLatLon(raster.getGeoCoding()); }
@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(); } }
private void collectCompatibleRasterDataNodes(CoordinateReferenceSystem thisCrs, RasterDataNode[] bands, Collection<RasterDataNode> rasterDataNodes) { for (RasterDataNode node : bands) { CoordinateReferenceSystem otherCrs = Product.findModelCRS(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); } } }
private void showDetailsDialog(ProductSceneView view) { GeoCoding geoCoding = view.getRaster().getGeoCoding(); if (geoCoding == null) { Dialogs.showInformation(TITLE, String.format("No geo-coding information for %s.", view.getRaster().getName()), null);
@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); }
return; GeoCoding geoCoding = rasterDataNode.getGeoCoding(); if (geoCoding == null) { geoPosLabel.setText(String.format(GEO_POS_FORMAT, "--", "--"));
@Override public void nodeChanged(final ProductNodeEvent event) { if (Product.PROPERTY_NAME_SCENE_GEO_CODING.equals(event.getPropertyName())) { if (event.getSourceNode() instanceof Product) { geoCoding = getProduct().getSceneGeoCoding(); } else { geoCoding = getRaster().getGeoCoding(); } updateComponents(); } }
} else { RasterDataNode raster = SnapApp.getDefault().getSelectedProductSceneView().getRaster(); AffineTransform g2mTransform = Product.findImageToModelTransform(raster.getGeoCoding()); Rectangle2D bounds = g2mTransform.createTransformedShape( new Rectangle(0, 0, raster.getRasterWidth(),
private void deriveRasterPropertiesFromExpression(String expression, Product product) { if (product != null) { try { final RasterDataNode[] refRasters = BandArithmetic.getRefRasters(expression, product); if (refRasters.length > 0) { setGeoCoding(refRasters[0].getGeoCoding()); setImageToModelTransform(refRasters[0].getImageToModelTransform()); setSceneToModelTransform(refRasters[0].getSceneToModelTransform()); setModelToSceneTransform(refRasters[0].getModelToSceneTransform()); } } catch (ParseException e) { // do not set geocoding then } } }
final GeoCoding thisGeoCoding = thisRaster.getGeoCoding(); final GeoCoding thatGeoCoding = thatRaster.getGeoCoding(); if (thisGeoCoding != null && thatGeoCoding != null && thisGeoCoding.canGetGeoPos() && thatGeoCoding.canGetPixelPos()) { final Viewport thisViewport = layerCanvas.getViewport();
AffineTransform i2mTransform = Product.findImageToModelTransform(raster.getGeoCoding()); i2mTransform.scale((double) sceneWidth / image.getWidth(), (double) sceneHeight / image.getHeight()); final Rectangle2D bounds = DefaultMultiLevelModel.getModelBounds(i2mTransform, image);
@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); }
geoCoding = raster.getGeoCoding(); sceneCenter = new PixelPos(Math.floor(raster.getRasterWidth() / 2.0) + 0.5, Math.floor(raster.getRasterHeight() / 2.0) + 0.5);
if (!reprojectionSettingsMap.containsKey(key)) { GeoPos centerGeoPos = getCenterGeoPos(rasterDataNode.getGeoCoding(), rasterDataNode.getRasterWidth(), rasterDataNode.getRasterHeight());
GeoCoding geoCoding = mask.getGeoCoding(); AreaCalculator areaCalculator = new AreaCalculator(geoCoding); MaskAreaStatistics areaStatistics = new MaskAreaStatistics(areaCalculator.getEarthRadius() / 1000.0);
private static String formatKML(ProductSceneView view, String imageName) { final RasterDataNode raster = view.getRaster(); final Product product = raster.getProduct(); final GeoCoding geoCoding = raster.getGeoCoding(); final PixelPos upperLeftPP = new PixelPos(0, 0); final PixelPos lowerRightPP = new PixelPos(product.getSceneRasterWidth(),
private void resetPositionTableModel() { positionModel.clear(); if (currentRaster != null) { final GeoCoding geoCoding = currentRaster.getGeoCoding(); positionModel.addRow("Image-X", "", "pixel"); positionModel.addRow("Image-Y", "", "pixel"); //todo [Multisize_products] ask for something else than multisize (scenetomodeltransform) if (getCurrentProduct().isMultiSize()) { positionModel.addRow("Scene-X", "", "pixel"); positionModel.addRow("Scene-Y", "", "pixel"); } if (geoCoding != null) { positionModel.addRow("Longitude", "", "degree"); positionModel.addRow("Latitude", "", "degree"); if (geoCoding instanceof MapGeoCoding) { final MapGeoCoding mapGeoCoding = (MapGeoCoding) geoCoding; final String mapUnit = mapGeoCoding.getMapInfo().getMapProjection().getMapUnit(); positionModel.addRow("Map-X", "", mapUnit); positionModel.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(); positionModel.addRow("Map-X", "", xAxisUnit); positionModel.addRow("Map-Y", "", yAxisUnit); } } } }