26QString QgsTessellateAlgorithm::name()
const
28 return QStringLiteral(
"tessellate" );
31QString QgsTessellateAlgorithm::displayName()
const
33 return QObject::tr(
"Tessellate" );
36QStringList QgsTessellateAlgorithm::tags()
const
38 return QObject::tr(
"3d,triangle" ).split(
',' );
41QString QgsTessellateAlgorithm::group()
const
43 return QObject::tr(
"Vector geometry" );
46QString QgsTessellateAlgorithm::groupId()
const
48 return QStringLiteral(
"vectorgeometry" );
51QString QgsTessellateAlgorithm::outputName()
const
53 return QObject::tr(
"Tessellated" );
66QString QgsTessellateAlgorithm::shortHelpString()
const
68 return QObject::tr(
"This algorithm tessellates a polygon geometry layer, dividing the geometries into triangular components." )
69 + QStringLiteral(
"\n\n" )
70 + QObject::tr(
"The output layer consists of multipolygon geometries for each input feature, with each multipolygon consisting of multiple triangle component polygons." );
73QList<int> QgsTessellateAlgorithm::inputLayerTypes()
const
78QgsTessellateAlgorithm *QgsTessellateAlgorithm::createInstance()
const
80 return new QgsTessellateAlgorithm();
93 bool tessellationComplete =
false;
94#if (GEOS_VERSION_MAJOR==3 && GEOS_VERSION_MINOR>=11) || GEOS_VERSION_MAJOR>3
103 if ( !triangulation.
lastError().isEmpty() )
105 feedback->
reportError( QObject::tr(
"Feature ID %1 could not be tessellated: %2" ).arg( f.
id() ).arg( triangulation.
lastError() ) );
109 feedback->
reportError( QObject::tr(
"Feature ID %1 could not be tessellated" ).arg( f.
id() ) );
116 tessellationComplete =
true;
120 if ( !tessellationComplete )
125 t.setOutputZUp(
true );
132 const std::unique_ptr< QgsPolygon > p( qgsgeometry_cast< QgsPolygon * >( ms->
geometryN( i )->
segmentize() ) );
133 t.addPolygon( *p, 0 );
139 t.addPolygon( *p, 0 );
144 if ( !t.error().isEmpty() )
146 feedback->
reportError( QObject::tr(
"Feature ID %1 was only partially tessellated: %2" ).arg( f.
id() ).arg( t.error() ) );
153 if ( !t.error().isEmpty() )
154 feedback->
reportError( QObject::tr(
"Feature ID %1 could not be tessellated: %2" ).arg( f.
id() ).arg( t.error() ) );
156 feedback->
reportError( QObject::tr(
"Feature ID %1 could not be divided into triangular components." ).arg( f.
id() ) );
159 g.get()->dropZValue();
ProcessingSourceType
Processing data source types.
@ VectorPolygon
Vector polygon layers.
WkbType
The WKB type describes the number of dimensions a geometry has.
@ MultiPolygon
MultiPolygon.
@ MultiPolygonZ
MultiPolygonZ.
virtual QgsAbstractGeometry * segmentize(double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a version of the geometry without curves.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void clearGeometry()
Removes any geometry associated with the feature.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
int numGeometries() const
Returns the number of geometries within the collection.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
A geometry is the spatial representation of a feature.
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
Qgis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
QgsGeometry constrainedDelaunayTriangulation() const
Returns a constrained Delaunay triangulation for the vertices of the geometry.
Multi surface geometry collection.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
A rectangle specified with double values.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
Class that takes care of tessellation of polygons into triangles.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
QList< QgsFeature > QgsFeatureList