Class CoordinateOperationContext
java.lang.Object
org.apache.sis.referencing.operation.CoordinateOperationContext
- All Implemented Interfaces:
Serializable
Optional information about the context in which a requested coordinate operation will be used.
The context can provide information such as:
- 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.
Example:
if a transformation from NAD27 to WGS84 is requested without providing context, then Apache SIS will return the
transformation applicable to the widest North American surface. But if the user provides a context saying that
he wants to transform coordinates in Texas, then Apache SIS may return another coordinate transformation with
different Bursa-Wolf parameters more suitable
to Texas, but not suitable to the rest of North-America.
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
- Author:
- Martin Desruisseaux (Geomatys)
- See Also:
-
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 CoordinateOperationContextfromBoundingBox(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.ExtentReturns the spatiotemporal area of interest, ornullif none.doubleReturns the desired accuracy in metres.voidsetAreaOfInterest(org.opengis.metadata.extent.Extent area) Sets the spatiotemporal area of interest, ornullif none.voidsetAreaOfInterest(org.opengis.metadata.extent.GeographicBoundingBox area) Sets the geographic component of the area of interest, ornullif none.voidsetDesiredAccuracy(double accuracy) Sets the desired accuracy in metres.
-
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, ornullif 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, ornullif none.- Returns:
- the operation context, or
nullif 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, ornullif none.- Returns:
- the spatiotemporal area of interest, or
nullif none. - See Also:
-
setAreaOfInterest
public void setAreaOfInterest(org.opengis.metadata.extent.Extent area) Sets the spatiotemporal area of interest, ornullif none.- Parameters:
area- the spatiotemporal area of interest, ornullif none.
-
setAreaOfInterest
public void setAreaOfInterest(org.opengis.metadata.extent.GeographicBoundingBox area) Sets the geographic component of the area of interest, ornullif 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, ornullif none.
-
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.
-