GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
Loading...
Searching...
No Matches
geodesk::Polygonizer Class Reference

Utility class for creating polygon rings from Relation members. More...

#include <Polygonizer.h>

Public Member Functions

 Polygonizer ()
 
const Ring * outerRings () const
 Returns the assembled outer rings.
 
const Ring * innerRings () const
 Returns the assembled outer rings.
 
void createRings (FeatureStore *store, RelationPtr relation)
 Creates only the raw outer and inner rings, without assigning the inner rings to outer, and without merging inner rings whose edges touch.
 
void assignAndMergeHoles ()
 Assigns inner rings to outer, and merges any inner rings whose edges touch.
 

Detailed Description

Utility class for creating polygon rings from Relation members.

In OpenStreetMap, polygons with holes and multi-polygons are represented as relations. Member ways with role outer and inner form the linework. The Polygonizer assembles these linestrings into rings and ensures that inner rings are matched with their corresponding outer rings.

Constructor & Destructor Documentation

◆ Polygonizer()

geodesk::Polygonizer::Polygonizer ( )

Member Function Documentation

◆ assignAndMergeHoles()

void geodesk::Polygonizer::assignAndMergeHoles ( )

Assigns inner rings to outer, and merges any inner rings whose edges touch.

The createRings() method must have been called.

◆ createRings()

void geodesk::Polygonizer::createRings ( FeatureStore * store,
RelationPtr relation )

Creates only the raw outer and inner rings, without assigning the inner rings to outer, and without merging inner rings whose edges touch.

(This is sufficient for many operations such as area or centroid computation)

Parameters
storethe FeatureStore
relationpointer to the stored Relation

◆ innerRings()

const Ring * geodesk::Polygonizer::innerRings ( ) const
inline

Returns the assembled outer rings.

The Ring objects form a linked list. createRings() must have been called, or the result of this method will be nullptr. After a subsequent call to assignAndMergeHoles() this method will always return nullptr, as the inner rings will have been assigned to their outer rings.

Returns
a pointer the first outer ring, or nullptr if no valid outer rings could be assembled, or if they have been assigned to their outer rings.

◆ outerRings()

const Ring * geodesk::Polygonizer::outerRings ( ) const
inline

Returns the assembled outer rings.

The Ring objects form a linked list. createRings() must have been called, or the result of this method will be nullptr.

Returns
a pointer the first outer ring, or nullptr if no valid outer rings could be assembled.

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