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 doubleDesired resolution in display units (usually pixels).private org.opengis.metadata.extent.GeographicBoundingBoxThe geographic area, computed when first requested and saved for reuse.private org.opengis.referencing.operation.CoordinateOperationTransformation from objective CRS to a geographic CRS, ornullif none can be found.private doubleThe resolution in metres, computed when first requested and saved for reuse. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final voidclear()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 OptionalDoublegetSpatialResolution(Canvas canvas) Returns the spatial resolution, or an empty value if none.(package private) final voidpartialClear(boolean poi) Clears only some information, depending on whether the modified property is point of interest or the display bounds.private voidRecomputesgeographicAreaandresolutionfields that are not valid.(package private) final voidSets theCoordinateOperationContextobject to the desired area and accuracy of the coordinate operation to obtain.(package private) final voidsetObjectiveToGeographic(org.opengis.referencing.operation.CoordinateOperation op) Sets the operation fromCanvas.objectiveCRSto 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. -
objectiveToGeographic
private org.opengis.referencing.operation.CoordinateOperation objectiveToGeographicTransformation from objective CRS to a geographic CRS, ornullif 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.objectiveCRSorCanvas.pointOfInterestbecause it will be needed anyway forCanvas.findTransform(CoordinateReferenceSystem, CoordinateReferenceSystem, boolean). -
geographicArea
private org.opengis.metadata.extent.GeographicBoundingBox geographicAreaThe geographic area, computed when first requested and saved for reuse. This is reset tonullevery time thatCanvas.objectiveCRS,Canvas.objectiveToDisplayorCanvas.displayBoundsis modified. -
resolution
private double resolutionThe resolution in metres, computed when first requested and saved for reuse. This is reset tonullevery timeCanvas.objectiveCRS,Canvas.objectiveToDisplayorCanvas.pointOfInterestis modified. Value 0 means that the value has not yet been computed.
-
-
Constructor Details
-
CanvasContext
CanvasContext()Creates a new context.
-
-
Method Details
-
setObjectiveToGeographic
final void setObjectiveToGeographic(org.opengis.referencing.operation.CoordinateOperation op) Sets the operation fromCanvas.objectiveCRSto geographic CRS.- Parameters:
op- the conversion from objective CRS to geographic CRS, ornullif none.
-
clear
final void clear()Clears information that depends onCanvas.objectiveToDisplay. This method assumes thatCanvas.objectiveCRSis 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-trueif the modified property is the point of interest,falseif 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
RecomputesgeographicAreaandresolutionfields that are not valid. This method assumes thatobjectiveToGeographicisnullor valid.- Throws:
org.opengis.referencing.operation.TransformException
-
refresh
Sets theCoordinateOperationContextobject to the desired area and accuracy of the coordinate operation to obtain.- Throws:
org.opengis.referencing.operation.TransformException
-