GEOS 3.14.0dev
Static Public Member Functions | List of all members
geos::operation::overlayng::OverlayUtil Class Reference

#include <OverlayUtil.h>

Static Public Member Functions

static bool isFloating (const PrecisionModel *pm)
 
static bool clippingEnvelope (int opCode, const InputGeometry *inputGeom, const PrecisionModel *pm, Envelope &rsltEnvelope)
 
static bool isEmptyResult (int opCode, const Geometry *a, const Geometry *b, const PrecisionModel *pm)
 
static bool isEnvDisjoint (const Geometry *a, const Geometry *b, const PrecisionModel *pm)
 
static std::unique_ptr< GeometrycreateEmptyResult (int dim, const GeometryFactory *geomFact)
 
static int resultDimension (int opCode, int dim0, int dim1)
 
static std::unique_ptr< GeometrycreateResultGeometry (std::vector< std::unique_ptr< Polygon > > &resultPolyList, std::vector< std::unique_ptr< LineString > > &resultLineList, std::vector< std::unique_ptr< Point > > &resultPointList, const GeometryFactory *geometryFactory)
 
static std::unique_ptr< GeometrytoLines (OverlayGraph *graph, bool isOutputEdges, const GeometryFactory *geomFact)
 
static bool isResultAreaConsistent (const Geometry *geom0, const Geometry *geom1, int opCode, const Geometry *result)
 
static bool round (const Point *pt, const PrecisionModel *pm, Coordinate &rsltCoord)
 
template<typename T >
static void moveGeometry (std::vector< std::unique_ptr< T > > &inGeoms, std::vector< std::unique_ptr< Geometry > > &outGeoms)
 

Detailed Description

Utility methods for overlay processing.

Author
mdavis

Member Function Documentation

◆ clippingEnvelope()

static bool geos::operation::overlayng::OverlayUtil::clippingEnvelope ( int  opCode,
const InputGeometry inputGeom,
const PrecisionModel pm,
Envelope rsltEnvelope 
)
static

Computes a clipping envelope for overlay input geometries. The clipping envelope encloses all geometry line segments which might participate in the overlay, with a buffer to account for numerical precision (in particular, rounding due to a precision model. The clipping envelope is used in both the RingClipper and in the LineLimiter.

Some overlay operations (i.e. UNION and SYMDIFFERENCE cannot use clipping as an optimization, since the result envelope is the full extent of the two input geometries. In this case the returned envelope is null to indicate this.

◆ createEmptyResult()

static std::unique_ptr< Geometry > geos::operation::overlayng::OverlayUtil::createEmptyResult ( int  dim,
const GeometryFactory geomFact 
)
static

Creates an empty result geometry of the appropriate dimension, based on the given overlay operation and the dimensions of the inputs. The created geometry is an atomic geometry, not a collection (unless the dimension is -1, in which case a GEOMETRYCOLLECTION EMPTY is created.)

◆ createResultGeometry()

static std::unique_ptr< Geometry > geos::operation::overlayng::OverlayUtil::createResultGeometry ( std::vector< std::unique_ptr< Polygon > > &  resultPolyList,
std::vector< std::unique_ptr< LineString > > &  resultLineList,
std::vector< std::unique_ptr< Point > > &  resultPointList,
const GeometryFactory geometryFactory 
)
static

Creates an overlay result geometry for homogeneous or mixed components.

◆ isEmptyResult()

static bool geos::operation::overlayng::OverlayUtil::isEmptyResult ( int  opCode,
const Geometry a,
const Geometry b,
const PrecisionModel pm 
)
static

Tests if the result can be determined to be empty based on simple properties of the input geometries (such as whether one or both are empty, or their envelopes are disjoint).

◆ isEnvDisjoint()

static bool geos::operation::overlayng::OverlayUtil::isEnvDisjoint ( const Geometry a,
const Geometry b,
const PrecisionModel pm 
)
static

Tests if the geometry envelopes are disjoint, or empty. The disjoint test must take into account the precision model being used, since geometry coordinates may shift under rounding.

◆ isResultAreaConsistent()

static bool geos::operation::overlayng::OverlayUtil::isResultAreaConsistent ( const Geometry geom0,
const Geometry geom1,
int  opCode,
const Geometry result 
)
static

A heuristic check for overlay result correctness comparing the areas of the input and result. The heuristic is necessarily coarse, but it detects some obvious issues. (e.g. https://github.com/locationtech/jts/issues/798)

Note: - this check is only safe if the precision model is floating. It should also be safe for snapping noding if the distance tolerance is reasonably small. (Fixed precision models can lead to collapse causing result area to expand.)

Parameters
geom0input geometry 0
geom1input geometry 1
opCodethe overlay opcode
resultthe overlay result
Returns
true if the result area is consistent

◆ resultDimension()

static int geos::operation::overlayng::OverlayUtil::resultDimension ( int  opCode,
int  dim0,
int  dim1 
)
static

Computes the dimension of the result of applying the given operation to inputs with the given dimensions. This assumes that complete collapse does not occur.

The result dimension is computed according to the following rules:

  • OverlayNG::INTERSECTION - result has the dimension of the lowest input dimension
  • OverlayNG::UNION - result has the dimension of the highest input dimension
  • OverlayNG::DIFFERENCE - result has the dimension of the left-hand input
  • OverlayNG::SYMDIFFERENCE - result has the dimension of the highest input dimension (since the Symmetric Difference is the Union of the Differences).

◆ round()

static bool geos::operation::overlayng::OverlayUtil::round ( const Point pt,
const PrecisionModel pm,
Coordinate rsltCoord 
)
static

Round the key point if precision model is fixed. Note: return value is only copied if rounding is performed.


The documentation for this class was generated from the following file: