|
static bool | isResultOfOpPoint (const OverlayLabel *label, int opCode) |
|
static bool | isResultOfOp (int overlayOpCode, Location loc0, Location loc1) |
|
static std::unique_ptr< Geometry > | overlay (const Geometry *geom0, const Geometry *geom1, int opCode, const PrecisionModel *pm) |
|
static std::unique_ptr< Geometry > | overlay (const Geometry *geom0, const Geometry *geom1, int opCode, const PrecisionModel *pm, noding::Noder *noder) |
|
static std::unique_ptr< Geometry > | overlay (const Geometry *geom0, const Geometry *geom1, int opCode, noding::Noder *noder) |
|
static std::unique_ptr< Geometry > | overlay (const Geometry *geom0, const Geometry *geom1, int opCode) |
|
static std::unique_ptr< Geometry > | geomunion (const Geometry *geom, const PrecisionModel *pm) |
|
static std::unique_ptr< Geometry > | geomunion (const Geometry *geom, const PrecisionModel *pm, noding::Noder *noder) |
|
Computes the geometric overlay of two geom::Geometrys, using an explicit precision model to allow robust computation. The overlay can be used to determine any of the following set-theoretic operations (boolean combinations) of the geometries:
- INTERSECTION - all points which lie in both geometries
- UNION - all points which lie in at least one geometry
- DIFFERENCE - all points which lie in the first geometry but not the second
- SYMDIFFERENCE - all points which lie in one geometry but not both
The requirements for overlay input are:
- Input collections must be homogeneous (all elements must have the same dimension).
- Inputs may be simple link GeometryCollections. A GeometryCollection is simple if it can be flattened into a valid Multi-geometry; i.e. it is homogeneous and does not contain any overlapping Polygons.
- In general, inputs must be valid geometries. However, polygonal inputs may contain the following two kinds of "mild" invalid topology: (i) rings which self-touch at discrete points (sometimes called inverted shells and exverted holes). (ii) rings which touch along line segments (i.e. topology collapse).
The precision model used for the computation can be supplied independent of the precision model of the input geometry. The main use for this is to allow using a fixed precision for geometry with a floating precision model. This does two things: ensures robust computation; and forces the output to be validly rounded to the precision model.
For fixed precision models noding is performed using a noding::snapround::SnapRoundingNoder. This provides robust computation (as long as precision is limited to around 13 decimal digits).
For floating precision an noding::MCIndexNoder is used. This is not fully robust, so can sometimes result in util::TopologyExceptions being thrown. For robust full-precision overlay see OverlayNGRobust.
Note: If a noding::snap::SnappingNoder is used it is best to specify a fairly small snap tolerance, since the intersection clipping optimization can interact with the snapping to alter the result.
Optionally the overlay computation can process using strict mode (via setStrictMode(boolean). In strict mode result semantics are:
- Lines and Points resulting from topology collapses are not included in the result
- Result geometry is homogeneous for the INTERSECTION and DIFFERENCE operations.
- Result geometry is homogeneous for the UNION and SYMDIFFERENCE operations if the inputs have the same dimension.
Strict mode has the following benefits:
- Results are simpler
- Overlay operations are chainable without needing to remove lower-dimension elements
The original JTS overlay semantics correspond to non-strict mode.
If a robustness error occurs, a TopologyException is thrown. These are usually caused by numerical rounding causing the noding output to not be fully noded. For robust computation with full-precision OverlayNGRobust can be used.
- Author
- mdavis
- See also
- OverlayNGRobust