public class ProjectionHandler extends Object
This basic implementation will cut the geometries that get outside of the area of validity of the projection (as provided by the constructor)
WARNING: this API is not finalized and is meant to be used by StreamingRenderer only
Modifier and Type | Field and Description |
---|---|
static String |
ADVANCED_PROJECTION_DENSIFY |
protected double |
datelineX |
protected double |
densify |
protected static double |
EPS |
protected SingleCRS |
geometryCRS |
protected static Logger |
LOGGER |
protected boolean |
noReprojection |
protected boolean |
queryAcrossDateline |
protected ReferencedEnvelope |
renderingEnvelope |
protected CoordinateReferenceSystem |
sourceCRS |
protected CoordinateReferenceSystem |
targetCRS |
protected double |
targetHalfCircle |
protected PreparedGeometry |
validaAreaTester |
protected Geometry |
validArea |
protected ReferencedEnvelope |
validAreaBounds |
Constructor and Description |
---|
ProjectionHandler(CoordinateReferenceSystem sourceCRS,
Envelope validAreaBounds,
ReferencedEnvelope renderingEnvelope)
Initializes a projection handler
|
ProjectionHandler(CoordinateReferenceSystem sourceCRS,
Geometry validArea,
ReferencedEnvelope renderingEnvelope)
Initializes a projection handler
|
Modifier and Type | Method and Description |
---|---|
protected void |
accumulateTransforms(MathTransform mt,
List<MathTransform> elements) |
protected void |
addGeometries(List<Geometry> geoms,
GeometryCollection collection,
String geometryType)
Private method for adding to the input List only the
Geometry objects of the input
GeometryCollection which belongs to the defined geometryType |
protected void |
computeDatelineX() |
protected MathTransform |
concatenateTransforms(List<MathTransform> datumShiftChain) |
protected Geometry |
densify(Geometry geometry,
boolean validate)
Densifies the given geometry using the current densification configuration.
|
ReferencedEnvelope |
getProjectedEnvelope(ReferencedEnvelope envelope,
CoordinateReferenceSystem targetCRS)
Reprojects the given envelope to the target CRS, taking into account the ProjectionHandler
constraints (valid area bounds, etc.).
|
List<ReferencedEnvelope> |
getQueryEnvelopes()
Returns a set of envelopes that will be used to query the data given the specified rendering
envelope and the current query envelope
|
ReferencedEnvelope |
getRenderingEnvelope()
Returns the current rendering envelope
|
MathTransform |
getRenderingTransform(MathTransform mt)
Can modify/wrap the transform to handle specific projection issues
|
CoordinateReferenceSystem |
getSourceCRS() |
protected List<ReferencedEnvelope> |
getSourceEnvelopes(ReferencedEnvelope renderingEnvelope) |
ReferencedEnvelope |
getValidAreaBounds()
Returns the area where the transformation from source to target is valid, expressed in the
source coordinate reference system, or null if there is no limit
|
protected Geometry |
intersect(Geometry geometry,
Geometry mask,
CoordinateReferenceSystem geometryCRS) |
protected void |
mergeEnvelopes(List<ReferencedEnvelope> envelopes) |
Geometry |
postProcess(MathTransform mt,
Geometry geometry)
Processes the geometry already projected to the target SRS.
|
Geometry |
preProcess(Geometry geometry)
Pre processes the geometry, e.g. cuts it, splits it, etc. in its native srs.
|
protected void |
reprojectEnvelopes(CoordinateReferenceSystem queryCRS,
List<ReferencedEnvelope> envelopes) |
boolean |
requiresProcessing(Geometry geometry)
Returns true if the geometry needs special handling
|
protected void |
setCentralMeridian(double centralMeridian) |
void |
setProjectionParameters(Map<String,Object> projectionParameters)
Set one of the supported projection parameters: - advancedProjectionDensify (double) if > 0
enables densification on preprocessing with the given distance between points.
|
protected ReferencedEnvelope |
transformEnvelope(ReferencedEnvelope envelope,
CoordinateReferenceSystem targetCRS) |
public static final String ADVANCED_PROJECTION_DENSIFY
protected static final double EPS
protected static final Logger LOGGER
protected ReferencedEnvelope renderingEnvelope
protected final ReferencedEnvelope validAreaBounds
protected final Geometry validArea
protected final PreparedGeometry validaAreaTester
protected final CoordinateReferenceSystem sourceCRS
protected final CoordinateReferenceSystem targetCRS
protected double datelineX
protected double targetHalfCircle
protected boolean queryAcrossDateline
protected SingleCRS geometryCRS
protected boolean noReprojection
protected double densify
public ProjectionHandler(CoordinateReferenceSystem sourceCRS, Envelope validAreaBounds, ReferencedEnvelope renderingEnvelope) throws FactoryException
sourceCRS
- The source CRSvalidAreaBounds
- The valid area (used to cut geometries that go beyond it)renderingEnvelope
- The target rendering area and target CRSFactoryException
public ProjectionHandler(CoordinateReferenceSystem sourceCRS, Geometry validArea, ReferencedEnvelope renderingEnvelope) throws FactoryException
sourceCRS
- The source CRSvalidArea
- The valid area (used to cut geometries that go beyond it)renderingEnvelope
- The target rendering area and target CRSFactoryException
public void setProjectionParameters(Map<String,Object> projectionParameters)
public ReferencedEnvelope getRenderingEnvelope()
public CoordinateReferenceSystem getSourceCRS()
public List<ReferencedEnvelope> getQueryEnvelopes() throws TransformException, FactoryException
TransformException
FactoryException
protected List<ReferencedEnvelope> getSourceEnvelopes(ReferencedEnvelope renderingEnvelope) throws TransformException, FactoryException
TransformException
FactoryException
public ReferencedEnvelope getProjectedEnvelope(ReferencedEnvelope envelope, CoordinateReferenceSystem targetCRS) throws TransformException, FactoryException
envelope
- envelope to reprojecttargetCRS
- target CRSTransformException
FactoryException
protected ReferencedEnvelope transformEnvelope(ReferencedEnvelope envelope, CoordinateReferenceSystem targetCRS) throws TransformException, FactoryException
TransformException
FactoryException
protected void reprojectEnvelopes(CoordinateReferenceSystem queryCRS, List<ReferencedEnvelope> envelopes) throws TransformException, FactoryException
TransformException
FactoryException
protected void mergeEnvelopes(List<ReferencedEnvelope> envelopes)
public boolean requiresProcessing(Geometry geometry)
public Geometry preProcess(Geometry geometry) throws TransformException, FactoryException
TransformException
FactoryException
protected Geometry densify(Geometry geometry, boolean validate)
It returns the original geometry if densification is not enabled.
protected Geometry intersect(Geometry geometry, Geometry mask, CoordinateReferenceSystem geometryCRS)
public MathTransform getRenderingTransform(MathTransform mt) throws FactoryException
FactoryException
protected MathTransform concatenateTransforms(List<MathTransform> datumShiftChain)
protected void accumulateTransforms(MathTransform mt, List<MathTransform> elements)
public Geometry postProcess(MathTransform mt, Geometry geometry)
mt
- optional reverse transformation to facilitate unwrappingpublic ReferencedEnvelope getValidAreaBounds()
protected void setCentralMeridian(double centralMeridian)
protected void computeDatelineX()
Copyright © 1996–2021 Geotools. All rights reserved.