QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsVectorLayerEditUtils Class Reference

#include <qgsvectorlayereditutils.h>

Public Member Functions

 QgsVectorLayerEditUtils (QgsVectorLayer *layer)
QgsGeometryCachecache ()
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), and feature Not meaningful for Point geometries.
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), and feature to the given coordinates.
bool deleteVertex (QgsFeatureId atFeatureId, int atVertex)
 Deletes a vertex from a feature.
int addRing (const QList< QgsPoint > &ring)
 Adds a ring to polygon/multipolygon features.
int addPart (const QList< QgsPoint > &ring, QgsFeatureId featureId)
 Adds a new part polygon to a multipart feature.
int translateFeature (QgsFeatureId featureId, double dx, double dy)
 Translates feature by dx, dy.
int splitParts (const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
 Splits parts cut by the given line.
int splitFeatures (const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
 Splits features cut by the given line.
int addTopologicalPoints (QgsGeometry *geom)
 Adds topological points for every vertex of the geometry.
int addTopologicalPoints (const QgsPoint &p)
 Adds a vertex to segments which intersect point p but don't already have a vertex there.
int insertSegmentVerticesForSnap (const QList< QgsSnappingResult > &snapResults)
 Inserts vertices to the snapped segments.

Protected Member Functions

int boundingBoxFromPointList (const QList< QgsPoint > &list, double &xmin, double &ymin, double &xmax, double &ymax) const
 Little helper function that gives bounding box from a list of points.

Protected Attributes

QgsVectorLayerL

Constructor & Destructor Documentation

QgsVectorLayerEditUtils::QgsVectorLayerEditUtils ( QgsVectorLayer layer)

Member Function Documentation

int QgsVectorLayerEditUtils::addPart ( const QList< QgsPoint > &  ring,
QgsFeatureId  featureId 
)

Adds a new part polygon to a multipart feature.

Returns
0 in case of success, 1 if selected feature is not multipart, 2 if ring is not a valid geometry, 3 if new polygon ring not disjoint with existing rings, 4 if no feature was selected, 5 if several features are selected, 6 if selected geometry not found
int QgsVectorLayerEditUtils::addRing ( const QList< QgsPoint > &  ring)

Adds a ring to polygon/multipolygon features.

Returns
0 in case of success, 1 problem with feature type, 2 ring not closed, 3 ring not valid, 4 ring crosses existing rings, 5 no feature found where ring can be inserted
int QgsVectorLayerEditUtils::addTopologicalPoints ( QgsGeometry geom)

Adds topological points for every vertex of the geometry.

Parameters
geomthe geometry where each vertex is added to segments of other features
Note
geom is not going to be modified by the function
Returns
0 in case of success
int QgsVectorLayerEditUtils::addTopologicalPoints ( const QgsPoint p)

Adds a vertex to segments which intersect point p but don't already have a vertex there.

If a feature already has a vertex at position p, no additional vertex is inserted. This method is useful for topological editing.

Parameters
pposition of the vertex
Returns
0 in case of success
int QgsVectorLayerEditUtils::boundingBoxFromPointList ( const QList< QgsPoint > &  list,
double &  xmin,
double &  ymin,
double &  xmax,
double &  ymax 
) const
protected

Little helper function that gives bounding box from a list of points.

Returns
0 in case of success
QgsGeometryCache* QgsVectorLayerEditUtils::cache ( )
inline
bool QgsVectorLayerEditUtils::deleteVertex ( QgsFeatureId  atFeatureId,
int  atVertex 
)

Deletes a vertex from a feature.

int QgsVectorLayerEditUtils::insertSegmentVerticesForSnap ( const QList< QgsSnappingResult > &  snapResults)

Inserts vertices to the snapped segments.

This is useful for topological editing if snap to segment is enabled.

Parameters
snapResultsresults collected from the snapping operation
Returns
0 in case of success
bool QgsVectorLayerEditUtils::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), and feature Not meaningful for Point geometries.

bool QgsVectorLayerEditUtils::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), and feature to the given coordinates.

int QgsVectorLayerEditUtils::splitFeatures ( const QList< QgsPoint > &  splitLine,
bool  topologicalEditing = false 
)

Splits features cut by the given line.

Parameters
splitLineline that splits the layer features
topologicalEditingtrue if topological editing is enabled
Returns
0 in case of success, 4 if there is a selection but no feature split
int QgsVectorLayerEditUtils::splitParts ( const QList< QgsPoint > &  splitLine,
bool  topologicalEditing = false 
)

Splits parts cut by the given line.

Parameters
splitLineline that splits the layer feature parts
topologicalEditingtrue if topological editing is enabled
Returns
0 in case of success, 4 if there is a selection but no feature split
int QgsVectorLayerEditUtils::translateFeature ( QgsFeatureId  featureId,
double  dx,
double  dy 
)

Translates feature by dx, dy.

Parameters
featureIdid of the feature to translate
dxtranslation of x-coordinate
dytranslation of y-coordinate
Returns
0 in case of success

Member Data Documentation

QgsVectorLayer* QgsVectorLayerEditUtils::L
protected

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