- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class 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>`

List of all members.

## Public Member Functions
std::auto_ptr< Geometry > | transform (const Geometry *nInputGeom)
## Protected Member Functions
CoordinateSequence::AutoPtr | createCoordinateSequence (std::auto_ptr< std::vector< Coordinate > > coords)
virtual CoordinateSequence::AutoPtr | transformCoordinates (const CoordinateSequence *coords, const Geometry *parent)
virtual Geometry::AutoPtr | transformPoint (const Point *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformMultiPoint (const MultiPoint *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformLinearRing (const LinearRing *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformLineString (const LineString *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformMultiLineString (const MultiLineString *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformPolygon (const Polygon *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformMultiPolygon (const MultiPolygon *geom, const Geometry *parent)
virtual Geometry::AutoPtr | transformGeometryCollection (const GeometryCollection *geom, const Geometry *parent)
## Protected Attributes
const GeometryFactory * | factory

## 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 transformMultiPolygon 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 transform 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

## Member Function Documentation

CoordinateSequence::AutoPtr geos::geom::util::GeometryTransformer::createCoordinateSequence | ( | std::auto_ptr< std::vector< Coordinate > > | coords | ) | `[protected]`

Convenience method which provides standard way of creating a CoordinateSequence

Parameters:

  | coords | the coordinate array to copy

Returns:
  a coordinate sequence for the array

[final]

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

- GeometryTransformer.h