/** * Creates a transform from the specified group of parameter values. * * @param factory the factory to use if this constructor needs to create other math transforms. * @param values the group of parameter values. * @return the created math transform. * @throws ParameterNotFoundException if a required parameter was not found. * @throws FactoryException if an error occurred while loading the grid. */ @Override public MathTransform createMathTransform(final MathTransformFactory factory, final ParameterValueGroup values) throws ParameterNotFoundException, FactoryException { final Parameters pg = Parameters.castOrWrap(values); return InterpolatedTransform.createGeodeticTransformation(factory, getOrLoad(pg.getMandatoryValue(LATITUDE), pg.getMandatoryValue(LONGITUDE))); }
/** * Creates a transformation from NAD27 to NAD93 * * @throws FactoryException if an error occurred while loading the grid. */ private void createNADCON() throws FactoryException { final URL latitudeShifts = NADCONTest.getResourceAsConvertibleURL(NADCONTest.TEST_FILE + ".laa"); final URL longitudeShifts = NADCONTest.getResourceAsConvertibleURL(NADCONTest.TEST_FILE + ".loa"); final NADCON provider = new NADCON(); final ParameterValueGroup values = provider.getParameters().createValue(); values.parameter("Latitude difference file").setValue(latitudeShifts); values.parameter("Longitude difference file").setValue(longitudeShifts); transform = provider.createMathTransform(DefaultFactories.forBuildin(MathTransformFactory.class), values); tolerance = NADCONTest.ANGULAR_TOLERANCE; validate(); }
/** * Creates a transform from the specified group of parameter values. * * @param factory the factory to use if this constructor needs to create other math transforms. * @param values the group of parameter values. * @return the created math transform. * @throws ParameterNotFoundException if a required parameter was not found. * @throws FactoryException if an error occurred while loading the grid. */ @Override public MathTransform createMathTransform(final MathTransformFactory factory, final ParameterValueGroup values) throws ParameterNotFoundException, FactoryException { final Parameters pg = Parameters.castOrWrap(values); return InterpolatedTransform.createGeodeticTransformation(factory, getOrLoad(pg.getMandatoryValue(LATITUDE), pg.getMandatoryValue(LONGITUDE))); }
throws IOException, FactoryException, TransformException final DatumShiftGridFile<Angle,Angle> grid = NADCON.getOrLoad(latitudeShifts, longitudeShifts); assertInstanceOf("Should not be compressed.", DatumShiftGridFile.Float.class, grid); assertEquals("coordinateUnit", Units.DEGREE, grid.getCoordinateUnit()); expected[1] /= DatumShiftGridLoader.DEGREES_TO_SECONDS; assertArrayEquals("interpolateAt", expected, grid.interpolateAt(position), ANGULAR_TOLERANCE); assertSame("Grid should be cached.", grid, NADCON.getOrLoad(latitudeShifts, longitudeShifts));