111     geometry.
set( 
nullptr );
   121   return addRing( ringLine, targetFeatureIds,  modifiedFeatureId );
   136   if ( !targetFeatureIds.isEmpty() )
   157     addRingReturnCode = g.
addRing( static_cast< QgsCurve * >( ring->
clone() ) );
   158     if ( addRingReturnCode == 0 )
   162         if ( modifiedFeatureId )
   163           *modifiedFeatureId = f.
id();
   171   return addRingReturnCode;
   177   for ( QList<QgsPointXY>::const_iterator it = points.constBegin(); it != points.constEnd(); ++it )
   181   return addPart( l, featureId );
   187     return QgsGeometry::OperationResult::AddPartSelectedGeometryNotFound;
   190   bool firstPart = 
false;
   193     return QgsGeometry::OperationResult::AddPartSelectedGeometryNotFound; 
   225   bool firstPart = 
false;
   266   int errorCode = geometry.
translate( dx, dy );
   267   if ( errorCode == 0 )
   280   double xMin, yMin, xMax, yMax;
   284   int numberOfSplitFeatures = 0;
   289   if ( !selectedIds.isEmpty() ) 
   295     if ( boundingBoxFromPointList( splitLine, xMin, yMin, xMax, yMax ) )
   304       return QgsGeometry::OperationResult::InvalidInputGeometryType;
   315       else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
   323         double bufferDistance = 0.000001;
   325           bufferDistance = 0.00000001;
   343     QVector<QgsGeometry> newGeometries;
   344     QVector<QgsPointXY> topologyTestPoints;
   346     splitFunctionReturn = featureGeom.
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
   347     if ( splitFunctionReturn == QgsGeometry::OperationResult::Success )
   353       for ( 
int i = 0; i < newGeometries.size(); ++i )
   359       if ( topologicalEditing )
   361         QVector<QgsPointXY>::const_iterator topol_it = topologyTestPoints.constBegin();
   362         for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
   367       ++numberOfSplitFeatures;
   371       returnCode = splitFunctionReturn;
   375   if ( numberOfSplitFeatures == 0 && !selectedIds.isEmpty() )
   379     returnCode = QgsGeometry::OperationResult::NothingHappened;
   390   double xMin, yMin, xMax, yMax;
   394   int numberOfSplitParts = 0;
   404     if ( boundingBoxFromPointList( splitLine, xMin, yMin, xMax, yMax ) )
   413       return QgsGeometry::OperationResult::InvalidInputGeometryType;
   424       else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
   432         double bufferDistance = 0.000001;
   434           bufferDistance = 0.00000001;
   450     QVector<QgsGeometry> newGeometries;
   451     QVector<QgsPointXY> topologyTestPoints;
   453     splitFunctionReturn = featureGeom.
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
   454     if ( splitFunctionReturn == 0 )
   457       if ( !newGeometries.isEmpty() )
   460       for ( 
int i = 0; i < newGeometries.size(); ++i )
   462         addPartRet = featureGeom.
addPart( newGeometries.at( i ) );
   475       if ( topologicalEditing )
   477         QVector<QgsPointXY>::const_iterator topol_it = topologyTestPoints.constBegin();
   478         for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
   483       ++numberOfSplitParts;
   485     else if ( splitFunctionReturn != QgsGeometry::OperationResult::Success && splitFunctionReturn != QgsGeometry::OperationResult::NothingHappened )
   487       returnCode = splitFunctionReturn;
   495     returnCode = QgsGeometry::OperationResult::NothingHappened;
   524         QgsPolylineXY::const_iterator line_it = line.constBegin();
   525         for ( ; line_it != line.constEnd(); ++line_it )
   538         for ( 
int i = 0; i < multiLine.size(); ++i )
   540           QgsPolylineXY::const_iterator line_it = currentPolyline.constBegin();
   541           for ( ; line_it != currentPolyline.constEnd(); ++line_it )
   560         for ( 
int i = 0; i < polygon.size(); ++i )
   562           currentRing = polygon.at( i );
   563           QgsPolylineXY::const_iterator line_it = currentRing.constBegin();
   564           for ( ; line_it != currentRing.constEnd(); ++line_it )
   579         for ( 
int i = 0; i < multiPolygon.size(); ++i )
   581           currentPolygon = multiPolygon.at( i );
   582           for ( 
int j = 0; j < currentPolygon.size(); ++j )
   584             currentRing = currentPolygon.at( j );
   585             QgsPolylineXY::const_iterator line_it = currentRing.constBegin();
   586             for ( ; line_it != currentRing.constEnd(); ++line_it )
   613   double segmentSearchEpsilon = mLayer->
crs().
isGeographic() ? 1e-12 : 1e-8;
   616   double threshold = 0.0000001;
   627                            p.
x() + threshold, p.
y() + threshold );
   628   double sqrSnappingTolerance = threshold * threshold;
   632                            .setFilterRect( searchRect )
   636   QMap<QgsFeatureId, QgsGeometry> features;
   637   QMap<QgsFeatureId, int> segments;
   644     if ( sqrDistSegmentSnap < sqrSnappingTolerance )
   646       segments[f.
id()] = afterVertex;
   651   if ( segments.isEmpty() )
   654   for ( QMap<QgsFeatureId, int>::const_iterator it = segments.constBegin(); it != segments.constEnd(); ++it )
   657     int segmentAfterVertex = it.value();
   660     int atVertex, beforeVertex, afterVertex;
   661     double sqrDistVertexSnap;
   662     geom.
closestVertex( p, atVertex, beforeVertex, afterVertex, sqrDistVertexSnap );
   664     if ( sqrDistVertexSnap < sqrSnappingTolerance )
   667     if ( !mLayer->
insertVertex( p.
x(), p.
y(), fid, segmentAfterVertex ) )
   677 bool QgsVectorLayerEditUtils::boundingBoxFromPointList( 
const QVector<QgsPointXY> &list, 
double &xmin, 
double &ymin, 
double &xmax, 
double &ymax )
 const   684   xmin = std::numeric_limits<double>::max();
   685   xmax = -std::numeric_limits<double>::max();
   686   ymin = std::numeric_limits<double>::max();
   687   ymax = -std::numeric_limits<double>::max();
   689   for ( QVector<QgsPointXY>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
   691     if ( it->x() < xmin )
   695     if ( it->x() > xmax )
   699     if ( it->y() < ymin )
   703     if ( it->y() > ymax )
 
Wrapper for iterator of features from vector data provider or vector layer. 
 
double closestSegmentWithContext(const QgsPointXY &point, QgsPointXY &minDistPoint, int &afterVertex, int *leftOf=nullptr, double epsilon=DEFAULT_SEGMENT_EPSILON) const
Searches for the closest segment of geometry to the given point. 
 
A rectangle specified with double values. 
 
QgsGeometry::OperationResult splitParts(const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false)
Splits parts cut by the given line. 
 
The input ring doesn't have any existing ring to fit into. 
 
static QgsFeature createFeature(QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer. 
 
OperationResult addPart(const QVector< QgsPointXY > &points, QgsWkbTypes::GeometryType geomType=QgsWkbTypes::UnknownGeometry)
Adds a new part to a the geometry. 
 
bool isNull() const
Returns true if the geometry is null (ie, contains no underlying geometry accessible via geometry() )...
 
void setXMaximum(double x)
Set the maximum x value. 
 
Use exact geometry intersection (slower) instead of bounding boxes. 
 
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type. 
 
Nothing happened, without any error. 
 
virtual bool addFeature(QgsFeature &f)
Adds a feature. 
 
QSet< QgsFeatureId > QgsFeatureIds
 
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.) 
 
A class to represent a 2D point. 
 
int selectedFeatureCount() const
Returns the number of features that are selected in this layer. 
 
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item...
 
bool moveVertex(double x, double y, int atVertex)
Moves the vertex at the given position number and item (first number is index 0) to the given coordin...
 
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon. 
 
A geometry is the spatial representation of a feature. 
 
QgsUnitTypes::DistanceUnit mapUnits
 
OperationResult addRing(const QVector< QgsPointXY > &ring)
Adds a new ring to this geometry. 
 
Edit operation resulted in an empty geometry. 
 
int addTopologicalPoints(const QgsGeometry &geom)
Adds topological points for every vertex of the geometry. 
 
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
 
bool insertVertex(double x, double y, int beforeVertex)
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the req...
 
bool hasGeometry() const
Returns true if the feature has an associated geometry. 
 
bool insertVertex(double x, double y, QgsFeatureId atFeatureId, int beforeVertex)
Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0)...
 
OperationResult
Success or failure of a geometry operation. 
 
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes. 
 
QgsPointXY closestVertex(const QgsPointXY &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist) const
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap ...
 
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes. 
 
QgsMultiPolylineXY asMultiPolyline() const
Returns contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list. 
 
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g. 
 
The selected geometry cannot be found. 
 
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
 
Type
The WKB type describes the number of dimensions a geometry has. 
 
const QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer. 
 
bool convertToSingleType()
Converts multi type geometry into single type geometry e.g. 
 
bool isEmpty() const
Returns true if the rectangle is empty. 
 
QgsFeatureIterator getSelectedFeatures(QgsFeatureRequest request=QgsFeatureRequest()) const
Returns an iterator of the selected features. 
 
QgsPolygonXY asPolygon() const
Returns contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list...
 
double width() const
Returns the width of the rectangle. 
 
void setYMinimum(double y)
Set the minimum y value. 
 
bool deleteVertex(int atVertex)
Deletes the vertex at the given position number and item (first number is index 0) ...
 
QgsWkbTypes::Type wkbType() const override
Returns the WKBType or WKBUnknown in case of error. 
 
QgsGeometry::OperationResult splitFeatures(const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false)
Splits features cut by the given line. 
 
static GeometryType geometryType(Type type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
 
int translateFeature(QgsFeatureId featureId, double dx, double dy)
Translates feature by dx, dy. 
 
bool moveVertex(double x, double y, QgsFeatureId atFeatureId, int atVertex)
Moves the vertex at the given position number, ring and item (first number is index 0)...
 
This class wraps a request for features to a vector layer (or directly its vector data provider)...
 
virtual bool changeGeometry(QgsFeatureId fid, const QgsGeometry &geom)
Change feature's geometry. 
 
bool isSpatial() const override
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
 
QgsCoordinateReferenceSystem crs() const
Returns the layer's spatial reference system. 
 
QgsAttributeMap toMap() const
Returns a QgsAttributeMap of the attribute values. 
 
bool isGeographic() const
Returns whether the CRS is a geographic CRS (using lat/lon coordinates) 
 
Abstract base class for curved geometry type. 
 
QgsGeometry geometry() const
Returns the geometry associated with this feature. 
 
Point geometry type, with support for z-dimension and m-values. 
 
QgsGeometry::OperationResult addPart(const QList< QgsPointXY > &ring, QgsFeatureId featureId)
Adds a new part polygon to a multipart feature. 
 
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override
Query the layer for features specified in request. 
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive. 
 
double yMinimum() const
Returns the y minimum value (bottom side of rectangle). 
 
static bool isSingleType(Type type)
Returns true if the WKB type is a single type. 
 
double xMaximum() const
Returns the x maximum value (right side of rectangle). 
 
QVector< QgsPoint > QgsPointSequence
 
bool insertVertex(double x, double y, QgsFeatureId atFeatureId, int beforeVertex)
Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0)...
 
QgsRectangle boundingBox() const override
Returns the minimal bounding box for the geometry. 
 
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points. 
 
bool convertToMultiType()
Converts single type geometry into multitype geometry e.g. 
 
The base geometry on which the operation is done is invalid or empty. 
 
QgsGeometry::OperationResult addRing(const QVector< QgsPointXY > &ring, const QgsFeatureIds &targetFeatureIds=QgsFeatureIds(), QgsFeatureId *modifiedFeatureId=nullptr)
Adds a ring to polygon/multipolygon features. 
 
OperationResult splitGeometry(const QVector< QgsPointXY > &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QVector< QgsPointXY > &topologyTestPoints)
Splits this geometry according to a given line. 
 
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy. 
 
void setYMaximum(double y)
Set the maximum y value. 
 
Edit operation was successful. 
 
Line string geometry type, with support for z-dimension and m-values. 
 
QgsVectorDataProvider * dataProvider() override
Returns the layer's data provider. 
 
QgsVectorLayer::EditResult deleteVertex(QgsFeatureId featureId, int vertex)
Deletes a vertex from a feature. 
 
double xMinimum() const
Returns the x minimum value (left side of rectangle). 
 
OperationResult translate(double dx, double dy, double dz=0.0, double dm=0.0)
Translates this geometry by dx, dy, dz and dm. 
 
double yMaximum() const
Returns the y maximum value (top side of rectangle). 
 
QgsPolylineXY asPolyline() const
Returns contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list...
 
Edit failed due to invalid layer. 
 
QList< int > QgsAttributeList
 
bool nextFeature(QgsFeature &f)
 
void set(QgsAbstractGeometry *geometry)
Sets the underlying geometry store. 
 
virtual int nCoordinates() const
Returns the number of nodes contained in the geometry. 
 
Represents a vector layer which manages a vector based data sets. 
 
EditResult
Result of an edit operation. 
 
QgsMultiPolygonXY asMultiPolygon() const
Returns contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty list. 
 
Unable to fetch requested feature. 
 
void setXMinimum(double x)
Set the minimum x value. 
 
double height() const
Returns the height of the rectangle. 
 
QgsVectorLayerEditUtils(QgsVectorLayer *layer)