Package org.geotools.geometry.jts
Class GeometryClipper
Object
GeometryClipper
A stateful geometry clipper, can clip linestring on a specified rectangle. Trivial benchmarks report a speedup factor
between 20 and 60 compared to JTS generic intersection algorithm. The class is not thread safe.
- Author:
- Andrea Aime - OpenGeo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClips the geometry on the specified bounds.This will try to handle failures when clipping - i.e. because of invalid input geometries (often caused by simplification).
-
Constructor Details
-
GeometryClipper
-
-
Method Details
-
getBounds
-
clipSafe
This will try to handle failures when clipping - i.e. because of invalid input geometries (often caused by simplification).This attempts to do a normal clip(). If it fails, it will try to do more to ensure the clip works properly.
- if its a polygon/multipolygon it will try to make the polygon valid and re-try the clip
- it will attempt to put the geometry on a precision grid (this will move the points around) and re-try the clip
- will attempt to clip with ensureValid = false (ie geotools simple clipping)
clip
- Parameters:
scale
- Scale used to snap geometry to precision model, 0 to disable- Returns:
- a clipped geometry, which may be empty, or null
-
clip
Clips the geometry on the specified bounds.- Parameters:
g
- The geometry to be clippedensureValid
- If false there is no guarantee the polygons returned will be valid according to JTS rules (but should still be good enough to be used for pure rendering)
-