QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Public Member Functions | Static Public Member Functions | List of all members
QgsGeos Class Reference

Does vector analysis using the geos library and handles import, export, exception handling*. More...

#include <qgsgeos.h>

Inheritance diagram for QgsGeos:
Inheritance graph
[legend]

Public Member Functions

 QgsGeos (const QgsAbstractGeometryV2 *geometry, double precision=0)
 GEOS geometry engine constructor. More...
 
 ~QgsGeos ()
 
double area (QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2buffer (double distance, int segments, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2buffer (double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const override
 
bool centroid (QgsPointV2 &pt, QString *errorMsg=nullptr) const override
 
QgsGeometry closestPoint (const QgsGeometry &other, QString *errorMsg=nullptr) const
 Returns the closest point on the geometry to the other geometry. More...
 
QgsAbstractGeometryV2combine (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2combine (const QList< QgsAbstractGeometryV2 * > &, QString *errorMsg=nullptr) const override
 
bool contains (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2convexHull (QString *errorMsg=nullptr) const override
 
bool crosses (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2difference (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool disjoint (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
double distance (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2envelope (QString *errorMsg=nullptr) const override
 
void geometryChanged () override
 Removes caches. More...
 
QgsAbstractGeometryV2interpolate (double distance, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryV2intersection (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool intersects (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool isEmpty (QString *errorMsg=nullptr) const override
 
bool isEqual (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool isValid (QString *errorMsg=nullptr) const override
 
double length (QString *errorMsg=nullptr) const override
 
double lineLocatePoint (const QgsPointV2 &point, QString *errorMsg=nullptr) const
 Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point. More...
 
QgsGeometry mergeLines (QString *errorMsg=nullptr) const
 Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings. More...
 
QgsAbstractGeometryV2offsetCurve (double distance, int segments, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const override
 
bool overlaps (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool pointOnSurface (QgsPointV2 &pt, QString *errorMsg=nullptr) const override
 
void prepareGeometry () override
 
QString relate (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries. More...
 
bool relatePattern (const QgsAbstractGeometryV2 &geom, const QString &pattern, QString *errorMsg=nullptr) const override
 Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern. More...
 
QgsAbstractGeometryV2reshapeGeometry (const QgsLineStringV2 &reshapeWithLine, int *errorCode, QString *errorMsg=nullptr) const
 
QgsGeometry shortestLine (const QgsGeometry &other, QString *errorMsg=nullptr) const
 Returns the shortest line joining this geometry to the other geometry. More...
 
QgsAbstractGeometryV2simplify (double tolerance, QString *errorMsg=nullptr) const override
 
int splitGeometry (const QgsLineStringV2 &splitLine, QList< QgsAbstractGeometryV2 * > &newGeometries, bool topological, QgsPointSequenceV2 &topologyTestPoints, QString *errorMsg=nullptr) const override
 Splits this geometry according to a given line. More...
 
QgsAbstractGeometryV2symDifference (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool touches (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
bool within (const QgsAbstractGeometryV2 &geom, QString *errorMsg=nullptr) const override
 
- Public Member Functions inherited from QgsGeometryEngine
 QgsGeometryEngine (const QgsAbstractGeometryV2 *geometry)
 
virtual ~QgsGeometryEngine ()
 

Static Public Member Functions

static GEOSGeometry * asGeos (const QgsAbstractGeometryV2 *geom, double precision=0)
 
static QgsPointV2 coordSeqPoint (const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM)
 
static QgsAbstractGeometryV2fromGeos (const GEOSGeometry *geos)
 Create a geometry from a GEOSGeometry. More...
 
static QgsPolygonV2fromGeosPolygon (const GEOSGeometry *geos)
 
static GEOSContextHandle_t getGEOSHandler ()
 

Additional Inherited Members

- Protected Member Functions inherited from QgsGeometryEngine
 QgsGeometryEngine ()
 
- Protected Attributes inherited from QgsGeometryEngine
const QgsAbstractGeometryV2mGeometry
 

Detailed Description

Does vector analysis using the geos library and handles import, export, exception handling*.

Note
this API is not considered stable and may change for 2.12
not available in Python bindings

Definition at line 32 of file qgsgeos.h.

Constructor & Destructor Documentation

QgsGeos::QgsGeos ( const QgsAbstractGeometryV2 geometry,
double  precision = 0 
)

GEOS geometry engine constructor.

Parameters
geometryThe geometry
precisionThe precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.

Definition at line 135 of file qgsgeos.cpp.

QgsGeos::~QgsGeos ( )

Definition at line 144 of file qgsgeos.cpp.

Member Function Documentation

double QgsGeos::area ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 348 of file qgsgeos.cpp.

GEOSGeometry * QgsGeos::asGeos ( const QgsAbstractGeometryV2 geom,
double  precision = 0 
)
static

Definition at line 1054 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::buffer ( double  distance,
int  segments,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1278 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::buffer ( double  distance,
int  segments,
int  endCapStyle,
int  joinStyle,
double  mitreLimit,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1294 of file qgsgeos.cpp.

bool QgsGeos::centroid ( QgsPointV2 pt,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1346 of file qgsgeos.cpp.

QgsGeometry QgsGeos::closestPoint ( const QgsGeometry other,
QString errorMsg = nullptr 
) const

Returns the closest point on the geometry to the other geometry.

Note
added in QGIS 2.14
See also
shortestLine()

Definition at line 1817 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::combine ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 191 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::combine ( const QList< QgsAbstractGeometryV2 * > &  geomList,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 196 of file qgsgeos.cpp.

bool QgsGeos::contains ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 275 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::convexHull ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1417 of file qgsgeos.cpp.

QgsPointV2 QgsGeos::coordSeqPoint ( const GEOSCoordSequence *  cs,
int  i,
bool  hasZ,
bool  hasM 
)
static

Definition at line 1017 of file qgsgeos.cpp.

bool QgsGeos::crosses ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 260 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::difference ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 186 of file qgsgeos.cpp.

bool QgsGeos::disjoint ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 280 of file qgsgeos.cpp.

double QgsGeos::distance ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 225 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::envelope ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1373 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::fromGeos ( const GEOSGeometry *  geos)
static

Create a geometry from a GEOSGeometry.

Parameters
geosGEOSGeometry. Ownership is NOT transferred.

Definition at line 865 of file qgsgeos.cpp.

QgsPolygonV2 * QgsGeos::fromGeosPolygon ( const GEOSGeometry *  geos)
static

Definition at line 953 of file qgsgeos.cpp.

void QgsGeos::geometryChanged ( )
overridevirtual

Removes caches.

Implements QgsGeometryEngine.

Definition at line 152 of file qgsgeos.cpp.

GEOSContextHandle_t QgsGeos::getGEOSHandler ( )
static

Definition at line 2416 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::interpolate ( double  distance,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1331 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::intersection ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 181 of file qgsgeos.cpp.

bool QgsGeos::intersects ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 250 of file qgsgeos.cpp.

bool QgsGeos::isEmpty ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1468 of file qgsgeos.cpp.

bool QgsGeos::isEqual ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1448 of file qgsgeos.cpp.

bool QgsGeos::isValid ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1434 of file qgsgeos.cpp.

double QgsGeos::length ( QString errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 365 of file qgsgeos.cpp.

double QgsGeos::lineLocatePoint ( const QgsPointV2 point,
QString errorMsg = nullptr 
) const

Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point.

Ie, the returned value indicates how far along this linestring you need to traverse to get to the closest location where this linestring comes to the specified point.

Parameters
pointpoint to seek proximity to
errorMsgerror messages emitted, if any
Note
only valid for linestring geometries
Returns
distance along line, or -1 on error

Definition at line 1895 of file qgsgeos.cpp.

QgsGeometry QgsGeos::mergeLines ( QString errorMsg = nullptr) const

Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.

Parameters
errorMsgif specified, will be set to any reported GEOS errors
Returns
a LineString or MultiLineString geometry, with any connected lines joined. An empty geometry will be returned if the input geometry was not a LineString/MultiLineString geometry.
Note
added in QGIS 2.18

Definition at line 1798 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::offsetCurve ( double  distance,
int  segments,
int  joinStyle,
double  mitreLimit,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1674 of file qgsgeos.cpp.

bool QgsGeos::overlaps ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 270 of file qgsgeos.cpp.

bool QgsGeos::pointOnSurface ( QgsPointV2 pt,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1388 of file qgsgeos.cpp.

void QgsGeos::prepareGeometry ( )
overridevirtual

Implements QgsGeometryEngine.

Definition at line 161 of file qgsgeos.cpp.

QString QgsGeos::relate ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries.

Parameters
geomgeometry to relate to
errorMsgdestination storage for any error message
Returns
DE-9IM string for relationship, or an empty string if an error occurred
Note
added in QGIS 2.12

Implements QgsGeometryEngine.

Definition at line 285 of file qgsgeos.cpp.

bool QgsGeos::relatePattern ( const QgsAbstractGeometryV2 geom,
const QString pattern,
QString errorMsg = nullptr 
) const
overridevirtual

Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern.

Parameters
geomgeometry to relate to
patternDE-9IM pattern for match
errorMsgdestination storage for any error message
Returns
true if geometry relationship matches with pattern
Note
added in QGIS 2.14

Implements QgsGeometryEngine.

Definition at line 319 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::reshapeGeometry ( const QgsLineStringV2 reshapeWithLine,
int *  errorCode,
QString errorMsg = nullptr 
) const

Definition at line 1690 of file qgsgeos.cpp.

QgsGeometry QgsGeos::shortestLine ( const QgsGeometry other,
QString errorMsg = nullptr 
) const

Returns the shortest line joining this geometry to the other geometry.

Note
added in QGIS 2.14
See also
closestPoint()

Definition at line 1852 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::simplify ( double  tolerance,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1316 of file qgsgeos.cpp.

int QgsGeos::splitGeometry ( const QgsLineStringV2 splitLine,
QList< QgsAbstractGeometryV2 * > &  newGeometries,
bool  topological,
QgsPointSequenceV2 topologyTestPoints,
QString errorMsg = nullptr 
) const
overridevirtual

Splits this geometry according to a given line.

Parameters
splitLinethe line that splits the geometry
[out]newGeometrieslist of new geometries that have been created with the split
topologicaltrue if topological editing is enabled
[out]topologyTestPointspoints that need to be tested for topological completeness in the dataset
[out]errorMsgerror messages emitted, if any
Returns
0 in case of success, 1 if geometry has not been split, error else

Reimplemented from QgsGeometryEngine.

Definition at line 381 of file qgsgeos.cpp.

QgsAbstractGeometryV2 * QgsGeos::symDifference ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 220 of file qgsgeos.cpp.

bool QgsGeos::touches ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 255 of file qgsgeos.cpp.

bool QgsGeos::within ( const QgsAbstractGeometryV2 geom,
QString errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 265 of file qgsgeos.cpp.


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