QGIS API Documentation  3.0.2-Girona (307d082)
Public Member Functions | List of all members
QgsInternalGeometryEngine Class Reference

This class offers geometry processing methods. More...

#include <qgsinternalgeometryengine.h>

Public Member Functions

 QgsInternalGeometryEngine (const QgsGeometry &geometry)
 The caller is responsible that the geometry is available and unchanged for the whole lifetime of this object. More...
 
QgsGeometry densifyByCount (int extraNodesPerSegment) const
 Densifies the geometry by adding the specified number of extra nodes within each segment of the geometry. More...
 
QgsGeometry densifyByDistance (double distance) const
 Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum distance between any two nodes does not exceed the specified distance. More...
 
QgsGeometry extrude (double x, double y) const
 Will extrude a line or (segmentized) curve by a given offset and return a polygon representation of it. More...
 
QgsGeometry orthogonalize (double tolerance=1.0E-8, int maxIterations=1000, double angleThreshold=15.0) const
 Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries angles either right angles or flat lines. More...
 
QgsGeometry poleOfInaccessibility (double precision, double *distanceFromBoundary=nullptr) const
 Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface. More...
 

Detailed Description

This class offers geometry processing methods.

The methods are available via QgsGeometry::[geometryfunction] and therefore this does not need to be accessed directly.

Note
not available in Python bindings

Definition at line 34 of file qgsinternalgeometryengine.h.

Constructor & Destructor Documentation

◆ QgsInternalGeometryEngine()

QgsInternalGeometryEngine::QgsInternalGeometryEngine ( const QgsGeometry geometry)
explicit

The caller is responsible that the geometry is available and unchanged for the whole lifetime of this object.

Parameters
geometry

Definition at line 31 of file qgsinternalgeometryengine.cpp.

Member Function Documentation

◆ densifyByCount()

QgsGeometry QgsInternalGeometryEngine::densifyByCount ( int  extraNodesPerSegment) const

Densifies the geometry by adding the specified number of extra nodes within each segment of the geometry.

If the geometry has z or m values present then these will be linearly interpolated at the added nodes. Curved geometry types are automatically segmentized by this routine.

Since
QGIS 3.0

Definition at line 642 of file qgsinternalgeometryengine.cpp.

◆ densifyByDistance()

QgsGeometry QgsInternalGeometryEngine::densifyByDistance ( double  distance) const

Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum distance between any two nodes does not exceed the specified distance.

E.g. specifying a distance 3 would cause the segment [0 0] -> [10 0] to be converted to [0 0] -> [2.5 0] -> [5 0] -> [7.5 0] -> [10 0], since 3 extra nodes are required on the segment and spacing these at 2.5 increments allows them to be evenly spaced over the segment. If the geometry has z or m values present then these will be linearly interpolated at the added nodes. Curved geometry types are automatically segmentized by this routine.

Since
QGIS 3.0

Definition at line 677 of file qgsinternalgeometryengine.cpp.

◆ extrude()

QgsGeometry QgsInternalGeometryEngine::extrude ( double  x,
double  y 
) const

Will extrude a line or (segmentized) curve by a given offset and return a polygon representation of it.

Parameters
xoffset in x direction
yoffset in y direction
Returns
an extruded polygon

Definition at line 43 of file qgsinternalgeometryengine.cpp.

◆ orthogonalize()

QgsGeometry QgsInternalGeometryEngine::orthogonalize ( double  tolerance = 1.0E-8,
int  maxIterations = 1000,
double  angleThreshold = 15.0 
) const

Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries angles either right angles or flat lines.

This is an iterative algorithm which will loop until either the vertices are within a specified tolerance of right angles or a set number of maximum iterations is reached. The angle threshold parameter specifies how close to a right angle or straight line an angle must be before it is attempted to be straightened.

Since
QGIS 3.0

Definition at line 485 of file qgsinternalgeometryengine.cpp.

◆ poleOfInaccessibility()

QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility ( double  precision,
double *  distanceFromBoundary = nullptr 
) const

Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface.

This function uses the 'polylabel' algorithm (Vladimir Agafonkin, 2016), which is an iterative approach guaranteed to find the true pole of inaccessibility within a specified tolerance. More precise tolerances require more iterations and will take longer to calculate. Optionally, the distance to the polygon boundary from the pole can be stored.

Definition at line 232 of file qgsinternalgeometryengine.cpp.


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