@Test public void testTransferGeoCoding() throws URISyntaxException, IOException { Product product = ProductIO.readProduct(new File(getClass().getResource("bowtiepixelgeocoding_test_product.L2_sub").toURI())); assertTrue(product.getSceneGeoCoding() instanceof BowtiePixelGeoCoding); Product targetProduct = new Product("name", "type", product.getSceneRasterWidth(), product.getSceneRasterHeight()); assertNull(targetProduct.getSceneGeoCoding()); ProductUtils.copyGeoCoding(product, targetProduct); assertNotNull(targetProduct.getSceneGeoCoding()); assertTrue(targetProduct.getSceneGeoCoding() instanceof BowtiePixelGeoCoding); }
@Override public boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef) { BowtiePixelGeoCoding srcGeocoding = (BowtiePixelGeoCoding)srcScene.getGeoCoding(); final String latBandName = srcGeocoding.latBand.getName(); final String lonBandName = srcGeocoding.lonBand.getName(); try { ensureLatLonBands(destScene, subsetDef); } catch (IOException e) { return false; } final Band targetLatBand = destScene.getProduct().getBand(latBandName); final Band targetLonBand = destScene.getProduct().getBand(lonBandName); if(subsetDef != null) { if(subsetDef.getSubSamplingY() != 1) { destScene.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(targetLatBand, targetLonBand, null, 5)); return true; } } if (targetLatBand != null && targetLonBand != null) { destScene.setGeoCoding(new BowtiePixelGeoCoding(targetLatBand, targetLonBand, srcGeocoding._scanlineHeight)); return true; } return false; }
BowtiePixelGeoCoding extends AbstractBowtieGeoCoding { @Override public boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef) { BowtiePixelGeoCoding srcGeocoding = (BowtiePixelGeoCoding)srcScene.getGeoCoding(); final String latBandName = srcGeocoding.latBand.getName(); final String lonBandName = srcGeocoding.lonBand.getName(); try { ensureLatLonBands(destScene, subsetDef); } catch (IOException e) { return false; } final Band targetLatBand = destScene.getProduct().getBand(latBandName); final Band targetLonBand = destScene.getProduct().getBand(lonBandName); if(subsetDef != null) { if(subsetDef.getSubSamplingY() != 1) { destScene.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(targetLatBand, targetLonBand, null, 5)); return true; } } if (targetLatBand != null && targetLonBand != null) { destScene.setGeoCoding(new BowtiePixelGeoCoding(targetLatBand, targetLonBand, srcGeocoding._scanlineHeight)); return true; } return false; } }
BowtiePixelGeoCoding extends AbstractBowtieGeoCoding { @Override public boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef) { BowtiePixelGeoCoding srcGeocoding = (BowtiePixelGeoCoding)srcScene.getGeoCoding(); final String latBandName = srcGeocoding.latBand.getName(); final String lonBandName = srcGeocoding.lonBand.getName(); try { ensureLatLonBands(destScene, subsetDef); } catch (IOException e) { return false; } final Band targetLatBand = destScene.getProduct().getBand(latBandName); final Band targetLonBand = destScene.getProduct().getBand(lonBandName); if(subsetDef != null) { if(subsetDef.getSubSamplingY() != 1) { destScene.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(targetLatBand, targetLonBand, null, 5)); return true; } } if (targetLatBand != null && targetLonBand != null) { destScene.setGeoCoding(new BowtiePixelGeoCoding(targetLatBand, targetLonBand, srcGeocoding._scanlineHeight)); return true; } return false; } BowtiePixelGeoCoding(Band latBand, Band lonBand, int scanlineHeight); }
BowtiePixelGeoCoding extends AbstractBowtieGeoCoding { @Override public boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef) { BowtiePixelGeoCoding srcGeocoding = (BowtiePixelGeoCoding)srcScene.getGeoCoding(); final String latBandName = srcGeocoding.latBand.getName(); final String lonBandName = srcGeocoding.lonBand.getName(); try { ensureLatLonBands(destScene, subsetDef); } catch (IOException e) { return false; } final Band targetLatBand = destScene.getProduct().getBand(latBandName); final Band targetLonBand = destScene.getProduct().getBand(lonBandName); if(subsetDef != null) { if(subsetDef.getSubSamplingY() != 1) { destScene.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(targetLatBand, targetLonBand, null, 5)); return true; } } if (targetLatBand != null && targetLonBand != null) { destScene.setGeoCoding(new BowtiePixelGeoCoding(targetLatBand, targetLonBand, srcGeocoding._scanlineHeight)); return true; } return false; } BowtiePixelGeoCoding(Band latBand, Band lonBand, int scanlineHeight); int getSceneHeight(); int getScanlineHeight(); int getScanlineOffset(); Band getLatBand(); Band getLonBand(); @Override boolean equals(Object o); @Override int hashCode(); @Override void dispose(); @Override boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef); }
BowtiePixelGeoCoding extends AbstractBowtieGeoCoding { @Override public boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef) { BowtiePixelGeoCoding srcGeocoding = (BowtiePixelGeoCoding)srcScene.getGeoCoding(); final String latBandName = srcGeocoding.latBand.getName(); final String lonBandName = srcGeocoding.lonBand.getName(); try { ensureLatLonBands(destScene, subsetDef); } catch (IOException e) { return false; } final Band targetLatBand = destScene.getProduct().getBand(latBandName); final Band targetLonBand = destScene.getProduct().getBand(lonBandName); if(subsetDef != null) { if(subsetDef.getSubSamplingY() != 1) { destScene.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(targetLatBand, targetLonBand, null, 5)); return true; } } if (targetLatBand != null && targetLonBand != null) { destScene.setGeoCoding(new BowtiePixelGeoCoding(targetLatBand, targetLonBand, srcGeocoding._scanlineHeight)); return true; } return false; } BowtiePixelGeoCoding(Band latBand, Band lonBand, int scanlineHeight); int getSceneHeight(); int getScanlineHeight(); int getScanlineOffset(); Band getLatBand(); Band getLonBand(); @Override boolean equals(Object o); @Override int hashCode(); @Override void dispose(); @Override boolean transferGeoCoding(final Scene srcScene, final Scene destScene, final ProductSubsetDef subsetDef);  }