QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
pal::PointSet Class Reference

The underlying raw pal geometry class. More...

#include <pointset.h>

Inheritance diagram for pal::PointSet:
Inheritance graph
[legend]

Public Member Functions

 PointSet ()
 
 PointSet (int nbPoints, double *x, double *y)
 
virtual ~PointSet ()
 
double area () const
 Returns area of polygon geometry.
 
QgsRectangle boundingBox () const
 Returns the point set bounding box.
 
bool boundingBoxIntersects (const PointSet *other) const
 Returns true if the bounding box of this pointset intersects the bounding box of another pointset.
 
std::unique_ptr< PointSetclone () const
 Returns a copy of the point set.
 
OrientedConvexHullBoundingBox computeConvexHullOrientedBoundingBox (bool &ok) const
 Computes an oriented bounding box for the shape's convex hull.
 
bool containsLabelCandidate (double x, double y, double width, double height, double alpha=0) const
 Tests whether a possible label candidate will fit completely within the shape.
 
bool containsPoint (double x, double y) const
 Tests whether point set contains a specified point.
 
std::tuple< std::vector< double >, double > edgeDistances () const
 Returns a vector of edge distances as well as its total length.
 
void extendLineByDistance (double startDistance, double endDistance, double smoothDistance)
 Extends linestrings by the specified amount at the start and end of the line, by extending the existing lines following the same direction as the original line start or end.
 
std::unique_ptr< PointSetextractShape (int nbPtSh, int imin, int imax, int fps, int fpe, double fptx, double fpty)
 Does... something completely inscrutable.
 
const GEOSGeometrygeos () const
 Returns the point set's GEOS geometry.
 
void getCentroid (double &px, double &py, bool forceInside=false) const
 
int getGeosType () const
 
PointSetgetHoleOf () const
 Returns nullptr if this isn't a hole. Otherwise returns pointer to parent pointset.
 
int getNumPoints () const
 
void getPointByDistance (double *d, double *ad, double dl, double *px, double *py) const
 Gets a point a set distance along a line geometry.
 
geos::unique_ptr interpolatePoint (double distance) const
 Returns a GEOS geometry representing the point interpolated on the shape by distance.
 
bool isClosed () const
 Returns true if pointset is closed.
 
double length () const
 Returns length of line geometry.
 
double lineLocatePoint (const GEOSGeometry *point) const
 Returns the distance along the geometry closest to the specified GEOS point.
 
double minDistanceToPoint (double px, double py, double *rx=nullptr, double *ry=nullptr) const
 Returns the squared minimum distance between the point set geometry and the point (px,py) Optionally, the nearest point is stored in (rx,ry).
 
void offsetCurveByDistance (double distance)
 Offsets linestrings by the specified distance.
 
QString toWkt () const
 Returns a WKT representation of the point set.
 

Static Public Member Functions

static QLinkedList< PointSet * > splitPolygons (PointSet *inputShape, double labelWidth, double labelHeight)
 Split a polygon using some random logic into some other polygons.
 

Public Attributes

int nbPoints
 
std::vector< double > x
 
std::vector< double > y
 

Protected Member Functions

 PointSet (const PointSet &ps)
 
 PointSet (double x, double y)
 
void createGeosGeom () const
 
void deleteCoords ()
 
void invalidateGeos () const
 
const GEOSPreparedGeometry * preparedGeom () const
 

Protected Attributes

std::vector< int > convexHull
 
PointSetholeOf = nullptr
 
double mArea = -1
 
GEOSGeometrymGeos = nullptr
 
double mLength = -1
 
bool mOwnsGeom = false
 
PointSetparent = nullptr
 
int type
 
double xmax = std::numeric_limits<double>::lowest()
 
double xmin = std::numeric_limits<double>::max()
 
double ymax = std::numeric_limits<double>::lowest()
 
double ymin = std::numeric_limits<double>::max()
 

Friends

class CostCalculator
 
class FeaturePart
 
class LabelPosition
 
class Layer
 
class PolygonCostCalculator
 

Detailed Description

The underlying raw pal geometry class.

Note
not available in Python bindings

Definition at line 76 of file pointset.h.

Constructor & Destructor Documentation

◆ PointSet() [1/4]

PointSet::PointSet ( )

Definition at line 41 of file pointset.cpp.

◆ PointSet() [2/4]

PointSet::PointSet ( int  nbPoints,
double *  x,
double *  y 
)

Definition at line 47 of file pointset.cpp.

◆ ~PointSet()

PointSet::~PointSet ( )
virtual

Definition at line 202 of file pointset.cpp.

◆ PointSet() [3/4]

PointSet::PointSet ( double  x,
double  y 
)
protected

Definition at line 63 of file pointset.cpp.

◆ PointSet() [4/4]

PointSet::PointSet ( const PointSet ps)
protected

Definition at line 77 of file pointset.cpp.

Member Function Documentation

◆ area()

double PointSet::area ( ) const

Returns area of polygon geometry.

Definition at line 1087 of file pointset.cpp.

◆ boundingBox()

QgsRectangle pal::PointSet::boundingBox ( ) const
inline

Returns the point set bounding box.

Definition at line 163 of file pointset.h.

◆ boundingBoxIntersects()

bool PointSet::boundingBoxIntersects ( const PointSet other) const

Returns true if the bounding box of this pointset intersects the bounding box of another pointset.

Definition at line 965 of file pointset.cpp.

◆ clone()

std::unique_ptr< PointSet > PointSet::clone ( ) const

Returns a copy of the point set.

Definition at line 266 of file pointset.cpp.

◆ computeConvexHullOrientedBoundingBox()

OrientedConvexHullBoundingBox PointSet::computeConvexHullOrientedBoundingBox ( bool &  ok) const

Computes an oriented bounding box for the shape's convex hull.

Definition at line 719 of file pointset.cpp.

◆ containsLabelCandidate()

bool PointSet::containsLabelCandidate ( double  x,
double  y,
double  width,
double  height,
double  alpha = 0 
) const

Tests whether a possible label candidate will fit completely within the shape.

Parameters
xx-coordinate of label candidate
yy-coordinate of label candidate
widthlabel width
heightlabel height
alphalabel angle
Returns
true if point set completely contains candidate label

Definition at line 290 of file pointset.cpp.

◆ containsPoint()

bool PointSet::containsPoint ( double  x,
double  y 
) const

Tests whether point set contains a specified point.

Parameters
xx-coordinate of point
yy-coordinate of point
Returns
true if point set contains a specified point

Definition at line 271 of file pointset.cpp.

◆ createGeosGeom()

void PointSet::createGeosGeom ( ) const
protected

Definition at line 100 of file pointset.cpp.

◆ deleteCoords()

void PointSet::deleteCoords ( )
protected

Definition at line 233 of file pointset.cpp.

◆ edgeDistances()

std::tuple< std::vector< double >, double > PointSet::edgeDistances ( ) const

Returns a vector of edge distances as well as its total length.

Definition at line 1148 of file pointset.cpp.

◆ extendLineByDistance()

void PointSet::extendLineByDistance ( double  startDistance,
double  endDistance,
double  smoothDistance 
)

Extends linestrings by the specified amount at the start and end of the line, by extending the existing lines following the same direction as the original line start or end.

The smoothDistance argument specifies the distance over which to smooth the direction of the line at its start and end points.

Definition at line 632 of file pointset.cpp.

◆ extractShape()

std::unique_ptr< PointSet > PointSet::extractShape ( int  nbPtSh,
int  imin,
int  imax,
int  fps,
int  fpe,
double  fptx,
double  fpty 
)

Does... something completely inscrutable.

Definition at line 239 of file pointset.cpp.

◆ geos()

const GEOSGeometry * PointSet::geos ( ) const

Returns the point set's GEOS geometry.

Definition at line 1053 of file pointset.cpp.

◆ getCentroid()

void PointSet::getCentroid ( double &  px,
double &  py,
bool  forceInside = false 
) const

Definition at line 918 of file pointset.cpp.

◆ getGeosType()

int pal::PointSet::getGeosType ( ) const
inline

Definition at line 158 of file pointset.h.

◆ getHoleOf()

PointSet * pal::PointSet::getHoleOf ( ) const
inline

Returns nullptr if this isn't a hole. Otherwise returns pointer to parent pointset.

Definition at line 175 of file pointset.h.

◆ getNumPoints()

int pal::PointSet::getNumPoints ( ) const
inline

Definition at line 177 of file pointset.h.

◆ getPointByDistance()

void PointSet::getPointByDistance ( double *  d,
double *  ad,
double  dl,
double *  px,
double *  py 
) const

Gets a point a set distance along a line geometry.

Parameters
darray of distances between points
adcumulative total distance from pt0 to each point (ad0 = pt0->pt0)
dldistance to traverse along line
pxfinal x coord on line
pyfinal y coord on line

Definition at line 976 of file pointset.cpp.

◆ interpolatePoint()

geos::unique_ptr PointSet::interpolatePoint ( double  distance) const

Returns a GEOS geometry representing the point interpolated on the shape by distance.

Definition at line 1015 of file pointset.cpp.

◆ invalidateGeos()

void PointSet::invalidateGeos ( ) const
protected

Definition at line 167 of file pointset.cpp.

◆ isClosed()

bool PointSet::isClosed ( ) const

Returns true if pointset is closed.

Definition at line 1114 of file pointset.cpp.

◆ length()

double PointSet::length ( ) const

Returns length of line geometry.

Definition at line 1061 of file pointset.cpp.

◆ lineLocatePoint()

double PointSet::lineLocatePoint ( const GEOSGeometry point) const

Returns the distance along the geometry closest to the specified GEOS point.

Definition at line 1033 of file pointset.cpp.

◆ minDistanceToPoint()

double PointSet::minDistanceToPoint ( double  px,
double  py,
double *  rx = nullptr,
double *  ry = nullptr 
) const

Returns the squared minimum distance between the point set geometry and the point (px,py) Optionally, the nearest point is stored in (rx,ry).

Parameters
pxx coordinate of the point
pyy coordinate of the points
rxpointer to x coordinates of the nearest point (can be NULL)
rypointer to y coordinates of the nearest point (can be NULL)
Returns
minimum distance

Definition at line 861 of file pointset.cpp.

◆ offsetCurveByDistance()

void PointSet::offsetCurveByDistance ( double  distance)

Offsets linestrings by the specified distance.

Definition at line 546 of file pointset.cpp.

◆ preparedGeom()

const GEOSPreparedGeometry * PointSet::preparedGeom ( ) const
protected

Definition at line 155 of file pointset.cpp.

◆ splitPolygons()

QLinkedList< PointSet * > PointSet::splitPolygons ( PointSet inputShape,
double  labelWidth,
double  labelHeight 
)
static

Split a polygon using some random logic into some other polygons.

Warning
this code is completely unreadable and cannot be understood by mortals

Definition at line 295 of file pointset.cpp.

◆ toWkt()

QString PointSet::toWkt ( ) const

Returns a WKT representation of the point set.

Definition at line 1119 of file pointset.cpp.

Friends And Related Symbol Documentation

◆ CostCalculator

friend class CostCalculator
friend

Definition at line 80 of file pointset.h.

◆ FeaturePart

friend class FeaturePart
friend

Definition at line 78 of file pointset.h.

◆ LabelPosition

friend class LabelPosition
friend

Definition at line 79 of file pointset.h.

◆ Layer

friend class Layer
friend

Definition at line 82 of file pointset.h.

◆ PolygonCostCalculator

friend class PolygonCostCalculator
friend

Definition at line 81 of file pointset.h.

Member Data Documentation

◆ convexHull

std::vector< int > pal::PointSet::convexHull
protected

Definition at line 237 of file pointset.h.

◆ holeOf

PointSet* pal::PointSet::holeOf = nullptr
protected

Definition at line 241 of file pointset.h.

◆ mArea

double pal::PointSet::mArea = -1
mutableprotected

Definition at line 244 of file pointset.h.

◆ mGeos

GEOSGeometry* pal::PointSet::mGeos = nullptr
mutableprotected

Definition at line 234 of file pointset.h.

◆ mLength

double pal::PointSet::mLength = -1
mutableprotected

Definition at line 245 of file pointset.h.

◆ mOwnsGeom

bool pal::PointSet::mOwnsGeom = false
mutableprotected

Definition at line 235 of file pointset.h.

◆ nbPoints

int pal::PointSet::nbPoints

Definition at line 229 of file pointset.h.

◆ parent

PointSet* pal::PointSet::parent = nullptr
protected

Definition at line 242 of file pointset.h.

◆ type

int pal::PointSet::type
protected

Definition at line 239 of file pointset.h.

◆ x

std::vector< double > pal::PointSet::x

Definition at line 230 of file pointset.h.

◆ xmax

double pal::PointSet::xmax = std::numeric_limits<double>::lowest()
protected

Definition at line 259 of file pointset.h.

◆ xmin

double pal::PointSet::xmin = std::numeric_limits<double>::max()
protected

Definition at line 258 of file pointset.h.

◆ y

std::vector< double > pal::PointSet::y

Definition at line 231 of file pointset.h.

◆ ymax

double pal::PointSet::ymax = std::numeric_limits<double>::lowest()
protected

Definition at line 261 of file pointset.h.

◆ ymin

double pal::PointSet::ymin = std::numeric_limits<double>::max()
protected

Definition at line 260 of file pointset.h.


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