GEOS  3.9.1dev
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
geos::geom::util::GeometryTransformer Class Reference

A framework for processes which transform an input Geometry into an output Geometry, possibly changing its structure and type(s). More...

#include <GeometryTransformer.h>

Inheritance diagram for geos::geom::util::GeometryTransformer:
[legend]
Collaboration diagram for geos::geom::util::GeometryTransformer:
[legend]

Public Member Functions

 GeometryTransformer ()
 
virtual ~GeometryTransformer ()=default
 
std::unique_ptr< Geometrytransform (const Geometry *nInputGeom)
 
void setSkipTransformedInvalidInteriorRings (bool b)
 

Protected Member Functions

CoordinateSequence::Ptr createCoordinateSequence (std::unique_ptr< std::vector< Coordinate > > coords)
 Convenience method which provides standard way of creating a CoordinateSequence. More...
 
virtual CoordinateSequence::Ptr transformCoordinates (const CoordinateSequence *coords, const Geometry *parent)
 
virtual Geometry::Ptr transformPoint (const Point *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformMultiPoint (const MultiPoint *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformLinearRing (const LinearRing *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformLineString (const LineString *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformMultiLineString (const MultiLineString *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformPolygon (const Polygon *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformMultiPolygon (const MultiPolygon *geom, const Geometry *parent)
 
virtual Geometry::Ptr transformGeometryCollection (const GeometryCollection *geom, const Geometry *parent)
 

Protected Attributes

const GeometryFactoryfactory
 

Private Member Functions

 GeometryTransformer (const GeometryTransformer &other)=delete
 
GeometryTransformeroperator= (const GeometryTransformer &rhs)=delete
 

Private Attributes

const GeometryinputGeom
 
bool pruneEmptyGeometry
 
bool preserveGeometryCollectionType
 
bool preserveType
 
bool skipTransformedInvalidInteriorRings
 

Detailed Description

A framework for processes which transform an input Geometry into an output Geometry, possibly changing its structure and type(s).

This class is a framework for implementing subclasses which perform transformations on various different Geometry subclasses. It provides an easy way of applying specific transformations to given geometry types, while allowing unhandled types to be simply copied. Also, the framework ensures that if subcomponents change type the parent geometries types change appropriately to maintain valid structure. Subclasses will override whichever transformX methods they need to to handle particular Geometry types.

A typically usage would be a transformation that may transform Polygons into Polygons, LineStrings or Points. This class would likely need to override the GeometryTransformer::transformMultiPolygon(const MultiPolygon* geom, const Geometry* parent) method to ensure that if input Polygons change type the result is a GeometryCollection, not a MultiPolygon

The default behaviour of this class is to simply recursively transform each Geometry component into an identical object by copying.

Note that all transformX methods may return null, to avoid creating empty geometry objects. This will be handled correctly by the transformer. The GeometryTransformer::transform(const Geometry* nInputGeom) method itself will always return a geometry object.

See also
GeometryEditor

Possible extensions: getParent() method to return immediate parent e.g. of LinearRings in Polygons

Definition at line 89 of file GeometryTransformer.h.

Constructor & Destructor Documentation

geos::geom::util::GeometryTransformer::GeometryTransformer ( )
virtual geos::geom::util::GeometryTransformer::~GeometryTransformer ( )
virtualdefault
geos::geom::util::GeometryTransformer::GeometryTransformer ( const GeometryTransformer other)
privatedelete

Member Function Documentation

CoordinateSequence::Ptr geos::geom::util::GeometryTransformer::createCoordinateSequence ( std::unique_ptr< std::vector< Coordinate > >  coords)
protected

Convenience method which provides standard way of creating a CoordinateSequence.

Parameters
coordsthe coordinate array to copy
Returns
a coordinate sequence for the array

[final]

GeometryTransformer& geos::geom::util::GeometryTransformer::operator= ( const GeometryTransformer rhs)
privatedelete
void geos::geom::util::GeometryTransformer::setSkipTransformedInvalidInteriorRings ( bool  b)
std::unique_ptr<Geometry> geos::geom::util::GeometryTransformer::transform ( const Geometry nInputGeom)
virtual CoordinateSequence::Ptr geos::geom::util::GeometryTransformer::transformCoordinates ( const CoordinateSequence coords,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformGeometryCollection ( const GeometryCollection geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformLinearRing ( const LinearRing geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformLineString ( const LineString geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformMultiLineString ( const MultiLineString geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformMultiPoint ( const MultiPoint geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformMultiPolygon ( const MultiPolygon geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformPoint ( const Point geom,
const Geometry parent 
)
protectedvirtual
virtual Geometry::Ptr geos::geom::util::GeometryTransformer::transformPolygon ( const Polygon geom,
const Geometry parent 
)
protectedvirtual

Member Data Documentation

const GeometryFactory* geos::geom::util::GeometryTransformer::factory
protected

Definition at line 103 of file GeometryTransformer.h.

const Geometry* geos::geom::util::GeometryTransformer::inputGeom
private

Definition at line 155 of file GeometryTransformer.h.

bool geos::geom::util::GeometryTransformer::preserveGeometryCollectionType
private

true if a homogenous collection result from a GeometryCollection should still be a general GeometryCollection

Definition at line 168 of file GeometryTransformer.h.

bool geos::geom::util::GeometryTransformer::preserveType
private

true if the output from a collection argument should still be a collection true if the type of the input should be preserved

Definition at line 178 of file GeometryTransformer.h.

bool geos::geom::util::GeometryTransformer::pruneEmptyGeometry
private

true if empty geometries should not be included in the result

Definition at line 161 of file GeometryTransformer.h.

bool geos::geom::util::GeometryTransformer::skipTransformedInvalidInteriorRings
private

true if transformed invalid interior rings should be skipped

Definition at line 183 of file GeometryTransformer.h.


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