QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Represents a vector layer which manages a vector based data sets. More...
#include <qgsvectorlayer.h>
Classes | |
struct | RangeData |
struct | ValueRelationData |
Public Slots | |
void | checkJoinLayerRemove (const QString &theLayerId) |
Check if there is a join with a layer that will be removed. More... | |
void | deselect (const QgsFeatureId featureId) |
Deselect feature by its ID. More... | |
void | deselect (const QgsFeatureIds &featureIds) |
Deselect features by their ID. More... | |
void | removeSelection () |
Clear selection. More... | |
void | select (QgsFeatureId featureId) |
Select feature by its ID. More... | |
void | select (const QgsFeatureIds &featureIds) |
Select features by their ID. More... | |
bool | startEditing () |
Make layer editable. More... | |
virtual void | updateExtents () |
Update the extents for the layer. More... | |
Public Slots inherited from QgsMapLayer | |
Q_DECL_DEPRECATED void | clearCacheImage () |
Clear cached image. More... | |
void | emitStyleChanged () |
Triggers an emission of the styleChanged() signal. More... | |
virtual void | invalidTransformInput () |
Event handler for when a coordinate transform fails due to bad vertex error. More... | |
void | setMaximumScale (double theMaxScale) |
Sets the maximum scale denominator at which the layer will be visible. More... | |
void | setMinimumScale (double theMinScale) |
Sets the minimum scale denominator at which the layer will be visible. More... | |
void | setScaleBasedVisibility (const bool enabled) |
Sets whether scale based visibility is enabled for the layer. More... | |
virtual QDateTime | timestamp () const |
Time stamp of data source in the moment when data/metadata were loaded by provider. More... | |
Q_DECL_DEPRECATED void | toggleScaleBasedVisibility (bool theVisibilityFlag) |
Accessor for the scale based visilibility flag. More... | |
void | triggerRepaint () |
Will advice the map canvas (and any other interested party) that this layer requires to be repainted. More... | |
Signals | |
void | attributeAdded (int idx) |
Will be emitted, when a new attribute has been added to this vector layer. More... | |
void | attributeDeleted (int idx) |
Will be emitted, when an attribute has been deleted from this vector layer. More... | |
void | attributeValueChanged (QgsFeatureId fid, int idx, const QVariant &value) |
Is emitted whenever an attribute value change is done in the edit buffer. More... | |
void | beforeAddingExpressionField (const QString &fieldName) |
Will be emitted, when an expression field is going to be added to this vector layer. More... | |
void | beforeCommitChanges () |
Is emitted, before changes are commited to the data provider. More... | |
void | beforeEditingStarted () |
Is emitted, before editing on this layer is started. More... | |
void | beforeModifiedCheck () const |
Is emitted, when layer is checked for modifications. More... | |
void | beforeRemovingExpressionField (int idx) |
Will be emitted, when an expression field is going to be deleted from this vector layer. More... | |
void | beforeRollBack () |
Is emitted, before changes are rolled back. More... | |
void | committedAttributesAdded (const QString &layerId, const QList< QgsField > &addedAttributes) |
This signal is emitted, when attributes are added to the provider. More... | |
void | committedAttributesDeleted (const QString &layerId, const QgsAttributeList &deletedAttributes) |
This signal is emitted, when attributes are deleted from the provider. More... | |
void | committedAttributeValuesChanges (const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues) |
This signal is emitted, when attribute value changes are saved to the provider. More... | |
void | committedFeaturesAdded (const QString &layerId, const QgsFeatureList &addedFeatures) |
This signal is emitted, when features are added to the provider. More... | |
void | committedFeaturesRemoved (const QString &layerId, const QgsFeatureIds &deletedFeatureIds) |
This signal is emitted, when features are deleted from the provider. More... | |
void | committedGeometriesChanges (const QString &layerId, const QgsGeometryMap &changedGeometries) |
This signal is emitted, when geometry changes are saved to the provider. More... | |
void | editCommandDestroyed () |
Signal emitted, whan an edit command is destroyed. More... | |
void | editCommandEnded () |
Signal emitted, when an edit command successfully ended. More... | |
void | editCommandStarted (const QString &text) |
Signal emitted when a new edit command has been started. More... | |
void | editingStarted () |
Is emitted, when editing on this layer has started. More... | |
void | editingStopped () |
Is emitted, when edited changes successfully have been written to the data provider. More... | |
void | featureAdded (QgsFeatureId fid) |
Emitted when a new feature has been added to the layer. More... | |
void | featureBlendModeChanged (QPainter::CompositionMode blendMode) |
Signal emitted when setFeatureBlendMode() is called. More... | |
void | featureDeleted (QgsFeatureId fid) |
Emitted when a feature has been deleted. More... | |
void | featuresDeleted (const QgsFeatureIds &fids) |
Emitted when features have been deleted. More... | |
void | geometryChanged (QgsFeatureId fid, QgsGeometry &geometry) |
Is emitted whenever a geometry change is done in the edit buffer. More... | |
void | labelingFontNotFound (QgsVectorLayer *layer, const QString &fontfamily) |
Emitted when the font family defined for labeling layer is not found on system. More... | |
void | layerDeleted () |
TODO QGIS3: remove in favor of QObject::destroyed. More... | |
void | layerModified () |
This signal is emitted when modifications has been done on layer. More... | |
void | layerTransparencyChanged (int layerTransparency) |
Signal emitted when setLayerTransparency() is called. More... | |
void | raiseError (const QString &msg) |
Signals an error related to this vector layer. More... | |
void | readCustomSymbology (const QDomElement &element, QString &errorMessage) |
Signal emitted whenever the symbology (QML-file) for this layer is being read. More... | |
Q_DECL_DEPRECATED void | saveLayerToProject () |
Deprecated: This signal has never been emitted. More... | |
void | selectionChanged (const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect) |
This signal is emitted when selection was changed. More... | |
void | selectionChanged () |
This signal is emitted when selection was changed. More... | |
void | updatedFields () |
Is emitted, whenever the fields available from this layer have been changed. More... | |
void | writeCustomSymbology (QDomElement &element, QDomDocument &doc, QString &errorMessage) const |
Signal emitted whenever the symbology (QML-file) for this layer is being written. More... | |
Signals inherited from QgsMapLayer | |
void | blendModeChanged (QPainter::CompositionMode blendMode) |
Signal emitted when the blend mode is changed, through QgsMapLayer::setBlendMode() More... | |
void | configChanged () |
Emitted whenever the configuration is changed. More... | |
void | dataChanged () |
Data of layer changed. More... | |
Q_DECL_DEPRECATED void | drawingProgress (int theProgress, int theTotalSteps) |
void | layerCrsChanged () |
Emit a signal that layer's CRS has been reset. More... | |
Q_DECL_DEPRECATED void | layerNameChanged () |
Emit a signal that the layer name has been changed. More... | |
void | legendChanged () |
Signal emitted when legend of the layer has changed. More... | |
void | nameChanged () |
Emitted when the name has been changed. More... | |
void | recalculateExtents () |
This is used to send a request that any mapcanvas using this layer update its extents. More... | |
void | rendererChanged () |
Signal emitted when renderer is changed. More... | |
void | repaintRequested () |
By emitting this signal the layer tells that either appearance or content have been changed and any view showing the rendered layer should refresh itself. More... | |
void | screenUpdateRequested () |
void | statusChanged (const QString &theStatus) |
Emit a signal with status (e.g. More... | |
void | styleChanged () |
Signal emitted whenever a change affects the layer's style. More... | |
Public Member Functions | |
QgsVectorLayer (const QString &path=QString::null, const QString &baseName=QString::null, const QString &providerLib=QString::null, bool loadDefaultStyleFlag=true) | |
Constructor - creates a vector layer. More... | |
virtual | ~QgsVectorLayer () |
Destructor. More... | |
QgsActionManager * | actions () |
Get all layer actions defined on this layer. More... | |
bool | addAttribute (const QgsField &field) |
Add an attribute field (but does not commit it) returns true if the field was added. More... | |
void | addAttributeAlias (int attIndex, const QString &aliasString) |
Sets an alias (a display name) for attributes to display in dialogs. More... | |
Q_DECL_DEPRECATED void | addAttributeEditorWidget (QgsAttributeEditorElement *data) |
Adds a tab (for the attribute editor form) holding groups and fields. More... | |
int | addExpressionField (const QString &exp, const QgsField &fld) |
Add a new field which is calculated by the expression specified. More... | |
bool | addFeature (QgsFeature &feature, bool alsoUpdateExtent=true) |
Adds a feature. More... | |
bool | addFeatures (QgsFeatureList features, bool makeSelected=true) |
Insert a copy of the given features into the layer (but does not commit it) More... | |
bool | addJoin (const QgsVectorJoinInfo &joinInfo) |
Joins another vector layer to this layer. More... | |
int | addPart (const QList< QgsPoint > &ring) |
Adds a new part polygon to a multipart feature. More... | |
int | addPart (const QgsPointSequenceV2 &ring) |
Adds a new part polygon to a multipart feature. More... | |
int | addPart (QgsCurveV2 *ring) |
int | addRing (const QList< QgsPoint > &ring, QgsFeatureId *featureId=nullptr) |
Adds a ring to polygon/multipolygon features. More... | |
int | addRing (QgsCurveV2 *ring, QgsFeatureId *featureId=nullptr) |
Adds a ring to polygon/multipolygon features (takes ownership) More... | |
int | addTopologicalPoints (const QgsGeometry *geom) |
Adds topological points for every vertex of the geometry. More... | |
int | addTopologicalPoints (const QgsPoint &p) |
Adds a vertex to segments which intersect point p but don't already have a vertex there. More... | |
QVariant | aggregate (QgsAggregateCalculator::Aggregate aggregate, const QString &fieldOrExpression, const QgsAggregateCalculator::AggregateParameters ¶meters=QgsAggregateCalculator::AggregateParameters(), QgsExpressionContext *context=nullptr, bool *ok=nullptr) |
Calculates an aggregated value from the layer's features. More... | |
QgsFeatureIds | allFeatureIds () |
Get all feature Ids. More... | |
QString | annotationForm () const |
Get annotation form. More... | |
virtual Q_DECL_DEPRECATED bool | applyNamedStyle (const QString &namedStyle, QString &errorMsg) |
Will load a named style from a provided QML string. More... | |
QString | attributeAlias (int attributeIndex) const |
Returns the alias of an attribute name or a null string if there is no alias. More... | |
QgsStringMap | attributeAliases () const |
Returns a map of field name to attribute alias. More... | |
QString | attributeDisplayName (int attributeIndex) const |
Convenience function that returns the attribute alias if defined or the field name else. More... | |
QgsAttributeEditorElement * | attributeEditorElementFromDomElement (QDomElement &elem, QObject *parent) |
Convert a saved attribute editor element into a AttributeEditor structure as it's used internally. More... | |
Q_DECL_DEPRECATED QList< QgsAttributeEditorElement *> | attributeEditorElements () |
Returns a list of tabs holding groups and fields. More... | |
QgsAttributeList | attributeList () const |
Returns list of attribute indexes. More... | |
QgsAttributeTableConfig | attributeTableConfig () const |
Get the attribute table configuration object. More... | |
void | beginEditCommand (const QString &text) |
Create edit command for undo/redo operations. More... | |
QgsRectangle | boundingBoxOfSelected () |
Returns the bounding box of the selected features. More... | |
QgsGeometryCache * | cache () |
QString | capabilitiesString () const |
Capabilities for this layer in a friendly format. More... | |
Q_DECL_DEPRECATED bool | changeAttributeValue (QgsFeatureId fid, int field, const QVariant &value, bool emitSignal) |
Changes an attribute value (but does not commit it) More... | |
bool | changeAttributeValue (QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue=QVariant()) |
Changes an attribute value (but does not commit it) More... | |
bool | changeAttributeValues (QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues) |
Changes attributes' values for a feature (but does not immediately commit the changes). More... | |
bool | changeGeometry (QgsFeatureId fid, QgsGeometry *geom) |
Change feature's geometry. More... | |
void | clearAttributeEditorWidgets () |
Clears all the tabs for the attribute editor form. More... | |
bool | commitChanges () |
Attempts to commit any changes to disk. More... | |
const QStringList & | commitErrors () |
QgsConditionalLayerStyles * | conditionalStyles () const |
Return the conditional styles that are set for this layer. More... | |
bool | countSymbolFeatures (bool showProgress=true) |
Count features for symbols. More... | |
void | createJoinCaches () |
Caches joined attributes if required (and not already done) More... | |
virtual QgsMapLayerRenderer * | createMapRenderer (QgsRenderContext &rendererContext) override |
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context. More... | |
QString | dataComment () const |
Returns a comment for the data in the layer. More... | |
QgsVectorDataProvider * | dataProvider () |
Returns the data provider. More... | |
const QgsVectorDataProvider * | dataProvider () const |
Returns the data provider in a const-correct manner. More... | |
Q_DECL_DEPRECATED QString | dateFormat (int idx) |
Access date format. More... | |
QVariant | defaultValue (int index, const QgsFeature &feature=QgsFeature(), QgsExpressionContext *context=nullptr) const |
Returns the calculated default value for the specified field index. More... | |
QString | defaultValueExpression (int index) const |
Returns the expression used when calculating the default value for a field. More... | |
bool | deleteAttribute (int attr) |
Delete an attribute field (but does not commit it) More... | |
bool | deleteAttributes (QList< int > attrs) |
Deletes a list of attribute fields (but does not commit it) More... | |
bool | deleteFeature (QgsFeatureId fid) |
Delete a feature from the layer (but does not commit it) More... | |
bool | deleteFeatures (const QgsFeatureIds &fids) |
Deletes a set of features from the layer (but does not commit it) More... | |
bool | deleteSelectedFeatures (int *deletedCount=nullptr) |
Deletes the selected features. More... | |
Q_DECL_DEPRECATED bool | deleteVertex (QgsFeatureId atFeatureId, int atVertex) |
Deletes a vertex from a feature. More... | |
EditResult | deleteVertexV2 (QgsFeatureId featureId, int vertex) |
Deletes a vertex from a feature. More... | |
void | destroyEditCommand () |
Destroy active command and reverts all changes in it. More... | |
const QgsDiagramLayerSettings * | diagramLayerSettings () const |
const QgsDiagramRendererV2 * | diagramRenderer () const |
bool | diagramsEnabled () const |
Returns whether the layer contains diagrams which are enabled and should be drawn. More... | |
QString | displayExpression () const |
Get the preview expression, used to create a human readable preview string. More... | |
QString | displayField () const |
Returns the primary display field name used in the identify results dialog. More... | |
bool | draw (QgsRenderContext &rendererContext) override |
Draws the layer. More... | |
Q_DECL_DEPRECATED void | drawLabels (QgsRenderContext &rendererContext) override |
Draws the layer labels using the old labeling engine. More... | |
QgsVectorLayerEditBuffer * | editBuffer () |
Buffer with uncommitted editing operations. Only valid after editing has been turned on. More... | |
Q_DECL_DEPRECATED QString | editForm () const |
Get edit form. More... | |
QgsEditFormConfig * | editFormConfig () const |
Get the configuration of the form used to represent this vector layer. More... | |
Q_DECL_DEPRECATED QString | editFormInit () const |
Get python function for edit form initialization. More... | |
Q_DECL_DEPRECATED EditorLayout | editorLayout () |
Get the active layout for the attribute editor for this layer. More... | |
Q_DECL_DEPRECATED const QString | editorWidgetV2 (int fieldIdx) const |
Get the id for the editor widget used to represent the field at the given index. More... | |
Q_DECL_DEPRECATED const QString | editorWidgetV2 (const QString &fieldName) const |
Get the id for the editor widget used to represent the field at the given index. More... | |
Q_DECL_DEPRECATED const QgsEditorWidgetConfig | editorWidgetV2Config (int fieldIdx) const |
Get the configuration for the editor widget used to represent the field at the given index. More... | |
Q_DECL_DEPRECATED const QgsEditorWidgetConfig | editorWidgetV2Config (const QString &fieldName) const |
Get the configuration for the editor widget used to represent the field with the given name. More... | |
Q_DECL_DEPRECATED EditType | editType (int idx) |
Get edit type. More... | |
Q_DECL_DEPRECATED void | enableLabels (bool on) |
Set labels on. More... | |
void | endEditCommand () |
Finish edit command and add it to undo/redo stack. More... | |
const QSet< QString > & | excludeAttributesWFS () const |
const QSet< QString > & | excludeAttributesWMS () const |
QString | expressionField (int index) |
Returns the expressoin used for a given expression field. More... | |
QgsRectangle | extent () override |
Return the extent of the layer. More... | |
QPainter::CompositionMode | featureBlendMode () const |
Returns the current blending mode for features. More... | |
long | featureCount (QgsSymbolV2 *symbol) |
Number of features rendered with specified symbol. More... | |
long | featureCount () const |
Returns feature count including changes which have not yet been committed If you need only the count of committed features call this method on this layer's provider. More... | |
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress | featureFormSuppress () const |
Type of feature form pop-up suppression after feature creation (overrides app setting) More... | |
Q_DECL_DEPRECATED bool | fieldEditable (int idx) |
Is edit widget editable. More... | |
int | fieldNameIndex (const QString &fieldName) const |
Returns the index of a field name or -1 if the field does not exist. More... | |
QgsFields | fields () const |
Returns the list of fields of this layer. More... | |
QGis::GeometryType | geometryType () const |
Returns point, line or polygon. More... | |
QList< double > | getDoubleValues (const QString &fieldOrExpression, bool &ok, bool selectedOnly=false, int *nullCount=nullptr) |
Fetches all double values from a specified field name or expression. More... | |
QgsFeatureIterator | getFeatures (const QgsFeatureRequest &request=QgsFeatureRequest()) |
Query the provider for features specified in request. More... | |
virtual QString | getStyleFromDatabase (const QString &styleId, QString &msgError) |
Will return the named style corresponding to style id provided. More... | |
QList< QVariant > | getValues (const QString &fieldOrExpression, bool &ok, bool selectedOnly=false) |
Fetches all values from a specified field name or expression. More... | |
bool | hasGeometryType () const |
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry. More... | |
Q_DECL_DEPRECATED bool | hasLabelsEnabled () const |
Label is on. More... | |
int | insertSegmentVerticesForSnap (const QList< QgsSnappingResult > &snapResults) |
Inserts vertices to the snapped segments. More... | |
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. More... | |
void | invertSelection () |
Select not selected features and deselect selected ones. More... | |
void | invertSelectionInRectangle (QgsRectangle &rect) |
Invert selection of features found within the search rectangle (in layer's coordinates) More... | |
virtual bool | isEditable () const override |
Returns true if the provider is in editing mode. More... | |
virtual bool | isModified () const |
Returns true if the provider has been modified since the last commit. More... | |
virtual Q_DECL_DEPRECATED bool | isReadOnly () const override |
Returns true if the provider is in read-only mode. More... | |
virtual bool | isSpatial () const override |
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated with it. More... | |
QgsVectorLayerJoinBuffer * | joinBuffer () |
Acccessor to the join buffer object. More... | |
QgsLabel * | label () |
Get the label rendering properties associated with this layer. More... | |
const QgsLabel * | label () const |
Get the label rendering properties associated with this layer. More... | |
const QgsAbstractVectorLayerLabeling * | labeling () const |
Access to labeling configuration. More... | |
Q_DECL_DEPRECATED bool | labelOnTop (int idx) |
Label widget on top. More... | |
bool | labelsEnabled () const |
Returns whether the layer contains labels which are enabled and should be drawn. More... | |
virtual QSet< QString > | layerDependencies () const |
Get the list of layer ids on which this layer depends. More... | |
int | layerTransparency () const |
Returns the current transparency for the vector layer. More... | |
virtual int | listStylesInDatabase (QStringList &ids, QStringList &names, QStringList &descriptions, QString &msgError) |
Lists all the style in db split into related to the layer and not related to. More... | |
virtual QString | loadNamedStyle (const QString &theURI, bool &theResultFlag, bool loadFromLocalDb) |
Load a named style from file/local db/datasource db. More... | |
virtual QString | loadNamedStyle (const QString &theURI, bool &theResultFlag) override |
Calls loadNamedStyle( theURI, theResultFlag, false ); Retained for backward compatibility. More... | |
QVariant | maximumValue (int index) |
Returns the maximum value for an attribute column or an invalid variant in case of error. More... | |
QString | metadata () override |
Obtain Metadata for this layer. More... | |
QVariant | minimumValue (int index) |
Returns the minimum value for an attribute column or an invalid variant in case of error. More... | |
void | modifySelection (QgsFeatureIds selectIds, QgsFeatureIds deselectIds) |
Modifies the current selection on this layer. More... | |
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. More... | |
bool | moveVertex (const QgsPointV2 &p, 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. More... | |
QgsAttributeList | pendingAllAttributesList () const |
Returns list of attribute indexes. More... | |
long | pendingFeatureCount () const |
Returns feature count including changes which have not yet been committed Alias for featureCount(). More... | |
QgsFields | pendingFields () const |
Returns the list of fields of this layer. More... | |
QgsAttributeList | pendingPkAttributesList () const |
Returns list of attributes making up the primary key Alias for pkAttributeList(). More... | |
QgsAttributeList | pkAttributeList () const |
Returns list of attributes making up the primary key. More... | |
QString | providerType () const |
Return the provider type for this layer. More... | |
Q_DECL_DEPRECATED RangeData | range (int idx) |
Access range widget config data. More... | |
bool | readSld (const QDomNode &node, QString &errorMessage) override |
Read the symbology of the layer according to the information contained in the UserStyle element of a SLD style document. More... | |
bool | readStyle (const QDomNode &node, QString &errorMessage) override |
Read the style for the current layer from the Dom node supplied. More... | |
bool | readSymbology (const QDomNode &node, QString &errorMessage) override |
Read the symbology for the current layer from the Dom node supplied. More... | |
virtual bool | readXml (const QDomNode &layer_node) override |
Reads vector layer specific state from project file Dom node. More... | |
QList< QgsRelation > | referencingRelations (int idx) |
Get relations, where the foreign key is on this layer. More... | |
virtual void | reload () override |
Synchronises with changes in the datasource. More... | |
void | remAttributeAlias (int attIndex) |
Removes an alias (a display name) for attributes to display in dialogs. More... | |
void | removeExpressionField (int index) |
Remove an expression field. More... | |
bool | removeJoin (const QString &joinLayerId) |
Removes a vector layer join. More... | |
Q_DECL_DEPRECATED int | removePolygonIntersections (QgsGeometry *geom, const QgsFeatureIds &ignoreFeatures=QgsFeatureIds()) |
Changes the specified geometry such that it has no intersections with other polygon (or multipolygon) geometries in this vector layer. More... | |
bool | renameAttribute (int attIndex, const QString &newName) |
Renames an attribute field (but does not commit it). More... | |
QgsFeatureRendererV2 * | rendererV2 () |
Return renderer V2. More... | |
const QgsFeatureRendererV2 * | rendererV2 () const |
Return const renderer V2. More... | |
bool | rollBack (bool deleteBuffer=true) |
Stop editing and discard the edits. More... | |
virtual void | saveStyleToDatabase (const QString &name, const QString &description, bool useAsDefault, const QString &uiFileContent, QString &msgError) |
Save named and sld style of the layer to the style table in the db. More... | |
Q_DECL_DEPRECATED void | select (QgsRectangle &rect, bool addToSelection) |
Select features found within the search rectangle (in layer's coordinates) More... | |
void | selectAll () |
Select all the features. More... | |
void | selectByExpression (const QString &expression, SelectBehaviour behaviour=SetSelection) |
Select matching features using an expression. More... | |
void | selectByIds (const QgsFeatureIds &ids, SelectBehaviour behaviour=SetSelection) |
Select matching features using a list of feature IDs. More... | |
void | selectByRect (QgsRectangle &rect, SelectBehaviour behaviour=SetSelection) |
Select features found within the search rectangle (in layer's coordinates) More... | |
int | selectedFeatureCount () |
The number of features that are selected in this layer. More... | |
QgsFeatureList | selectedFeatures () |
Get a copy of the user-selected features. More... | |
const QgsFeatureIds & | selectedFeaturesIds () const |
Return reference to identifiers of selected features. More... | |
QgsFeatureIterator | selectedFeaturesIterator (QgsFeatureRequest request=QgsFeatureRequest()) |
Get an iterator of the selected features. More... | |
void | setAnnotationForm (const QString &ui) |
Set annotation form for layer. More... | |
void | setAttributeTableConfig (const QgsAttributeTableConfig &attributeTableConfig) |
Set the attribute table configuration object. More... | |
Q_DECL_DEPRECATED void | setCheckedState (int idx, const QString &checked, const QString ¬Checked) |
Set string representing 'true' for a checkbox. More... | |
void | setCoordinateSystem () |
Setup the coordinate system transformation for the layer. More... | |
void | setDataSource (const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false) |
Update the data source of the layer. More... | |
void | setDefaultValueExpression (int index, const QString &expression) |
Sets an expression to use when calculating the default value for a field. More... | |
void | setDiagramLayerSettings (const QgsDiagramLayerSettings &s) |
void | setDiagramRenderer (QgsDiagramRendererV2 *r) |
Sets diagram rendering object (takes ownership) More... | |
void | setDisplayExpression (const QString &displayExpression) |
Set the preview expression, used to create a human readable preview string. More... | |
void | setDisplayField (const QString &fldName="") |
Set the primary display field to be used in the identify results dialog. More... | |
Q_DECL_DEPRECATED void | setEditForm (const QString &ui) |
Set edit form. More... | |
Q_DECL_DEPRECATED void | setEditFormInit (const QString &function) |
Set python function for edit form initialization. More... | |
Q_DECL_DEPRECATED void | setEditorLayout (EditorLayout editorLayout) |
Set the active layout for the attribute editor for this layer. More... | |
Q_DECL_DEPRECATED void | setEditorWidgetV2 (int attrIdx, const QString &widgetType) |
Set the editor widget type for a field. More... | |
Q_DECL_DEPRECATED void | setEditorWidgetV2Config (int attrIdx, const QgsEditorWidgetConfig &config) |
Set the editor widget config for a field. More... | |
Q_DECL_DEPRECATED void | setEditType (int idx, EditType edit) |
Set edit type. More... | |
void | setExcludeAttributesWFS (const QSet< QString > &att) |
void | setExcludeAttributesWMS (const QSet< QString > &att) |
void | setFeatureBlendMode (QPainter::CompositionMode blendMode) |
Set the blending mode used for rendering each feature. More... | |
Q_DECL_DEPRECATED void | setFeatureFormSuppress (QgsVectorLayer::FeatureFormSuppress s) |
Set type of feature form pop-up suppression after feature creation (overrides app setting) More... | |
Q_DECL_DEPRECATED void | setFieldEditable (int idx, bool editable) |
Set edit widget editable. More... | |
void | setLabeling (QgsAbstractVectorLayerLabeling *labeling) |
Set labeling configuration. More... | |
Q_DECL_DEPRECATED void | setLabelOnTop (int idx, bool onTop) |
Label widget on top. More... | |
void | setLayerTransparency (int layerTransparency) |
Set the transparency for the vector layer. More... | |
void | setProviderEncoding (const QString &encoding) |
Sets the textencoding of the data provider. More... | |
bool | setReadOnly (bool readonly=true) |
Make layer read-only (editing disabled) or not. More... | |
void | setRendererV2 (QgsFeatureRendererV2 *r) |
Set renderer which will be invoked to represent this layer. More... | |
Q_DECL_DEPRECATED void | setSelectedFeatures (const QgsFeatureIds &ids) |
Change selection to the new set of features. More... | |
void | setSimplifyMethod (const QgsVectorSimplifyMethod &simplifyMethod) |
Set the simplification settings for fast rendering of features. More... | |
virtual bool | setSubsetString (const QString &subset) |
Set the string (typically sql) used to define a subset of the layer. More... | |
bool | simplifyDrawingCanbeApplied (const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint) const |
Returns whether the VectorLayer can apply the specified simplification hint. More... | |
const QgsVectorSimplifyMethod & | simplifyMethod () const |
Returns the simplification settings for fast rendering of features. More... | |
bool | snapPoint (QgsPoint &point, double tolerance) |
Snaps a point to the closest vertex if there is one within the snapping tolerance. More... | |
int | snapWithContext (const QgsPoint &startPoint, double snappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to) |
Snaps to segment or vertex within given tolerance. More... | |
int | splitFeatures (const QList< QgsPoint > &splitLine, bool topologicalEditing=false) |
Splits features cut by the given line. More... | |
int | splitParts (const QList< QgsPoint > &splitLine, bool topologicalEditing=false) |
Splits parts cut by the given line. More... | |
QString | storageType () const |
Returns the permanent storage type for this layer as a friendly name. More... | |
virtual QString | subsetString () |
Get the string (typically sql) used to define a subset of the layer. More... | |
int | translateFeature (QgsFeatureId featureId, double dx, double dy) |
Translates feature by dx, dy. More... | |
void | uniqueValues (int index, QList< QVariant > &uniqueValues, int limit=-1) |
Calculates a list of unique values contained within an attribute in the layer. More... | |
void | updateExpressionField (int index, const QString &exp) |
Changes the expression used to define an expression based (virtual) field. More... | |
bool | updateFeature (QgsFeature &f) |
Updates an existing feature. More... | |
void | updateFields () |
Assembles mUpdatedFields considering provider fields, joined fields and added fields. More... | |
Q_DECL_DEPRECATED QMap< QString, QVariant > | valueMap (int idx) |
Access value map. More... | |
ValueRelationData | valueRelation (int idx) |
Access value relation widget data. More... | |
const QList< QgsVectorJoinInfo > | vectorJoins () const |
Q_DECL_DEPRECATED QSize | widgetSize (int idx) |
Access widget size for photo and webview widget. More... | |
QGis::WkbType | wkbType () const |
Returns the WKBType or WKBUnknown in case of error. More... | |
bool | writeSld (QDomNode &node, QDomDocument &doc, QString &errorMessage) const |
Writes the symbology of the layer into the document provided in SLD 1.1 format. More... | |
bool | writeSld (QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props) const |
Writes the symbology of the layer into the document provided in SLD 1.1 format. More... | |
bool | writeStyle (QDomNode &node, QDomDocument &doc, QString &errorMessage) const override |
Write just the style information for the layer into the document. More... | |
bool | writeSymbology (QDomNode &node, QDomDocument &doc, QString &errorMessage) const override |
Write the symbology for the layer into the docment provided. More... | |
virtual bool | writeXml (QDomNode &layer_node, QDomDocument &doc) override |
Write vector layer specific state to project file Dom node. More... | |
Public Member Functions inherited from QgsMapLayer | |
QgsMapLayer (QgsMapLayer::LayerType type=VectorLayer, const QString &lyrname=QString::null, const QString &source=QString::null) | |
Constructor. More... | |
virtual | ~QgsMapLayer () |
Destructor. More... | |
QString | abstract () const |
Get the abstract of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | attribution () const |
Get the attribution of the layer used by QGIS Server in GetCapabilities request Attribution indicates the provider of a Layer or collection of Layers. More... | |
QString | attributionUrl () const |
Get the attribution URL of the layer used by QGIS Server in GetCapabilities request Attribution indicates the provider of a Layer or collection of Layers. More... | |
QPainter::CompositionMode | blendMode () const |
Returns the current blending mode for a layer. More... | |
Q_DECL_DEPRECATED QImage * | cacheImage () |
const QgsCoordinateReferenceSystem & | crs () const |
Returns layer's spatial reference system. More... | |
QVariant | customProperty (const QString &value, const QVariant &defaultValue=QVariant()) const |
Read a custom property from layer. More... | |
QString | dataUrl () const |
Get the DataUrl of the layer used by QGIS Server in GetCapabilities request DataUrl is a a link to the underlying data represented by a particular layer. More... | |
QString | dataUrlFormat () const |
Get the DataUrl format of the layer used by QGIS Server in GetCapabilities request DataUrl is a a link to the underlying data represented by a particular layer. More... | |
virtual QgsError | error () const |
Get current status error. More... | |
virtual void | exportNamedStyle (QDomDocument &doc, QString &errorMsg) |
Export the properties of this layer as named style in a QDomDocument. More... | |
virtual void | exportSldStyle (QDomDocument &doc, QString &errorMsg) |
Export the properties of this layer as SLD style in a QDomDocument. More... | |
bool | hasScaleBasedVisibility () const |
Returns whether scale based visibility is enabled for the layer. More... | |
QString | id () const |
Get this layer's unique ID, this ID is used to access this layer from map layer registry. More... | |
virtual bool | importNamedStyle (QDomDocument &doc, QString &errorMsg) |
Import the properties of this layer from a QDomDocument. More... | |
bool | isInScaleRange (double scale) const |
Tests whether the layer should be visible at the specified scale. More... | |
bool | isValid () |
Return the status of the layer. More... | |
QString | keywordList () const |
Get the keyword list of the layer used by QGIS Server in GetCapabilities request. More... | |
virtual Q_DECL_DEPRECATED QString | lastError () |
virtual Q_DECL_DEPRECATED QString | lastErrorTitle () |
QgsMapLayerLegend * | legend () const |
Can be null. More... | |
QString | legendUrl () const |
QString | legendUrlFormat () const |
virtual QString | loadDefaultStyle (bool &theResultFlag) |
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual bool | loadNamedStyleFromDb (const QString &db, const QString &theURI, QString &qml) |
virtual QString | loadSldStyle (const QString &theURI, bool &theResultFlag) |
double | maximumScale () const |
Returns the maximum scale denominator at which the layer is visible. More... | |
QString | metadataUrl () const |
Get the metadata URL of the layer used by QGIS Server in GetCapabilities request MetadataUrl is a a link to the detailed, standardized metadata about the data. More... | |
QString | metadataUrlFormat () const |
Get the metadata format of the layer used by QGIS Server in GetCapabilities request MetadataUrlType indicates how the metadata is structured. More... | |
QString | metadataUrlType () const |
Get the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType indicates the standard to which the metadata complies. More... | |
double | minimumScale () const |
Returns the minimum scale denominator at which the layer is visible. More... | |
QString | name () const |
Get the display name of the layer. More... | |
virtual Q_DECL_DEPRECATED void | onCacheImageDelete () |
QString | originalName () const |
Get the original name of the layer. More... | |
QString | publicSource () const |
Gets a version of the internal layer definition that has sensitive bits removed (for example, the password). More... | |
bool | readLayerXML (const QDomElement &layerElement, const QString &relativeBasePath=QString()) |
Sets state from Dom document. More... | |
bool | readOnly () const |
Returns if this layer is read only. More... | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from layer. More... | |
virtual QString | saveDefaultStyle (bool &theResultFlag) |
Save the properties of this layer as the default style (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual QString | saveNamedStyle (const QString &theURI, bool &theResultFlag) |
Save the properties of this layer as a named style (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual QString | saveSldStyle (const QString &theURI, bool &theResultFlag) |
void | setAbstract (const QString &abstract) |
Set the abstract of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setAttribution (const QString &attrib) |
Set the attribution of the layer used by QGIS Server in GetCapabilities request Attribution indicates the provider of a Layer or collection of Layers. More... | |
void | setAttributionUrl (const QString &attribUrl) |
Set the attribution URL of the layer used by QGIS Server in GetCapabilities request Attribution indicates the provider of a Layer or collection of Layers. More... | |
void | setBlendMode (QPainter::CompositionMode blendMode) |
Set the blending mode used for rendering a layer. More... | |
Q_DECL_DEPRECATED void | setCacheImage (QImage *) |
void | setCrs (const QgsCoordinateReferenceSystem &srs, bool emitSignal=true) |
Sets layer's spatial reference system. More... | |
void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for layer. More... | |
void | setDataUrl (const QString &dataUrl) |
Set the DataUrl of the layer used by QGIS Server in GetCapabilities request DataUrl is a a link to the underlying data represented by a particular layer. More... | |
void | setDataUrlFormat (const QString &dataUrlFormat) |
Set the DataUrl format of the layer used by QGIS Server in GetCapabilities request DataUrl is a a link to the underlying data represented by a particular layer. More... | |
void | setKeywordList (const QString &keywords) |
Set the keyword list of the layer used by QGIS Server in GetCapabilities request. More... | |
Q_DECL_DEPRECATED void | setLayerName (const QString &name) |
Set the display name of the layer. More... | |
virtual void | setLayerOrder (const QStringList &layers) |
Reorders the previously selected sublayers of this layer from bottom to top (Useful for providers that manage their own layers, such as WMS) More... | |
void | setLegend (QgsMapLayerLegend *legend) |
Assign a legend controller to the map layer. More... | |
void | setLegendUrl (const QString &legendUrl) |
void | setLegendUrlFormat (const QString &legendUrlFormat) |
void | setMetadataUrl (const QString &metaUrl) |
Set the metadata URL of the layer used by QGIS Server in GetCapabilities request MetadataUrl is a a link to the detailed, standardized metadata about the data. More... | |
void | setMetadataUrlFormat (const QString &metaUrlFormat) |
Set the metadata format of the layer used by QGIS Server in GetCapabilities request MetadataUrlType indicates how the metadata is structured. More... | |
void | setMetadataUrlType (const QString &metaUrlType) |
Set the metadata type of the layer used by QGIS Server in GetCapabilities request MetadataUrlType indicates the standard to which the metadata complies. More... | |
void | setName (const QString &name) |
Set the display name of the layer. More... | |
void | setShortName (const QString &shortName) |
Set the short name of the layer used by QGIS Server to identify the layer. More... | |
virtual void | setSubLayerVisibility (const QString &name, bool vis) |
Set the visibility of the given sublayer name. More... | |
void | setTitle (const QString &title) |
Set the title of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | shortName () const |
Get the short name of the layer used by QGIS Server to identify the layer. More... | |
QString | source () const |
Returns the source for the layer. More... | |
QgsMapLayerStyleManager * | styleManager () const |
Get access to the layer's style manager. More... | |
virtual QString | styleURI () |
Retrieve the style URI for this layer (either as a .qml file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual QStringList | subLayers () const |
Returns the sublayers of this layer (Useful for providers that manage their own layers, such as WMS) More... | |
QString | title () const |
Get the title of the layer used by QGIS Server in GetCapabilities request. More... | |
QgsMapLayer::LayerType | type () const |
Get the type of the layer. More... | |
QUndoStack * | undoStack () |
Return pointer to layer's undo stack. More... | |
QUndoStack * | undoStackStyles () |
Return pointer to layer's style undo stack. More... | |
bool | writeLayerXML (QDomElement &layerElement, QDomDocument &document, const QString &relativeBasePath=QString()) |
Stores state in Dom node. More... | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static void | drawVertexMarker (double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize) |
Draws a vertex symbol at (screen) coordinates x, y. More... | |
Static Public Member Functions inherited from QgsMapLayer | |
static QDomDocument | asLayerDefinition (const QList< QgsMapLayer *> &layers, const QString &relativeBasePath=QString()) |
Returns the given layer as a layer definition document Layer definitions store the data source as well as styling and custom properties. More... | |
static QString | capitaliseLayerName (const QString &name) |
A convenience function to (un)capitalise the layer name. More... | |
static QList< QgsMapLayer * > | fromLayerDefinition (QDomDocument &document, bool addToRegistry=false, bool addToLegend=false, const QString &relativeBasePath=QString()) |
Creates a new layer from a layer defininition document. More... | |
static QList< QgsMapLayer * > | fromLayerDefinitionFile (const QString &qlrfile) |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Slots | |
void | invalidateSymbolCountedFlag () |
Protected Member Functions | |
void | setExtent (const QgsRectangle &rect) override |
Set the extent. More... | |
Protected Member Functions inherited from QgsMapLayer | |
void | appendError (const QgsErrorMessage &theMessage) |
Add error message. More... | |
void | readCustomProperties (const QDomNode &layerNode, const QString &keyStartsWith="") |
Read custom properties from project file. More... | |
void | readStyleManager (const QDomNode &layerNode) |
Read style manager's configuration (if any). More... | |
void | setError (const QgsError &theError) |
Set error message. More... | |
void | setValid (bool valid) |
Set whether layer is valid or not - should be used in constructor. More... | |
void | writeCustomProperties (QDomNode &layerNode, QDomDocument &doc) const |
Write custom properties to project file. More... | |
void | writeStyleManager (QDomNode &layerNode, QDomDocument &doc) const |
Write style manager's configuration (if exists). More... | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Friends | |
class | QgsVectorLayerEditBuffer |
class | QgsVectorLayerFeatureSource |
Additional Inherited Members | |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Protected Attributes inherited from QgsMapLayer | |
QString | mAbstract |
Description of the layer. More... | |
QString | mAttribution |
Attribution of the layer. More... | |
QString | mAttributionUrl |
QString | mDataSource |
Data source description string, varies by layer type. More... | |
QString | mDataUrl |
DataUrl of the layer. More... | |
QString | mDataUrlFormat |
QgsError | mError |
Error. More... | |
QgsRectangle | mExtent |
Extent of the layer. More... | |
QString | mKeywordList |
QString | mLayerName |
Name of the layer - used for display. More... | |
QString | mLayerOrigName |
Original name of the layer. More... | |
QString | mLegendUrl |
WMS legend. More... | |
QString | mLegendUrlFormat |
QString | mMetadataUrl |
MetadataUrl of the layer. More... | |
QString | mMetadataUrlFormat |
QString | mMetadataUrlType |
QString | mShortName |
QString | mTitle |
bool | mValid |
Indicates if the layer is valid and can be drawn. More... | |
Properties inherited from QgsMapLayer | |
QString | name |
Read property of QString layerName. More... | |
Properties inherited from QObject | |
objectName | |
Represents a vector layer which manages a vector based data sets.
The QgsVectorLayer is instantiated by specifying the name of a data provider, such as postgres or wfs, and url defining the specific data set to connect to. The vector layer constructor in turn instantiates a QgsVectorDataProvider subclass corresponding to the provider type, and passes it the url. The data provider connects to the data source.
The QgsVectorLayer provides a common interface to the different data types. It also manages editing transactions.
Sample usage of the QgsVectorLayer class:
The main data providers supported by QGIS are listed below.
The memory data provider is used to construct in memory data, for example scratch data or data generated from spatial operations such as contouring. There is no inherent persistent storage of the data. The data source uri is constructed. The url specifies the geometry type ("point", "linestring", "polygon", "multipoint","multilinestring","multipolygon"), optionally followed by url parameters as follows:
An example url is "Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes"
Accesses data using the OGR drivers (http://www.gdal.org/ogr/ogr_formats.html). The url is the OGR connection string. A wide variety of data formats can be accessed using this driver, including file based formats used by many GIS systems, database formats, and web services. Some of these formats are also supported by custom data providers listed below.
Access data in a spatialite database. The url defines the connection parameters, table, geometry column, and other attributes. The url can be constructed using the QgsDataSourceURI class.
Connects to a postgresql database. The url defines the connection parameters, table, geometry column, and other attributes. The url can be constructed using the QgsDataSourceURI class.
Connects to a Microsoft SQL server database. The url defines the connection parameters, table, geometry column, and other attributes. The url can be constructed using the QgsDataSourceURI class.
Used to access data provided by a web feature service.
The url can be a HTTP url to a WFS server (legacy, e.g. http://foobar/wfs?TYPENAME=xxx&SRSNAME=yyy[&FILTER=zzz]), or, starting with QGIS 2.16, a URI constructed using the QgsDataSourceURI class with the following parameters :
The ‘FILTER’ query string parameter can be used to filter the WFS feature type. The ‘FILTER’ key value can either be a QGIS expression or an OGC XML filter. If the value is set to a QGIS expression the driver will turn it into OGC XML filter before passing it to the WFS server. Beware the QGIS expression filter only supports” =, !=, <, >, <=, >=, AND, OR, NOT, LIKE, IS NULL” attribute operators, “BBOX, Disjoint, Intersects, Touches, Crosses, Contains, Overlaps, Within” spatial binary operators and the QGIS local “geomFromWKT, geomFromGML” geometry constructor functions.
Also note:
Accesses data in a delimited text file, for example CSV files generated by spreadsheets. The contents of the file are split into columns based on specified delimiter characters. Each record may be represented spatially either by an X and Y coordinate column, or by a WKT (well known text) formatted columns.
The url defines the filename, the formatting options (how the text in the file is divided into data fields, and which fields contain the X,Y coordinates or WKT text definition. The options are specified as url query items.
At its simplest the url can just be the filename, in which case it will be loaded as a CSV formatted file.
The url may include the following items:
encoding=UTF-8
Defines the character encoding in the file. The default is UTF-8. To use the default encoding for the operating system use "System".
type=(csv|regexp|whitespace|plain)
Defines the algorithm used to split records into columns. Records are defined by new lines, except for csv format files for which quoted fields may span multiple records. The default type is csv.
delimiter=characters
Defines the delimiter characters used for csv and plain type files, or the regular expression for regexp type files. It is a literal string of characters except that "\t" may be used to represent a tab character.
quote=characters
Defines the characters that are used as quote characters for csv and plain type files.
escape=characters
Defines the characters used to escape delimiter, quote, and newline characters.
skipLines=n
Defines the number of lines to ignore at the beginning of the file (default 0)
useHeader=(yes|no)
Defines whether the first record in the file (after skipped lines) contains column names (default yes)
trimFields=(yes|no)
If yes then leading and trailing whitespace will be removed from fields
skipEmptyFields=(yes|no)
If yes then empty fields will be discarded (eqivalent to concatenating consecutive delimiters)
maxFields=#
Specifies the maximum number of fields to load for each record. Additional fields will be discarded. Default is 0 - load all fields.
decimalPoint=c
Defines a character that is used as a decimal point in the numeric columns The default is '.'.
xField=column yField=column
Defines the name of the columns holding the x and y coordinates for XY point geometries. If the useHeader is no (ie there are no column names), then this is the column number (with the first column as 1).
xyDms=(yes|no)
If yes then the X and Y coordinates are interpreted as degrees/minutes/seconds format (fairly permissively), or degree/minutes format.
wktField=column
Defines the name of the columns holding the WKT geometry definition for WKT geometries. If the useHeader is no (ie there are no column names), then this is the column number (with the first column as 1).
geomType=(point|line|polygon|none)
Defines the geometry type for WKT type geometries. QGIS will only display one type of geometry for the layer - any others will be ignored when the file is loaded. By default the provider uses the type of the first geometry in the file. Use geomType to override this type.
geomType can also be set to none, in which case the layer is loaded without geometries.
subset=expression
Defines an expression that will identify a subset of records to display
crs=crsstring
Defines the coordinate reference system used for the layer. This can be any string accepted by QgsCoordinateReferenceSystem::createFromString()
-subsetIndex=(yes|no)
Determines whether the provider generates an index to improve the efficiency of subsets. The default is yes
-spatialIndex=(yes|no)
Determines whether the provider generates a spatial index. The default is no.
-watchFile=(yes|no)
Defines whether the file will be monitored for changes. The default is to monitor for changes.
quiet
Errors encountered loading the file will not be reported in a user dialog if quiet is included (They will still be shown in the output log).
Provider reads tracks, routes, and waypoints from a GPX file. The url defines the name of the file, and the type of data to retrieve from it ("track", "route", or "waypoint").
An example url is "/home/user/data/holiday.gpx?type=route"
Provider to display vector data in a GRASS GIS layer.
TODO QGIS3: Remove virtual from non-inherited methods (like isModified)
Definition at line 408 of file qgsvectorlayer.h.
Definition at line 414 of file qgsvectorlayer.h.
Definition at line 415 of file qgsvectorlayer.h.
Enumerator | |
---|---|
GeneratedLayout | |
TabLayout | |
UiFileLayout |
Definition at line 417 of file qgsvectorlayer.h.
Result of an edit operation.
Definition at line 509 of file qgsvectorlayer.h.
Definition at line 483 of file qgsvectorlayer.h.
Types of feature form suppression after feature creation.
Enumerator | |
---|---|
SuppressDefault | |
SuppressOn | |
SuppressOff |
Definition at line 473 of file qgsvectorlayer.h.
Selection behaviour.
Definition at line 519 of file qgsvectorlayer.h.
Editing vertex markers.
Enumerator | |
---|---|
SemiTransparentCircle | |
Cross | |
NoMarker |
Definition at line 1759 of file qgsvectorlayer.h.
QgsVectorLayer::QgsVectorLayer | ( | const QString & | path = QString::null , |
const QString & | baseName = QString::null , |
||
const QString & | providerLib = QString::null , |
||
bool | loadDefaultStyleFlag = true |
||
) |
Constructor - creates a vector layer.
The QgsVectorLayer is constructed by instantiating a data provider. The provider interprets the supplied path (url) of the data source to connect to and access the data.
path | The path or url of the parameter. Typically this encodes parameters used by the data provider as url query items. |
baseName | The name used to represent the layer in the legend |
providerLib | The name of the data provider, eg "memory", "postgres" |
loadDefaultStyleFlag | whether to load the default style |
Definition at line 123 of file qgsvectorlayer.cpp.
|
virtual |
Destructor.
Definition at line 176 of file qgsvectorlayer.cpp.
|
inline |
Get all layer actions defined on this layer.
The pointer which is returned directly points to the actions object which is used by the layer, so any changes are immediately applied.
Definition at line 669 of file qgsvectorlayer.h.
bool QgsVectorLayer::addAttribute | ( | const QgsField & | field | ) |
Add an attribute field (but does not commit it) returns true if the field was added.
Definition at line 2429 of file qgsvectorlayer.cpp.
void QgsVectorLayer::addAttributeAlias | ( | int | attIndex, |
const QString & | aliasString | ||
) |
Sets an alias (a display name) for attributes to display in dialogs.
Definition at line 2491 of file qgsvectorlayer.cpp.
|
inline |
Adds a tab (for the attribute editor form) holding groups and fields.
editFormConfig()->addTab()
instead Definition at line 1406 of file qgsvectorlayer.h.
Add a new field which is calculated by the expression specified.
exp | The expression which calculates the field |
fld | The field to calculate |
Definition at line 3186 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::addFeature | ( | QgsFeature & | feature, |
bool | alsoUpdateExtent = true |
||
) |
Adds a feature.
feature | feature to add |
alsoUpdateExtent | If True, will also go to the effort of e.g. updating the extents. |
Definition at line 1113 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::addFeatures | ( | QgsFeatureList | features, |
bool | makeSelected = true |
||
) |
Insert a copy of the given features into the layer (but does not commit it)
Definition at line 2776 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::addJoin | ( | const QgsVectorJoinInfo & | joinInfo | ) |
Joins another vector layer to this layer.
joinInfo | join object containing join layer id, target and source field |
Definition at line 3158 of file qgsvectorlayer.cpp.
Adds a new part polygon to a multipart feature.
Definition at line 1327 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addPart | ( | const QgsPointSequenceV2 & | ring | ) |
Adds a new part polygon to a multipart feature.
Definition at line 1353 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addPart | ( | QgsCurveV2 * | ring | ) |
Definition at line 1379 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addRing | ( | const QList< QgsPoint > & | ring, |
QgsFeatureId * | featureId = nullptr |
||
) |
Adds a ring to polygon/multipolygon features.
ring | ring to add |
featureId | if specified, feature ID for feature ring was added to will be stored in this parameter |
Definition at line 1266 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addRing | ( | QgsCurveV2 * | ring, |
QgsFeatureId * | featureId = nullptr |
||
) |
Adds a ring to polygon/multipolygon features (takes ownership)
ring | ring to add |
featureId | if specified, feature ID for feature ring was added to will be stored in this parameter |
Definition at line 1289 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addTopologicalPoints | ( | const QgsGeometry * | geom | ) |
Adds topological points for every vertex of the geometry.
geom | the geometry where each vertex is added to segments of other features |
Definition at line 1480 of file qgsvectorlayer.cpp.
int QgsVectorLayer::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.
p | position of the vertex |
Definition at line 1489 of file qgsvectorlayer.cpp.
QVariant QgsVectorLayer::aggregate | ( | QgsAggregateCalculator::Aggregate | aggregate, |
const QString & | fieldOrExpression, | ||
const QgsAggregateCalculator::AggregateParameters & | parameters = QgsAggregateCalculator::AggregateParameters() , |
||
QgsExpressionContext * | context = nullptr , |
||
bool * | ok = nullptr |
||
) |
Calculates an aggregated value from the layer's features.
aggregate | aggregate to calculate |
fieldOrExpression | source field or expression to use as basis for aggregated values. |
parameters | parameters controlling aggregate calculation |
context | expression context for expressions and filters |
ok | if specified, will be set to true if aggregate calculation was successful |
Definition at line 3624 of file qgsvectorlayer.cpp.
QgsFeatureIds QgsVectorLayer::allFeatureIds | ( | ) |
Get all feature Ids.
Definition at line 584 of file qgsvectorlayer.cpp.
|
inline |
Get annotation form.
Definition at line 1658 of file qgsvectorlayer.h.
Will load a named style from a provided QML string.
namedStyle | A QML string |
errorMsg | An error message indicating problems if any |
Definition at line 4464 of file qgsvectorlayer.cpp.
|
signal |
Will be emitted, when a new attribute has been added to this vector layer.
Applies only to types QgsFields::OriginEdit, QgsFields::OriginProvider and QgsFields::OriginExpression
idx | The index of the new attribute |
QString QgsVectorLayer::attributeAlias | ( | int | attributeIndex | ) | const |
Returns the alias of an attribute name or a null string if there is no alias.
Definition at line 2503 of file qgsvectorlayer.cpp.
QgsStringMap QgsVectorLayer::attributeAliases | ( | ) | const |
Returns a map of field name to attribute alias.
Definition at line 2519 of file qgsvectorlayer.cpp.
|
signal |
Will be emitted, when an attribute has been deleted from this vector layer.
Applies only to types QgsFields::OriginEdit, QgsFields::OriginProvider and QgsFields::OriginExpression
idx | The index of the deleted attribute |
QString QgsVectorLayer::attributeDisplayName | ( | int | attributeIndex | ) | const |
Convenience function that returns the attribute alias if defined or the field name else.
Definition at line 2511 of file qgsvectorlayer.cpp.
|
inline |
Convert a saved attribute editor element into a AttributeEditor structure as it's used internally.
elem | the DOM element |
parent | the QObject which will own this object |
Definition at line 911 of file qgsvectorlayer.h.
|
inline |
Returns a list of tabs holding groups and fields.
editFormConfig()->tabs()
instead Definition at line 1461 of file qgsvectorlayer.h.
|
inline |
Returns list of attribute indexes.
i.e. a list from 0 ... fieldCount() Alias for attributeList()
Definition at line 1299 of file qgsvectorlayer.h.
QgsAttributeTableConfig QgsVectorLayer::attributeTableConfig | ( | ) | const |
Get the attribute table configuration object.
This defines the appearance of the attribute table.
Definition at line 4020 of file qgsvectorlayer.cpp.
|
signal |
Is emitted whenever an attribute value change is done in the edit buffer.
Note that at this point the attribute change is not yet saved to the provider.
fid | The id of the changed feature |
idx | The attribute index of the changed attribute |
value | The new value of the attribute |
|
signal |
Will be emitted, when an expression field is going to be added to this vector layer.
Applies only to types QgsFields::OriginExpression
fieldName | The name of the attribute to be added |
|
signal |
Is emitted, before changes are commited to the data provider.
|
signal |
Is emitted, before editing on this layer is started.
|
signal |
Is emitted, when layer is checked for modifications.
Use for last-minute additions
|
signal |
Will be emitted, when an expression field is going to be deleted from this vector layer.
Applies only to types QgsFields::OriginExpression
idx | The index of the attribute to be deleted |
|
signal |
Is emitted, before changes are rolled back.
void QgsVectorLayer::beginEditCommand | ( | const QString & | text | ) |
Create edit command for undo/redo operations.
text | text which is to be displayed in undo window |
Definition at line 3093 of file qgsvectorlayer.cpp.
QgsRectangle QgsVectorLayer::boundingBoxOfSelected | ( | ) |
Returns the bounding box of the selected features.
If there is no selection, QgsRectangle(0,0,0,0) is returned
Definition at line 698 of file qgsvectorlayer.cpp.
|
inline |
Definition at line 1892 of file qgsvectorlayer.h.
QString QgsVectorLayer::capabilitiesString | ( | ) | const |
Capabilities for this layer in a friendly format.
Definition at line 209 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeAttributeValue | ( | QgsFeatureId | fid, |
int | field, | ||
const QVariant & | value, | ||
bool | emitSignal | ||
) |
Changes an attribute value (but does not commit it)
Definition at line 2373 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeAttributeValue | ( | QgsFeatureId | fid, |
int | field, | ||
const QVariant & | newValue, | ||
const QVariant & | oldValue = QVariant() |
||
) |
Changes an attribute value (but does not commit it)
fid | The feature id of the feature to be changed |
field | The index of the field to be updated |
newValue | The value which will be assigned to the field |
oldValue | The previous value to restore on undo (will otherwise be retrieved) |
Definition at line 2379 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeAttributeValues | ( | QgsFeatureId | fid, |
const QgsAttributeMap & | newValues, | ||
const QgsAttributeMap & | oldValues | ||
) |
Changes attributes' values for a feature (but does not immediately commit the changes).
The fid argument specifies the ID of the feature to be changed.
The new values to be assigned to the fields are given by newValues.
If a valid QVariant is specified for a field in oldValues, it will be used as the field value in the case of an undo operation corresponding to this attribute value change. If an invalid QVariant is used (the default behavior), then the feature's current value will be automatically retrieved and used. Note that this involves a feature request to the underlying data provider, so it is more efficient to explicitly pass an oldValue if it is already available.
Returns true if feature's attributes was successfully changed.
Definition at line 2387 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeGeometry | ( | QgsFeatureId | fid, |
QgsGeometry * | geom | ||
) |
Change feature's geometry.
Definition at line 2356 of file qgsvectorlayer.cpp.
|
slot |
Check if there is a join with a layer that will be removed.
Definition at line 3163 of file qgsvectorlayer.cpp.
|
inline |
Clears all the tabs for the attribute editor form.
Definition at line 1476 of file qgsvectorlayer.h.
bool QgsVectorLayer::commitChanges | ( | ) |
Attempts to commit any changes to disk.
Returns the result of the attempt. If a commit fails, the in-memory changes are left alone.
This allows editing to continue if the commit failed on e.g. a disallowed value in a Postgres database - the user can re-edit and try again.
The commits occur in distinct stages, (add attributes, add features, change attribute values, change geometries, delete features, delete attributes) so if a stage fails, it's difficult to roll back cleanly. Therefore any error message also includes which stage failed so that the user has some chance of repairing the damage cleanly.
Definition at line 2619 of file qgsvectorlayer.cpp.
const QStringList & QgsVectorLayer::commitErrors | ( | ) |
Definition at line 2666 of file qgsvectorlayer.cpp.
|
signal |
This signal is emitted, when attributes are added to the provider.
|
signal |
This signal is emitted, when attributes are deleted from the provider.
|
signal |
This signal is emitted, when attribute value changes are saved to the provider.
|
signal |
This signal is emitted, when features are added to the provider.
|
signal |
This signal is emitted, when features are deleted from the provider.
|
signal |
This signal is emitted, when geometry changes are saved to the provider.
QgsConditionalLayerStyles * QgsVectorLayer::conditionalStyles | ( | ) | const |
Return the conditional styles that are set for this layer.
Style information is used to render conditional formatting in the attribute table.
Definition at line 1099 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::countSymbolFeatures | ( | bool | showProgress = true | ) |
Count features for symbols.
Feature counts may be get by featureCount( QgsSymbolV2*).
showProgress | show progress dialog |
Definition at line 831 of file qgsvectorlayer.cpp.
void QgsVectorLayer::createJoinCaches | ( | ) |
Caches joined attributes if required (and not already done)
Definition at line 3264 of file qgsvectorlayer.cpp.
|
overridevirtual |
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context.
Reimplemented from QgsMapLayer.
Definition at line 384 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::dataComment | ( | ) | const |
Returns a comment for the data in the layer.
Definition at line 218 of file qgsvectorlayer.cpp.
QgsVectorDataProvider * QgsVectorLayer::dataProvider | ( | ) |
Returns the data provider.
Definition at line 638 of file qgsvectorlayer.cpp.
const QgsVectorDataProvider * QgsVectorLayer::dataProvider | ( | ) | const |
Returns the data provider in a const-correct manner.
Definition at line 643 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::dateFormat | ( | int | idx | ) |
Access date format.
editFormConfig()->widgetConfig()
instead Definition at line 3061 of file qgsvectorlayer.cpp.
QVariant QgsVectorLayer::defaultValue | ( | int | index, |
const QgsFeature & | feature = QgsFeature() , |
||
QgsExpressionContext * | context = nullptr |
||
) | const |
Returns the calculated default value for the specified field index.
The default value may be taken from a client side default value expression (see setDefaultValueExpression()) or taken from the underlying data provider.
index | field index |
feature | optional feature to use for default value evaluation. If passed, then properties from the feature (such as geometry) can be used when calculating the default value. |
context | optional expression context to evaluate expressions again. If not specified, a default context will be created |
Definition at line 3272 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::defaultValueExpression | ( | int | index | ) | const |
Returns the expression used when calculating the default value for a field.
index | field index |
Definition at line 3337 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteAttribute | ( | int | attr | ) |
Delete an attribute field (but does not commit it)
Definition at line 2530 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteAttributes | ( | QList< int > | attrs | ) |
Deletes a list of attribute fields (but does not commit it)
attrs | the indices of the attributes to delete |
Definition at line 2547 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteFeature | ( | QgsFeatureId | fid | ) |
Delete a feature from the layer (but does not commit it)
Definition at line 2567 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteFeatures | ( | const QgsFeatureIds & | fids | ) |
Deletes a set of features from the layer (but does not commit it)
fids | The feature ids to delete |
Definition at line 2582 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteSelectedFeatures | ( | int * | deletedCount = nullptr | ) |
Deletes the selected features.
Definition at line 1234 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteVertex | ( | QgsFeatureId | atFeatureId, |
int | atVertex | ||
) |
Deletes a vertex from a feature.
Definition at line 1210 of file qgsvectorlayer.cpp.
QgsVectorLayer::EditResult QgsVectorLayer::deleteVertexV2 | ( | QgsFeatureId | featureId, |
int | vertex | ||
) |
Deletes a vertex from a feature.
featureId | ID of feature to remove vertex from |
vertex | index of vertex to delete |
Definition at line 1220 of file qgsvectorlayer.cpp.
|
slot |
Deselect feature by its ID.
featureId | The id of the feature to deselect |
Definition at line 425 of file qgsvectorlayer.cpp.
|
slot |
Deselect features by their ID.
featureIds | The ids of the features to deselect |
Definition at line 432 of file qgsvectorlayer.cpp.
void QgsVectorLayer::destroyEditCommand | ( | ) |
Destroy active command and reverts all changes in it.
Definition at line 3126 of file qgsvectorlayer.cpp.
|
inline |
Definition at line 815 of file qgsvectorlayer.h.
|
inline |
Definition at line 812 of file qgsvectorlayer.h.
bool QgsVectorLayer::diagramsEnabled | ( | ) | const |
Returns whether the layer contains diagrams which are enabled and should be drawn.
Definition at line 771 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::displayExpression | ( | ) | const |
Get the preview expression, used to create a human readable preview string.
Uses QgsExpression
Definition at line 2976 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::displayField | ( | ) | const |
Returns the primary display field name used in the identify results dialog.
Definition at line 2966 of file qgsvectorlayer.cpp.
|
overridevirtual |
Draws the layer.
Reimplemented from QgsMapLayer.
Definition at line 389 of file qgsvectorlayer.cpp.
|
overridevirtual |
Draws the layer labels using the old labeling engine.
Reimplemented from QgsMapLayer.
Definition at line 315 of file qgsvectorlayer.cpp.
|
static |
Draws a vertex symbol at (screen) coordinates x, y.
(Useful to assist vertex editing.)
Definition at line 395 of file qgsvectorlayer.cpp.
|
inline |
Buffer with uncommitted editing operations. Only valid after editing has been turned on.
Definition at line 1741 of file qgsvectorlayer.h.
|
signal |
Signal emitted, whan an edit command is destroyed.
|
signal |
Signal emitted, when an edit command successfully ended.
|
signal |
Signal emitted when a new edit command has been started.
text | Description for this edit command |
|
inline |
Get edit form.
editFormConfig()->uiForm()
instead Definition at line 1637 of file qgsvectorlayer.h.
|
inline |
Get the configuration of the form used to represent this vector layer.
This is a writable configuration that can directly be changed in place.
Definition at line 1471 of file qgsvectorlayer.h.
|
inline |
Get python function for edit form initialization.
editFormConfig()->initFunction()
instead Definition at line 1668 of file qgsvectorlayer.h.
|
signal |
Is emitted, when editing on this layer has started.
|
signal |
Is emitted, when edited changes successfully have been written to the data provider.
|
inline |
Get the active layout for the attribute editor for this layer.
editFormConfig()->layout()
instead Definition at line 1566 of file qgsvectorlayer.h.
|
inline |
Get the id for the editor widget used to represent the field at the given index.
fieldIdx | The index of the field |
editFormConfig()->widgetType()
instead Definition at line 1417 of file qgsvectorlayer.h.
|
inline |
Get the id for the editor widget used to represent the field at the given index.
fieldName | The name of the field |
editFormConfig()->widgetType()
instead Definition at line 1430 of file qgsvectorlayer.h.
|
inline |
Get the configuration for the editor widget used to represent the field at the given index.
fieldIdx | The index of the field |
editFormConfig()->widgetConfig()
instead Definition at line 1441 of file qgsvectorlayer.h.
|
inline |
Get the configuration for the editor widget used to represent the field with the given name.
fieldName | The name of the field |
editFormConfig()->widgetConfig()
instead Definition at line 1454 of file qgsvectorlayer.h.
QgsVectorLayer::EditType QgsVectorLayer::editType | ( | int | idx | ) |
Get edit type.
editFormConfig()->widgetType()
instead Definition at line 3012 of file qgsvectorlayer.cpp.
void QgsVectorLayer::enableLabels | ( | bool | on | ) |
Set labels on.
Definition at line 1508 of file qgsvectorlayer.cpp.
void QgsVectorLayer::endEditCommand | ( | ) |
Finish edit command and add it to undo/redo stack.
Definition at line 3107 of file qgsvectorlayer.cpp.
Definition at line 1495 of file qgsvectorlayer.h.
Definition at line 1492 of file qgsvectorlayer.h.
QString QgsVectorLayer::expressionField | ( | int | index | ) |
Returns the expressoin used for a given expression field.
index | An index of an epxression based (virtual) field |
Definition at line 3205 of file qgsvectorlayer.cpp.
|
overridevirtual |
Return the extent of the layer.
Reimplemented from QgsMapLayer.
Definition at line 967 of file qgsvectorlayer.cpp.
|
signal |
Emitted when a new feature has been added to the layer.
fid | The id of the new feature |
QPainter::CompositionMode QgsVectorLayer::featureBlendMode | ( | ) | const |
Returns the current blending mode for features.
Read blend mode for layer.
Definition at line 3764 of file qgsvectorlayer.cpp.
|
signal |
Signal emitted when setFeatureBlendMode() is called.
long QgsVectorLayer::featureCount | ( | QgsSymbolV2 * | symbol | ) |
Number of features rendered with specified symbol.
Features must be first calculated by countSymbolFeatures()
symbol | the symbol |
Definition at line 784 of file qgsvectorlayer.cpp.
long QgsVectorLayer::featureCount | ( | ) | const |
Returns feature count including changes which have not yet been committed If you need only the count of committed features call this method on this layer's provider.
Definition at line 2613 of file qgsvectorlayer.cpp.
|
signal |
Emitted when a feature has been deleted.
If you do expensive operations in a slot connected to this, you should prever to use featuresDeleted( const QgsFeatureIds& ).
fid | The id of the feature which has been deleted |
|
inline |
Type of feature form pop-up suppression after feature creation (overrides app setting)
editFormConfig()->suppress()
instead Definition at line 1649 of file qgsvectorlayer.h.
|
signal |
Emitted when features have been deleted.
If features are deleted within an edit command, this will only be emitted once at the end to allow connected slots to minimize the overhead. If features are deleted outside of an edit command, this signal will be emitted once per feature.
fids | The feature ids that have been deleted. |
|
inline |
Is edit widget editable.
editFormConfig()->fieldEditable()
instead Definition at line 1720 of file qgsvectorlayer.h.
int QgsVectorLayer::fieldNameIndex | ( | const QString & | fieldName | ) | const |
Returns the index of a field name or -1 if the field does not exist.
Definition at line 3153 of file qgsvectorlayer.cpp.
|
inline |
Returns the list of fields of this layer.
This also includes fields which have not yet been saved to the provider.
Definition at line 1278 of file qgsvectorlayer.h.
|
signal |
Is emitted whenever a geometry change is done in the edit buffer.
Note that at this point the geometry change is not yet saved to the provider.
fid | The id of the changed feature |
geometry | The new geometry |
QGis::GeometryType QgsVectorLayer::geometryType | ( | ) | const |
Returns point, line or polygon.
Definition at line 665 of file qgsvectorlayer.cpp.
QList< double > QgsVectorLayer::getDoubleValues | ( | const QString & | fieldOrExpression, |
bool & | ok, | ||
bool | selectedOnly = false , |
||
int * | nullCount = nullptr |
||
) |
Fetches all double values from a specified field name or expression.
Null values or invalid expression results are skipped.
fieldOrExpression | field name or an expression string evaluating to a double value |
ok | will be set to false if field or expression is invalid, otherwise true |
selectedOnly | set to true to get values from selected features only |
nullCount | optional pointer to integer to store number of null values encountered in |
Definition at line 3727 of file qgsvectorlayer.cpp.
QgsFeatureIterator QgsVectorLayer::getFeatures | ( | const QgsFeatureRequest & | request = QgsFeatureRequest() | ) |
Query the provider for features specified in request.
Definition at line 1104 of file qgsvectorlayer.cpp.
|
virtual |
Will return the named style corresponding to style id provided.
Definition at line 4367 of file qgsvectorlayer.cpp.
QList< QVariant > QgsVectorLayer::getValues | ( | const QString & | fieldOrExpression, |
bool & | ok, | ||
bool | selectedOnly = false |
||
) |
Fetches all values from a specified field name or expression.
fieldOrExpression | field name or an expression string |
ok | will be set to false if field or expression is invalid, otherwise true |
selectedOnly | set to true to get values from selected features only |
Definition at line 3662 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::hasGeometryType | ( | ) | const |
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry.
Definition at line 687 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::hasLabelsEnabled | ( | ) | const |
Label is on.
Definition at line 1513 of file qgsvectorlayer.cpp.
int QgsVectorLayer::insertSegmentVerticesForSnap | ( | const QList< QgsSnappingResult > & | snapResults | ) |
Inserts vertices to the snapped segments.
This is useful for topological editing if snap to segment is enabled.
snapResults | results collected from the snapping operation |
Definition at line 2938 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::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.
Definition at line 1171 of file qgsvectorlayer.cpp.
|
protectedslot |
Definition at line 4299 of file qgsvectorlayer.cpp.
void QgsVectorLayer::invertSelection | ( | ) |
Select not selected features and deselect selected ones.
Definition at line 572 of file qgsvectorlayer.cpp.
void QgsVectorLayer::invertSelectionInRectangle | ( | QgsRectangle & | rect | ) |
Invert selection of features found within the search rectangle (in layer's coordinates)
rect | The rectangle in which the selection of features will be inverted |
Definition at line 601 of file qgsvectorlayer.cpp.
|
overridevirtual |
Returns true if the provider is in editing mode.
Reimplemented from QgsMapLayer.
Definition at line 2981 of file qgsvectorlayer.cpp.
|
virtual |
Returns true if the provider has been modified since the last commit.
Definition at line 3006 of file qgsvectorlayer.cpp.
|
overridevirtual |
Returns true if the provider is in read-only mode.
TODO QGIS3: make private
Reimplemented from QgsMapLayer.
Definition at line 2991 of file qgsvectorlayer.cpp.
|
overridevirtual |
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated with it.
Reimplemented from QgsMapLayer.
Definition at line 2986 of file qgsvectorlayer.cpp.
|
inline |
Acccessor to the join buffer object.
Definition at line 604 of file qgsvectorlayer.h.
QgsLabel * QgsVectorLayer::label | ( | ) |
Get the label rendering properties associated with this layer.
Definition at line 1498 of file qgsvectorlayer.cpp.
const QgsLabel * QgsVectorLayer::label | ( | ) | const |
Get the label rendering properties associated with this layer.
Definition at line 1503 of file qgsvectorlayer.cpp.
|
inline |
Access to labeling configuration.
Definition at line 1206 of file qgsvectorlayer.h.
|
signal |
Emitted when the font family defined for labeling layer is not found on system.
|
inline |
Label widget on top.
editFormConfig()->labelOnTop()
instead Definition at line 1726 of file qgsvectorlayer.h.
bool QgsVectorLayer::labelsEnabled | ( | ) | const |
Returns whether the layer contains labels which are enabled and should be drawn.
Definition at line 757 of file qgsvectorlayer.cpp.
|
signal |
TODO QGIS3: remove in favor of QObject::destroyed.
Get the list of layer ids on which this layer depends.
This in particular determines the order of layer loading.
Definition at line 4472 of file qgsvectorlayer.cpp.
|
signal |
This signal is emitted when modifications has been done on layer.
int QgsVectorLayer::layerTransparency | ( | ) | const |
Returns the current transparency for the vector layer.
Read transparency for layer.
Definition at line 3778 of file qgsvectorlayer.cpp.
|
signal |
Signal emitted when setLayerTransparency() is called.
|
virtual |
Lists all the style in db split into related to the layer and not related to.
ids | the list in which will be stored the style db ids |
names | the list in which will be stored the style names |
descriptions | the list in which will be stored the style descriptions |
msgError |
Definition at line 4346 of file qgsvectorlayer.cpp.
|
virtual |
Load a named style from file/local db/datasource db.
theURI | the URI of the style or the URI of the layer |
theResultFlag | will be set to true if a named style is correctly loaded |
loadFromLocalDb | if true forces to load from local db instead of datasource one |
Definition at line 4436 of file qgsvectorlayer.cpp.
|
overridevirtual |
Calls loadNamedStyle( theURI, theResultFlag, false ); Retained for backward compatibility.
Reimplemented from QgsMapLayer.
Definition at line 4431 of file qgsvectorlayer.cpp.
QVariant QgsVectorLayer::maximumValue | ( | int | index | ) |
Returns the maximum value for an attribute column or an invalid variant in case of error.
Note that in some circumstances when unsaved changes are present for the layer then the returned value may be outdated (for instance when the attribute value in a saved feature has been changed inside the edit buffer then the previous saved value may be returned as the maximum).
Definition at line 3539 of file qgsvectorlayer.cpp.
|
overridevirtual |
Obtain Metadata for this layer.
Reimplemented from QgsMapLayer.
Definition at line 4046 of file qgsvectorlayer.cpp.
QVariant QgsVectorLayer::minimumValue | ( | int | index | ) |
Returns the minimum value for an attribute column or an invalid variant in case of error.
Note that in some circumstances when unsaved changes are present for the layer then the returned value may be outdated (for instance when the attribute value in a saved feature has been changed inside the edit buffer then the previous saved value may be returned as the minimum).
Definition at line 3451 of file qgsvectorlayer.cpp.
void QgsVectorLayer::modifySelection | ( | QgsFeatureIds | selectIds, |
QgsFeatureIds | deselectIds | ||
) |
Modifies the current selection on this layer.
selectIds | Select these ids |
deselectIds | Deselect these ids |
Definition at line 558 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::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.
Definition at line 1184 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::moveVertex | ( | const QgsPointV2 & | p, |
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.
Definition at line 1197 of file qgsvectorlayer.cpp.
|
inline |
Returns list of attribute indexes.
i.e. a list from 0 ... fieldCount() Alias for attributeList()
Definition at line 1293 of file qgsvectorlayer.h.
|
inline |
Returns feature count including changes which have not yet been committed Alias for featureCount().
Definition at line 1314 of file qgsvectorlayer.h.
|
inline |
Returns the list of fields of this layer.
This also includes fields which have not yet been saved to the provider. Alias for fields()
Definition at line 1287 of file qgsvectorlayer.h.
|
inline |
Returns list of attributes making up the primary key Alias for pkAttributeList().
Definition at line 1305 of file qgsvectorlayer.h.
QgsAttributeList QgsVectorLayer::pkAttributeList | ( | ) | const |
Returns list of attributes making up the primary key.
Definition at line 2598 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::providerType | ( | ) | const |
Return the provider type for this layer.
Definition at line 228 of file qgsvectorlayer.cpp.
|
signal |
Signals an error related to this vector layer.
QgsVectorLayer::RangeData QgsVectorLayer::range | ( | int | idx | ) |
Access range widget config data.
editFormConfig()->widgetConfig()
instead Definition at line 3049 of file qgsvectorlayer.cpp.
|
signal |
Signal emitted whenever the symbology (QML-file) for this layer is being read.
If there is custom style information saved in the file, you can connect to this signal and update the layer style accordingly.
element | The XML layer style element. |
errorMessage | Write error messages into this string. |
Read the symbology of the layer according to the information contained in the UserStyle element of a SLD style document.
node | the node that have the style element in it. |
errorMessage | reference to string that will be updated with any error messages |
Reimplemented from QgsMapLayer.
Definition at line 2305 of file qgsvectorlayer.cpp.
Read the style for the current layer from the Dom node supplied.
node | node that will contain the style definition for this layer. |
errorMessage | reference to string that will be updated with any error messages |
Reimplemented from QgsMapLayer.
Definition at line 1983 of file qgsvectorlayer.cpp.
|
overridevirtual |
Read the symbology for the current layer from the Dom node supplied.
node | node that will contain the symbology definition for this layer. |
errorMessage | reference to string that will be updated with any error messages |
Implements QgsMapLayer.
Definition at line 1867 of file qgsvectorlayer.cpp.
|
overridevirtual |
Reads vector layer specific state from project file Dom node.
Reimplemented from QgsMapLayer.
Definition at line 1596 of file qgsvectorlayer.cpp.
QList< QgsRelation > QgsVectorLayer::referencingRelations | ( | int | idx | ) |
Get relations, where the foreign key is on this layer.
idx | Only get relations, where idx forms part of the foreign key |
Definition at line 4341 of file qgsvectorlayer.cpp.
|
overridevirtual |
Synchronises with changes in the datasource.
Reimplemented from QgsMapLayer.
Definition at line 375 of file qgsvectorlayer.cpp.
void QgsVectorLayer::remAttributeAlias | ( | int | attIndex | ) |
Removes an alias (a display name) for attributes to display in dialogs.
Definition at line 2437 of file qgsvectorlayer.cpp.
void QgsVectorLayer::removeExpressionField | ( | int | index | ) |
Remove an expression field.
index | The index of the field |
Definition at line 3196 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::removeJoin | ( | const QString & | joinLayerId | ) |
Removes a vector layer join.
Definition at line 3168 of file qgsvectorlayer.cpp.
int QgsVectorLayer::removePolygonIntersections | ( | QgsGeometry * | geom, |
const QgsFeatureIds & | ignoreFeatures = QgsFeatureIds() |
||
) |
Changes the specified geometry such that it has no intersections with other polygon (or multipolygon) geometries in this vector layer.
geom | geometry to modify |
ignoreFeatures | list of feature ids where intersections should be ignored |
Definition at line 1436 of file qgsvectorlayer.cpp.
|
slot |
Clear selection.
Definition at line 630 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::renameAttribute | ( | int | attIndex, |
const QString & | newName | ||
) |
Renames an attribute field (but does not commit it).
attIndex | attribute index |
newName | new name of field |
Definition at line 2452 of file qgsvectorlayer.cpp.
|
inline |
Return renderer V2.
Definition at line 818 of file qgsvectorlayer.h.
|
inline |
Return const renderer V2.
Definition at line 823 of file qgsvectorlayer.h.
bool QgsVectorLayer::rollBack | ( | bool | deleteBuffer = true | ) |
Stop editing and discard the edits.
deleteBuffer | whether to delete editing buffer |
Definition at line 2671 of file qgsvectorlayer.cpp.
|
signal |
Deprecated: This signal has never been emitted.
|
virtual |
Save named and sld style of the layer to the style table in the db.
name | |
description | |
useAsDefault | |
uiFileContent | |
msgError |
Definition at line 4389 of file qgsvectorlayer.cpp.
void QgsVectorLayer::select | ( | QgsRectangle & | rect, |
bool | addToSelection | ||
) |
Select features found within the search rectangle (in layer's coordinates)
rect | The search rectangle |
addToSelection | If set to true will not clear before selecting |
Definition at line 439 of file qgsvectorlayer.cpp.
|
slot |
Select feature by its ID.
featureId | The id of the feature to select |
Definition at line 411 of file qgsvectorlayer.cpp.
|
slot |
Select features by their ID.
featureIds | The ids of the features to select |
Definition at line 418 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectAll | ( | ) |
Select all the features.
Definition at line 579 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByExpression | ( | const QString & | expression, |
QgsVectorLayer::SelectBehaviour | behaviour = SetSelection |
||
) |
Select matching features using an expression.
expression | expression to evaluate to select features |
behaviour | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 466 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByIds | ( | const QgsFeatureIds & | ids, |
QgsVectorLayer::SelectBehaviour | behaviour = SetSelection |
||
) |
Select matching features using a list of feature IDs.
Will emit the selectionChanged() signal with the clearAndSelect flag set.
ids | feature IDs to select |
behaviour | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 529 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByRect | ( | QgsRectangle & | rect, |
QgsVectorLayer::SelectBehaviour | behaviour = SetSelection |
||
) |
Select features found within the search rectangle (in layer's coordinates)
rect | search rectangle |
behaviour | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 444 of file qgsvectorlayer.cpp.
int QgsVectorLayer::selectedFeatureCount | ( | ) |
The number of features that are selected in this layer.
Definition at line 2722 of file qgsvectorlayer.cpp.
QgsFeatureList QgsVectorLayer::selectedFeatures | ( | ) |
Get a copy of the user-selected features.
Definition at line 2732 of file qgsvectorlayer.cpp.
const QgsFeatureIds & QgsVectorLayer::selectedFeaturesIds | ( | ) | const |
Return reference to identifiers of selected features.
Definition at line 2727 of file qgsvectorlayer.cpp.
QgsFeatureIterator QgsVectorLayer::selectedFeaturesIterator | ( | QgsFeatureRequest | request = QgsFeatureRequest() | ) |
Get an iterator of the selected features.
request | You may specify a request, e.g. to limit the set of requested attributes. Any filter on the request will be discarded. |
Definition at line 2760 of file qgsvectorlayer.cpp.
|
signal |
This signal is emitted when selection was changed.
selected | Newly selected feature ids |
deselected | Ids of all features which have previously been selected but are not any more |
clearAndSelect | In case this is set to true, the old selection was dismissed and the new selection corresponds to selected |
|
signal |
This signal is emitted when selection was changed.
void QgsVectorLayer::setAnnotationForm | ( | const QString & | ui | ) |
Set annotation form for layer.
Definition at line 3037 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setAttributeTableConfig | ( | const QgsAttributeTableConfig & | attributeTableConfig | ) |
Set the attribute table configuration object.
This defines the appearance of the attribute table.
Definition at line 4030 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setCheckedState | ( | int | idx, |
const QString & | checked, | ||
const QString & | notChecked | ||
) |
Set string representing 'true' for a checkbox.
Use
Use editFormConfig()->setWidgetConfig()
instead
Definition at line 3143 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setCoordinateSystem | ( | ) |
Setup the coordinate system transformation for the layer.
Definition at line 2945 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDataSource | ( | const QString & | dataSource, |
const QString & | baseName, | ||
const QString & | provider, | ||
bool | loadDefaultStyleFlag = false |
||
) |
Update the data source of the layer.
The layer's renderer and legend will be preserved only if the geometry type of the new data source matches the current geometry type of the layer.
dataSource | new layer data source |
baseName | base name of the layer |
provider | provider string |
loadDefaultStyleFlag | set to true to reset the layer's style to the default for the data source |
Definition at line 1675 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDefaultValueExpression | ( | int | index, |
const QString & | expression | ||
) |
Sets an expression to use when calculating the default value for a field.
index | field index |
expression | expression to evaluate when calculating default values for field. Pass an empty expression to clear the default. |
Definition at line 3321 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDiagramLayerSettings | ( | const QgsDiagramLayerSettings & | s | ) |
Definition at line 4039 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDiagramRenderer | ( | QgsDiagramRendererV2 * | r | ) |
Sets diagram rendering object (takes ownership)
Definition at line 657 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDisplayExpression | ( | const QString & | displayExpression | ) |
Set the preview expression, used to create a human readable preview string.
Used e.g. in the attribute table feature list. Uses QgsExpression.
displayExpression | The expression which will be used to preview features for this layer |
Definition at line 2971 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDisplayField | ( | const QString & | fldName = "" | ) |
Set the primary display field to be used in the identify results dialog.
sets the preferred display field based on some fuzzy logic
Definition at line 236 of file qgsvectorlayer.cpp.
|
inline |
Set edit form.
editFormConfig()->setUiForm()
instead Definition at line 1643 of file qgsvectorlayer.h.
|
inline |
Set python function for edit form initialization.
editFormConfig()->setInitFunction()
instead Definition at line 1675 of file qgsvectorlayer.h.
|
inline |
Set the active layout for the attribute editor for this layer.
editFormConfig()->setLayout()
instead Definition at line 1572 of file qgsvectorlayer.h.
|
inline |
Set the editor widget type for a field.
QGIS ships the following widget types, additional types may be available depending on plugins.
attrIdx | Index of the field |
widgetType | Type id of the editor widget to use |
editFormConfig()->setWidgetType()
instead Definition at line 1604 of file qgsvectorlayer.h.
|
inline |
Set the editor widget config for a field.
Python: Will accept a map.
Example:
attrIdx | Index of the field |
config | The config to set for this field |
editFormConfig()->setWidgetConfig()
instead Definition at line 1623 of file qgsvectorlayer.h.
void QgsVectorLayer::setEditType | ( | int | idx, |
EditType | edit | ||
) |
Set edit type.
editFormConfig()->setWidgetType()
instead Definition at line 3022 of file qgsvectorlayer.cpp.
Definition at line 1496 of file qgsvectorlayer.h.
Definition at line 1493 of file qgsvectorlayer.h.
|
overrideprotectedvirtual |
void QgsVectorLayer::setFeatureBlendMode | ( | QPainter::CompositionMode | blendMode | ) |
Set the blending mode used for rendering each feature.
Write blend mode for features.
Definition at line 3756 of file qgsvectorlayer.cpp.
|
inline |
Set type of feature form pop-up suppression after feature creation (overrides app setting)
editFormConfig()->setSuppress()
instead Definition at line 1655 of file qgsvectorlayer.h.
|
inline |
Set edit widget editable.
editFormConfig()->setFieldEditable()
instead Definition at line 1732 of file qgsvectorlayer.h.
void QgsVectorLayer::setLabeling | ( | QgsAbstractVectorLayerLabeling * | labeling | ) |
Set labeling configuration.
Takes ownership of the object.
Definition at line 1518 of file qgsvectorlayer.cpp.
|
inline |
Label widget on top.
editFormConfig()->setLabelOnTop()
instead Definition at line 1738 of file qgsvectorlayer.h.
void QgsVectorLayer::setLayerTransparency | ( | int | layerTransparency | ) |
Set the transparency for the vector layer.
Write transparency for layer.
Definition at line 3770 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setProviderEncoding | ( | const QString & | encoding | ) |
Sets the textencoding of the data provider.
Definition at line 648 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::setReadOnly | ( | bool | readonly = true | ) |
Make layer read-only (editing disabled) or not.
Definition at line 2996 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setRendererV2 | ( | QgsFeatureRendererV2 * | r | ) |
Set renderer which will be invoked to represent this layer.
Ownership is transferred.
Definition at line 3076 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setSelectedFeatures | ( | const QgsFeatureIds & | ids | ) |
Change selection to the new set of features.
Dismisses the current selection. Will emit the selectionChanged( const QgsFeatureIds&, const QgsFeatureIds&qt_check_for_QOBJECT_macro, bool ) signal with the clearAndSelect flag set.
ids | The ids which will be the new selection |
Definition at line 2717 of file qgsvectorlayer.cpp.
|
inline |
Set the simplification settings for fast rendering of features.
Definition at line 1897 of file qgsvectorlayer.h.
|
virtual |
Set the string (typically sql) used to define a subset of the layer.
subset | The subset string. This may be the where clause of a sql statement or other defintion string specific to the underlying dataprovider and data store. |
Definition at line 1063 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::simplifyDrawingCanbeApplied | ( | const QgsRenderContext & | renderContext, |
QgsVectorSimplifyMethod::SimplifyHint | simplifyHint | ||
) | const |
Returns whether the VectorLayer can apply the specified simplification hint.
Definition at line 1084 of file qgsvectorlayer.cpp.
|
inline |
Returns the simplification settings for fast rendering of features.
Definition at line 1901 of file qgsvectorlayer.h.
bool QgsVectorLayer::snapPoint | ( | QgsPoint & | point, |
double | tolerance | ||
) |
Snaps a point to the closest vertex if there is one within the snapping tolerance.
point | The point which is set to the position of a vertex if there is one within the snapping tolerance. If there is no point within this tolerance, point is left unchanged. |
tolerance | The snapping tolerance |
Definition at line 2799 of file qgsvectorlayer.cpp.
int QgsVectorLayer::snapWithContext | ( | const QgsPoint & | startPoint, |
double | snappingTolerance, | ||
QMultiMap< double, QgsSnappingResult > & | snappingResults, | ||
QgsSnapper::SnappingType | snap_to | ||
) |
Snaps to segment or vertex within given tolerance.
startPoint | point to snap (in layer coordinates) |
snappingTolerance | distance tolerance for snapping |
snappingResults | snapping results. Key is the distance between startPoint and snapping target |
snap_to | to segment / to vertex |
Definition at line 2824 of file qgsvectorlayer.cpp.
int QgsVectorLayer::splitFeatures | ( | const QList< QgsPoint > & | splitLine, |
bool | topologicalEditing = false |
||
) |
Splits features cut by the given line.
splitLine | line that splits the layer features |
topologicalEditing | true if topological editing is enabled |
Definition at line 1427 of file qgsvectorlayer.cpp.
int QgsVectorLayer::splitParts | ( | const QList< QgsPoint > & | splitLine, |
bool | topologicalEditing = false |
||
) |
Splits parts cut by the given line.
splitLine | line that splits the layer features |
topologicalEditing | true if topological editing is enabled |
Definition at line 1418 of file qgsvectorlayer.cpp.
|
slot |
Make layer editable.
This starts an edit session on this layer. Changes made in this edit session will not be made persistent until commitChanges() is called and can be reverted by calling rollBack().
Definition at line 1527 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::storageType | ( | ) | const |
Returns the permanent storage type for this layer as a friendly name.
Definition at line 199 of file qgsvectorlayer.cpp.
|
virtual |
Get the string (typically sql) used to define a subset of the layer.
Definition at line 1053 of file qgsvectorlayer.cpp.
int QgsVectorLayer::translateFeature | ( | QgsFeatureId | featureId, |
double | dx, | ||
double | dy | ||
) |
Translates feature by dx, dy.
featureId | id of the feature to translate |
dx | translation of x-coordinate |
dy | translation of y-coordinate |
Definition at line 1405 of file qgsvectorlayer.cpp.
Calculates a list of unique values contained within an attribute in the layer.
Note that in some circumstances when unsaved changes are present for the layer then the returned list may contain outdated values (for instance when the attribute value in a saved feature has been changed inside the edit buffer then the previous saved value will be included in the returned list).
index | column index for attribute |
uniqueValues | out: result list |
limit | maximum number of values to return (or -1 if unlimited) |
Definition at line 3345 of file qgsvectorlayer.cpp.
|
signal |
Is emitted, whenever the fields available from this layer have been changed.
This can be due to manually adding attributes or due to a join.
void QgsVectorLayer::updateExpressionField | ( | int | index, |
const QString & | exp | ||
) |
Changes the expression used to define an expression based (virtual) field.
index | The index of the expression to change |
exp | The new expression to set |
Definition at line 3211 of file qgsvectorlayer.cpp.
|
virtualslot |
Update the extents for the layer.
This is necessary if features are added/deleted or the layer has been subsetted.
Definition at line 956 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::updateFeature | ( | QgsFeature & | f | ) |
Updates an existing feature.
This method needs to query the datasource on every call. Consider using changeAttributeValue() or changeGeometry() instead.
f | Feature to update |
Definition at line 1127 of file qgsvectorlayer.cpp.
void QgsVectorLayer::updateFields | ( | ) |
Assembles mUpdatedFields considering provider fields, joined fields and added fields.
Definition at line 3217 of file qgsvectorlayer.cpp.
Access value map.
editFormConfig()->widgetConfig()
instead Definition at line 3042 of file qgsvectorlayer.cpp.
QgsVectorLayer::ValueRelationData QgsVectorLayer::valueRelation | ( | int | idx | ) |
Access value relation widget data.
Definition at line 4320 of file qgsvectorlayer.cpp.
const QList< QgsVectorJoinInfo > QgsVectorLayer::vectorJoins | ( | ) | const |
Definition at line 3178 of file qgsvectorlayer.cpp.
QSize QgsVectorLayer::widgetSize | ( | int | idx | ) |
Access widget size for photo and webview widget.
editFormConfig()->widgetConfig()
instead Definition at line 3068 of file qgsvectorlayer.cpp.
QGis::WkbType QgsVectorLayer::wkbType | ( | ) | const |
Returns the WKBType or WKBUnknown in case of error.
Definition at line 693 of file qgsvectorlayer.cpp.
|
signal |
Signal emitted whenever the symbology (QML-file) for this layer is being written.
If there is custom style information you want to save to the file, you can connect to this signal and update the element accordingly.
element | The XML element where you can add additional style information to. |
doc | The XML document that you can use to create new XML nodes. |
errorMessage | Write error messages into this string. |
bool QgsVectorLayer::writeSld | ( | QDomNode & | node, |
QDomDocument & | doc, | ||
QString & | errorMessage | ||
) | const |
Writes the symbology of the layer into the document provided in SLD 1.1 format.
node | the node that will have the style element added to it. |
doc | the document that will have the QDomNode added. |
errorMessage | reference to string that will be updated with any error messages |
Definition at line 2328 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::writeSld | ( | QDomNode & | node, |
QDomDocument & | doc, | ||
QString & | errorMessage, | ||
const QgsStringMap & | props | ||
) | const |
Writes the symbology of the layer into the document provided in SLD 1.1 format.
node | the node that will have the style element added to it. |
doc | the document that will have the QDomNode added. |
errorMessage | reference to string that will be updated with any error messages |
props | a open ended set of properties that can drive/inform the SLD encoding |
Definition at line 2333 of file qgsvectorlayer.cpp.
|
overridevirtual |
Write just the style information for the layer into the document.
node | the node that will have the style element added to it. |
doc | the document that will have the QDomNode added. |
errorMessage | reference to string that will be updated with any error messages |
Reimplemented from QgsMapLayer.
Definition at line 2199 of file qgsvectorlayer.cpp.
|
overridevirtual |
Write the symbology for the layer into the docment provided.
node | the node that will have the style element added to it. |
doc | the document that will have the QDomNode added. |
errorMessage | reference to string that will be updated with any error messages |
Implements QgsMapLayer.
Definition at line 2118 of file qgsvectorlayer.cpp.
|
overridevirtual |
Write vector layer specific state to project file Dom node.
Reimplemented from QgsMapLayer.
Definition at line 1815 of file qgsvectorlayer.cpp.
|
friend |
Definition at line 2329 of file qgsvectorlayer.h.
|
friend |
Definition at line 2361 of file qgsvectorlayer.h.