use of org.opengis.parameter.ParameterValueGroup in project sis by apache.
the class InterpolatedTransformTest method createNADCON.
/**
* 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();
}
use of org.opengis.parameter.ParameterValueGroup in project sis by apache.
the class MolodenskyTransformTest method testProvider.
/**
* Tests the creation through the provider.
*
* @throws FactoryException if an error occurred while creating a transform step.
* @throws TransformException if a transformation failed.
*/
@Test
@DependsOnMethod("testRandomPoints")
public void testProvider() throws FactoryException, TransformException {
final MathTransformFactory factory = new MathTransformFactoryMock(new Molodensky());
final ParameterValueGroup parameters = factory.getDefaultParameters("Molodenski");
parameters.parameter("dim").setValue(3);
parameters.parameter("dx").setValue(-3.0);
parameters.parameter("dy").setValue(142.0);
parameters.parameter("dz").setValue(183.0);
parameters.parameter("src_semi_major").setValue(6378206.4);
parameters.parameter("src_semi_minor").setValue(6356583.8);
parameters.parameter("tgt_semi_major").setValue(6378137.0);
parameters.parameter("tgt_semi_minor").setValue(6356752.31414036);
transform = factory.createParameterizedTransform(parameters);
assertEquals(3, transform.getSourceDimensions());
assertEquals(3, transform.getTargetDimensions());
tolerance = Formulas.ANGULAR_TOLERANCE * 5;
zTolerance = Formulas.LINEAR_TOLERANCE * 5;
verifyInDomain(CoordinateDomain.RANGE_10, ORDINATE_COUNT);
}
use of org.opengis.parameter.ParameterValueGroup in project sis by apache.
the class Store method getOpenParameters.
/**
* Returns the parameters used to open this data store.
*/
@Override
public ParameterValueGroup getOpenParameters() {
final String format = StoreUtilities.getFormatName(componentProvider);
final ParameterValueGroup pg = (provider != null ? provider.getOpenParameters() : FolderStoreProvider.PARAMETERS).createValue();
pg.parameter(DataStoreProvider.LOCATION).setValue(location);
if (locale != null)
pg.parameter("locale").setValue(locale);
if (timezone != null)
pg.parameter("timezone").setValue(timezone);
if (encoding != null)
pg.parameter("encoding").setValue(encoding);
if (format != null)
pg.parameter("format").setValue(format);
return pg;
}
use of org.opengis.parameter.ParameterValueGroup in project sis by apache.
the class URIDataStore method parameters.
/**
* Creates parameter value group for the current location, if non-null.
* This convenience method is used for {@link DataStore#getOpenParameters()} implementations in public
* {@code DataStore} that can not extend {@code URIDataStore} directly, because this class is internal.
*
* @param provider the provider of the data store for which to get open parameters.
* @param location file opened by the data store.
* @return parameters to be returned by {@link DataStore#getOpenParameters()}.
*
* @todo Verify if non-exported classes in JDK9 are hidden from Javadoc, like package-private classes.
* If true, we could remove this hack and extend {@code URIDataStore} even in public classes.
*/
public static ParameterValueGroup parameters(final DataStoreProvider provider, final URI location) {
if (location == null || provider == null)
return null;
final ParameterValueGroup pg = provider.getOpenParameters().createValue();
pg.parameter(DataStoreProvider.LOCATION).setValue(location);
return pg;
}
use of org.opengis.parameter.ParameterValueGroup in project sis by apache.
the class ServicesForMetadata method toFormattableObject.
/**
* Converts the given object in a {@code FormattableObject} instance. Callers should verify that the given
* object is not already an instance of {@code FormattableObject} before to invoke this method. This method
* returns {@code null} if it can not convert the object.
*
* @param object the object to wrap.
* @param internal {@code true} if the formatting convention is {@code Convention.INTERNAL}.
* @return the given object converted to a {@code FormattableObject} instance, or {@code null}.
*
* @since 0.6
*/
@Override
public FormattableObject toFormattableObject(final MathTransform object, boolean internal) {
Matrix matrix;
final ParameterValueGroup parameters;
if (internal && (matrix = MathTransforms.getMatrix(object)) != null) {
parameters = Affine.parameters(matrix);
} else if (object instanceof Parameterized) {
parameters = ((Parameterized) object).getParameterValues();
} else {
matrix = MathTransforms.getMatrix(object);
if (matrix == null) {
return null;
}
parameters = Affine.parameters(matrix);
}
return new FormattableObject() {
@Override
protected String formatTo(final Formatter formatter) {
WKTUtilities.appendParamMT(parameters, formatter);
return WKTKeywords.Param_MT;
}
};
}
Aggregations