Class MathTransformBuilder
Object
MathTransformBuilder
Builder of a parameterized math transform using a method identified by a name or code.
A builder instance is created by a call to
DefaultMathTransformFactory.builder(String).
The parameters are set to default values and should be modified
in-place by the caller. If the transform requires semi-major and semi-minor axis lengths,
those parameters can be set directly or indirectly.
Then, the transform is created by a call to create().- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MathTransformFactoryThe factory to use for building the transform.protected OperationMethodThe provider that created the parameterizedMathTransforminstance, ornullif this information does not apply. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new builder. -
Method Summary
Modifier and TypeMethodDescriptionabstract MathTransformcreate()Creates the parameterized transform.Returns a function which determines whether the URI specified in a parameter can be opened.final Optional<OperationMethod> Returns the operation method used for creating the math transform from the parameter values.abstract ParameterValueGroupReturns the parameter values of the transform to create.voidSets a function which determines whether the URI specified in a parameter can be opened.voidsetSourceAxes(CoordinateSystem cs, Ellipsoid ellipsoid) Gives hints about axis lengths and their orientations in input coordinates.voidsetTargetAxes(CoordinateSystem cs, Ellipsoid ellipsoid) Gives hints about axis lengths and their orientations in output coordinates.Returns a string representation of this builder for debugging purposes.protected MathTransformunique(MathTransform result) Eventually replaces the given transform by a unique instance.
-
Field Details
-
factory
The factory to use for building the transform. -
provider
The provider that created the parameterizedMathTransforminstance, ornullif this information does not apply. This is initially set to the operation method specified in the call to, but may be modified byinvalid reference
#builder(String)create().This operation method is usually an instance of
MathTransformProvider, but not necessarily.- See Also:
-
-
Constructor Details
-
MathTransformBuilder
Creates a new builder.- Parameters:
factory- factory to use for building the transform.
-
-
Method Details
-
getMethod
Returns the operation method used for creating the math transform from the parameter values. This is initially the operation method specified in the call to, but may change after the call toinvalid reference
#builder(String)create()if the method has been adjusted because of the parameter values.- Returns:
- the operation method used for creating the math transform from the parameter values.
-
parameters
Returns the parameter values of the transform to create. Those parameters are initialized to default values, which may be implementation or method depend. User-supplied values should be set directly in the returned instance with codes likeparameter(name).setValue(value).- Returns:
- the parameter values of the transform to create. Values should be set in-place.
-
setSourceAxes
Gives hints about axis lengths and their orientations in input coordinates. The action performed by this call depends on the operation method. For map projections, the action may include something equivalent to the following code:For geodetic datum shifts, the action may be similar to above code but with different parameter names:parameters().parameter("semi_major").setValue(ellipsoid.getSemiMajorAxis(), ellipsoid.getAxisUnit()); parameters().parameter("semi_minor").setValue(ellipsoid.getSemiMinorAxis(), ellipsoid.getAxisUnit());"src_semi_major"and"src_semi_minor". Other operation methods may ignore the arguments.Axis order, units and direction
By default, the source axes of a parameterized transform are normalized to east, north, up (if applicable) directions with units in degrees and meters. If this requirement is ambiguous, for example because the operation method uses incompatible axis directions or units, then thecsargument should be non-null for allowing the implementation to resolve that ambiguity.- Parameters:
cs- the coordinate system defining source axis order and units, ornullif none.ellipsoid- the ellipsoid providing source semi-axis lengths, ornullif none.
-
setTargetAxes
Gives hints about axis lengths and their orientations in output coordinates. The action performed by this call depends on the operation method. For datum shifts, the action may include something equivalent to the following code:parameters().parameter("tgt_semi_major").setValue(ellipsoid.getSemiMajorAxis(), ellipsoid.getAxisUnit()); parameters().parameter("tgt_semi_minor").setValue(ellipsoid.getSemiMinorAxis(), ellipsoid.getAxisUnit());Axis order, units and direction
By default, the target axes of a parameterized transform are normalized to east, north, up (if applicable) directions with units in degrees and meters. If this requirement is ambiguous, for example because the operation method uses incompatible axis directions or units, then thecsargument should be non-null for allowing the implementation to resolve that ambiguity.- Parameters:
cs- the coordinate system defining target axis order and units, ornullif none.ellipsoid- the ellipsoid providing target semi-axis lengths, ornullif none.
-
create
Creates the parameterized transform. The operation method is given bygetMethod()and the parameter values should have been set on the group returned byparameters()before to invoke this constructor. Example:MathTransformFactory factory = ...; MathTransformBuilder builder = factory.builder("Transverse_Mercator"); ParameterValueGroup pg = builder.parameters(); pg.parameter("semi_major").setValue(6378137.000); pg.parameter("semi_minor").setValue(6356752.314); MathTransform mt = builder.create();- Returns:
- the parameterized transform.
- Throws:
FactoryException- if the transform creation failed. This exception is thrown if some required parameters have not been supplied, or have illegal values.
-
getAccessControl
Returns a function which determines whether the URI specified in a parameter can be opened. The function will receive the following arguments:- a description of the URI parameter,
- the actual URI parameter value.
Authorization.GRANTEDin a trusted environment, orAuthorization.DEFAULTotherwise. TheDEFAULTauthorization grants access to files in the$SIS_DATA/DatumChangesdirectory for parameters that are datum shift grid files, and to files in the same directory as the JSON, GML or WKT document where the parameter value appears.- Returns:
- a function deciding whether the URI can be opened.
- Since:
- 1.7
- See Also:
-
setAccessControl
Sets a function which determines whether the URI specified in a parameter can be opened. SeegetAccessControl()for more information.- Parameters:
ac- function telling whether the URI can be opened.- Since:
- 1.7
-
unique
Eventually replaces the given transform by a unique instance. The replacement is done only if the factory is an instance ofDefaultMathTransformFactoryand caching is enabled.This is a helper method for
create()implementations.- Parameters:
result- the newly created transform.- Returns:
- a transform equals to the given transform (may be the given transform itself).
-
toString
-