/** * Checks whether or not this geo-coding can determine the geodetic position from a pixel position. * * @return <code>true</code>, if so */ @Override public boolean canGetGeoPos() { return getGeoCoding().canGetGeoPos(); }
@Override @Deprecated public GeoPos updateGeoPos(GeoCoding geoCoding, PixelPos pixelPos, GeoPos geoPos) { if (geoCoding == null || !geoCoding.canGetGeoPos()) { return geoPos; } return geoCoding.getGeoPos(pixelPos, geoPos); } }
@Override @Deprecated public GeoPos updateGeoPos(GeoCoding geoCoding, PixelPos pixelPos, GeoPos geoPos) { if (geoCoding == null || !geoCoding.canGetGeoPos()) { return geoPos; } return geoCoding.getGeoPos(pixelPos, geoPos); } }
@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(); }
@Override protected boolean acceptForBinning(Product product) { final GeoCoding geoCoding = product.getGeoCoding(); if (geoCoding != null && geoCoding.canGetGeoPos()) { return true; } setReason("Rejected because it does not contain a proper geo coding."); return false; } }
private static boolean intersectsWith(Product sourceProduct, Product targetProduct) { final GeoCoding srcGC = sourceProduct.getGeoCoding(); final GeoCoding targetGC = targetProduct.getGeoCoding(); if (srcGC != null && srcGC.canGetGeoPos() && targetGC != null && targetGC.canGetGeoPos()) { final GeneralPath[] sourcePath = ProductUtils.createGeoBoundaryPaths(sourceProduct); final GeneralPath[] targetPath = ProductUtils.createGeoBoundaryPaths(targetProduct); for (GeneralPath spath : sourcePath) { Rectangle bounds = spath.getBounds(); for (GeneralPath tPath : targetPath) { if (tPath.getBounds().intersects(bounds)) { return true; } } } } return false; } }
@Test public void testAcceptProduct_WithProperGeoCoding() throws Exception { when(product.getGeoCoding()).thenReturn(geoCoding); when(geoCoding.canGetGeoPos()).thenReturn(true); assertThat(filter.accept(product), is(true)); assertThat(filter.getReason(), is(nullValue())); }
@Test public void testRejectProduct_WhenGeoCodingCanNotGetGeoPos() throws Exception { when(product.getGeoCoding()).thenReturn(geoCoding); when(geoCoding.canGetGeoPos()).thenReturn(false); // reject condition assertThat(filter.accept(product), is(false)); assertThat(filter.getReason(), is("Rejected because it does not contain a proper geo coding.")); }
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(CommandEvent event) { final Product product = VisatApp.getApp().getSelectedProduct(); setEnabled(product != null && product.getGeoCoding() != null && product.getGeoCoding().canGetGeoPos() && product.getGeoCoding().canGetPixelPos()); }
Guardian.assertNotNull("shape", shape); Guardian.assertNotNull("geoCoding", geoCoding); if (!geoCoding.canGetGeoPos()) { throw new IllegalArgumentException("invalid 'geoCoding'"); /*I18N*/
@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; } }
if (geoCoding != null && geoCoding.canGetGeoPos()) { geoPos = geoCoding.getGeoPos(imagePos, geoPos);
if (geoCoding.canGetGeoPos()) { final PixelPos pixelPos = new PixelPos(imagePosX, imagePosY); geoCoding.getGeoPos(pixelPos, geoPos);
if (formerGeocoding != null && formerGeocoding.canGetGeoPos()) { formerGeocoding.getGeoPos(pixelPos, geoPos); } else {
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();
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); } } }
Guardian.assertEquals("sourceGeoCoding.canGetPixelPos()", sourceGeoCoding.canGetPixelPos(), true); Guardian.assertNotNull("destGeoCoding", destGeoCoding); Guardian.assertEquals("destGeoCoding.canGetGeoPos()", destGeoCoding.canGetGeoPos(), true); Guardian.assertNotNull("destArea", destArea);
final boolean hasGeoCoding = geoCoding != null; canGetPixelPos = hasGeoCoding && geoCoding.canGetPixelPos(); canGetGeoPos = hasGeoCoding && geoCoding.canGetGeoPos();