GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::geounion::CascadedUnion Class Reference

Provides an efficient method of unioning a collection of Geometries. More...

#include <CascadedUnion.h>

Collaboration diagram for geos::operation::geounion::CascadedUnion:
[legend]

Public Member Functions

 CascadedUnion ()
 
 CascadedUnion (const std::vector< geom::Geometry * > *geoms)
 
geom::GeometryUnion ()
 

Static Public Member Functions

static geom::GeometryUnion (std::vector< geom::Geometry * > *geoms)
 
template<class T >
static geom::GeometryUnion (T start, T end)
 

Private Member Functions

geom::GeometryunionTree (index::strtree::ItemsList *geomTree)
 
geom::GeometrybinaryUnion (GeometryListHolder *geoms)
 
geom::GeometrybinaryUnion (GeometryListHolder *geoms, std::size_t start, std::size_t end)
 
GeometryListHolderreduceToGeometries (index::strtree::ItemsList *geomTree)
 
geom::GeometryunionSafe (geom::Geometry *g0, geom::Geometry *g1)
 
geom::GeometryunionOptimized (geom::Geometry *g0, geom::Geometry *g1)
 
geom::GeometryunionUsingEnvelopeIntersection (geom::Geometry *g0, geom::Geometry *g1, geom::Envelope const &common)
 
geom::GeometryextractByEnvelope (geom::Envelope const &env, geom::Geometry *geom, std::vector< const geom::Geometry * > &disjointGeoms)
 

Static Private Member Functions

static geom::GeometryunionActual (geom::Geometry *g0, geom::Geometry *g1)
 

Private Attributes

const std::vector< geom::Geometry * > * inputGeoms
 
geom::GeometryFactory const * geomFactory
 

Static Private Attributes

static int const STRTREE_NODE_CAPACITY = 4
 

Detailed Description

Provides an efficient method of unioning a collection of Geometries.

This algorithm is more robust than the simple iterated approach of repeatedly unioning each geometry to a result geometry.

Definition at line 55 of file CascadedUnion.h.

Constructor & Destructor Documentation

geos::operation::geounion::CascadedUnion::CascadedUnion ( )
geos::operation::geounion::CascadedUnion::CascadedUnion ( const std::vector< geom::Geometry * > *  geoms)
inline

Creates a new instance to union the given collection of geom::Geometrys.

Parameters
geomsa collection of geom::Geometrys. Ownership of elements and vector are left to caller.

Definition at line 106 of file CascadedUnion.h.

Member Function Documentation

geom::Geometry* geos::operation::geounion::CascadedUnion::binaryUnion ( GeometryListHolder geoms)
private

Unions a list of geometries by treating the list as a flattened binary tree, and performing a cascaded union on the tree.

geom::Geometry* geos::operation::geounion::CascadedUnion::binaryUnion ( GeometryListHolder geoms,
std::size_t  start,
std::size_t  end 
)
private

Unions a section of a list using a recursive binary union on each half of the section.

Parameters
geoms
start
end
Returns
the union of the list section
geom::Geometry* geos::operation::geounion::CascadedUnion::extractByEnvelope ( geom::Envelope const &  env,
geom::Geometry geom,
std::vector< const geom::Geometry * > &  disjointGeoms 
)
private
GeometryListHolder* geos::operation::geounion::CascadedUnion::reduceToGeometries ( index::strtree::ItemsList geomTree)
private

Reduces a tree of geometries to a list of geometries by recursively unioning the subtrees in the list.

Parameters
geomTreea tree-structured list of geometries
Returns
a list of Geometrys
static geom::Geometry* geos::operation::geounion::CascadedUnion::Union ( std::vector< geom::Geometry * > *  geoms)
static

Computes the union of a collection of geom::Geometrys.

Parameters
geomsa collection of geom::Geometrys. ownership of elements and vector are left to caller.
template<class T >
static geom::Geometry* geos::operation::geounion::CascadedUnion::Union ( start,
end 
)
inlinestatic

Computes the union of a set of geom::Geometrys.

Template Parameters
Tan iterator yelding something castable to const Geometry *
Parameters
startstart iterator
endend iterator

Definition at line 89 of file CascadedUnion.h.

geom::Geometry* geos::operation::geounion::CascadedUnion::Union ( )

Computes the union of the input geometries.

Returns
the union of the input geometries
null if no input geometries were provided
static geom::Geometry* geos::operation::geounion::CascadedUnion::unionActual ( geom::Geometry g0,
geom::Geometry g1 
)
staticprivate

Encapsulates the actual unioning of two polygonal geometries.

Parameters
g0
g1
Returns
geom::Geometry* geos::operation::geounion::CascadedUnion::unionOptimized ( geom::Geometry g0,
geom::Geometry g1 
)
private
geom::Geometry* geos::operation::geounion::CascadedUnion::unionSafe ( geom::Geometry g0,
geom::Geometry g1 
)
private

Computes the union of two geometries, either of both of which may be null.

Parameters
g0a Geometry
g1a Geometry
Returns
the union of the input(s)
null if both inputs are null
geom::Geometry* geos::operation::geounion::CascadedUnion::unionTree ( index::strtree::ItemsList geomTree)
private
geom::Geometry* geos::operation::geounion::CascadedUnion::unionUsingEnvelopeIntersection ( geom::Geometry g0,
geom::Geometry g1,
geom::Envelope const &  common 
)
private

Unions two geometries. The case of multi geometries is optimized to union only the components which lie in the intersection of the two geometry's envelopes. Geometrys outside this region can simply be combined with the union result, which is potentially much faster. This case is likely to occur often during cascaded union, and may also occur in real world data (such as unioning data for parcels on different street blocks).

Parameters
g0a geometry
g1a geometry
commonthe intersection of the envelopes of the inputs
Returns
the union of the inputs

Member Data Documentation

geom::GeometryFactory const* geos::operation::geounion::CascadedUnion::geomFactory
private

Definition at line 58 of file CascadedUnion.h.

const std::vector<geom::Geometry*>* geos::operation::geounion::CascadedUnion::inputGeoms
private

Definition at line 57 of file CascadedUnion.h.

int const geos::operation::geounion::CascadedUnion::STRTREE_NODE_CAPACITY = 4
staticprivate

The effectiveness of the index is somewhat sensitive to the node capacity. Testing indicates that a smaller capacity is better. For an STRtree, 4 is probably a good number (since this produces 2x2 "squares").

Definition at line 67 of file CascadedUnion.h.


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