geos::triangulate::VoronoiDiagramBuilder Class Reference

A utility class which creates Voronoi Diagrams from collections of points. More...

`#include <VoronoiDiagramBuilder.h>`

## Public Member Functions

| VoronoiDiagramBuilder ()
| Creates a new Voronoi diagram builder.
void | setSites (const geom::Geometry &geom)
| Sets the sites (point or vertices) which will be diagrammed. All vertices of the given geometry will be used as sites.
void | setSites (const geom::CoordinateSequence &coords)
| Sets the sites (point or vertices) which will be diagrammed from a collection of `geom::Coordinate`s.
void | setOrdered (bool isOrdered)
| Specify whether the geometries in the generated diagram should reflect the order of coordinates in the input. If the generated diagram cannot be consistent with the input coordinate order (e.g., for repeated input points that become a single cell) an exception will be thrown.
void | setClipEnvelope (const geom::Envelope *clipEnv)
| Sets the envelope to clip the diagram to.
void | setTolerance (double tolerance)
| Sets the snapping tolerance which will be used to improved the robustness of the triangulation computation.
std::unique_ptr< quadedge::QuadEdgeSubdivision > | getSubdivision ()
| Gets the quadedge::QuadEdgeSubdivision which models the computed diagram.
std::unique_ptr< geom::GeometryCollection > | getDiagram (const geom::GeometryFactory &geomFact)
| Gets the faces of the computed diagram as a `geom::GeometryCollection` of `geom::Polygon`s, clipped as specified.
std::unique_ptr< geom::MultiLineString > | getDiagramEdges (const geom::GeometryFactory &geomFact)
| Gets the edges of the computed diagram as a `geom::MultiLineString`, clipped as specified.
void | reorderCellsToInput (std::vector< std::unique_ptr< geom::Geometry > > &polys) const

## Detailed Description

A utility class which creates Voronoi Diagrams from collections of points.

The diagram is returned as a geom::GeometryCollection of `geom::Polygon`s, clipped to the larger of a supplied envelope or to an envelope determined by the input sites.

Author
  Martin Davis

## Member Function Documentation

## getDiagram()

std::unique_ptr< geom::GeometryCollection > geos::triangulate::VoronoiDiagramBuilder::getDiagram | ( | const geom::GeometryFactory & | geomFact | ) |

Gets the faces of the computed diagram as a `geom::GeometryCollection` of `geom::Polygon`s, clipped as specified.

Parameters

  geomFact | the geometry factory to use to create the output

Returns
  the faces of the diagram

## getDiagramEdges()

std::unique_ptr< geom::MultiLineString > geos::triangulate::VoronoiDiagramBuilder::getDiagramEdges | ( | const geom::GeometryFactory & | geomFact | ) |

Gets the edges of the computed diagram as a `geom::MultiLineString`, clipped as specified.

Parameters

  geomFact | the geometry factory to use to create the output

Returns
  the edges of the diagram

## getSubdivision()

std::unique_ptr< quadedge::QuadEdgeSubdivision > geos::triangulate::VoronoiDiagramBuilder::getSubdivision | ( |  | ) |

Gets the quadedge::QuadEdgeSubdivision which models the computed diagram.

Returns
  the subdivision containing the triangulation

## setClipEnvelope()

void geos::triangulate::VoronoiDiagramBuilder::setClipEnvelope | ( | const geom::Envelope * | clipEnv | ) |

Sets the envelope to clip the diagram to.

The diagram will be clipped to the larger of this envelope or an envelope surrounding the sites.

Parameters

  clipEnv | the clip envelope; must be kept alive by caller until done with this instance; set to 0 for no clipping.

## setOrdered()

void geos::triangulate::VoronoiDiagramBuilder::setOrdered | ( | bool | isOrdered | ) |

Specify whether the geometries in the generated diagram should reflect the order of coordinates in the input. If the generated diagram cannot be consistent with the input coordinate order (e.g., for repeated input points that become a single cell) an exception will be thrown.

Parameters

  isOrdered | should the geometries reflect the input order?

## setSites() [1/2]

void geos::triangulate::VoronoiDiagramBuilder::setSites | ( | const geom::CoordinateSequence & | coords | ) |

Sets the sites (point or vertices) which will be diagrammed from a collection of `geom::Coordinate`s.

Parameters

  coords | a collection of Coordinates.

## setSites() [2/2]

void geos::triangulate::VoronoiDiagramBuilder::setSites | ( | const geom::Geometry & | geom | ) |

Sets the sites (point or vertices) which will be diagrammed. All vertices of the given geometry will be used as sites.

Parameters

  geom | the geometry from which the sites will be extracted.

## setTolerance()

void geos::triangulate::VoronoiDiagramBuilder::setTolerance | ( | double | tolerance | ) |

Sets the snapping tolerance which will be used to improved the robustness of the triangulation computation.

A tolerance of 0.0 specifies that no snapping will take place.

Parameters

  tolerance | the tolerance distance to use

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

- VoronoiDiagramBuilder.h