SlstrTiePointGeoCoding extends TiePointGeoCoding { @Override public PixelPos getPixelPos(GeoPos geoPos, PixelPos pixelPos) { pixelPos = super.getPixelPos(geoPos, pixelPos); PixelPos transformedPixelPos = new PixelPos(); inverse.transform(pixelPos, transformedPixelPos); pixelPos.setLocation(transformedPixelPos); return transformedPixelPos; } SlstrTiePointGeoCoding(TiePointGrid latGrid, TiePointGrid lonGrid, AffineTransform2D transform); @Override GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos); @Override PixelPos getPixelPos(GeoPos geoPos, PixelPos pixelPos); @Override boolean transferGeoCoding(Scene srcScene, Scene destScene, ProductSubsetDef subsetDef); @Override boolean canClone(); @SuppressWarnings("MethodDoesntCallSuperMethod") @Override GeoCoding clone();  }
@Test public void testGetPixelPos_IdentityTransform() { final GeoPos geoPos = new GeoPos(6, 6); final PixelPos referencePixelPos = new PixelPos(); referenceGeoCoding.getPixelPos(geoPos, referencePixelPos); final PixelPos slstrPixelPos = new PixelPos(); slstrCoding.getPixelPos(geoPos, slstrPixelPos); assertEquals(referencePixelPos.getX(), slstrPixelPos.getX(), 1e-8); assertEquals(referencePixelPos.getY(), slstrPixelPos.getY(), 1e-8); }
@Test public void testGetPixelPos_Transform() throws Exception { final GeoPos geoPos1 = new GeoPos(4, 7); final GeoPos geoPos2 = new GeoPos(6, 6); final GeoPos geoPos3 = new GeoPos(7, 4); final PixelPos referencePixelPos1 = new PixelPos(); final PixelPos referencePixelPos2 = new PixelPos(); final PixelPos referencePixelPos3 = new PixelPos(); referenceGeoCoding.getPixelPos(geoPos1, referencePixelPos1); referenceGeoCoding.getPixelPos(geoPos2, referencePixelPos2); referenceGeoCoding.getPixelPos(geoPos3, referencePixelPos3); final AffineTransform transform = new AffineTransform(); transform.scale(2.0, 2.0); transform.translate(1.0, 1.0); final SlstrTiePointGeoCoding slstrTiePointGeoCoding = new SlstrTiePointGeoCoding(lat, lon, new AffineTransform2D(transform)); final PixelPos slstrPixelPos1 = new PixelPos(); final PixelPos slstrPixelPos2 = new PixelPos(); final PixelPos slstrPixelPos3 = new PixelPos(); slstrTiePointGeoCoding.getPixelPos(geoPos1, slstrPixelPos1); slstrTiePointGeoCoding.getPixelPos(geoPos2, slstrPixelPos2); slstrTiePointGeoCoding.getPixelPos(geoPos3, slstrPixelPos3); assertEquals((referencePixelPos1.getX() / 2) - 1, slstrPixelPos1.getX(), 1e-8); assertEquals((referencePixelPos1.getY() / 2) - 1, slstrPixelPos1.getY(), 1e-8); assertEquals((referencePixelPos2.getX() / 2) - 1, slstrPixelPos2.getX(), 1e-8); assertEquals((referencePixelPos2.getY() / 2) - 1, slstrPixelPos2.getY(), 1e-8); assertEquals((referencePixelPos3.getX() / 2) - 1, slstrPixelPos3.getX(), 1e-8); assertEquals((referencePixelPos3.getY() / 2) - 1, slstrPixelPos3.getY(), 1e-8); }