GEOS  3.9.1dev
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::overlayng::RingClipper Class Reference

#include <RingClipper.h>

Public Member Functions

 RingClipper (const Envelope *env)
 
std::unique_ptr< CoordinateArraySequenceclip (const CoordinateSequence *cs) const
 

Private Member Functions

std::unique_ptr< CoordinateArraySequenceclipToBoxEdge (const CoordinateSequence *pts, int edgeIndex, bool closeRing) const
 
void intersection (const Coordinate &a, const Coordinate &b, int edgeIndex, Coordinate &rsltPt) const
 
double intersectionLineY (const Coordinate &a, const Coordinate &b, double y) const
 
double intersectionLineX (const Coordinate &a, const Coordinate &b, double x) const
 
bool isInsideEdge (const Coordinate &p, int edgeIndex) const
 

Private Attributes

double clipEnvMinY
 
double clipEnvMaxY
 
double clipEnvMinX
 
double clipEnvMaxX
 

Static Private Attributes

static constexpr int BOX_LEFT = 3
 
static constexpr int BOX_TOP = 2
 
static constexpr int BOX_RIGHT = 1
 
static constexpr int BOX_BOTTOM = 0
 

Detailed Description

Clips rings of points to a rectangle. Uses a variant of Cohen-Sutherland clipping.

In general the output is not topologically valid. In particular, the output may contain coincident non-noded line segments along the clip rectangle sides. However, the output is sufficiently well-structured that it can be used as input to the OverlayNG algorithm (which is able to process coincident linework due to the need to handle topology collapse under precision reduction).

Because of the likelihood of creating extraneous line segments along the clipping rectangle sides, this class is not suitable for clipping linestrings.

The clipping envelope should be generated using RobustClipEnvelopeComputer, to ensure that intersecting line segments are not perturbed by clipping. This is required to ensure that the overlay of the clipped geometry is robust and correct (i.e. the same as if clipping was not used).

See also
LineLimiter
Author
Martin Davis

Definition at line 66 of file RingClipper.h.

Constructor & Destructor Documentation

geos::operation::overlayng::RingClipper::RingClipper ( const Envelope env)
inline

Definition at line 103 of file RingClipper.h.

Member Function Documentation

std::unique_ptr<CoordinateArraySequence> geos::operation::overlayng::RingClipper::clip ( const CoordinateSequence cs) const

Clips a list of points to the clipping rectangle box.

std::unique_ptr<CoordinateArraySequence> geos::operation::overlayng::RingClipper::clipToBoxEdge ( const CoordinateSequence pts,
int  edgeIndex,
bool  closeRing 
) const
private

Clips line to the axis-parallel line defined by a single box edge.

void geos::operation::overlayng::RingClipper::intersection ( const Coordinate a,
const Coordinate b,
int  edgeIndex,
Coordinate rsltPt 
) const
private

Computes the intersection point of a segment with an edge of the clip box. The segment must be known to intersect the edge.

double geos::operation::overlayng::RingClipper::intersectionLineX ( const Coordinate a,
const Coordinate b,
double  x 
) const
private
double geos::operation::overlayng::RingClipper::intersectionLineY ( const Coordinate a,
const Coordinate b,
double  y 
) const
private
bool geos::operation::overlayng::RingClipper::isInsideEdge ( const Coordinate p,
int  edgeIndex 
) const
private

Member Data Documentation

constexpr int geos::operation::overlayng::RingClipper::BOX_BOTTOM = 0
staticprivate

Definition at line 74 of file RingClipper.h.

constexpr int geos::operation::overlayng::RingClipper::BOX_LEFT = 3
staticprivate

Definition at line 71 of file RingClipper.h.

constexpr int geos::operation::overlayng::RingClipper::BOX_RIGHT = 1
staticprivate

Definition at line 73 of file RingClipper.h.

constexpr int geos::operation::overlayng::RingClipper::BOX_TOP = 2
staticprivate

Definition at line 72 of file RingClipper.h.

double geos::operation::overlayng::RingClipper::clipEnvMaxX
private

Definition at line 81 of file RingClipper.h.

double geos::operation::overlayng::RingClipper::clipEnvMaxY
private

Definition at line 79 of file RingClipper.h.

double geos::operation::overlayng::RingClipper::clipEnvMinX
private

Definition at line 80 of file RingClipper.h.

double geos::operation::overlayng::RingClipper::clipEnvMinY
private

Definition at line 78 of file RingClipper.h.


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