public abstract class MathTransformProvider extends DefaultOperationMethod
META-INF/services/org.geotools.referencing.operation.MathTransformProvider
The math transform factory will parse this file in order to gets all available providers on a system. If this file is bundle in many JAR files, the math transform factory will read all of them.
Modifier and Type | Class and Description |
---|---|
protected static class |
MathTransformProvider.Delegate
The result of a call to
createMathTransform . |
sourceDimensions, targetDimensions
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
SINGLE_LINE
FORMULA_KEY
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Constructor and Description |
---|
MathTransformProvider(int sourceDimensions,
int targetDimensions,
ParameterDescriptorGroup parameters)
Constructs a math transform provider from a set of parameters.
|
MathTransformProvider(Map<String,?> properties,
int sourceDimensions,
int targetDimensions,
ParameterDescriptorGroup parameters)
Constructs a math transform provider from a set of properties.
|
Modifier and Type | Method and Description |
---|---|
protected static ParameterDescriptor<Double> |
createDescriptor(ReferenceIdentifier[] identifiers,
double defaultValue,
double minimum,
double maximum,
Unit<?> unit)
Constructs a parameter descriptor from a set of alias.
|
protected static ParameterDescriptorGroup |
createDescriptorGroup(ReferenceIdentifier[] identifiers,
GeneralParameterDescriptor[] parameters)
Constructs a parameter group from a set of alias.
|
protected abstract MathTransform |
createMathTransform(ParameterValueGroup values)
Creates a math transform from the specified group of parameter values.
|
protected static ParameterDescriptor<Double> |
createOptionalDescriptor(ReferenceIdentifier[] identifiers,
double minimum,
double maximum,
Unit<?> unit)
Constructs an optional parameter descriptor from a set of alias.
|
protected static double |
doubleValue(ParameterDescriptor<?> param,
ParameterValueGroup group)
Returns the parameter value for the specified operation parameter.
|
protected ParameterValueGroup |
ensureValidValues(ParameterValueGroup values)
Ensures that the given set of parameters contains only valid values.
|
protected String |
formatWKT(Formatter formatter)
Format the inner part of a Well
Known Text (WKT) element.
|
Class<? extends Operation> |
getOperationType()
Returns the operation type.
|
protected static <T> ParameterValue<T> |
getParameter(ParameterDescriptor<T> param,
ParameterValueGroup group)
Returns the parameter value for the specified operation parameter.
|
protected static int |
intValue(ParameterDescriptor<?> param,
ParameterValueGroup group)
Returns the parameter value for the specified operation parameter.
|
protected static String |
stringValue(ParameterDescriptor<?> param,
ParameterValueGroup group)
Returns the parameter value for the specified operation parameter.
|
protected static Map<String,Object> |
toMap(ReferenceIdentifier[] identifiers)
Put the identifiers into a properties map suitable for
IdentifiedObject constructor. |
protected static <T> T |
value(ParameterDescriptor<T> param,
ParameterValueGroup group)
Returns the parameter value for the specified operation parameter.
|
checkDimensions, equals, getFormula, getParameters, getSourceDimensions, getTargetDimensions, hashCode
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches, nameMatches
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
getAlias, getIdentifiers, getName, getRemarks, toWKT
public MathTransformProvider(int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters)
sourceDimensions
- Number of dimensions in the source CRS of this operation method.targetDimensions
- Number of dimensions in the target CRS of this operation method.parameters
- The set of parameters (never null
).public MathTransformProvider(Map<String,?> properties, int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters)
properties
- Set of properties. Should contains at least "name"
.sourceDimensions
- Number of dimensions in the source CRS of this operation method.targetDimensions
- Number of dimensions in the target CRS of this operation method.parameters
- The set of parameters (never null
).public Class<? extends Operation> getOperationType()
Operation.class
,
Conversion.class
,
Projection.class
, etc.
The default implementation returns Operation.class
. Subclass should overrides this
methods and returns the appropriate OpenGIS interface type (not the
implementation type).
protected abstract MathTransform createMathTransform(ParameterValueGroup values) throws InvalidParameterNameException, ParameterNotFoundException, InvalidParameterValueException, FactoryException
double semiMajor = values.parameter("semi_major").doubleValue(SI.METRE); double semiMinor = values.parameter("semi_minor").doubleValue(SI.METRE); // etc... return new MyTransform(semiMajor, semiMinor, ...);
values
- The group of parameter values.InvalidParameterNameException
- if the values contains an unknow parameter.ParameterNotFoundException
- if a required parameter was not found.InvalidParameterValueException
- if a parameter has an invalid value.FactoryException
- if the math transform can't be created for some other reason (for
example a required file was not found).MathTransformProvider.Delegate
protected static ParameterDescriptor<Double> createDescriptor(ReferenceIdentifier[] identifiers, double defaultValue, double minimum, double maximum, Unit<?> unit)
OGC
and
EPSG
for example.
The first entry in the identifiers
array is both the main name and the identifiers. All others are aliases.
identifiers
- The parameter identifiers. Most contains at least one entry.defaultValue
- The default value for the parameter, or Double.NaN
if none.minimum
- The minimum parameter value, or Double.NEGATIVE_INFINITY
if none.maximum
- The maximum parameter value, or Double.POSITIVE_INFINITY
if none.unit
- The unit for default, minimum and maximum values.protected static ParameterDescriptor<Double> createOptionalDescriptor(ReferenceIdentifier[] identifiers, double minimum, double maximum, Unit<?> unit)
createDescriptor(org.opengis.referencing.ReferenceIdentifier[], double, double, double, javax.measure.Unit<?>)
.identifiers
- The parameter identifiers. Most contains at least one entry.minimum
- The minimum parameter value, or Double.NEGATIVE_INFINITY
if none.maximum
- The maximum parameter value, or Double.POSITIVE_INFINITY
if none.unit
- The unit for default, minimum and maximum values.protected static ParameterDescriptorGroup createDescriptorGroup(ReferenceIdentifier[] identifiers, GeneralParameterDescriptor[] parameters)
OGC
and
EPSG
for example.
Special rules:
identifiers
array is the primary name.
GenericName
interface, it is an identifiers.
identifiers
- The operation identifiers. Most contains at least one entry.parameters
- The set of parameters, or null
or an empty array if none.protected static Map<String,Object> toMap(ReferenceIdentifier[] identifiers)
IdentifiedObject
constructor.protected ParameterValueGroup ensureValidValues(ParameterValueGroup values) throws InvalidParameterNameException, InvalidParameterValueException
InvalidParameterNameException
is thrown. This method also ensures that all values are
assignable to the expected class, are between
the minimum and maximum values and are one of the set of valid values. If the value fails any of those
tests, then an InvalidParameterValueException
is thrown.values
- The parameters values to check.values
argument if some missing
values needed to be filled with default values.InvalidParameterNameException
- if a parameter name is unknow.InvalidParameterValueException
- if a parameter has an invalid value.protected static <T> ParameterValue<T> getParameter(ParameterDescriptor<T> param, ParameterValueGroup group) throws ParameterNotFoundException
param
- The parameter to look for.group
- The parameter value group to search into.ParameterNotFoundException
- if the parameter is not found.protected static <T> T value(ParameterDescriptor<T> param, ParameterValueGroup group) throws ParameterNotFoundException
T
- The type of parameter value.param
- The parameter to look for.group
- The parameter value group to search into.null
if param
is optional and the user didn't provided any value.ParameterNotFoundException
- if the parameter is not found.protected static String stringValue(ParameterDescriptor<?> param, ParameterValueGroup group) throws ParameterNotFoundException
param
- The parameter to look for.group
- The parameter value group to search into.null
if param
is optional and the user didn't provided any value.ParameterNotFoundException
- if the parameter is not found.protected static int intValue(ParameterDescriptor<?> param, ParameterValueGroup group) throws ParameterNotFoundException
param
- The parameter to look for.group
- The parameter value group to search into.0
if param
is optional and the user didn't provided any value.ParameterNotFoundException
- if the parameter is not found.protected static double doubleValue(ParameterDescriptor<?> param, ParameterValueGroup group) throws ParameterNotFoundException
param
argument. This
convenience method is used by subclasses for initializing math
transform from a set of parameters.param
- The parameter to look for.group
- The parameter value group to search into.NaN
if param
is optional and the user didn't provided any value.ParameterNotFoundException
- if the parameter is not found.protected String formatWKT(Formatter formatter)
formatWKT
in class DefaultOperationMethod
formatter
- The formatter to use.Formattable.toWKT()
,
Formattable.toString()
Copyright © 1996–2019 Geotools. All rights reserved.