@Override @Deprecated public PixelPos updatePixelPos(GeoCoding geoCoding, GeoPos geoPos, PixelPos pixelPos) { if (geoCoding == null || !geoCoding.canGetPixelPos() || geoPos == null) { return pixelPos; } return geoCoding.getPixelPos(geoPos, pixelPos); }
/** * Checks whether or not this geo-coding can determine the pixel position from a geodetic position. * * @return <code>true</code>, if so */ @Override public boolean canGetPixelPos() { return getGeoCoding().canGetPixelPos(); }
@Override @Deprecated public PixelPos updatePixelPos(GeoCoding geoCoding, GeoPos geoPos, PixelPos pixelPos) { if (geoCoding == null || !geoCoding.canGetPixelPos() || geoPos == null) { return pixelPos; } return geoCoding.getPixelPos(geoPos, pixelPos); }
/** * Returns whether or not a product can return a pixel position from a given geographical position. * * @param product the product to be checked * * @return <code>true</code> if the given product can return a pixel position */ public static boolean canGetPixelPos(Product product) { return product != null && product.getGeoCoding() != null && product.getGeoCoding().canGetPixelPos(); }
/** * 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(); }
private void removePPL(ProductSceneView view) { GeoCoding geoCoding = view.getProduct().getGeoCoding(); if (geoCoding != null && geoCoding.canGetPixelPos()) { ViewPPL ppl = viewPplMap.get(view); viewPplMap.remove(view); view.removePixelPositionListener(ppl); } }
@Override public boolean accept(Product product) { final GeoCoding geoCoding = product.getGeoCoding(); return geoCoding != null && geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos(); } }
private boolean canUseGeoCoordinates(Product product) { final GeoCoding geoCoding = product.getGeoCoding(); return geoCoding != null && geoCoding.canGetPixelPos() && geoCoding.canGetGeoPos(); }
private void addPPL(ProductSceneView view) { GeoCoding geoCoding = view.getProduct().getGeoCoding(); if (geoCoding != null && geoCoding.canGetPixelPos()) { psvOverlayMap.put(view, null); ViewPPL ppl = new ViewPPL(view); viewPplMap.put(view, ppl); view.addPixelPositionListener(ppl); } }
private boolean isAbleToExtractPixels(Product product) { final Logger logger = getLogger(); if (product == null) { return false; } final GeoCoding geoCoding = product.getGeoCoding(); if (geoCoding == null) { final String msgPattern = "Product [%s] refused. Cause: Product is not geo-coded."; logger.warning(String.format(msgPattern, product.getFileLocation())); return false; } if (!geoCoding.canGetPixelPos()) { final String msgPattern = "Product [%s] refused. Cause: Pixel position can not be determined."; logger.warning(String.format(msgPattern, product.getFileLocation())); return false; } return true; }
private boolean containsGeoCodingWithReverseOperationSupport(Product product) { GeoCoding geoCoding = product.getGeoCoding(); if (geoCoding == null) { logSkipped("The product '" + product.getName() + "' does not contain a geo coding."); return false; } if (!geoCoding.canGetPixelPos()) { logSkipped("The geo-coding of the product '" + product.getName() + "' can not determine the pixel position from a geodetic position."); return false; } return true; }
private boolean productsIntersect(Product timeSeriesSourceProduct, Product collocationProduct) { if (collocationProduct.getGeoCoding() == null) { return false; } final GeoCoding geoCoding = collocationProduct.getGeoCoding(); if (geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos() && ((geoCoding instanceof CrsGeoCoding)||(geoCoding instanceof MapGeoCoding))) { final GeneralPath[] sourcePaths = ProductUtils.createGeoBoundaryPaths(timeSeriesSourceProduct); final GeneralPath[] collocationPaths = ProductUtils.createGeoBoundaryPaths(collocationProduct); for (GeneralPath sourcePath : sourcePaths) { for (GeneralPath collocationPath : collocationPaths) { final Area sourceArea = new Area(sourcePath); final Area collocationArea = new Area(collocationPath); collocationArea.intersect(sourceArea); if (!collocationArea.isEmpty()) { return true; } } } } return false; } }
@Override public void updateState(final CommandEvent event) { ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView(); GeoCoding geoCoding = null; if (view != null && view.getProduct() != null) { geoCoding = view.getProduct().getGeoCoding(); } setEnabled(geoCoding != null && geoCoding.canGetPixelPos()); }
@Override public void updateState(CommandEvent event) { final Product product = VisatApp.getApp().getSelectedProduct(); setEnabled(product != null && product.getGeoCoding() != null && product.getGeoCoding().canGetGeoPos() && product.getGeoCoding().canGetPixelPos()); }
@Override public boolean accept(Product collocationProduct) { final Product referenceProduct = getReferenceProduct(); if (referenceProduct == collocationProduct || collocationProduct.getGeoCoding() == null) { return false; } if (referenceProduct == null) { return true; } final GeoCoding geoCoding = collocationProduct.getGeoCoding(); if (geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos() && (geoCoding instanceof CrsGeoCoding)) { final GeneralPath[] sourcePath = ProductUtils.createGeoBoundaryPaths(referenceProduct); final GeneralPath[] collocationPath = ProductUtils.createGeoBoundaryPaths(collocationProduct); for (GeneralPath path : sourcePath) { Rectangle bounds = path.getBounds(); for (GeneralPath colPath : collocationPath) { if (colPath.getBounds().intersects(bounds)) { return true; } } } } return false; } }
&& geoPos != null && geoCoding != null && geoCoding.canGetPixelPos()) { imagePos = geoCoding.getPixelPos(geoPos, imagePos);
final GeoCoding thisGeoCoding = thisRaster.getGeoCoding(); final GeoCoding thatGeoCoding = thatRaster.getGeoCoding(); if (thisGeoCoding != null && thatGeoCoding != null && thisGeoCoding.canGetGeoPos() && thatGeoCoding.canGetPixelPos()) { final Viewport thisViewport = layerCanvas.getViewport(); final Viewport thatViewport = thatView.layerCanvas.getViewport();
@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 assertEquality(final GeoCoding gc1, final GeoCoding gc2, float accuracy) { assertNotNull(gc2); assertEquals(gc1.canGetGeoPos(), gc2.canGetGeoPos()); assertEquals(gc1.canGetPixelPos(), gc2.canGetPixelPos()); assertEquals(gc1.isCrossingMeridianAt180(), gc2.isCrossingMeridianAt180()); if (gc1 instanceof CrsGeoCoding) { assertEquals(CrsGeoCoding.class, gc2.getClass()); CRS.equalsIgnoreMetadata(gc1, gc2); } else if (gc1 instanceof TiePointGeoCoding) { assertEquals(TiePointGeoCoding.class, gc2.getClass()); } final int width = outProduct.getSceneRasterWidth(); final int height = outProduct.getSceneRasterHeight(); GeoPos geoPos1 = null; GeoPos geoPos2 = null; final String msgPattern = "%s at [%d,%d] is not equal:"; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { final PixelPos pixelPos = new PixelPos(i, j); geoPos1 = gc1.getGeoPos(pixelPos, geoPos1); geoPos2 = gc2.getGeoPos(pixelPos, geoPos2); assertEquals(String.format(msgPattern, "Latitude", i, j), geoPos1.lat, geoPos2.lat, accuracy); assertEquals(String.format(msgPattern, "Longitude", i, j), geoPos1.lon, geoPos2.lon, accuracy); } } }
final Rectangle destArea) { Guardian.assertNotNull("sourceGeoCoding", sourceGeoCoding); Guardian.assertEquals("sourceGeoCoding.canGetPixelPos()", sourceGeoCoding.canGetPixelPos(), true); Guardian.assertNotNull("destGeoCoding", destGeoCoding); Guardian.assertEquals("destGeoCoding.canGetGeoPos()", destGeoCoding.canGetGeoPos(), true);