Package org.apache.sis.portrayal
Class CanvasContext
java.lang.Object
org.apache.sis.referencing.operation.CoordinateOperationContext
org.apache.sis.portrayal.CanvasContext
- All Implemented Interfaces:
Serializable
Contextual information for allowing
Canvas
to select the most appropriate
coordinate operation for the viewed area and resolution.- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
Desired resolution in display units (usually pixels).private org.opengis.metadata.extent.GeographicBoundingBox
The geographic area, computed when first requested and saved for reuse.private org.opengis.referencing.operation.CoordinateOperation
Transformation from objective CRS to a geographic CRS, ornull
if none can be found.private double
The resolution in metres, computed when first requested and saved for reuse. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final void
clear()
Clears information that depends onCanvas.objectiveToDisplay
.(package private) final Optional
<org.opengis.metadata.extent.GeographicBoundingBox> getGeographicArea
(Canvas canvas) Returns the geographic area, or an empty value if none.(package private) final OptionalDouble
getSpatialResolution
(Canvas canvas) Returns the spatial resolution, or an empty value if none.(package private) final void
partialClear
(boolean poi) Clears only some information, depending on whether the modified property is point of interest or the display bounds.private void
RecomputesgeographicArea
andresolution
fields that are not valid.(package private) final void
Sets theCoordinateOperationContext
object to the desired area and accuracy of the coordinate operation to obtain.(package private) final void
setObjectiveToGeographic
(org.opengis.referencing.operation.CoordinateOperation op) Sets the operation fromCanvas.objectiveCRS
to geographic CRS.Methods inherited from class org.apache.sis.referencing.operation.CoordinateOperationContext
fromBoundingBox, getAreaOfInterest, getDesiredAccuracy, setAreaOfInterest, setAreaOfInterest, setDesiredAccuracy
-
Field Details
-
DISPLAY_RESOLUTION
private static final double DISPLAY_RESOLUTIONDesired resolution in display units (usually pixels). This is used for avoiding the cost of transformations having too much accuracy for the current zoom level.- See Also:
-
objectiveToGeographic
private org.opengis.referencing.operation.CoordinateOperation objectiveToGeographicTransformation from objective CRS to a geographic CRS, ornull
if none can be found. The geographic CRS (operation target) has (longitude, latitude) axes in degrees but the same geodetic datum than the objective CRS, so the prime meridian is not necessarily Greenwich. This is recomputed immediately after a change ofCanvas.objectiveCRS
orCanvas.pointOfInterest
because it will be needed anyway forCanvas.findTransform(CoordinateReferenceSystem, CoordinateReferenceSystem, boolean)
.- See Also:
-
geographicArea
private org.opengis.metadata.extent.GeographicBoundingBox geographicAreaThe geographic area, computed when first requested and saved for reuse. This is reset tonull
every time thatCanvas.objectiveCRS
,Canvas.objectiveToDisplay
orCanvas.displayBounds
is modified.- See Also:
-
resolution
private double resolutionThe resolution in metres, computed when first requested and saved for reuse. This is reset tonull
every timeCanvas.objectiveCRS
,Canvas.objectiveToDisplay
orCanvas.pointOfInterest
is modified. Value 0 means that the value has not yet been computed.- See Also:
-
-
Constructor Details
-
CanvasContext
CanvasContext()Creates a new context.
-
-
Method Details
-
setObjectiveToGeographic
final void setObjectiveToGeographic(org.opengis.referencing.operation.CoordinateOperation op) Sets the operation fromCanvas.objectiveCRS
to geographic CRS.- Parameters:
op
- the conversion from objective CRS to geographic CRS, ornull
if none.
-
clear
final void clear()Clears information that depends onCanvas.objectiveToDisplay
. This method assumes thatCanvas.objectiveCRS
is still valid. -
partialClear
final void partialClear(boolean poi) Clears only some information, depending on whether the modified property is point of interest or the display bounds.- Parameters:
poi
-true
if the modified property is the point of interest,false
if the modified property is the display bounds.
-
getGeographicArea
final Optional<org.opengis.metadata.extent.GeographicBoundingBox> getGeographicArea(Canvas canvas) throws org.opengis.referencing.operation.TransformException Returns the geographic area, or an empty value if none.- Throws:
org.opengis.referencing.operation.TransformException
- See Also:
-
getSpatialResolution
final OptionalDouble getSpatialResolution(Canvas canvas) throws org.opengis.referencing.operation.TransformException Returns the spatial resolution, or an empty value if none.- Throws:
org.opengis.referencing.operation.TransformException
- See Also:
-
recompute
RecomputesgeographicArea
andresolution
fields that are not valid. This method assumes thatobjectiveToGeographic
isnull
or valid.- Throws:
org.opengis.referencing.operation.TransformException
-
refresh
Sets theCoordinateOperationContext
object to the desired area and accuracy of the coordinate operation to obtain.- Throws:
org.opengis.referencing.operation.TransformException
-