QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
Represents a vector layer which manages a vector based data sets. More...
#include <qgsvectorlayer.h>
Classes | |
struct | DeleteContext |
Context for cascade delete features. More... | |
struct | LayerOptions |
Setting options for loading vector layers. More... | |
Public Types | |
enum | EditResult { Success = 0 , EmptyGeometry = 1 , EditFailed = 2 , FetchFeatureFailed = 3 , InvalidLayer = 4 } |
Result of an edit operation. More... | |
enum | SelectBehavior { SetSelection , AddToSelection , IntersectSelection , RemoveFromSelection } |
Selection behavior. More... | |
enum | VertexMarkerType { SemiTransparentCircle , Cross , NoMarker } |
Editing vertex markers. More... | |
Public Types inherited from QgsMapLayer | |
enum | LayerFlag { Identifiable = 1 << 0 , Removable = 1 << 1 , Searchable = 1 << 2 , Private = 1 << 3 } |
Flags for the map layer. More... | |
enum | PropertyType { Style = 0 , Metadata } |
Maplayer has a style and a metadata property. More... | |
enum | ReadFlag { FlagDontResolveLayers = 1 << 0 , FlagTrustLayerMetadata = 1 << 1 } |
Flags which control project read behavior. More... | |
enum | StyleCategory { LayerConfiguration = 1 << 0 , Symbology = 1 << 1 , Symbology3D = 1 << 2 , Labeling = 1 << 3 , Fields = 1 << 4 , Forms = 1 << 5 , Actions = 1 << 6 , MapTips = 1 << 7 , Diagrams = 1 << 8 , AttributeTable = 1 << 9 , Rendering = 1 << 10 , CustomProperties = 1 << 11 , GeometryOptions = 1 << 12 , Relations = 1 << 13 , Temporal = 1 << 14 , Legend = 1 << 15 , Elevation = 1 << 16 , AllStyleCategories } |
Categories of style to distinguish appropriate sections for import/export. More... | |
Public Types inherited from QgsFeatureSink | |
enum | Flag { FastInsert = 1 << 1 , RollBackOnErrors = 1 << 2 } |
Flags controlling how features are added to a sink. More... | |
enum | SinkFlag { RegeneratePrimaryKey = 1 << 1 } |
Flags that can be set on a QgsFeatureSink. More... | |
Public Types inherited from QgsFeatureSource | |
enum | FeatureAvailability { NoFeaturesAvailable , FeaturesAvailable , FeaturesMaybeAvailable } |
Possible return value for hasFeatures() to determine if a source is empty. More... | |
enum | SpatialIndexPresence { SpatialIndexUnknown = 0 , SpatialIndexNotPresent = 1 , SpatialIndexPresent = 2 } |
Enumeration of spatial index presence states. More... | |
Public Slots | |
bool | accept (QgsStyleEntityVisitorInterface *visitor) const override |
Q_INVOKABLE void | deselect (const QgsFeatureIds &featureIds) |
Deselects features by their ID. More... | |
void | deselect (QgsFeatureId featureId) |
Deselects feature by its ID. More... | |
SpatialIndexPresence | hasSpatialIndex () const override |
Q_INVOKABLE void | removeSelection () |
Clear selection. More... | |
void | reselect () |
Reselects the previous set of selected features. More... | |
Q_INVOKABLE void | select (const QgsFeatureIds &featureIds) |
Selects features by their ID. More... | |
void | select (QgsFeatureId featureId) |
Selects feature by its ID. More... | |
virtual void | setTransformContext (const QgsCoordinateTransformContext &transformContext) override |
Sets the coordinate transform context to transformContext. More... | |
Q_INVOKABLE bool | startEditing () |
Makes the layer editable. More... | |
virtual void | updateExtents (bool force=false) |
Update the extents for the layer. More... | |
Public Slots inherited from QgsMapLayer | |
void | emitStyleChanged () |
Triggers an emission of the styleChanged() signal. More... | |
QgsProject * | project () const |
Returns the parent project if this map layer is added to a project. More... | |
void | setMaximumScale (double scale) |
Sets the maximum map scale (i.e. More... | |
void | setMinimumScale (double scale) |
Sets the minimum map scale (i.e. More... | |
void | setRefreshOnNofifyMessage (const QString &message) |
Set the notification message that triggers repaint If refresh on notification is enabled, the notification will triggerRepaint only if the notification message is equal to. More... | |
void | setRefreshOnNotifyEnabled (bool enabled) |
Set whether provider notification is connected to triggerRepaint. More... | |
void | setScaleBasedVisibility (bool enabled) |
Sets whether scale based visibility is enabled for the layer. More... | |
virtual void | setTransformContext (const QgsCoordinateTransformContext &transformContext)=0 |
Sets the coordinate transform context to transformContext. More... | |
void | trigger3DUpdate () |
Will advise any 3D maps that this layer requires to be updated in the scene. More... | |
void | triggerRepaint (bool deferredUpdate=false) |
Will advise the map canvas (and any other interested party) that this layer requires to be repainted. More... | |
Signals | |
void | afterCommitChanges () |
Emitted after changes are committed to the data provider. More... | |
void | afterRollBack () |
Emitted after changes are rolled back. More... | |
void | allowCommitChanged () |
Emitted whenever the allowCommitChanged() property of this layer changes. More... | |
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) |
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 (bool stopEditing) |
Emitted before changes are committed to the data provider. More... | |
void | beforeEditingStarted () |
Emitted before editing on this layer is started. More... | |
void | beforeModifiedCheck () const |
Emitted when the layer is checked for modifications. Use for last-minute additions. More... | |
void | beforeRemovingExpressionField (int idx) |
Will be emitted, when an expression field is going to be deleted from this vector layer. More... | |
void | beforeRollBack () |
Emitted before changes are rolled back. More... | |
void | committedAttributesAdded (const QString &layerId, const QList< QgsField > &addedAttributes) |
Emitted when attributes are added to the provider. More... | |
void | committedAttributesDeleted (const QString &layerId, const QgsAttributeList &deletedAttributes) |
Emitted when attributes are deleted from the provider. More... | |
void | committedAttributeValuesChanges (const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues) |
Emitted when attribute value changes are saved to the provider. More... | |
void | committedFeaturesAdded (const QString &layerId, const QgsFeatureList &addedFeatures) |
Emitted when features are added to the provider. More... | |
void | committedFeaturesRemoved (const QString &layerId, const QgsFeatureIds &deletedFeatureIds) |
Emitted when features are deleted from the provider. More... | |
void | committedGeometriesChanges (const QString &layerId, const QgsGeometryMap &changedGeometries) |
Emitted when geometry changes are saved to the provider. More... | |
void | displayExpressionChanged () |
Emitted when the display expression changes. More... | |
void | editCommandDestroyed () |
Signal emitted, when 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 | editFormConfigChanged () |
Will be emitted whenever the edit form configuration of this layer changes. More... | |
void | editingStarted () |
Emitted when editing on this layer has started. More... | |
void | editingStopped () |
Emitted when edited changes have been successfully 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, const QgsGeometry &geometry) |
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 | layerModified () |
Emitted when modifications has been done on layer. More... | |
void | mapTipTemplateChanged () |
Emitted when the map tip changes. 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... | |
void | readOnlyChanged () |
Emitted when the read only state of this layer is changed. More... | |
void | selectionChanged (const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect) |
Emitted when selection was changed. More... | |
void | subsetStringChanged () |
Emitted when the layer's subset string has changed. More... | |
void | supportsEditingChanged () |
Emitted when the read only state or the data provider of this layer is changed. More... | |
void | symbolFeatureCountMapChanged () |
Emitted when the feature count for symbols on this layer has been recalculated. More... | |
void | updatedFields () |
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 | autoRefreshIntervalChanged (int interval) |
Emitted when the auto refresh interval changes. More... | |
void | beforeResolveReferences (QgsProject *project) |
Emitted when all layers are loaded and references can be resolved, just before the references of this layer are resolved. More... | |
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 | crsChanged () |
Emit a signal that layer's CRS has been reset. More... | |
void | customPropertyChanged (const QString &key) |
Emitted when a custom property of the layer has been changed or removed. More... | |
void | dataChanged () |
Data of layer changed. More... | |
void | dataSourceChanged () |
Emitted whenever the layer's data source has been changed. More... | |
void | dependenciesChanged () |
Emitted when dependencies are changed. More... | |
void | flagsChanged () |
Emitted when layer's flags have been modified. More... | |
void | isValidChanged () |
Emitted when the validity of this layer changed. More... | |
void | legendChanged () |
Signal emitted when legend of the layer has changed. More... | |
void | metadataChanged () |
Emitted when the layer's metadata is changed. More... | |
void | nameChanged () |
Emitted when the name has been changed. More... | |
void | opacityChanged (double opacity) |
Emitted when the layer's opacity is changed, where opacity is a value between 0 (transparent) and 1 (opaque). More... | |
void | recalculateExtents () const |
This is used to send a request that any mapcanvas using this layer update its extents. More... | |
void | renderer3DChanged () |
Signal emitted when 3D renderer associated with the layer has changed. More... | |
void | rendererChanged () |
Signal emitted when renderer is changed. More... | |
void | repaintRequested (bool deferredUpdate=false) |
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 | request3DUpdate () |
Signal emitted when a layer requires an update in any 3D maps. More... | |
void | statusChanged (const QString &status) |
Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar) More... | |
void | styleChanged () |
Signal emitted whenever a change affects the layer's style. More... | |
void | styleLoaded (QgsMapLayer::StyleCategories categories) |
Emitted when a style has been loaded. More... | |
void | willBeDeleted () |
Emitted in the destructor when the layer is about to be deleted, but it is still in a perfectly valid state: the last chance for other pieces of code for some cleanup if they use the layer. More... | |
Public Member Functions | |
QgsVectorLayer (const QgsVectorLayer &rhs)=delete | |
QgsVectorLayer cannot be copied. More... | |
QgsVectorLayer (const QString &path=QString(), const QString &baseName=QString(), const QString &providerLib="ogr", const QgsVectorLayer::LayerOptions &options=QgsVectorLayer::LayerOptions()) | |
Constructor - creates a vector layer. More... | |
~QgsVectorLayer () override | |
QgsActionManager * | actions () |
Returns all layer actions defined on this layer. More... | |
const QgsActionManager * | actions () const |
Returns 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... | |
int | addExpressionField (const QString &exp, const QgsField &fld) |
Add a new field which is calculated by the expression specified. More... | |
bool | addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) FINAL |
Adds a single feature to the sink. More... | |
void | addFeatureRendererGenerator (QgsFeatureRendererGenerator *generator) |
Adds a new feature renderer generator to the layer. More... | |
bool | addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) FINAL |
Adds a list of features to the sink. More... | |
bool | addJoin (const QgsVectorLayerJoinInfo &joinInfo) |
Joins another vector layer to this layer. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | addPart (const QgsPointSequence &ring) |
Adds a new part polygon to a multipart feature. More... | |
Q_DECL_DEPRECATED QgsGeometry::OperationResult | addPart (const QList< QgsPointXY > &ring) |
Adds a new part polygon to a multipart feature. More... | |
Q_DECL_DEPRECATED QgsGeometry::OperationResult | addPart (const QVector< QgsPointXY > &ring) |
Adds a new part polygon to a multipart feature. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | addPart (QgsCurve *ring) |
Q_INVOKABLE QgsGeometry::OperationResult | addRing (const QgsPointSequence &ring, QgsFeatureId *featureId=nullptr) |
Adds a ring to polygon/multipolygon features. More... | |
Q_DECL_DEPRECATED QgsGeometry::OperationResult | addRing (const QVector< QgsPointXY > &ring, QgsFeatureId *featureId=nullptr) |
Adds a ring to polygon/multipolygon features. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | addRing (QgsCurve *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... | |
int | addTopologicalPoints (const QgsPointSequence &ps) |
Adds a vertex to segments which intersect any of the points p but don't already have a vertex there. More... | |
Q_DECL_DEPRECATED int | addTopologicalPoints (const QgsPointXY &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, QgsFeatureIds *fids=nullptr) const |
Calculates an aggregated value from the layer's features. More... | |
bool | allowCommit () const |
Controls, if the layer is allowed to commit changes. More... | |
QString | attributeAlias (int index) 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 index) const |
Convenience function that returns the attribute alias if defined or the field name else. More... | |
QgsAttributeList | attributeList () const |
Returns list of attribute indexes. More... | |
QgsAttributeTableConfig | attributeTableConfig () const |
Returns the attribute table configuration object. More... | |
QgsAuxiliaryLayer * | auxiliaryLayer () |
Returns the current auxiliary layer. More... | |
const QgsAuxiliaryLayer * | auxiliaryLayer () const |
Returns the current const auxiliary layer. More... | |
void | beginEditCommand (const QString &text) |
Create edit command for undo/redo operations. More... | |
Q_INVOKABLE QgsRectangle | boundingBoxOfSelected () const |
Returns the bounding box of the selected features. If there is no selection, QgsRectangle(0,0,0,0) is returned. More... | |
QString | capabilitiesString () const |
Capabilities for this layer, comma separated and translated. More... | |
bool | changeAttributeValue (QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue=QVariant(), bool skipDefaultValues=false) |
Changes an attribute value for a feature (but does not immediately commit the changes). More... | |
bool | changeAttributeValues (QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues=QgsAttributeMap(), bool skipDefaultValues=false) |
Changes attributes' values for a feature (but does not immediately commit the changes). More... | |
bool | changeGeometry (QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue=false) |
Changes a feature's geometry within the layer's edit buffer (but does not immediately commit the changes). More... | |
QgsVectorLayer * | clone () const override |
Returns a new instance equivalent to this one. More... | |
Q_INVOKABLE bool | commitChanges (bool stopEditing=true) |
Attempts to commit to the underlying data provider any buffered changes made since the last to call to startEditing(). More... | |
QStringList | commitErrors () const |
Returns a list containing any error messages generated when attempting to commit changes to the layer. More... | |
QgsConditionalLayerStyles * | conditionalStyles () const |
Returns the conditional styles that are set for this layer. More... | |
QString | constraintDescription (int index) const |
Returns the descriptive name for the constraint expression for a specified field index. More... | |
QString | constraintExpression (int index) const |
Returns the constraint expression for for a specified field index, if set. More... | |
QgsVectorLayerFeatureCounter * | countSymbolFeatures (bool storeSymbolFids=false) |
Count features for symbols. More... | |
QgsExpressionContext | createExpressionContext () const FINAL |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
QgsExpressionContextScope * | createExpressionContextScope () const FINAL |
This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. More... | |
QgsMapLayerRenderer * | createMapRenderer (QgsRenderContext &rendererContext) FINAL |
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context. More... | |
QString | dataComment () const |
Returns a description for this layer as defined in the data provider. More... | |
const QgsVectorDataProvider * | dataProvider () const FINAL |
Returns the layer's data provider in a const-correct manner, it may be nullptr . More... | |
QgsVectorDataProvider * | dataProvider () FINAL |
Returns the layer's data provider, it may be nullptr . More... | |
QString | decodedSource (const QString &source, const QString &provider, const QgsReadWriteContext &context) const FINAL |
Called by readLayerXML(), used by derived classes to decode provider's specific data source from project files. More... | |
QVariant | defaultValue (int index, const QgsFeature &feature=QgsFeature(), QgsExpressionContext *context=nullptr) const |
Returns the calculated default value for the specified field index. More... | |
QgsDefaultValue | defaultValueDefinition (int index) const |
Returns the definition of the expression used when calculating the default value for a field. More... | |
virtual bool | deleteAttribute (int attr) |
Deletes an attribute field (but does not commit it). More... | |
bool | deleteAttributes (const QList< int > &attrs) |
Deletes a list of attribute fields (but does not commit it) More... | |
bool | deleteFeature (QgsFeatureId fid, DeleteContext *context=nullptr) |
Deletes a feature from the layer (but does not commit it). More... | |
bool | deleteFeatures (const QgsFeatureIds &fids, DeleteContext *context=nullptr) |
Deletes a set of features from the layer (but does not commit it) More... | |
Q_INVOKABLE bool | deleteSelectedFeatures (int *deletedCount=nullptr, DeleteContext *context=nullptr) |
Deletes the selected features. More... | |
virtual bool | deleteStyleFromDatabase (const QString &styleId, QString &msgError) |
Deletes a style from the database. More... | |
EditResult | deleteVertex (QgsFeatureId featureId, int vertex) |
Deletes a vertex from a feature. More... | |
QSet< QgsMapLayerDependency > | dependencies () const FINAL |
Gets the list of dependencies. More... | |
void | destroyEditCommand () |
Destroy active command and reverts all changes in it. More... | |
const QgsDiagramLayerSettings * | diagramLayerSettings () const |
const QgsDiagramRenderer * | diagramRenderer () const |
bool | diagramsEnabled () const |
Returns whether the layer contains diagrams which are enabled and should be drawn. More... | |
QString | displayExpression () const |
Returns the preview expression, used to create a human readable preview string. More... | |
QString | displayField () const |
This is a shorthand for accessing the displayExpression if it is a simple field. More... | |
Q_INVOKABLE QgsVectorLayerEditBuffer * | editBuffer () |
Buffer with uncommitted editing operations. Only valid after editing has been turned on. More... | |
const QgsVectorLayerEditBuffer * | editBuffer () const |
Buffer with uncommitted editing operations. More... | |
QgsEditFormConfig | editFormConfig () const |
Returns the configuration of the form used to represent this vector layer. More... | |
QgsEditorWidgetSetup | editorWidgetSetup (int index) const |
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field at index . More... | |
QString | encodedSource (const QString &source, const QgsReadWriteContext &context) const FINAL |
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to project files. More... | |
void | endEditCommand () |
Finish edit command and add it to undo/redo stack. More... | |
Q_DECL_DEPRECATED QSet< QString > | excludeAttributesWfs () const |
A set of attributes that are not advertised in WFS requests with QGIS server. More... | |
Q_DECL_DEPRECATED QSet< QString > | excludeAttributesWms () const |
A set of attributes that are not advertised in WMS requests with QGIS server. More... | |
QString | expressionField (int index) const |
Returns the expression used for a given expression field. More... | |
QgsRectangle | extent () const FINAL |
Returns the extent of the layer. More... | |
QPainter::CompositionMode | featureBlendMode () const |
Returns the current blending mode for features. More... | |
long | featureCount () const FINAL |
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... | |
long | featureCount (const QString &legendKey) const |
Number of features rendered with specified legend key. More... | |
QList< const QgsFeatureRendererGenerator * > | featureRendererGenerators () const |
Returns a list of the feature renderer generators owned by the layer. More... | |
QgsField::ConfigurationFlags | fieldConfigurationFlags (int index) const |
Returns the configuration flags of the field at given index. More... | |
QgsFieldConstraints::Constraints | fieldConstraints (int fieldIndex) const |
Returns any constraints which are present for a specified field index. More... | |
QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength > | fieldConstraintsAndStrength (int fieldIndex) const |
Returns a map of constraint with their strength for a specific field of the layer. More... | |
QgsFields | fields () const FINAL |
Returns the list of fields of this layer. More... | |
QgsGeometryOptions * | geometryOptions () const |
Configuration and logic to apply automatically on any edit happening on this layer. More... | |
Q_INVOKABLE QgsWkbTypes::GeometryType | geometryType () const |
Returns point, line or polygon. More... | |
QgsFeature | getFeature (QgsFeatureId fid) const |
Queries the layer for the feature with the given id. More... | |
QgsFeatureIterator | getFeatures (const QgsFeatureIds &fids) |
Queries the layer for the features with the given ids. More... | |
QgsFeatureIterator | getFeatures (const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL |
Queries the layer for features specified in request. More... | |
QgsFeatureIterator | getFeatures (const QgsRectangle &rectangle) |
Queries the layer for the features which intersect the specified rectangle. More... | |
QgsFeatureIterator | getFeatures (const QString &expression) |
Queries the layer for features matching a given expression. More... | |
QgsGeometry | getGeometry (QgsFeatureId fid) const |
Queries the layer for the geometry at the given id. More... | |
QgsFeatureIterator | getSelectedFeatures (QgsFeatureRequest request=QgsFeatureRequest()) const |
Returns an iterator of the selected features. More... | |
virtual QString | getStyleFromDatabase (const QString &styleId, QString &msgError) |
Returns the named style corresponding to style id provided. More... | |
FeatureAvailability | hasFeatures () const FINAL |
Determines if this vector layer has features. More... | |
QString | htmlMetadata () const FINAL |
Obtain a formatted HTML string containing assorted metadata for this layer. More... | |
bool | insertVertex (const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex) |
Inserts a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature. More... | |
bool | insertVertex (double x, double y, QgsFeatureId atFeatureId, int beforeVertex) |
Inserts a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature. More... | |
Q_INVOKABLE void | invertSelection () |
Selects not selected features and deselects selected ones. More... | |
Q_INVOKABLE void | invertSelectionInRectangle (QgsRectangle &rect) |
Inverts selection of features found within the search rectangle (in layer's coordinates) More... | |
bool | isAuxiliaryField (int index, int &srcIndex) const |
Returns true if the field comes from the auxiliary layer, false otherwise. More... | |
bool | isEditable () const FINAL |
Returns true if the provider is in editing mode. More... | |
bool | isEditCommandActive () const |
Tests if an edit command is active. More... | |
virtual bool | isModified () const |
Returns true if the provider has been modified since the last commit. More... | |
bool | isSpatial () const FINAL |
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry. More... | |
QgsVectorLayerJoinBuffer * | joinBuffer () |
Returns the join buffer object. More... | |
const QgsVectorLayerJoinBuffer * | joinBuffer () const |
Returns a const pointer on join buffer object. More... | |
QgsAbstractVectorLayerLabeling * | labeling () |
Access to labeling configuration. More... | |
const QgsAbstractVectorLayerLabeling * | labeling () const |
Access to const labeling configuration. More... | |
bool | labelsEnabled () const |
Returns whether the layer contains labels which are enabled and should be drawn. 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... | |
bool | loadAuxiliaryLayer (const QgsAuxiliaryStorage &storage, const QString &key=QString()) |
Loads the auxiliary layer for this vector layer. More... | |
QString | loadDefaultStyle (bool &resultFlag) FINAL |
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 QString | loadNamedStyle (const QString &theURI, bool &resultFlag, bool loadFromLocalDb, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) |
Loads a named style from file/local db/datasource db. More... | |
QString | loadNamedStyle (const QString &theURI, bool &resultFlag, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) FINAL |
Calls loadNamedStyle( theURI, resultFlag, false ); Retained for backward compatibility. More... | |
QString | mapTipTemplate () const |
The mapTip is a pretty, html representation for feature information. More... | |
QVariant | maximumValue (int index) const FINAL |
Returns the maximum value for an attribute column or an invalid variant in case of error. More... | |
QVariant | minimumValue (int index) const FINAL |
Returns the minimum value for an attribute column or an invalid variant in case of error. More... | |
Q_INVOKABLE void | modifySelection (const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds) |
Modifies the current selection on this layer. More... | |
bool | moveVertex (const QgsPoint &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... | |
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... | |
QgsVectorLayer & | operator= (QgsVectorLayer const &rhs)=delete |
QgsVectorLayer cannot be copied. More... | |
QgsAttributeList | primaryKeyAttributes () const |
Returns the list of attributes which make up the layer's primary keys. More... | |
bool | readExtentFromXml () const |
Returns true if the extent is read from the XML document when data source has no metadata, false if it's the data provider which determines it. More... | |
bool | readSld (const QDomNode &node, QString &errorMessage) FINAL |
bool | readStyle (const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) FINAL |
bool | readSymbology (const QDomNode &layerNode, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) FINAL |
bool | readXml (const QDomNode &layer_node, QgsReadWriteContext &context) FINAL |
Reads vector layer specific state from project file Dom node. More... | |
QList< QgsRelation > | referencingRelations (int idx) const |
Returns the layer's relations, where the foreign key is on this layer. More... | |
void | reload () FINAL |
Synchronises with changes in the datasource. More... | |
void | removeExpressionField (int index) |
Removes an expression field. More... | |
void | removeFeatureRendererGenerator (const QString &id) |
Removes the feature renderer with matching id from the layer. More... | |
void | removeFieldAlias (int index) |
Removes an alias (a display name) for attributes to display in dialogs. More... | |
void | removeFieldConstraint (int index, QgsFieldConstraints::Constraint constraint) |
Removes a constraint for a specified field index. More... | |
bool | removeJoin (const QString &joinLayerId) |
Removes a vector layer join. More... | |
bool | renameAttribute (int index, const QString &newName) |
Renames an attribute field (but does not commit it). More... | |
QgsFeatureRenderer * | renderer () |
Returns the feature renderer used for rendering the features in the layer in 2D map views. More... | |
const QgsFeatureRenderer * | renderer () const |
Returns the feature renderer used for rendering the features in the layer in 2D map views. More... | |
void | resolveReferences (QgsProject *project) FINAL |
Resolves references to other layers (kept as layer IDs after reading XML) into layer objects. More... | |
Q_INVOKABLE bool | rollBack (bool deleteBuffer=true) |
Stops a current editing operation and discards any uncommitted edits. More... | |
virtual void | saveStyleToDatabase (const QString &name, const QString &description, bool useAsDefault, const QString &uiFileContent, QString &msgError) |
Saves named and sld style of the layer to the style table in the db. More... | |
Q_INVOKABLE void | selectAll () |
Select all the features. More... | |
Q_INVOKABLE void | selectByExpression (const QString &expression, QgsVectorLayer::SelectBehavior behavior=QgsVectorLayer::SetSelection) |
Selects matching features using an expression. More... | |
Q_INVOKABLE void | selectByIds (const QgsFeatureIds &ids, QgsVectorLayer::SelectBehavior behavior=QgsVectorLayer::SetSelection) |
Selects matching features using a list of feature IDs. More... | |
Q_INVOKABLE void | selectByRect (QgsRectangle &rect, QgsVectorLayer::SelectBehavior behavior=QgsVectorLayer::SetSelection) |
Selects features found within the search rectangle (in layer's coordinates) More... | |
int | selectedFeatureCount () const |
Returns the number of features that are selected in this layer. More... | |
Q_INVOKABLE const QgsFeatureIds & | selectedFeatureIds () const |
Returns a list of the selected features IDs in this layer. More... | |
Q_INVOKABLE QgsFeatureList | selectedFeatures () const |
Returns a copy of the user-selected features. More... | |
QgsVectorLayerServerProperties * | serverProperties () const |
Returns QGIS Server Properties of the vector layer. More... | |
void | setAllowCommit (bool allowCommit) |
Controls, if the layer is allowed to commit changes. More... | |
void | setAttributeTableConfig (const QgsAttributeTableConfig &attributeTableConfig) |
Sets the attribute table configuration object. More... | |
void | setAuxiliaryLayer (QgsAuxiliaryLayer *layer=nullptr) |
Sets the current auxiliary layer. More... | |
void | setConstraintExpression (int index, const QString &expression, const QString &description=QString()) |
Sets the constraint expression for the specified field index. More... | |
void | setCoordinateSystem () |
Setup the coordinate system transformation for the layer. More... | |
Q_DECL_DEPRECATED void | setDataSource (const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false) |
Update the data source of the layer. More... | |
void | setDataSource (const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag=false) override |
Updates the data source of the layer. More... | |
void | setDefaultValueDefinition (int index, const QgsDefaultValue &definition) |
Sets the definition of the expression to use when calculating the default value for a field. More... | |
bool | setDependencies (const QSet< QgsMapLayerDependency > &layers) FINAL |
Sets the list of dependencies. More... | |
void | setDiagramLayerSettings (const QgsDiagramLayerSettings &s) |
void | setDiagramRenderer (QgsDiagramRenderer *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 | setEditFormConfig (const QgsEditFormConfig &editFormConfig) |
Sets the editFormConfig (configuration) of the form used to represent this vector layer. More... | |
void | setEditorWidgetSetup (int index, const QgsEditorWidgetSetup &setup) |
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field at index . More... | |
Q_DECL_DEPRECATED void | setExcludeAttributesWfs (const QSet< QString > &att) |
A set of attributes that are not advertised in WFS requests with QGIS server. More... | |
Q_DECL_DEPRECATED void | setExcludeAttributesWms (const QSet< QString > &att) |
A set of attributes that are not advertised in WMS requests with QGIS server. More... | |
void | setFeatureBlendMode (QPainter::CompositionMode blendMode) |
Sets the blending mode used for rendering each feature. More... | |
void | setFieldAlias (int index, const QString &aliasString) |
Sets an alias (a display name) for attributes to display in dialogs. More... | |
void | setFieldConfigurationFlag (int index, QgsField::ConfigurationFlag flag, bool active) |
Sets the given configuration flag for the field at given index to be active or not. More... | |
void | setFieldConfigurationFlags (int index, QgsField::ConfigurationFlags flags) |
Sets the configuration flags of the field at given index. More... | |
void | setFieldConstraint (int index, QgsFieldConstraints::Constraint constraint, QgsFieldConstraints::ConstraintStrength strength=QgsFieldConstraints::ConstraintStrengthHard) |
Sets a constraint for a specified field index. More... | |
void | setLabeling (QgsAbstractVectorLayerLabeling *labeling) |
Sets labeling configuration. More... | |
void | setLabelsEnabled (bool enabled) |
Sets whether labels should be enabled for the layer. More... | |
void | setMapTipTemplate (const QString &mapTipTemplate) |
The mapTip is a pretty, html representation for feature information. More... | |
void | setProviderEncoding (const QString &encoding) |
Sets the text encoding of the data provider. More... | |
void | setReadExtentFromXml (bool readExtentFromXml) |
Flag allowing to indicate if the extent has to be read from the XML document when data source has no metadata or if the data provider has to determine it. More... | |
bool | setReadOnly (bool readonly=true) |
Makes layer read-only (editing disabled) or not. More... | |
void | setRenderer (QgsFeatureRenderer *r) |
Sets the feature renderer which will be invoked to represent this layer in 2D map views. More... | |
void | setSimplifyMethod (const QgsVectorSimplifyMethod &simplifyMethod) |
Sets the simplification settings for fast rendering of features. More... | |
virtual bool | setSubsetString (const QString &subset) |
Sets 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... | |
QgsCoordinateReferenceSystem | sourceCrs () const FINAL |
Returns the coordinate reference system for features in the source. More... | |
QgsRectangle | sourceExtent () const FINAL |
Returns the extent of all geometries from the source. More... | |
QString | sourceName () const FINAL |
Returns a friendly display name for the source. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | splitFeatures (const QgsCurve *curve, QgsPointSequence &topologyTestPoints, bool preserveCircular=false, bool topologicalEditing=false) |
Splits features cut by the given curve. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | splitFeatures (const QgsPointSequence &splitLine, bool topologicalEditing=false) |
Splits features cut by the given line. More... | |
Q_DECL_DEPRECATED QgsGeometry::OperationResult | splitFeatures (const QVector< QgsPointXY > &splitLine, bool topologicalEditing=false) |
Splits features cut by the given line. More... | |
Q_INVOKABLE QgsGeometry::OperationResult | splitParts (const QgsPointSequence &splitLine, bool topologicalEditing=false) |
Splits parts cut by the given line. More... | |
Q_DECL_DEPRECATED QgsGeometry::OperationResult | splitParts (const QVector< QgsPointXY > &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... | |
QgsStoredExpressionManager * | storedExpressionManager () |
Returns the manager of the stored expressions for this layer. More... | |
virtual QString | subsetString () const |
Returns the string (typically sql) used to define a subset of the layer. More... | |
bool | supportsEditing () |
Returns whether the layer supports editing or not. More... | |
QgsFeatureIds | symbolFeatureIds (const QString &legendKey) const |
Ids of features rendered with specified legend key. More... | |
QgsMapLayerTemporalProperties * | temporalProperties () override |
Returns temporal properties associated with the vector layer. More... | |
Q_INVOKABLE int | translateFeature (QgsFeatureId featureId, double dx, double dy) |
Translates feature by dx, dy. More... | |
QStringList | uniqueStringsMatching (int index, const QString &substring, int limit=-1, QgsFeedback *feedback=nullptr) const |
Returns unique string values of an attribute which contain a specified subset string. More... | |
QSet< QVariant > | uniqueValues (int fieldIndex, int limit=-1) const FINAL |
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 &feature, bool skipDefaultValues=false) |
Updates an existing feature in the layer, replacing the attributes and geometry for the feature with matching QgsFeature::id() with the attributes and geometry from feature. More... | |
void | updateFields () |
Will regenerate the fields property of this layer by obtaining all fields from the dataProvider, joined fields and virtual fields. More... | |
const QList< QgsVectorLayerJoinInfo > | vectorJoins () const |
QList< QgsWeakRelation > | weakRelations () const |
Returns the layer's weak relations as specified in the layer's style. More... | |
Q_INVOKABLE QgsWkbTypes::Type | wkbType () const FINAL |
Returns the WKBType or WKBUnknown in case of error. More... | |
bool | writeSld (QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props=QVariantMap()) 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 QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) const FINAL |
bool | writeSymbology (QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) const FINAL |
bool | writeXml (QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context) const FINAL |
Writes vector layer specific state to project file Dom node. More... | |
Public Member Functions inherited from QgsMapLayer | |
QgsMapLayer (QgsMapLayer const &)=delete | |
QgsMapLayer cannot be copied. More... | |
QgsMapLayer (QgsMapLayerType type=QgsMapLayerType::VectorLayer, const QString &name=QString(), const QString &source=QString()) | |
Constructor for QgsMapLayer. More... | |
~QgsMapLayer () override | |
QString | abstract () const |
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. More... | |
virtual bool | accept (QgsStyleEntityVisitorInterface *visitor) const |
Accepts the specified symbology visitor, causing it to visit all symbols associated with the layer. More... | |
QString | attribution () const |
Returns the attribution of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | attributionUrl () const |
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request. More... | |
int | autoRefreshInterval () const |
Returns the auto refresh interval (in milliseconds). More... | |
QPainter::CompositionMode | blendMode () const |
Returns the current blending mode for a layer. More... | |
QgsCoordinateReferenceSystem | crs () const |
Returns the layer's spatial reference system. More... | |
const QgsObjectCustomProperties & | customProperties () const |
Read all custom properties from layer. More... | |
Q_INVOKABLE QVariant | customProperty (const QString &value, const QVariant &defaultValue=QVariant()) const |
Read a custom property from layer. More... | |
Q_INVOKABLE QStringList | customPropertyKeys () const |
Returns list of all keys within custom properties. More... | |
QString | dataUrl () const |
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | dataUrlFormat () const |
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request. More... | |
virtual QgsMapLayerElevationProperties * | elevationProperties () |
Returns the layer's elevation properties. More... | |
virtual QgsError | error () const |
Gets current status error. More... | |
void | exportNamedMetadata (QDomDocument &doc, QString &errorMsg) const |
Export the current metadata of this layer as named metadata in a QDomDocument. More... | |
virtual void | exportNamedStyle (QDomDocument &doc, QString &errorMsg, const QgsReadWriteContext &context=QgsReadWriteContext(), QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) const |
Export the properties of this layer as named style in a QDomDocument. More... | |
virtual void | exportSldStyle (QDomDocument &doc, QString &errorMsg) const |
Export the properties of this layer as SLD style in a QDomDocument. More... | |
QgsMapLayer::LayerFlags | flags () const |
Returns the flags for this layer. More... | |
bool | hasAutoRefreshEnabled () const |
Returns true if auto refresh is enabled for the layer. More... | |
bool | hasScaleBasedVisibility () const |
Returns whether scale based visibility is enabled for the layer. More... | |
QString | id () const |
Returns the layer's unique ID, which is used to access this layer from QgsProject. More... | |
bool | importNamedMetadata (QDomDocument &document, QString &errorMessage) |
Import the metadata of this layer from a QDomDocument. More... | |
virtual bool | importNamedStyle (QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) |
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 | isRefreshOnNotifyEnabled () const |
Returns true if the refresh on provider nofification is enabled. More... | |
virtual bool | isTemporary () const |
Returns true if the layer is considered a temporary layer. More... | |
bool | isValid () const |
Returns the status of the layer. More... | |
QString | keywordList () const |
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request. More... | |
QgsMapLayerLegend * | legend () const |
Can be nullptr . More... | |
QString | legendUrl () const |
Returns the URL for the layer's legend. More... | |
QString | legendUrlFormat () const |
Returns the format for a URL based layer legend. More... | |
virtual QString | loadDefaultMetadata (bool &resultFlag) |
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a record in the users metadata table in their personal qgis.db) More... | |
virtual QString | loadNamedMetadata (const QString &uri, bool &resultFlag) |
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record in the users style table in their personal qgis.db) More... | |
bool | loadNamedMetadataFromDatabase (const QString &db, const QString &uri, QString &qmd) |
Retrieve a named metadata for this layer from a sqlite database. More... | |
virtual bool | loadNamedStyleFromDatabase (const QString &db, const QString &uri, QString &qml) |
Retrieve a named style for this layer from a sqlite database. More... | |
virtual QString | loadSldStyle (const QString &uri, bool &resultFlag) |
Attempts to style the layer using the formatting from an SLD type file. More... | |
double | maximumScale () const |
Returns the maximum map scale (i.e. More... | |
virtual const QgsLayerMetadata & | metadata () const |
Returns a reference to the layer's metadata store. More... | |
virtual QString | metadataUri () const |
Retrieve the metadata URI for this layer (either as a .qmd file on disk or as a record in the users style table in their personal qgis.db) More... | |
QString | metadataUrl () const |
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | metadataUrlFormat () const |
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | metadataUrlType () const |
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request. More... | |
double | minimumScale () const |
Returns the minimum map scale (i.e. More... | |
QString | name () const |
Returns the display name of the layer. More... | |
virtual double | opacity () const |
Returns the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque). More... | |
QgsMapLayer & | operator= (QgsMapLayer const &)=delete |
QgsMapLayer cannot be copied. More... | |
QString | originalXmlProperties () const |
Returns the XML properties of the original layer as they were when the layer was first read from the project file. More... | |
QString | providerType () const |
Returns the provider type (provider key) for this 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, QgsReadWriteContext &context, QgsMapLayer::ReadFlags flags=QgsMapLayer::ReadFlags()) |
Sets state from DOM document. More... | |
bool | readOnly () const |
Returns if this layer is read only. More... | |
virtual bool | readStyle (const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) |
Read the style for the current layer from the DOM node supplied. More... | |
virtual bool | readSymbology (const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)=0 |
Read the symbology for the current layer from the DOM node supplied. More... | |
QString | refreshOnNotifyMessage () const |
Returns the message that should be notified by the provider to triggerRepaint. More... | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from layer. More... | |
QgsAbstract3DRenderer * | renderer3D () const |
Returns 3D renderer associated with the layer. More... | |
virtual QString | saveDefaultMetadata (bool &resultFlag) |
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual QString | saveDefaultStyle (bool &resultFlag) |
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... | |
QString | saveNamedMetadata (const QString &uri, bool &resultFlag) |
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a record in the users style table in their personal qgis.db) More... | |
virtual QString | saveNamedStyle (const QString &uri, bool &resultFlag, StyleCategories categories=AllStyleCategories) |
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 &uri, bool &resultFlag) const |
Saves the properties of this layer to an SLD format file. More... | |
void | setAbstract (const QString &abstract) |
Sets the abstract of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setAttribution (const QString &attrib) |
Sets the attribution of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setAttributionUrl (const QString &attribUrl) |
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setAutoRefreshEnabled (bool enabled) |
Sets whether auto refresh is enabled for the layer. More... | |
void | setAutoRefreshInterval (int interval) |
Sets the auto refresh interval (in milliseconds) for the layer. More... | |
void | setBlendMode (QPainter::CompositionMode blendMode) |
Set the blending mode used for rendering a layer. More... | |
void | setCrs (const QgsCoordinateReferenceSystem &srs, bool emitSignal=true) |
Sets layer's spatial reference system. More... | |
void | setCustomProperties (const QgsObjectCustomProperties &properties) |
Set custom properties for layer. More... | |
Q_INVOKABLE void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for layer. More... | |
void | setDataUrl (const QString &dataUrl) |
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setDataUrlFormat (const QString &dataUrlFormat) |
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setFlags (QgsMapLayer::LayerFlags flags) |
Returns the flags for this layer. More... | |
void | setKeywordList (const QString &keywords) |
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request. More... | |
virtual void | setLayerOrder (const QStringList &layers) |
Reorders the previously selected sublayers of this layer from bottom to top. More... | |
void | setLegend (QgsMapLayerLegend *legend) |
Assign a legend controller to the map layer. More... | |
void | setLegendUrl (const QString &legendUrl) |
Sets the URL for the layer's legend. More... | |
void | setLegendUrlFormat (const QString &legendUrlFormat) |
Sets the format for a URL based layer legend. More... | |
virtual void | setMetadata (const QgsLayerMetadata &metadata) |
Sets the layer's metadata store. More... | |
void | setMetadataUrl (const QString &metaUrl) |
Sets the metadata URL of the layer used by QGIS Server in GetCapabilities request. More... | |
void | setMetadataUrlFormat (const QString &metaUrlFormat) |
Sets the metadata format of the layer used by QGIS Server in GetCapabilities request. 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... | |
virtual void | setOpacity (double opacity) |
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque). More... | |
void | setOriginalXmlProperties (const QString &originalXmlProperties) |
Sets the original XML properties for the layer to originalXmlProperties. More... | |
void | setRenderer3D (QgsAbstract3DRenderer *renderer) |
Sets 3D renderer for the layer. More... | |
void | setShortName (const QString &shortName) |
Sets the short name of the layer used by QGIS Server to identify the layer. More... | |
virtual void | setSubLayerVisibility (const QString &name, bool visible) |
Set the visibility of the given sublayer name. More... | |
void | setTitle (const QString &title) |
Sets the title of the layer used by QGIS Server in GetCapabilities request. More... | |
QString | shortName () const |
Returns 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 |
Gets access to the layer's style manager. More... | |
virtual QString | styleURI () const |
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. More... | |
virtual QDateTime | timestamp () const |
Time stamp of data source in the moment when data/metadata were loaded by provider. More... | |
QString | title () const |
Returns the title of the layer used by QGIS Server in GetCapabilities request. More... | |
QgsCoordinateTransformContext | transformContext () const |
Returns the layer data provider coordinate transform context or a default transform context if the layer does not have a valid data provider. More... | |
QgsMapLayerType | type () const |
Returns the type of the layer. More... | |
QUndoStack * | undoStack () |
Returns pointer to layer's undo stack. More... | |
QUndoStack * | undoStackStyles () |
Returns pointer to layer's style undo stack. More... | |
bool | writeLayerXml (QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores state in DOM node. More... | |
virtual bool | writeStyle (QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const |
Write just the symbology information for the layer into the document. More... | |
virtual bool | writeSymbology (QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const =0 |
Write the style for the layer into the docment provided. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Public Member Functions inherited from QgsExpressionContextScopeGenerator | |
virtual | ~QgsExpressionContextScopeGenerator ()=default |
Public Member Functions inherited from QgsFeatureSink | |
virtual | ~QgsFeatureSink ()=default |
virtual bool | addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) |
Adds all features from the specified iterator to the sink. More... | |
virtual bool | flushBuffer () |
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. More... | |
virtual QString | lastError () const |
Returns the most recent error encountered by the sink, e.g. More... | |
Public Member Functions inherited from QgsFeatureSource | |
virtual | ~QgsFeatureSource ()=default |
virtual QgsFeatureIds | allFeatureIds () const |
Returns a list of all feature IDs for features present in the source. More... | |
virtual SpatialIndexPresence | hasSpatialIndex () const |
Returns an enum value representing the presence of a valid spatial index on the source, if it can be determined. More... | |
QgsVectorLayer * | materialize (const QgsFeatureRequest &request, QgsFeedback *feedback=nullptr) |
Materializes a request (query) made against this feature source, by running it over the source and returning a new memory based vector layer containing the result. More... | |
Static Public Member Functions | |
static Q_DECL_DEPRECATED 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 QString | extensionPropertyType (PropertyType type) |
Returns the extension of a Property. More... | |
static QString | formatLayerName (const QString &name) |
A convenience function to capitalize and format a layer name. More... | |
static QString | generateId (const QString &layerName) |
Generates an unique identifier for this layer, the generate ID is prefixed by layerName. More... | |
Protected Member Functions | |
void | setExtent (const QgsRectangle &rect) FINAL |
Sets the extent. More... | |
Protected Member Functions inherited from QgsMapLayer | |
void | appendError (const QgsErrorMessage &error) |
Add error message. More... | |
void | clone (QgsMapLayer *layer) const |
Copies attributes like name, short name, ... More... | |
Q_DECL_DEPRECATED bool | hasDependencyCycle (const QSet< QgsMapLayerDependency > &) const |
Checks whether a new set of dependencies will introduce a cycle this method is now deprecated and always return false , because circular dependencies are now correctly managed. More... | |
void | readCommonStyle (const QDomElement &layerElement, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) |
Read style data common to all layer types. More... | |
void | readCustomProperties (const QDomNode &layerNode, const QString &keyStartsWith=QString()) |
Read custom properties from project file. More... | |
void | readStyleManager (const QDomNode &layerNode) |
Read style manager's configuration (if any). To be called by subclasses. More... | |
void | setError (const QgsError &error) |
Sets error message. More... | |
void | setProviderType (const QString &providerType) |
Sets the providerType (provider key) More... | |
void | setValid (bool valid) |
Sets whether layer is valid or not. More... | |
void | writeCommonStyle (QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const |
Write style data common to all layer types. 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). To be called by subclasses. More... | |
Properties | |
QString | displayExpression |
QgsEditFormConfig | editFormConfig |
QString | mapTipTemplate |
bool | readOnly |
QString | subsetString |
bool | supportsEditing |
Properties inherited from QgsMapLayer | |
int | autoRefreshInterval |
QgsCoordinateReferenceSystem | crs |
bool | isValid |
QgsLayerMetadata | metadata |
QString | name |
double | opacity |
QgsMapLayerType | type |
Friends | |
class | QgsVectorLayerEditBuffer |
class | QgsVectorLayerEditPassthrough |
class | QgsVectorLayerFeatureSource |
Additional Inherited Members | |
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 |
QSet< QgsMapLayerDependency > | mDependencies |
List of layers that may modify this layer on modification. More... | |
QgsError | mError |
Error. More... | |
QgsRectangle | mExtent |
Extent of the layer. More... | |
bool | mIsRefreshOnNofifyEnabled = false |
QString | mKeywordList |
QString | mLayerName |
Name of the layer - used for display. More... | |
double | mLayerOpacity = 1.0 |
Layer opacity. More... | |
QString | mLegendUrl |
WMS legend. More... | |
QString | mLegendUrlFormat |
QString | mMetadataUrl |
MetadataUrl of the layer. More... | |
QString | mMetadataUrlFormat |
QString | mMetadataUrlType |
QString | mProviderKey |
Data provider key (name of the data provider) More... | |
QgsMapLayer::ReadFlags | mReadFlags = QgsMapLayer::ReadFlags() |
Read flags. It's up to the subclass to respect these when restoring state from XML. More... | |
QString | mRefreshOnNofifyMessage |
QString | mShortName |
bool | mShouldValidateCrs = true |
true if the layer's CRS should be validated and invalid CRSes are not permitted. More... | |
QString | mTitle |
bool | mValid = false |
Indicates if the layer is valid and can be drawn. More... | |
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"
Since QGIS 3.4 when closing a project, the application shows a warning about potential data loss if there are any non-empty memory layers present. If your memory layer should not trigger such warning, it is possible to suppress that by setting the following custom variable:
Accesses data using the OGR drivers (https://gdal.org/drivers/vector/index.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.
Used to access data provided by a OGC API - Features server.
The URI should be constructed using the QgsDataSourceUri class with the following parameters:
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 (equivalent 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.
Definition at line 387 of file qgsvectorlayer.h.
Result of an edit operation.
Definition at line 401 of file qgsvectorlayer.h.
Selection behavior.
Definition at line 412 of file qgsvectorlayer.h.
Editing vertex markers.
Enumerator | |
---|---|
SemiTransparentCircle | |
Cross | |
NoMarker |
Definition at line 2040 of file qgsvectorlayer.h.
|
explicit |
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, e.g., "memory", "postgres" |
options | layer load options |
Definition at line 152 of file qgsvectorlayer.cpp.
|
override |
Definition at line 222 of file qgsvectorlayer.cpp.
|
delete |
QgsVectorLayer cannot be copied.
|
overrideslot |
Definition at line 1504 of file qgsvectorlayer.cpp.
|
inline |
Returns 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 739 of file qgsvectorlayer.h.
|
inline |
Returns all layer actions defined on this layer.
The pointer which is returned is const.
Definition at line 746 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 3066 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addExpressionField | ( | const QString & | exp, |
const QgsField & | fld | ||
) |
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 3797 of file qgsvectorlayer.cpp.
|
virtual |
Adds a single feature to the sink.
Feature addition behavior is controlled by the specified flags.
true
in case of success and false
in case of failure Reimplemented from QgsFeatureSink.
Definition at line 1019 of file qgsvectorlayer.cpp.
void QgsVectorLayer::addFeatureRendererGenerator | ( | QgsFeatureRendererGenerator * | generator | ) |
Adds a new feature renderer generator to the layer.
Ownership of generator is transferred to the layer.
Definition at line 3702 of file qgsvectorlayer.cpp.
|
virtual |
Adds a list of features to the sink.
Feature addition behavior is controlled by the specified flags.
true
in case of success and false
in case of failure Implements QgsFeatureSink.
Definition at line 3551 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::addJoin | ( | const QgsVectorLayerJoinInfo & | joinInfo | ) |
Joins another vector layer to this layer.
joinInfo | join object containing join layer id, target and source field |
Definition at line 3781 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addPart | ( | const QgsPointSequence & | ring | ) |
Adds a new part polygon to a multipart feature.
Definition at line 1296 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addPart | ( | const QList< QgsPointXY > & | ring | ) |
Adds a new part polygon to a multipart feature.
Definition at line 1280 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addPart | ( | const QVector< QgsPointXY > & | ring | ) |
Adds a new part polygon to a multipart feature.
Definition at line 1291 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addPart | ( | QgsCurve * | ring | ) |
Definition at line 1322 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addRing | ( | const QgsPointSequence & | 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 1219 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addRing | ( | const QVector< QgsPointXY > & | 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 1214 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::addRing | ( | QgsCurve * | 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 1242 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 1395 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 1409 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addTopologicalPoints | ( | const QgsPointSequence & | ps | ) |
Adds a vertex to segments which intersect any of the points 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.
ps | point sequence of the vertices |
Definition at line 1418 of file qgsvectorlayer.cpp.
int QgsVectorLayer::addTopologicalPoints | ( | const QgsPointXY & | 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 1404 of file qgsvectorlayer.cpp.
|
signal |
Emitted after changes are committed to the data provider.
|
signal |
Emitted after changes are rolled back.
QVariant QgsVectorLayer::aggregate | ( | QgsAggregateCalculator::Aggregate | aggregate, |
const QString & | fieldOrExpression, | ||
const QgsAggregateCalculator::AggregateParameters & | parameters = QgsAggregateCalculator::AggregateParameters() , |
||
QgsExpressionContext * | context = nullptr , |
||
bool * | ok = nullptr , |
||
QgsFeatureIds * | fids = nullptr |
||
) | const |
Calculates an aggregated value from the layer's features.
Currently any filtering expression provided will override filters in the FeatureRequest.
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 |
fids | list of fids to filter, otherwise will use all fids |
Definition at line 4347 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::allowCommit | ( | ) | const |
Controls, if the layer is allowed to commit changes.
If this is set to false
it will not be possible to commit changes on this layer. This can be used to define checks on a layer that need to be pass before the layer can be saved. If you use this API, make sure that:
true
, once the user has fixed his data.When calling
Definition at line 5629 of file qgsvectorlayer.cpp.
|
signal |
Emitted whenever the allowCommitChanged() property of this layer changes.
|
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 | index | ) | const |
Returns the alias of an attribute name or a null string if there is no alias.
Definition at line 3142 of file qgsvectorlayer.cpp.
QgsStringMap QgsVectorLayer::attributeAliases | ( | ) | const |
Returns a map of field name to attribute alias.
Definition at line 3158 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 | index | ) | const |
Convenience function that returns the attribute alias if defined or the field name else.
Definition at line 3150 of file qgsvectorlayer.cpp.
|
inline |
Returns list of attribute indexes.
i.e. a list from 0 ... fieldCount()
Definition at line 1717 of file qgsvectorlayer.h.
QgsAttributeTableConfig QgsVectorLayer::attributeTableConfig | ( | ) | const |
Returns the attribute table configuration object.
This defines the appearance of the attribute table.
Definition at line 4977 of file qgsvectorlayer.cpp.
|
signal |
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 |
QgsAuxiliaryLayer * QgsVectorLayer::auxiliaryLayer | ( | ) |
Returns the current auxiliary layer.
Definition at line 5341 of file qgsvectorlayer.cpp.
const QgsAuxiliaryLayer * QgsVectorLayer::auxiliaryLayer | ( | ) | const |
Returns the current const auxiliary layer.
Definition at line 5336 of file qgsvectorlayer.cpp.
|
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 |
Emitted before changes are committed to the data provider.
The stopEditing flag specifies if the editing mode shall be left after this commit.
|
signal |
Emitted before editing on this layer is started.
|
signal |
Emitted when the 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 |
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 3727 of file qgsvectorlayer.cpp.
QgsRectangle QgsVectorLayer::boundingBoxOfSelected | ( | ) | const |
Returns the bounding box of the selected features. If there is no selection, QgsRectangle(0,0,0,0) is returned.
Definition at line 677 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::capabilitiesString | ( | ) | const |
Capabilities for this layer, comma separated and translated.
Definition at line 358 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeAttributeValue | ( | QgsFeatureId | fid, |
int | field, | ||
const QVariant & | newValue, | ||
const QVariant & | oldValue = QVariant() , |
||
bool | skipDefaultValues = false |
||
) |
Changes an attribute value for a feature (but does not immediately commit the changes).
The fid argument specifies the ID of the feature to be changed.
The field argument must specify a valid field index for the layer (where an index of 0 corresponds to the first field).
The new value to be assigned to the field is given by newValue.
If a valid QVariant is specified for oldValue, 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.
If skipDefaultValues is set to true
, default field values will not be updated. This can be used to override default field value expressions.
true
if the feature's attribute was successfully changed.Definition at line 2977 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeAttributeValues | ( | QgsFeatureId | fid, |
const QgsAttributeMap & | newValues, | ||
const QgsAttributeMap & | oldValues = QgsAttributeMap() , |
||
bool | skipDefaultValues = false |
||
) |
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.
If skipDefaultValues is set to true
, default field values will not be updated. This can be used to override default field value expressions.
true
if feature's attributes was successfully changed.Definition at line 3008 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::changeGeometry | ( | QgsFeatureId | fid, |
QgsGeometry & | geometry, | ||
bool | skipDefaultValue = false |
||
) |
Changes a feature's geometry within the layer's edit buffer (but does not immediately commit the changes).
The fid argument specifies the ID of the feature to be changed.
If skipDefaultValue is set to true
, default field values will not be updated. This can be used to override default field value expressions.
true
if the feature's geometry was successfully changed.Definition at line 2953 of file qgsvectorlayer.cpp.
|
overridevirtual |
Returns a new instance equivalent to this one.
A new provider is created for the same data source and renderers for features and diagrams are cloned too. Moreover, each attributes (transparency, extent, selected features and so on) are identical.
Implements QgsMapLayer.
Definition at line 248 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::commitChanges | ( | bool | stopEditing = true | ) |
Attempts to commit to the underlying data provider any buffered changes made since the last to call to startEditing().
Returns the result of the attempt. If a commit fails (i.e. false
is returned), the in-memory changes are left untouched and are not discarded. 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 can be difficult to roll back cleanly. Therefore any error message returned by commitErrors() also includes which stage failed so that the user has some chance of repairing the damage cleanly.
By setting stopEditing to false
, the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the commit is successful.
Definition at line 3391 of file qgsvectorlayer.cpp.
QStringList QgsVectorLayer::commitErrors | ( | ) | const |
Returns a list containing any error messages generated when attempting to commit changes to the layer.
Definition at line 3441 of file qgsvectorlayer.cpp.
|
signal |
Emitted when attributes are added to the provider.
|
signal |
Emitted when attributes are deleted from the provider.
|
signal |
Emitted when attribute value changes are saved to the provider.
|
signal |
Emitted when features are added to the provider.
|
signal |
Emitted when features are deleted from the provider.
|
signal |
Emitted when geometry changes are saved to the provider.
QgsConditionalLayerStyles * QgsVectorLayer::conditionalStyles | ( | ) | const |
Returns the conditional styles that are set for this layer.
Style information is used to render conditional formatting in the attribute table.
Definition at line 996 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::constraintDescription | ( | int | index | ) | const |
Returns the descriptive name for the constraint expression for a specified field index.
Definition at line 5531 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::constraintExpression | ( | int | index | ) | const |
Returns the constraint expression for for a specified field index, if set.
Definition at line 5523 of file qgsvectorlayer.cpp.
QgsVectorLayerFeatureCounter * QgsVectorLayer::countSymbolFeatures | ( | bool | storeSymbolFids = false | ) |
Count features for symbols.
The method will return the feature counter task. You will need to connect to the symbolFeatureCountMapChanged() signal to be notified when the freshly updated feature counts are ready.
storeSymbolFids | If true will gather the feature ids (fids) per symbol, otherwise only the count. Default false . |
nullptr
is returned. If you need to wait for the results, you can call waitForFinished() on the feature counter.Definition at line 774 of file qgsvectorlayer.cpp.
|
virtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 4996 of file qgsvectorlayer.cpp.
|
virtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context scope.
Implements QgsExpressionContextScopeGenerator.
Definition at line 5001 of file qgsvectorlayer.cpp.
|
virtual |
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context.
Implements QgsMapLayer.
Definition at line 395 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::dataComment | ( | ) | const |
Returns a description for this layer as defined in the data provider.
Definition at line 367 of file qgsvectorlayer.cpp.
|
virtual |
Returns the layer's data provider in a const-correct manner, it may be nullptr
.
Reimplemented from QgsMapLayer.
Definition at line 640 of file qgsvectorlayer.cpp.
|
virtual |
Returns the layer's data provider, it may be nullptr
.
Reimplemented from QgsMapLayer.
Definition at line 635 of file qgsvectorlayer.cpp.
|
virtual |
Called by readLayerXML(), used by derived classes to decode provider's specific data source from project files.
Typically resolving absolute or relative paths, usernames and passwords or drivers prefixes ("HDF5:")
source | data source to decode, typically read from layer's DOM element "datasource" |
dataProvider | string identification of data provider (e.g. "ogr"), typically read from layer's DOM element |
context | reading context (e.g. for conversion between relative and absolute paths) |
Reimplemented from QgsMapLayer.
Definition at line 2022 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 setDefaultValueDefinition()) 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 3958 of file qgsvectorlayer.cpp.
QgsDefaultValue QgsVectorLayer::defaultValueDefinition | ( | int | index | ) | const |
Returns the definition of the expression used when calculating the default value for a field.
index | field index |
Definition at line 4020 of file qgsvectorlayer.cpp.
|
virtual |
Deletes an attribute field (but does not commit it).
Reimplemented in QgsAuxiliaryLayer.
Definition at line 3211 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteAttributes | ( | const QList< int > & | attrs | ) |
Deletes a list of attribute fields (but does not commit it)
attrs | the indices of the attributes to delete |
true
if at least one attribute has been deleted Definition at line 3228 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteFeature | ( | QgsFeatureId | fid, |
QgsVectorLayer::DeleteContext * | context = nullptr |
||
) |
Deletes a feature from the layer (but does not commit it).
fid | The feature id to delete |
context | The chain of features who will be deleted for feedback and to avoid endless recursions |
Definition at line 3310 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteFeatures | ( | const QgsFeatureIds & | fids, |
QgsVectorLayer::DeleteContext * | context = nullptr |
||
) |
Deletes a set of features from the layer (but does not commit it)
fids | The feature ids to delete |
context | The chain of features who will be deleted for feedback and to avoid endless recursions |
false
if the layer is not in edit mode or does not support deleting in case of an active transaction depends on the provider implementationDefinition at line 3326 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::deleteSelectedFeatures | ( | int * | deletedCount = nullptr , |
QgsVectorLayer::DeleteContext * | context = nullptr |
||
) |
Deletes the selected features.
deletedCount | The number of successfully deleted features |
context | The chain of features who will be deleted for feedback and to avoid endless recursions |
true
in case of success and false
otherwise Definition at line 1169 of file qgsvectorlayer.cpp.
|
virtual |
Deletes a style from the database.
styleId | the provider's layer_styles table id of the style to delete |
msgError | will be set to a descriptive error message if any occurs |
true
in case of success Definition at line 5245 of file qgsvectorlayer.cpp.
QgsVectorLayer::EditResult QgsVectorLayer::deleteVertex | ( | 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 1155 of file qgsvectorlayer.cpp.
|
virtual |
Gets the list of dependencies.
This includes data dependencies set by the user (
Reimplemented from QgsMapLayer.
Definition at line 5373 of file qgsvectorlayer.cpp.
|
slot |
Deselects features by their ID.
featureIds | The ids of the features to deselect |
Definition at line 441 of file qgsvectorlayer.cpp.
|
slot |
Deselects feature by its ID.
featureId | The id of the feature to deselect |
Definition at line 433 of file qgsvectorlayer.cpp.
void QgsVectorLayer::destroyEditCommand | ( | ) |
Destroy active command and reverts all changes in it.
Definition at line 3759 of file qgsvectorlayer.cpp.
|
inline |
Definition at line 898 of file qgsvectorlayer.h.
|
inline |
Definition at line 895 of file qgsvectorlayer.h.
bool QgsVectorLayer::diagramsEnabled | ( | ) | const |
Returns whether the layer contains diagrams which are enabled and should be drawn.
true
if layer contains enabled diagrams Definition at line 746 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::displayExpression | ( | ) | const |
Returns the preview expression, used to create a human readable preview string.
Uses QgsExpression
Definition at line 3601 of file qgsvectorlayer.cpp.
|
signal |
Emitted when the display expression changes.
QString QgsVectorLayer::displayField | ( | ) | const |
This is a shorthand for accessing the displayExpression if it is a simple field.
If the displayExpression is more complex than a simple field, a null string will be returned.
Definition at line 3581 of file qgsvectorlayer.cpp.
|
static |
Draws a vertex symbol at (screen) coordinates x, y.
(Useful to assist vertex editing.)
Definition at line 401 of file qgsvectorlayer.cpp.
|
inline |
Buffer with uncommitted editing operations. Only valid after editing has been turned on.
Definition at line 2019 of file qgsvectorlayer.h.
|
inline |
Buffer with uncommitted editing operations.
Only valid after editing has been turned on.
Definition at line 2025 of file qgsvectorlayer.h.
|
signal |
Signal emitted, when 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 |
QgsEditFormConfig QgsVectorLayer::editFormConfig | ( | ) | const |
Returns the configuration of the form used to represent this vector layer.
Definition at line 4948 of file qgsvectorlayer.cpp.
|
signal |
Will be emitted whenever the edit form configuration of this layer changes.
|
signal |
Emitted when editing on this layer has started.
|
signal |
Emitted when edited changes have been successfully written to the data provider.
QgsEditorWidgetSetup QgsVectorLayer::editorWidgetSetup | ( | int | index | ) | const |
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field at index
.
Definition at line 5594 of file qgsvectorlayer.cpp.
|
virtual |
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to project files.
Typically resolving absolute or relative paths, usernames and passwords or drivers prefixes ("HDF5:")
source | data source to encode, typically QgsMapLayer::source() |
context | writing context (e.g. for conversion between relative and absolute paths) |
Reimplemented from QgsMapLayer.
Definition at line 1937 of file qgsvectorlayer.cpp.
void QgsVectorLayer::endEditCommand | ( | ) |
Finish edit command and add it to undo/redo stack.
Definition at line 3743 of file qgsvectorlayer.cpp.
QSet< QString > QgsVectorLayer::excludeAttributesWfs | ( | ) | const |
A set of attributes that are not advertised in WFS requests with QGIS server.
Definition at line 3187 of file qgsvectorlayer.cpp.
QSet< QString > QgsVectorLayer::excludeAttributesWms | ( | ) | const |
A set of attributes that are not advertised in WMS requests with QGIS server.
Definition at line 3163 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::expressionField | ( | int | index | ) | const |
Returns the expression used for a given expression field.
index | An index of an epxression based (virtual) field |
Definition at line 3816 of file qgsvectorlayer.cpp.
|
virtual |
Returns the extent of the layer.
Reimplemented from QgsMapLayer.
Definition at line 841 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.
Definition at line 4398 of file qgsvectorlayer.cpp.
|
signal |
Signal emitted when setFeatureBlendMode() is called.
|
virtual |
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.
Implements QgsFeatureSource.
Definition at line 3364 of file qgsvectorlayer.cpp.
long QgsVectorLayer::featureCount | ( | const QString & | legendKey | ) | const |
Number of features rendered with specified legend key.
Features must be first calculated by countSymbolFeatures()
Definition at line 759 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 prefer to use featuresDeleted( const QgsFeatureIds& ).
fid | The id of the feature which has been deleted |
QList< const QgsFeatureRendererGenerator * > QgsVectorLayer::featureRendererGenerators | ( | ) | const |
Returns a list of the feature renderer generators owned by the layer.
Definition at line 3719 of file qgsvectorlayer.cpp.
|
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. |
QgsField::ConfigurationFlags QgsVectorLayer::fieldConfigurationFlags | ( | int | index | ) | const |
Returns the configuration flags of the field at given index.
Definition at line 5573 of file qgsvectorlayer.cpp.
QgsFieldConstraints::Constraints QgsVectorLayer::fieldConstraints | ( | int | fieldIndex | ) | const |
Returns any constraints which are present for a specified field index.
These constraints may be inherited from the layer's data provider or may be set manually on the vector layer from within QGIS.
Definition at line 5452 of file qgsvectorlayer.cpp.
QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength > QgsVectorLayer::fieldConstraintsAndStrength | ( | int | fieldIndex | ) | const |
Returns a map of constraint with their strength for a specific field of the layer.
fieldIndex | field index |
Definition at line 5468 of file qgsvectorlayer.cpp.
|
virtual |
Returns the list of fields of this layer.
This also includes fields which have not yet been saved to the provider.
Implements QgsFeatureSource.
Definition at line 3342 of file qgsvectorlayer.cpp.
|
signal |
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 |
QgsGeometryOptions * QgsVectorLayer::geometryOptions | ( | ) | const |
Configuration and logic to apply automatically on any edit happening on this layer.
Definition at line 5643 of file qgsvectorlayer.cpp.
QgsWkbTypes::GeometryType QgsVectorLayer::geometryType | ( | ) | const |
Returns point, line or polygon.
Definition at line 667 of file qgsvectorlayer.cpp.
|
inline |
Queries the layer for the feature with the given id.
If there is no such feature, the returned feature will be invalid.
Definition at line 1207 of file qgsvectorlayer.h.
|
inline |
Queries the layer for the features with the given ids.
Definition at line 1223 of file qgsvectorlayer.h.
|
virtual |
Queries the layer for features specified in request.
request | feature request describing parameters of features to return |
Implements QgsFeatureSource.
Definition at line 1001 of file qgsvectorlayer.cpp.
|
inline |
Queries the layer for the features which intersect the specified rectangle.
Definition at line 1231 of file qgsvectorlayer.h.
|
inline |
Queries the layer for features matching a given expression.
Definition at line 1198 of file qgsvectorlayer.h.
QgsGeometry QgsVectorLayer::getGeometry | ( | QgsFeatureId | fid | ) | const |
Queries the layer for the geometry at the given id.
If there is no such feature, the returned geometry will be invalid.
Definition at line 1009 of file qgsvectorlayer.cpp.
QgsFeatureIterator QgsVectorLayer::getSelectedFeatures | ( | QgsFeatureRequest | request = QgsFeatureRequest() | ) | const |
Returns 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 3535 of file qgsvectorlayer.cpp.
|
virtual |
Returns the named style corresponding to style id provided.
Definition at line 5240 of file qgsvectorlayer.cpp.
|
virtual |
Determines if this vector layer has features.
Reimplemented from QgsFeatureSource.
Definition at line 3372 of file qgsvectorlayer.cpp.
|
overrideslot |
Definition at line 1499 of file qgsvectorlayer.cpp.
|
virtual |
Obtain a formatted HTML string containing assorted metadata for this layer.
Reimplemented from QgsMapLayer.
Definition at line 5013 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::insertVertex | ( | const QgsPoint & | point, |
QgsFeatureId | atFeatureId, | ||
int | beforeVertex | ||
) |
Inserts 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 1116 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::insertVertex | ( | double | x, |
double | y, | ||
QgsFeatureId | atFeatureId, | ||
int | beforeVertex | ||
) |
Inserts 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 1103 of file qgsvectorlayer.cpp.
void QgsVectorLayer::invertSelection | ( | ) |
Selects not selected features and deselects selected ones.
Definition at line 576 of file qgsvectorlayer.cpp.
void QgsVectorLayer::invertSelectionInRectangle | ( | QgsRectangle & | rect | ) |
Inverts 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 588 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::isAuxiliaryField | ( | int | index, |
int & | srcIndex | ||
) | const |
Returns true
if the field comes from the auxiliary layer, false
otherwise.
Definition at line 3662 of file qgsvectorlayer.cpp.
|
virtual |
Returns true
if the provider is in editing mode.
Reimplemented from QgsMapLayer.
Definition at line 3621 of file qgsvectorlayer.cpp.
|
inline |
|
virtual |
Returns true
if the provider has been modified since the last commit.
Definition at line 3656 of file qgsvectorlayer.cpp.
|
virtual |
Returns true
if this is a geometry layer and false
in case of NoGeometry (table only) or UnknownGeometry.
Reimplemented from QgsMapLayer.
Definition at line 3626 of file qgsvectorlayer.cpp.
|
inline |
|
inline |
Returns a const pointer on join buffer object.
Definition at line 667 of file qgsvectorlayer.h.
|
inline |
Access to labeling configuration.
May be nullptr
if labeling is not used.
true
. Definition at line 1669 of file qgsvectorlayer.h.
|
inline |
Access to const labeling configuration.
May be nullptr
if labeling is not used.
true
. Definition at line 1661 of file qgsvectorlayer.h.
|
signal |
Emitted when the font family defined for labeling layer is not found on system.
bool QgsVectorLayer::labelsEnabled | ( | ) | const |
Returns whether the layer contains labels which are enabled and should be drawn.
true
if layer contains enabled labelsDefinition at line 736 of file qgsvectorlayer.cpp.
|
signal |
Emitted when modifications has been done on layer.
|
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 | will be set to a descriptive error message if any occurs |
Definition at line 5235 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::loadAuxiliaryLayer | ( | const QgsAuxiliaryStorage & | storage, |
const QString & | key = QString() |
||
) |
Loads the auxiliary layer for this vector layer.
If there's no corresponding table in the database, then nothing happens and false
is returned. The key is optional because if this layer has been read from a XML document, then the key read in this document is used by default.
storage | The auxiliary storage where to look for the table |
key | The key to use for joining. |
true
if the auxiliary layer is well loaded, false
otherwiseDefinition at line 5284 of file qgsvectorlayer.cpp.
|
virtual |
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)
resultFlag | a reference to a flag that will be set to false if we did not manage to load the default style. |
Reimplemented from QgsMapLayer.
Definition at line 1718 of file qgsvectorlayer.cpp.
|
virtual |
Loads a named style from file/local db/datasource db.
theURI | the URI of the style or the URI of the layer |
resultFlag | 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 |
categories | the style categories to be loaded. |
Definition at line 5346 of file qgsvectorlayer.cpp.
|
virtual |
Calls loadNamedStyle( theURI, resultFlag, false
); Retained for backward compatibility.
Reimplemented from QgsMapLayer.
Definition at line 5279 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::mapTipTemplate | ( | ) | const |
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
Definition at line 4963 of file qgsvectorlayer.cpp.
|
signal |
Emitted when the map tip changes.
|
virtual |
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).
Reimplemented from QgsFeatureSource.
Definition at line 4241 of file qgsvectorlayer.cpp.
|
virtual |
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).
Reimplemented from QgsFeatureSource.
Definition at line 4236 of file qgsvectorlayer.cpp.
void QgsVectorLayer::modifySelection | ( | const QgsFeatureIds & | selectIds, |
const QgsFeatureIds & | deselectIds | ||
) |
Modifies the current selection on this layer.
selectIds | Select these ids |
deselectIds | Deselect these ids |
Definition at line 561 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::moveVertex | ( | const QgsPoint & | 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 1142 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 1129 of file qgsvectorlayer.cpp.
|
delete |
QgsVectorLayer cannot be copied.
QgsAttributeList QgsVectorLayer::primaryKeyAttributes | ( | ) | const |
Returns the list of attributes which make up the layer's primary keys.
Definition at line 3347 of file qgsvectorlayer.cpp.
|
signal |
Signals an error related to this vector layer.
|
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. |
bool QgsVectorLayer::readExtentFromXml | ( | ) | const |
Returns true
if the extent is read from the XML document when data source has no metadata, false
if it's the data provider which determines it.
Definition at line 5653 of file qgsvectorlayer.cpp.
|
signal |
Emitted when the read only state of this layer is changed.
Only applies to manually set readonly state, not to the edit mode.
|
virtual |
Reimplemented from QgsMapLayer.
Definition at line 2892 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::readStyle | ( | const QDomNode & | node, |
QString & | errorMessage, | ||
QgsReadWriteContext & | context, | ||
QgsMapLayer::StyleCategories | categories = QgsMapLayer::AllStyleCategories |
||
) |
Definition at line 2416 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::readSymbology | ( | const QDomNode & | layerNode, |
QString & | errorMessage, | ||
QgsReadWriteContext & | context, | ||
QgsMapLayer::StyleCategories | categories = QgsMapLayer::AllStyleCategories |
||
) |
Definition at line 2126 of file qgsvectorlayer.cpp.
|
virtual |
Reads vector layer specific state from project file Dom node.
Reimplemented from QgsMapLayer.
Definition at line 1517 of file qgsvectorlayer.cpp.
QList< QgsRelation > QgsVectorLayer::referencingRelations | ( | int | idx | ) | const |
Returns the layer's relations, where the foreign key is on this layer.
idx | Only get relations, where idx forms part of the foreign key |
Definition at line 5225 of file qgsvectorlayer.cpp.
|
virtual |
Synchronises with changes in the datasource.
Reimplemented from QgsMapLayer.
Definition at line 386 of file qgsvectorlayer.cpp.
void QgsVectorLayer::removeExpressionField | ( | int | index | ) |
Removes an expression field.
index | The index of the field |
Definition at line 3807 of file qgsvectorlayer.cpp.
void QgsVectorLayer::removeFeatureRendererGenerator | ( | const QString & | id | ) |
Removes the feature renderer with matching id from the layer.
The corresponding generator will be deleted.
Definition at line 3707 of file qgsvectorlayer.cpp.
void QgsVectorLayer::removeFieldAlias | ( | int | index | ) |
Removes an alias (a display name) for attributes to display in dialogs.
Definition at line 3074 of file qgsvectorlayer.cpp.
void QgsVectorLayer::removeFieldConstraint | ( | int | index, |
QgsFieldConstraints::Constraint | constraint | ||
) |
Removes a constraint for a specified field index.
Any constraints inherited from the layer's data provider will be kept intact and cannot be removed.
Definition at line 5506 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::removeJoin | ( | const QString & | joinLayerId | ) |
Removes a vector layer join.
true
if join was found and successfully removed Definition at line 3787 of file qgsvectorlayer.cpp.
|
slot |
Clear selection.
Definition at line 617 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::renameAttribute | ( | int | index, |
const QString & | newName | ||
) |
Renames an attribute field (but does not commit it).
index | attribute index |
newName | new name of field |
Definition at line 3090 of file qgsvectorlayer.cpp.
|
inline |
Returns the feature renderer used for rendering the features in the layer in 2D map views.
Definition at line 906 of file qgsvectorlayer.h.
|
inline |
Returns the feature renderer used for rendering the features in the layer in 2D map views.
Definition at line 915 of file qgsvectorlayer.h.
|
slot |
Reselects the previous set of selected features.
This is only applicable after a prior call to removeSelection().
Any other modifications to the selection following a call to removeSelection() clears memory of the previous selection and consequently calling reselect() has no impact.
Definition at line 627 of file qgsvectorlayer.cpp.
|
virtual |
Resolves references to other layers (kept as layer IDs after reading XML) into layer objects.
Reimplemented from QgsMapLayer.
Definition at line 2119 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::rollBack | ( | bool | deleteBuffer = true | ) |
Stops a current editing operation and discards any uncommitted edits.
If deleteBuffer is true
the editing buffer will be completely deleted (the default behavior).
Definition at line 3446 of file qgsvectorlayer.cpp.
|
virtual |
Saves named and sld style of the layer to the style table in the db.
name | Style name |
description | A description of the style |
useAsDefault | Set to true if style should be used as the default style for the layer |
uiFileContent | |
msgError | will be set to a descriptive error message if any occurs |
Definition at line 5251 of file qgsvectorlayer.cpp.
|
slot |
Selects features by their ID.
featureIds | The ids of the features to select |
Definition at line 425 of file qgsvectorlayer.cpp.
|
slot |
Selects feature by its ID.
featureId | The id of the feature to select |
Definition at line 417 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectAll | ( | ) |
Select all the features.
Definition at line 583 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByExpression | ( | const QString & | expression, |
QgsVectorLayer::SelectBehavior | behavior = QgsVectorLayer::SetSelection |
||
) |
Selects matching features using an expression.
expression | expression to evaluate to select features |
behavior | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 471 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByIds | ( | const QgsFeatureIds & | ids, |
QgsVectorLayer::SelectBehavior | behavior = QgsVectorLayer::SetSelection |
||
) |
Selects matching features using a list of feature IDs.
Will emit the selectionChanged() signal with the clearAndSelect flag set.
ids | feature IDs to select |
behavior | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 531 of file qgsvectorlayer.cpp.
void QgsVectorLayer::selectByRect | ( | QgsRectangle & | rect, |
QgsVectorLayer::SelectBehavior | behavior = QgsVectorLayer::SetSelection |
||
) |
Selects features found within the search rectangle (in layer's coordinates)
rect | search rectangle |
behavior | selection type, allows adding to current selection, removing from selection, etc. |
Definition at line 449 of file qgsvectorlayer.cpp.
int QgsVectorLayer::selectedFeatureCount | ( | ) | const |
Returns the number of features that are selected in this layer.
Definition at line 3495 of file qgsvectorlayer.cpp.
const QgsFeatureIds & QgsVectorLayer::selectedFeatureIds | ( | ) | const |
Returns a list of the selected features IDs in this layer.
Definition at line 3500 of file qgsvectorlayer.cpp.
QgsFeatureList QgsVectorLayer::selectedFeatures | ( | ) | const |
Returns a copy of the user-selected features.
Definition at line 3505 of file qgsvectorlayer.cpp.
|
signal |
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 |
|
inline |
Returns QGIS Server Properties of the vector layer.
Definition at line 752 of file qgsvectorlayer.h.
void QgsVectorLayer::setAllowCommit | ( | bool | allowCommit | ) |
Controls, if the layer is allowed to commit changes.
If this is set to false
it will not be possible to commit changes on this layer. This can be used to define checks on a layer that need to be pass before the layer can be saved. If you use this API, make sure that:
true
, once the user has fixed his data.When calling
Definition at line 5634 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setAttributeTableConfig | ( | const QgsAttributeTableConfig & | attributeTableConfig | ) |
Sets the attribute table configuration object.
This defines the appearance of the attribute table.
Definition at line 4987 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setAuxiliaryLayer | ( | QgsAuxiliaryLayer * | layer = nullptr | ) |
Sets the current auxiliary layer.
The auxiliary layer is automatically put in editable mode and fields are updated. Moreover, a join is created between the current layer and the auxiliary layer. Ownership is transferred.
Definition at line 5313 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setConstraintExpression | ( | int | index, |
const QString & | expression, | ||
const QString & | description = QString() |
||
) |
Sets the constraint expression for the specified field index.
An optional descriptive name for the constraint can also be set. Setting an empty expression will clear any existing expression constraint.
Definition at line 5539 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setCoordinateSystem | ( | ) |
Setup the coordinate system transformation for the layer.
Definition at line 3575 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 1633 of file qgsvectorlayer.cpp.
|
overridevirtual |
Updates 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 |
options | provider options |
loadDefaultStyleFlag | set to true to reset the layer's style to the default for the data source |
Reimplemented from QgsMapLayer.
Definition at line 1639 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDefaultValueDefinition | ( | int | index, |
const QgsDefaultValue & | definition | ||
) |
Sets the definition of the expression to use when calculating the default value for a field.
index | field index |
definition | default value definition to use and evaluate when calculating default values for field. Pass an empty expression to clear the default. |
Definition at line 4004 of file qgsvectorlayer.cpp.
|
virtual |
Sets the list of dependencies.
layers | set of QgsMapLayerDependency. Only user-defined dependencies will be added |
false
if a dependency cycle has been detected Reimplemented from QgsMapLayer.
Definition at line 5398 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDiagramLayerSettings | ( | const QgsDiagramLayerSettings & | s | ) |
Definition at line 5006 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setDiagramRenderer | ( | QgsDiagramRenderer * | r | ) |
Sets diagram rendering object (takes ownership)
Definition at line 659 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 3592 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setEditFormConfig | ( | const QgsEditFormConfig & | editFormConfig | ) |
Sets the editFormConfig (configuration) of the form used to represent this vector layer.
Definition at line 4953 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setEditorWidgetSetup | ( | int | index, |
const QgsEditorWidgetSetup & | setup | ||
) |
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field at index
.
Definition at line 5582 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setExcludeAttributesWfs | ( | const QSet< QString > & | att | ) |
A set of attributes that are not advertised in WFS requests with QGIS server.
Definition at line 3201 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setExcludeAttributesWms | ( | const QSet< QString > & | att | ) |
A set of attributes that are not advertised in WMS requests with QGIS server.
Definition at line 3177 of file qgsvectorlayer.cpp.
|
protectedvirtual |
void QgsVectorLayer::setFeatureBlendMode | ( | QPainter::CompositionMode | blendMode | ) |
Sets the blending mode used for rendering each feature.
Definition at line 4388 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setFieldAlias | ( | int | index, |
const QString & | aliasString | ||
) |
Sets an alias (a display name) for attributes to display in dialogs.
Definition at line 3129 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setFieldConfigurationFlag | ( | int | index, |
QgsField::ConfigurationFlag | flag, | ||
bool | active | ||
) |
Sets the given configuration flag for the field at given index to be active or not.
Definition at line 5564 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setFieldConfigurationFlags | ( | int | index, |
QgsField::ConfigurationFlags | flags | ||
) |
Sets the configuration flags of the field at given index.
Definition at line 5555 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setFieldConstraint | ( | int | index, |
QgsFieldConstraints::Constraint | constraint, | ||
QgsFieldConstraints::ConstraintStrength | strength = QgsFieldConstraints::ConstraintStrengthHard |
||
) |
Sets a constraint for a specified field index.
Any constraints inherited from the layer's data provider will be kept intact and cannot be modified. Ie, calling this method only allows for new constraints to be added on top of the existing provider constraints.
Definition at line 5489 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setLabeling | ( | QgsAbstractVectorLayerLabeling * | labeling | ) |
Sets labeling configuration.
Takes ownership of the object.
Definition at line 1427 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setLabelsEnabled | ( | bool | enabled | ) |
Sets whether labels should be enabled for the layer.
true
and a labeling object is returned by labeling().Definition at line 741 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setMapTipTemplate | ( | const QString & | mapTipTemplate | ) |
The mapTip is a pretty, html representation for feature information.
It may also contain embedded expressions.
Definition at line 4968 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setProviderEncoding | ( | const QString & | encoding | ) |
Sets the text encoding of the data provider.
An empty encoding string indicates that the provider should automatically select the most appropriate encoding.
Definition at line 650 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setReadExtentFromXml | ( | bool | readExtentFromXml | ) |
Flag allowing to indicate if the extent has to be read from the XML document when data source has no metadata or if the data provider has to determine it.
Definition at line 5648 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::setReadOnly | ( | bool | readonly = true | ) |
Makes layer read-only (editing disabled) or not.
false
if the layer is in editing yet Definition at line 3637 of file qgsvectorlayer.cpp.
void QgsVectorLayer::setRenderer | ( | QgsFeatureRenderer * | r | ) |
Sets the feature renderer which will be invoked to represent this layer in 2D map views.
Ownership is transferred.
Definition at line 3681 of file qgsvectorlayer.cpp.
|
inline |
Sets the simplification settings for fast rendering of features.
Definition at line 2280 of file qgsvectorlayer.h.
|
virtual |
Sets 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 definition string specific to the underlying dataprovider and data store. |
true
, when setting the subset string was successful, false
otherwise Definition at line 951 of file qgsvectorlayer.cpp.
|
overridevirtualslot |
Sets the coordinate transform context to transformContext.
Definition at line 1493 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 984 of file qgsvectorlayer.cpp.
|
inline |
Returns the simplification settings for fast rendering of features.
Definition at line 2286 of file qgsvectorlayer.h.
|
virtual |
Returns the coordinate reference system for features in the source.
Implements QgsFeatureSource.
Definition at line 376 of file qgsvectorlayer.cpp.
|
virtual |
Returns the extent of all geometries from the source.
The base class implementation uses a non-optimised approach of looping through all features in the source.
Reimplemented from QgsFeatureSource.
Definition at line 936 of file qgsvectorlayer.cpp.
|
virtual |
Returns a friendly display name for the source.
The returned value can be an empty string.
Implements QgsFeatureSource.
Definition at line 381 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::splitFeatures | ( | const QgsCurve * | curve, |
QgsPointSequence & | topologyTestPoints, | ||
bool | preserveCircular = false , |
||
bool | topologicalEditing = false |
||
) |
Splits features cut by the given curve.
curve | curve that splits the layer features | |
[out] | topologyTestPoints | topological points to be tested against other layers |
preserveCircular | whether circular strings are preserved after splitting | |
topologicalEditing | true if topological editing is enabled |
Definition at line 1386 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::splitFeatures | ( | const QgsPointSequence & | 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 1378 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::splitFeatures | ( | const QVector< QgsPointXY > & | 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 1373 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::splitParts | ( | const QgsPointSequence & | 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 1365 of file qgsvectorlayer.cpp.
QgsGeometry::OperationResult QgsVectorLayer::splitParts | ( | const QVector< QgsPointXY > & | 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 1361 of file qgsvectorlayer.cpp.
|
slot |
Makes the 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().
true
if the layer was successfully made editable, or false
if the operation failed (e.g. due to an underlying read-only data source, or lack of edit support by the backend data provider).Definition at line 1436 of file qgsvectorlayer.cpp.
QString QgsVectorLayer::storageType | ( | ) | const |
Returns the permanent storage type for this layer as a friendly name.
This is obtained from the data provider and does not follow any standard.
Definition at line 348 of file qgsvectorlayer.cpp.
|
inline |
Returns the manager of the stored expressions for this layer.
Definition at line 2430 of file qgsvectorlayer.h.
|
virtual |
Returns the string (typically sql) used to define a subset of the layer.
Definition at line 941 of file qgsvectorlayer.cpp.
|
signal |
Emitted when the layer's subset string has changed.
bool QgsVectorLayer::supportsEditing | ( | ) |
Returns whether the layer supports editing or not.
false
if the layer is read only or the data provider has no editing capabilities
|
signal |
Emitted when the read only state or the data provider of this layer is changed.
|
signal |
Emitted when the feature count for symbols on this layer has been recalculated.
QgsFeatureIds QgsVectorLayer::symbolFeatureIds | ( | const QString & | legendKey | ) | const |
Ids of features rendered with specified legend key.
Features must be first calculated by countSymbolFeatures()
Definition at line 767 of file qgsvectorlayer.cpp.
|
overridevirtual |
Returns temporal properties associated with the vector layer.
Reimplemented from QgsMapLayer.
Definition at line 645 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 1348 of file qgsvectorlayer.cpp.
QStringList QgsVectorLayer::uniqueStringsMatching | ( | int | index, |
const QString & | substring, | ||
int | limit = -1 , |
||
QgsFeedback * | feedback = nullptr |
||
) | const |
Returns unique string values of an attribute which contain a specified subset string.
Subset matching is done in a case-insensitive manner. 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 |
substring | substring to match (case insensitive) |
limit | maxmum number of the values to return, or -1 to return all unique values |
feedback | optional feedback object for canceling request |
Definition at line 4135 of file qgsvectorlayer.cpp.
|
virtual |
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).
fieldIndex | column index for attribute |
limit | maximum number of values to return (or -1 if unlimited) |
Reimplemented from QgsFeatureSource.
Definition at line 4028 of file qgsvectorlayer.cpp.
|
signal |
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 3825 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.
force | true to update layer extent even if it's read from xml by default, false otherwise |
Definition at line 809 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::updateFeature | ( | QgsFeature & | feature, |
bool | skipDefaultValues = false |
||
) |
Updates an existing feature in the layer, replacing the attributes and geometry for the feature with matching QgsFeature::id() with the attributes and geometry from feature.
Changes are not immediately committed to the layer.
If skipDefaultValue is set to true
, default field values will not be updated. This can be used to override default field value expressions.
Returns true
if the feature's attribute was successfully changed.
Definition at line 1045 of file qgsvectorlayer.cpp.
void QgsVectorLayer::updateFields | ( | ) |
Will regenerate the fields
property of this layer by obtaining all fields from the dataProvider, joined fields and virtual fields.
It will also take any changes made to default values into consideration.
Definition at line 3831 of file qgsvectorlayer.cpp.
const QList< QgsVectorLayerJoinInfo > QgsVectorLayer::vectorJoins | ( | ) | const |
Definition at line 3792 of file qgsvectorlayer.cpp.
QList< QgsWeakRelation > QgsVectorLayer::weakRelations | ( | ) | const |
Returns the layer's weak relations as specified in the layer's style.
Definition at line 5230 of file qgsvectorlayer.cpp.
|
virtual |
Returns the WKBType or WKBUnknown in case of error.
Implements QgsFeatureSource.
Definition at line 672 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 QVariantMap & | props = QVariantMap() |
||
) | 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 |
true
in case of success Definition at line 2915 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::writeStyle | ( | QDomNode & | node, |
QDomDocument & | doc, | ||
QString & | errorMessage, | ||
const QgsReadWriteContext & | context, | ||
QgsMapLayer::StyleCategories | categories = QgsMapLayer::AllStyleCategories |
||
) | const |
Definition at line 2808 of file qgsvectorlayer.cpp.
bool QgsVectorLayer::writeSymbology | ( | QDomNode & | node, |
QDomDocument & | doc, | ||
QString & | errorMessage, | ||
const QgsReadWriteContext & | context, | ||
QgsMapLayer::StyleCategories | categories = QgsMapLayer::AllStyleCategories |
||
) | const |
Definition at line 2619 of file qgsvectorlayer.cpp.
|
virtual |
Writes vector layer specific state to project file Dom node.
Reimplemented from QgsMapLayer.
Definition at line 1857 of file qgsvectorlayer.cpp.
|
friend |
Definition at line 2921 of file qgsvectorlayer.h.
|
friend |
Definition at line 2922 of file qgsvectorlayer.h.
|
friend |
Definition at line 2976 of file qgsvectorlayer.h.
|
readwrite |
Definition at line 86 of file qgsvectorlayer.h.
|
readwrite |
Definition at line 86 of file qgsvectorlayer.h.
|
readwrite |
Definition at line 86 of file qgsvectorlayer.h.
|
readwrite |
Definition at line 86 of file qgsvectorlayer.h.
|
readwrite |
Definition at line 86 of file qgsvectorlayer.h.
|
read |
Definition at line 86 of file qgsvectorlayer.h.