25QString QgsDelaunayTriangulationAlgorithm::name()
 const 
   27  return QStringLiteral( 
"delaunaytriangulation" );
 
   30QString QgsDelaunayTriangulationAlgorithm::displayName()
 const 
   32  return QObject::tr( 
"Delaunay triangulation" );
 
   35QStringList QgsDelaunayTriangulationAlgorithm::tags()
 const 
   37  return QObject::tr( 
"delaunay,triangulation,polygons,voronoi" ).split( 
',' );
 
   40QString QgsDelaunayTriangulationAlgorithm::group()
 const 
   42  return QObject::tr( 
"Vector geometry" );
 
   45QString QgsDelaunayTriangulationAlgorithm::groupId()
 const 
   47  return QStringLiteral( 
"vectorgeometry" );
 
   50QString QgsDelaunayTriangulationAlgorithm::shortHelpString()
 const 
   52  return QObject::tr( 
"This algorithm creates a polygon layer with the Delaunay triangulation corresponding to a points layer." );
 
   55QString QgsDelaunayTriangulationAlgorithm::shortDescription()
 const 
   57  return QObject::tr( 
"Creates a polygon layer with the Delaunay triangulation corresponding to a points layer." );
 
   60QgsDelaunayTriangulationAlgorithm *QgsDelaunayTriangulationAlgorithm::createInstance()
 const 
   62  return new QgsDelaunayTriangulationAlgorithm();
 
   65void QgsDelaunayTriangulationAlgorithm::initAlgorithm( 
const QVariantMap & )
 
   69  toleranceParam->setHelp( QObject::tr( 
"Specifies an optional snapping tolerance which can be used to improve the robustness of the triangulation" ) );
 
   70  addParameter( toleranceParam.release() );
 
   77  std::unique_ptr<QgsProcessingFeatureSource> source( parameterAsSource( parameters, QStringLiteral( 
"INPUT" ), context ) );
 
   81  if ( source->featureCount() < 3 )
 
   84  const double tolerance = parameterAsDouble( parameters, QStringLiteral( 
"TOLERANCE" ), context );
 
   85  const bool addAttributes = parameterAsBool( parameters, QStringLiteral( 
"ADD_ATTRIBUTES" ), context );
 
   90    fields.
append( 
QgsField( QStringLiteral( 
"POINTA" ), QMetaType::Type::LongLong ) );
 
   91    fields.
append( 
QgsField( QStringLiteral( 
"POINTB" ), QMetaType::Type::LongLong ) );
 
   92    fields.
append( 
QgsField( QStringLiteral( 
"POINTC" ), QMetaType::Type::LongLong ) );
 
   96    fields.
append( 
QgsField( QStringLiteral( 
"id" ), QMetaType::Type::LongLong ) );
 
  100  std::unique_ptr<QgsFeatureSink> sink( parameterAsSink( parameters, QStringLiteral( 
"OUTPUT" ), context, dest, fields, 
Qgis::WkbType::Polygon, source->sourceCrs() ) );
 
  109  const double step = source->featureCount() > 0 ? 50.0 / source->featureCount() : 1;
 
  124      const QgsMultiPoint mp( *qgsgeometry_cast< const QgsMultiPoint * >( geom ) );
 
  125      for ( 
auto pit = mp.const_parts_begin(); pit != mp.const_parts_end(); ++pit )
 
  139  if ( !triangulation.isEmpty() )
 
  142    for ( 
int i = 0; i < collection.length(); i++ )
 
  153        const QList<QgsFeatureId> nearest = index.nearestNeighbor( collection[i], 3 );
 
  155        for ( 
int j = 0; j < 3; j++ )
 
  157          attrs << nearest.at( j );
 
  175  outputs.insert( QStringLiteral( 
"OUTPUT" ), dest );
 
@ VectorPoint
Vector point layers.
 
@ VectorPolygon
Vector polygon layers.
 
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
 
@ Double
Double/float values.
 
Abstract base class for all geometries.
 
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
 
Wrapper for iterator of features from vector data provider or vector layer.
 
Wraps a request for features to a vector layer (or directly its vector data provider).
 
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
 
void setFields(const QgsFields &fields, bool initAttributes=false)
Assigns a field map with the feature to allow attribute access by attribute name.
 
bool hasGeometry() const
Returns true if the feature has an associated geometry.
 
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
 
bool isCanceled() const
Tells whether the operation has been canceled already.
 
void setProgress(double progress)
Sets the current progress for the feedback object.
 
Encapsulate a field in an attribute table or data source.
 
Container of fields for a vector layer.
 
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
 
A geometry is the spatial representation of a feature.
 
QVector< QgsGeometry > asGeometryCollection() const
Returns contents of the geometry as a list of geometries.
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
Qgis::GeometryOperationResult addPartV2(const QVector< QgsPointXY > &points, Qgis::WkbType wkbType=Qgis::WkbType::Unknown)
Adds a new part to a the geometry.
 
QgsGeometry delaunayTriangulation(double tolerance=0.0, bool edgesOnly=false) const
Returns the Delaunay triangulation for the vertices of the geometry.
 
Multi point geometry collection.
 
Contains information about the context in which a processing algorithm is executed.
 
Custom exception class for processing related exceptions.
 
Base class for providing feedback from a processing algorithm.
 
A boolean parameter for processing algorithms.
 
A feature sink output for processing algorithms.
 
An input feature source (such as vector layers) parameter for processing algorithms.
 
A spatial index for QgsFeature objects.
 
@ FlagStoreFeatureGeometries
Indicates that the spatial index should also store feature geometries. This requires more memory,...
 
static Q_INVOKABLE bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.