private void detachGeoCoding(Product product) { if (product.getGeoCoding() instanceof GcpGeoCoding) { GeoCoding gc = ((GcpGeoCoding) product.getGeoCoding()).getOriginalGeoCoding(); product.setGeoCoding(gc); } updateUIState(); }
private boolean containsGeocoding(Product product) { final boolean valid = product.getGeoCoding() != null; if (!valid) { logSkipped("The product '" + product.getName() + "' does not contain a geo coding."); } return valid; }
@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; } }
@Override public void updateState(CommandEvent event) { boolean enabled = false; final Product product = VisatApp.getApp().getSelectedProduct(); if (product != null) { enabled = product.getGeoCoding() instanceof BasicPixelGeoCoding; } setEnabled(enabled); }
@Override public void updateState(CommandEvent event) { final Product product = VisatApp.getApp().getSelectedProduct(); setEnabled(product != null && product.getGeoCoding() != null); }
public static GeoTIFFMetadata createGeoTIFFMetadata(final Product product) { final GeoCoding geoCoding = product.getGeoCoding(); final int w = product.getSceneRasterWidth(); final int h = product.getSceneRasterHeight(); return createGeoTIFFMetadata(geoCoding, w, h); }
private void updatePixelPos() { if (canGetPixelPos && !adjusting) { adjusting = true; PixelPos pixelPos = placemarkDescriptor.updatePixelPos(product.getGeoCoding(), getGeoPos(), getPixelPos()); setPixelPos(pixelPos); adjusting = false; } }
@Override protected GcpGeoCoding doInBackground() throws Exception { GcpGeoCoding gcpGeoCoding = new GcpGeoCoding(method, gcps, product.getSceneRasterWidth(), product.getSceneRasterHeight(), datum); gcpGeoCoding.setOriginalGeoCoding(product.getGeoCoding()); return gcpGeoCoding; }
@Override public Pointing createPointing(final RasterDataNode raster) { final Product product = raster.getProduct(); return new TiePointGridPointing(product.getGeoCoding(), null, null, product.getTiePointGrid("vza"), product.getTiePointGrid("vaa"), null); } }
@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(); } }
protected void writeGeoCoding(final int indent) { if (product.isUsingSingleGeoCoding()) { writeGeoCoding(product.getGeoCoding(), indent, -1); } else { final Band[] bands = product.getBands(); for (int i = 0; i < bands.length; i++) { final Band band = bands[i]; writeGeoCoding(band.getGeoCoding(), indent, i); } } }
@Test public void testTransferGeoCoding() throws URISyntaxException, IOException { Product product = ProductIO.readProduct(new File(getClass().getResource("bowtiepixelgeocoding_test_product.L2_sub").toURI())); assertTrue(product.getGeoCoding() instanceof BowtiePixelGeoCoding); Product targetProduct = new Product("name", "type", product.getSceneRasterWidth(), product.getSceneRasterHeight()); assertNull(targetProduct.getGeoCoding()); ProductUtils.copyGeoCoding(product, targetProduct); assertNotNull(targetProduct.getGeoCoding()); assertTrue(targetProduct.getGeoCoding() instanceof BowtiePixelGeoCoding); }
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; }
@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 void updateDefaultGeometryAttribute(PixelPos pixelPos) { final Product product = getProduct(); final Point2D.Float geometryPoint = new Point2D.Float(pixelPos.x, pixelPos.y); if (product != null) { final AffineTransform i2m = ImageManager.getImageToModelTransform(product.getGeoCoding()); i2m.transform(pixelPos, geometryPoint); } final Point point = (Point) feature.getDefaultGeometry(); point.getCoordinate().setCoordinate(toCoordinate(geometryPoint)); point.geometryChanged(); }
@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()); }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 360, 180, -180.0, 90.0, 1.0, 1.0, 0.0, 0.0)); PinDescriptor descriptor = PinDescriptor.getInstance(); Placemark pin1 = Placemark.createPointPlacemark(descriptor, "pin_1", "Pin 1", "Schnatter!", new PixelPos(0, 0), new GeoPos(), product1.getGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
@Test public void testDestLatLonBandsExisting() { final ProductSubsetDef subsetDef = null; final Product destP = new Product("dest", "dest", sourceP.getSceneRasterWidth(), sourceP.getSceneRasterHeight()); copyBandTo(destP, pixelGeoCoding.getLatBand()); copyBandTo(destP, pixelGeoCoding.getLonBand()); assertEquals(true, sourceP.transferGeoCodingTo(destP, subsetDef)); assertNotNull(destP.getGeoCoding()); assertEquals(true, destP.getGeoCoding() instanceof BasicPixelGeoCoding); }
private void testMerisPointingAt00(Product product, final Pointing pointing) { assertNotNull(pointing); assertSame(product.getGeoCoding(), pointing.getGeoCoding()); final PixelPos pixel00 = new PixelPos(0, 0); Assert.assertEquals(new AngularDirection(2, 1), pointing.getSunDir(pixel00, null)); assertEquals(new AngularDirection(10, 0), pointing.getViewDir(pixel00, null)); assertEquals(20.0f, pointing.getElevation(pixel00), 1.0e-10f); }
@Test public void testDestWithoutLatLonBands() { final ProductSubsetDef subsetDef = null; final Product destP = new Product("dest", "dest", sourceP.getSceneRasterWidth(), sourceP.getSceneRasterHeight()); assertEquals(true, sourceP.transferGeoCodingTo(destP, subsetDef)); final GeoCoding destGeoCoding = destP.getGeoCoding(); assertNotNull(destGeoCoding); assertEquals(true, destGeoCoding instanceof BasicPixelGeoCoding); }