Class CoordinateOperationContext
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CanvasContext
- The geographic area where the transformation will be used.
- The desired accuracy. A coarser accuracy may allow SIS to choose a faster transformation method.
DefaultCoordinateOperationFactory
to choose the most suitable coordinate transformation between two CRS.
CoordinateOperationContext
is part of the API used by SIS for implementing the late binding
model. See package javadoc for a note on early binding versus
late binding implementations.- Since:
- 0.7
- Version:
- 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.opengis.metadata.extent.Extent
The spatiotemporal area of interest, ornull
if none.private double
The desired accuracy in metres, or 0 for the best accuracy available.private static final long
For cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new context with no area of interest and the best accuracy available.CoordinateOperationContext
(org.opengis.metadata.extent.Extent area, double accuracy) Creates a new context with the given area of interest and desired accuracy. -
Method Summary
Modifier and TypeMethodDescriptionstatic CoordinateOperationContext
fromBoundingBox
(org.opengis.metadata.extent.GeographicBoundingBox areaOfInterest) Creates an operation context for the given area of interest, which may be null orundefined
.org.opengis.metadata.extent.Extent
Returns the spatiotemporal area of interest, ornull
if none.(package private) static double[]
Invoked when some coordinates in the target CRS cannot be computed from coordinates in the source CRS.double
Returns the desired accuracy in metres.(package private) final Predicate<org.opengis.referencing.operation.CoordinateOperation>
Returns a filter that can be used for applying additional restrictions on the coordinate operation.void
setAreaOfInterest
(org.opengis.metadata.extent.Extent area) Sets the spatiotemporal area of interest, ornull
if none.void
setAreaOfInterest
(org.opengis.metadata.extent.GeographicBoundingBox area) Sets the geographic component of the area of interest, ornull
if none.void
setDesiredAccuracy
(double accuracy) Sets the desired accuracy in metres.(package private) static org.opengis.metadata.extent.Extent
setGeographicBoundingBox
(org.opengis.metadata.extent.Extent areaOfInterest, org.opengis.metadata.extent.GeographicBoundingBox bbox) Sets the given geographic bounding box in the given extent.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
areaOfInterest
private org.opengis.metadata.extent.Extent areaOfInterestThe spatiotemporal area of interest, ornull
if none. This instance may be updated or replaced by other methods in this class, or (indirectly) byCoordinateOperationFinder
. -
desiredAccuracy
private double desiredAccuracyThe desired accuracy in metres, or 0 for the best accuracy available. SeegetDesiredAccuracy()
for more details about what we mean by "best accuracy".
-
-
Constructor Details
-
CoordinateOperationContext
public CoordinateOperationContext()Creates a new context with no area of interest and the best accuracy available. -
CoordinateOperationContext
public CoordinateOperationContext(org.opengis.metadata.extent.Extent area, double accuracy) Creates a new context with the given area of interest and desired accuracy.- Parameters:
area
- the area of interest, ornull
if none.accuracy
- the desired accuracy in metres, or 0 for the best accuracy available. SeegetDesiredAccuracy()
for more details about what we mean by "best accuracy".
-
-
Method Details
-
fromBoundingBox
public static CoordinateOperationContext fromBoundingBox(org.opengis.metadata.extent.GeographicBoundingBox areaOfInterest) Creates an operation context for the given area of interest, which may be null orundefined
. This is a convenience method for a frequently-used operation.- Parameters:
areaOfInterest
- the area of interest, ornull
if none.- Returns:
- the operation context, or
null
if the given bounding box was null, undefined or covers the whole world (in which case Apache SIS does not need that we specify a context). - Since:
- 1.0
-
getAreaOfInterest
public org.opengis.metadata.extent.Extent getAreaOfInterest()Returns the spatiotemporal area of interest, ornull
if none.- Returns:
- the spatiotemporal area of interest, or
null
if none. - See Also:
-
setAreaOfInterest
public void setAreaOfInterest(org.opengis.metadata.extent.Extent area) Sets the spatiotemporal area of interest, ornull
if none.- Parameters:
area
- the spatiotemporal area of interest, ornull
if none.
-
setAreaOfInterest
public void setAreaOfInterest(org.opengis.metadata.extent.GeographicBoundingBox area) Sets the geographic component of the area of interest, ornull
if none. This convenience method set the bounding box into the spatiotemporalExtent
.The reverse operation can be done with
Extents.getGeographicBoundingBox(getAreaOfInterest())
.- Parameters:
area
- the geographic area of interest, ornull
if none.
-
setGeographicBoundingBox
static org.opengis.metadata.extent.Extent setGeographicBoundingBox(org.opengis.metadata.extent.Extent areaOfInterest, org.opengis.metadata.extent.GeographicBoundingBox bbox) Sets the given geographic bounding box in the given extent. This method may modify the extent given in parameters.- Parameters:
areaOfInterest
- the extent to update, ornull
.- Returns:
- the updated extent. May be the given one or a new instance.
-
getDesiredAccuracy
public double getDesiredAccuracy()Returns the desired accuracy in metres. A value of 0 means to search for the most accurate operation.When searching for the most accurate operation, SIS considers only the operations specified by the authority. For example, the Molodensky method is a better datum shift approximation than Abridged Molodensky. But if all coordinate operations defined by the authority use the Abridged Molodensky method, then SIS will ignore the Molodensky one.
- Returns:
- the desired accuracy in metres.
-
setDesiredAccuracy
public void setDesiredAccuracy(double accuracy) Sets the desired accuracy in metres. A value of 0 means to search for the most accurate operation. SeegetDesiredAccuracy()
for more details about what we mean by "most accurate".- Parameters:
accuracy
- the desired accuracy in metres.
-
getOperationFilter
Returns a filter that can be used for applying additional restrictions on the coordinate operation. -
getConstantCoordinates
static double[] getConstantCoordinates() throws org.opengis.referencing.operation.TransformExceptionInvoked when some coordinates in the target CRS cannot be computed from coordinates in the source CRS. For example if the source CRS has (x, y) axes and the target CRS has (x, y, t) axes, then this method is invoked for determining which value to assign to the t coordinate. In some cases the user can tell that the coordinate should be set to a constant value.If this method returns
null
(which is the default), then theCoordinateOperationFinder
caller will throw anOperationNotFoundException
. Otherwise the returned array should have a length equals to the number of dimensions in the full (usually compound) target CRS. Only coordinate values in dimensions without source (the t dimension in above example) will be used. All other coordinate values will be ignored.- Returns:
- coordinate values to take as constants for the specified target component, or
null
if none. - Throws:
org.opengis.referencing.operation.TransformException
- if the coordinates cannot be computed. This exception may occur when the constant coordinate values are the results of performing a coordinate operation in advance.
-