GEOS  3.9.1dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geos::noding::snapround::SnapRoundingNoder Class Reference

#include <SnapRoundingNoder.h>

Inheritance diagram for geos::noding::snapround::SnapRoundingNoder:
[legend]
Collaboration diagram for geos::noding::snapround::SnapRoundingNoder:
[legend]

Public Member Functions

 SnapRoundingNoder (const geom::PrecisionModel *p_pm)
 
std::vector< SegmentString * > * getNodedSubstrings () const override
 
void computeNodes (std::vector< SegmentString * > *inputSegStrings) override
 
- Public Member Functions inherited from geos::noding::Noder
virtual ~Noder ()
 

Private Member Functions

void snapRound (std::vector< SegmentString * > &inputSegStrings, std::vector< SegmentString * > &resultNodedSegments)
 
void addVertexPixels (std::vector< SegmentString * > &segStrings)
 
void addIntersectionPixels (std::vector< SegmentString * > &segStrings)
 
void round (const geom::Coordinate &pt, geom::Coordinate &ptOut)
 
std::unique_ptr< std::vector< geom::Coordinate > > round (const std::vector< geom::Coordinate > &pts)
 
void computeSnaps (const std::vector< SegmentString * > &segStrings, std::vector< SegmentString * > &snapped)
 
NodedSegmentStringcomputeSegmentSnaps (NodedSegmentString *ss)
 
void snapSegment (geom::Coordinate &p0, geom::Coordinate &p1, NodedSegmentString *ss, size_t segIndex)
 
void addVertexNodeSnaps (NodedSegmentString *ss)
 
void snapVertexNode (const geom::Coordinate &p0, NodedSegmentString *ss, size_t segIndex)
 

Private Attributes

const geom::PrecisionModelpm
 
noding::snapround::HotPixelIndex pixelIndex
 
std::vector< SegmentString * > snappedResult
 

Additional Inherited Members

- Protected Member Functions inherited from geos::noding::Noder
 Noder ()
 

Detailed Description

Uses Snap Rounding to compute a rounded, fully noded arrangement from a set of noding::SegmentStrings, in a performant way, and avoiding unnecessary noding.

Implements the Snap Rounding technique described in the papers by Hobby, Guibas & Marimont, and Goodrich et al. Snap Rounding enforces that all output vertices lie on a uniform grid, which is determined by the provided geom::PrecisionModel.

Input vertices do not have to be rounded to the grid beforehand; this is done during the snap-rounding process. In fact, rounding cannot be done a priori, since rounding vertices by themselves can distort the rounded topology of the arrangement (i.e. by moving segments away from hot pixels that would otherwise intersect them, or by moving vertices across segments).

To minimize the number of introduced nodes, the Snap-Rounding Noder avoids creating nodes at edge vertices if there is no intersection or snap at that location. However, if two different input edges contain identical segments, each of the segment vertices will be noded. This still provides fully-noded output. This is the same behaviour provided by other noders, such as noding::MCIndexNoder and noding::snap::SnappingNoder.

Definition at line 71 of file SnapRoundingNoder.h.

Constructor & Destructor Documentation

geos::noding::snapround::SnapRoundingNoder::SnapRoundingNoder ( const geom::PrecisionModel p_pm)
inline

Definition at line 140 of file SnapRoundingNoder.h.

Member Function Documentation

void geos::noding::snapround::SnapRoundingNoder::addIntersectionPixels ( std::vector< SegmentString * > &  segStrings)
private

Detects interior intersections in the collection of SegmentStrings, and adds nodes for them to the segment strings. Also creates HotPixel nodes for the intersection points.

void geos::noding::snapround::SnapRoundingNoder::addVertexNodeSnaps ( NodedSegmentString ss)
private

Add nodes for any vertices in hot pixels that were added as nodes during segment noding.

void geos::noding::snapround::SnapRoundingNoder::addVertexPixels ( std::vector< SegmentString * > &  segStrings)
private

Creates HotPixels for each vertex in the input segStrings. The HotPixels are not marked as nodes, since they will only be nodes in the final line arrangement if they interact with other segments (or they are already created as intersection nodes).

void geos::noding::snapround::SnapRoundingNoder::computeNodes ( std::vector< SegmentString * > *  inputSegStrings)
overridevirtual

Computes the nodes in the snap-rounding line arrangement. The nodes are added to the NodedSegmentStrings provided as the input.

Implements geos::noding::Noder.

NodedSegmentString* geos::noding::snapround::SnapRoundingNoder::computeSegmentSnaps ( NodedSegmentString ss)
private
void geos::noding::snapround::SnapRoundingNoder::computeSnaps ( const std::vector< SegmentString * > &  segStrings,
std::vector< SegmentString * > &  snapped 
)
private

Computes new segment strings which are rounded and contain intersections added as a result of snapping segments to snap points (hot pixels).

Parameters
segStringssegments to snap
Returns
the snapped segment strings
std::vector<SegmentString*>* geos::noding::snapround::SnapRoundingNoder::getNodedSubstrings ( ) const
overridevirtual
Returns
a Collection of NodedSegmentStrings representing the substrings

Implements geos::noding::Noder.

void geos::noding::snapround::SnapRoundingNoder::round ( const geom::Coordinate pt,
geom::Coordinate ptOut 
)
private
std::unique_ptr<std::vector<geom::Coordinate> > geos::noding::snapround::SnapRoundingNoder::round ( const std::vector< geom::Coordinate > &  pts)
private

Gets a list of the rounded coordinates. Duplicate (collapsed) coordinates are removed.

Parameters
ptsthe coordinates to round
Returns
array of rounded coordinates
void geos::noding::snapround::SnapRoundingNoder::snapRound ( std::vector< SegmentString * > &  inputSegStrings,
std::vector< SegmentString * > &  resultNodedSegments 
)
private
void geos::noding::snapround::SnapRoundingNoder::snapSegment ( geom::Coordinate p0,
geom::Coordinate p1,
NodedSegmentString ss,
size_t  segIndex 
)
private

Snaps a segment in a segmentString to HotPixels that it intersects.

Parameters
p0the segment start coordinate
p1the segment end coordinate
ssthe segment string to add intersections to
segIndexthe index of the segment
void geos::noding::snapround::SnapRoundingNoder::snapVertexNode ( const geom::Coordinate p0,
NodedSegmentString ss,
size_t  segIndex 
)
private

Member Data Documentation

noding::snapround::HotPixelIndex geos::noding::snapround::SnapRoundingNoder::pixelIndex
private

Definition at line 77 of file SnapRoundingNoder.h.

const geom::PrecisionModel* geos::noding::snapround::SnapRoundingNoder::pm
private

Definition at line 76 of file SnapRoundingNoder.h.

std::vector<SegmentString*> geos::noding::snapround::SnapRoundingNoder::snappedResult
private

Definition at line 78 of file SnapRoundingNoder.h.


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