QGIS API Documentation  2.99.0-Master (cd0ba91)
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QSet>
25 #include <QList>
26 #include <QStringList>
27 #include <QFont>
28 #include <QMutex>
29 
30 #include "qgis.h"
31 #include "qgsmaplayer.h"
32 #include "qgsfeature.h"
33 #include "qgsfeaturerequest.h"
34 #include "qgsfeaturesource.h"
35 #include "qgsfields.h"
36 #include "qgsvectordataprovider.h"
38 #include "qgseditformconfig.h"
40 #include "qgsaggregatecalculator.h"
41 #include "qgsfeatureiterator.h"
43 
44 class QPainter;
45 class QImage;
46 
48 class QgsActionManager;
51 class QgsCurve;
53 class QgsDiagramRenderer;
56 class QgsFeatureRenderer;
57 class QgsGeometry;
58 class QgsGeometryVertexIndex;
59 class QgsMapToPixel;
60 class QgsRectangle;
61 class QgsRectangle;
62 class QgsRelation;
63 class QgsRelationManager;
65 class QgsSymbol;
71 class QgsPoint;
72 class QgsFeedback;
75 
76 typedef QList<int> QgsAttributeList;
77 typedef QSet<int> QgsAttributeIds;
78 
79 
354 {
355  Q_OBJECT
356 
357  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
358  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
359  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
360  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
361  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
362 
363  public:
364 
367  {
368  Success = 0,
369  EmptyGeometry = 1,
370  EditFailed = 2,
371  FetchFeatureFailed = 3,
372  InvalidLayer = 4,
373  };
374 
377  {
382  };
383 
389  {
390 
394  explicit LayerOptions( bool loadDefaultStyle = true, bool readExtentFromXml = false )
395  : loadDefaultStyle( loadDefaultStyle )
396  , readExtentFromXml( readExtentFromXml )
397  {}
398 
400  bool loadDefaultStyle = true;
401 
406  bool readExtentFromXml = false;
407 
408  };
409 
423  explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
424  const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
425 
426 
427  virtual ~QgsVectorLayer();
428 
430  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
432  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
433 
442  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
443 
448  QString storageType() const;
449 
453  QString capabilitiesString() const;
454 
458  QString dataComment() const;
459 
467  QString displayField() const;
468 
476  void setDisplayExpression( const QString &displayExpression );
477 
484  QString displayExpression() const;
485 
486  QgsVectorDataProvider *dataProvider() override;
487  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
488 
490  void setProviderEncoding( const QString &encoding );
491 
493  void setCoordinateSystem();
494 
499  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
500 
504  bool removeJoin( const QString &joinLayerId );
505 
510  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
511  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
512 
521  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
522 
530  virtual QSet<QgsMapLayerDependency> dependencies() const override;
531 
542  int addExpressionField( const QString &exp, const QgsField &fld );
543 
551  void removeExpressionField( int index );
552 
562  QString expressionField( int index ) const;
563 
573  void updateExpressionField( int index, const QString &exp );
574 
581  QgsActionManager *actions() { return mActions; }
582 
588  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
589 
595  int selectedFeatureCount() const;
596 
606  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
607 
617  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
618 
629  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
630 
643  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
644 
646  void invertSelection();
647 
649  void selectAll();
650 
658  void invertSelectionInRectangle( QgsRectangle &rect );
659 
668  QgsFeatureList selectedFeatures() const;
669 
681  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
682 
689  const QgsFeatureIds &selectedFeatureIds() const;
690 
692  QgsRectangle boundingBoxOfSelected() const;
693 
699  bool labelsEnabled() const;
700 
706  bool diagramsEnabled() const;
707 
709  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
710  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
711 
712  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
713  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
714 
716  QgsFeatureRenderer *renderer() { return mRenderer; }
717 
722  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
723 
728  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
729 
731  QgsWkbTypes::GeometryType geometryType() const;
732 
734  QgsWkbTypes::Type wkbType() const override;
735 
737  QString providerType() const;
738 
739  QgsCoordinateReferenceSystem sourceCrs() const override;
740  QString sourceName() const override;
741 
746  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
747 
752  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
753 
758  virtual void resolveReferences( QgsProject *project ) override;
759 
768  virtual void saveStyleToDatabase( const QString &name, const QString &description,
769  bool useAsDefault, const QString &uiFileContent,
770  QString &msgError SIP_OUT );
771 
780  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
781  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
782 
786  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
787 
795  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
796 
803  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
804 
809  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
810 
824  bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
825 
835  void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
836 
842  QgsAuxiliaryLayer *auxiliaryLayer();
843 
849  const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
850 
858  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
859 
867  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
868 
877  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
878 
887  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
888 
897  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
898 
899  bool readSld( const QDomNode &node, QString &errorMessage ) override;
900 
906  long featureCount( const QString &legendKey ) const;
907 
918  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
919 
932  QgsVectorLayerFeatureCounter *countSymbolFeatures();
933 
941  virtual bool setSubsetString( const QString &subset );
942 
947  virtual QString subsetString() const;
948 
954  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
955 
959  inline QgsFeatureIterator getFeatures( const QString &expression )
960  {
961  return getFeatures( QgsFeatureRequest( expression ) );
962  }
963 
968  inline QgsFeature getFeature( QgsFeatureId fid ) const
969  {
970  QgsFeature feature;
971  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
972  return feature;
973  }
974 
979  {
980  return getFeatures( QgsFeatureRequest( fids ) );
981  }
982 
986  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
987  {
988  return getFeatures( QgsFeatureRequest( rectangle ) );
989  }
990 
991  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
992 
1003  bool updateFeature( const QgsFeature &feature, bool skipDefaultValues = false );
1004 
1010  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1011 
1017  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1018 
1024  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1025 
1032  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1033 
1040  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
1041 
1046  bool deleteSelectedFeatures( int *deletedCount = nullptr );
1047 
1061  // TODO QGIS 3.0 returns an enum instead of a magic constant
1062  int addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
1063 
1075  // TODO QGIS 3.0 returns an enum instead of a magic constant
1076  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1077 
1090  // TODO QGIS 3.0 returns an enum instead of a magic constant
1091  int addPart( const QList<QgsPointXY> &ring );
1092 
1106  // TODO QGIS 3.0 returns an enum instead of a magic constant
1107  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1108 
1110  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1111 
1119  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1120 
1129  // TODO QGIS 3.0 returns an enum instead of a magic constant
1130  int splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1131 
1140  // TODO QGIS 3.0 returns an enum instead of a magic constant
1141  int splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1142 
1149  int addTopologicalPoints( const QgsGeometry &geom );
1150 
1159  int addTopologicalPoints( const QgsPointXY &p );
1160 
1165  const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1166 
1171  QgsAbstractVectorLayerLabeling *labeling() { return mLabeling; }
1172 
1177  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1178 
1180  virtual bool isEditable() const override;
1181 
1183  virtual bool isSpatial() const override;
1184 
1186  virtual bool isModified() const;
1187 
1194  bool isAuxiliaryField( int index, int &srcIndex ) const;
1195 
1197  virtual void reload() override;
1198 
1203  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1204 
1205  QgsRectangle extent() const override;
1206  QgsRectangle sourceExtent() const override;
1207 
1214  inline QgsFields fields() const override { return mFields; }
1215 
1223  inline QgsFields pendingFields() const { return mFields; }
1224 
1229  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1230 
1235  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1236 
1241  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1242 
1244  QgsAttributeList pkAttributeList() const;
1245 
1250  inline long pendingFeatureCount() const { return featureCount(); }
1251 
1256  long featureCount() const override;
1257 
1262  bool setReadOnly( bool readonly = true );
1263 
1265  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom, bool skipDefaultValue = false );
1266 
1279  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false );
1280 
1285  bool addAttribute( const QgsField &field );
1286 
1292  void setFieldAlias( int index, const QString &aliasString );
1293 
1299  void removeFieldAlias( int index );
1300 
1307  bool renameAttribute( int index, const QString &newName );
1308 
1315  QString attributeAlias( int index ) const;
1316 
1318  QString attributeDisplayName( int index ) const;
1319 
1321  QgsStringMap attributeAliases() const;
1322 
1326  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1327 
1331  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1332 
1336  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1337 
1341  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1342 
1344  virtual bool deleteAttribute( int attr );
1345 
1353  bool deleteAttributes( QList<int> attrs );
1354 
1355  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1356 
1358  bool deleteFeature( QgsFeatureId fid );
1359 
1367  bool deleteFeatures( const QgsFeatureIds &fids );
1368 
1385  bool commitChanges();
1386 
1392  QStringList commitErrors() const;
1393 
1398  bool rollBack( bool deleteBuffer = true );
1399 
1406  QList<QgsRelation> referencingRelations( int idx ) const;
1407 
1409  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1410 
1415  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1416 
1421  void beginEditCommand( const QString &text );
1422 
1424  void endEditCommand();
1425 
1427  void destroyEditCommand();
1428 
1431  {
1434  NoMarker
1435  };
1436 
1438  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1439 
1448  void updateFields();
1449 
1464  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1465  QgsExpressionContext *context = nullptr ) const;
1466 
1478  void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
1479 
1490  QgsDefaultValue defaultValueDefinition( int index ) const;
1491 
1499  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1500 
1506  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1507 
1517 
1525  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1526 
1534  QString constraintExpression( int index ) const;
1535 
1543  QString constraintDescription( int index ) const;
1544 
1553  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1554 
1558  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1559 
1566  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1567 
1579  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1580 
1594  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1595  QgsFeedback *feedback = nullptr ) const;
1596 
1605  QVariant minimumValue( int index ) const override;
1606 
1615  QVariant maximumValue( int index ) const override;
1616 
1627  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1628  const QString &fieldOrExpression,
1630  QgsExpressionContext *context = nullptr,
1631  bool *ok = nullptr ) const;
1632 
1643  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1644 
1657  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1658 
1660  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1662  QPainter::CompositionMode featureBlendMode() const;
1663 
1671  void setOpacity( double opacity );
1672 
1680  double opacity() const;
1681 
1682  QString htmlMetadata() const override;
1683 
1688  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1689 
1694  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1695 
1701  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1702 
1710  QgsConditionalLayerStyles *conditionalStyles() const;
1711 
1716  QgsAttributeTableConfig attributeTableConfig() const;
1717 
1722  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1723 
1731  QString mapTipTemplate() const;
1732 
1740  void setMapTipTemplate( const QString &mapTipTemplate );
1741 
1742  QgsExpressionContext createExpressionContext() const override;
1743 
1752  QgsEditFormConfig editFormConfig() const;
1753 
1762  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1763 
1771  void setReadExtentFromXml( bool readExtentFromXml );
1772 
1780  bool readExtentFromXml() const;
1781 
1787  bool isEditCommandActive() const { return mEditCommandActive; }
1788 
1789  public slots:
1790 
1798  void select( QgsFeatureId featureId );
1799 
1807  void select( const QgsFeatureIds &featureIds );
1808 
1816  void deselect( const QgsFeatureId featureId );
1817 
1825  void deselect( const QgsFeatureIds &featureIds );
1826 
1832  void removeSelection();
1833 
1840  virtual void updateExtents( bool force = false );
1841 
1848  bool startEditing();
1849 
1850  signals:
1851 
1859  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1860 
1862  void layerModified();
1863 
1865  void beforeModifiedCheck() const;
1866 
1868  void beforeEditingStarted();
1869 
1871  void editingStarted();
1872 
1874  void editingStopped();
1875 
1877  void beforeCommitChanges();
1878 
1880  void beforeRollBack();
1881 
1890  void attributeAdded( int idx );
1891 
1898  void beforeAddingExpressionField( const QString &fieldName );
1899 
1908  void attributeDeleted( int idx );
1909 
1916  void beforeRemovingExpressionField( int idx );
1917 
1923  void featureAdded( QgsFeatureId fid );
1924 
1933  void featureDeleted( QgsFeatureId fid );
1934 
1944  void featuresDeleted( const QgsFeatureIds &fids );
1945 
1950  void updatedFields();
1951 
1952 
1961  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1962 
1970  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1971 
1973  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1975  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1977  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1979  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1981  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1983  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1984 
1986  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1987 
1989  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1990 
1998  void opacityChanged( double opacity );
1999 
2005  void editCommandStarted( const QString &text );
2006 
2012  void editCommandEnded();
2013 
2019  void editCommandDestroyed();
2020 
2030  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2031 
2041  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2042 
2048  void mapTipTemplateChanged();
2049 
2055  void displayExpressionChanged();
2056 
2060  void raiseError( const QString &msg );
2061 
2067  void editFormConfigChanged();
2068 
2075  void readOnlyChanged();
2076 
2082  void symbolFeatureCountMapChanged();
2083 
2084  private slots:
2085  void invalidateSymbolCountedFlag();
2086  void onFeatureCounterCompleted();
2087  void onFeatureCounterTerminated();
2088  void onJoinedFieldsChanged();
2089  void onFeatureDeleted( QgsFeatureId fid );
2090  void onRelationsLoaded();
2091  void onSymbolsCounted();
2092  void onDirtyTransaction( const QString &sql );
2093 
2094  protected:
2096  void setExtent( const QgsRectangle &rect ) override;
2097 
2098  private: // Private methods
2099 
2100  void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );
2101 
2105  virtual bool isReadOnly() const override;
2106 
2112  bool setDataProvider( QString const &provider );
2113 
2115  void readSldLabeling( const QDomNode &node );
2116 
2118  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2119 
2120 #ifdef SIP_RUN
2121  QgsVectorLayer( const QgsVectorLayer &rhs );
2122 #endif
2123 
2124  private: // Private attributes
2125  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2126 
2128  QgsVectorDataProvider *mDataProvider = nullptr;
2129 
2131  QString mDisplayExpression;
2132 
2133  QString mMapTipTemplate;
2134 
2136  QString mProviderKey;
2137 
2139  QgsActionManager *mActions = nullptr;
2140 
2142  bool mReadOnly = false;
2143 
2149  QgsFeatureIds mSelectedFeatureIds;
2150 
2152  QgsFields mFields;
2153 
2155  QgsStringMap mAttributeAliasMap;
2156 
2158  QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2159 
2161  QSet<int> mDefaultValueOnUpdateFields;
2162 
2164  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2165 
2167  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2168 
2170  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2171 
2172  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2173 
2175  QgsEditFormConfig mEditFormConfig;
2176 
2178  QSet<QString> mExcludeAttributesWMS;
2179 
2181  QSet<QString> mExcludeAttributesWFS;
2182 
2185 
2187  QgsFeatureRenderer *mRenderer = nullptr;
2188 
2190  QgsVectorSimplifyMethod mSimplifyMethod;
2191 
2193  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2194 
2196  bool mLabelFontNotFoundNotified = false;
2197 
2199  QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
2200 
2202  double mLayerOpacity = 1.0;
2203 
2205  bool mVertexMarkerOnlyForSelection = false;
2206 
2207  QStringList mCommitErrors;
2208 
2210  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2212 
2213  //stores information about joined layers
2214  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2215 
2217  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2218 
2219  //diagram rendering object. 0 if diagram drawing is disabled
2220  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2221 
2222  //stores infos about diagram placement (placement type, priority, position distance)
2223  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2224 
2225  mutable bool mValidExtent = false;
2226  mutable bool mLazyExtent = true;
2227 
2229  std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
2230 
2232  QString mAuxiliaryLayerKey;
2233 
2234  // Features in renderer classes counted
2235  bool mSymbolFeatureCounted = false;
2236 
2237  // Feature counts for each renderer legend key
2238  QHash<QString, long> mSymbolFeatureCountMap;
2239 
2241  bool mEditCommandActive = false;
2242 
2243  bool mReadExtentFromXml;
2244  QgsRectangle mXmlExtent;
2245 
2246  QgsFeatureIds mDeletedFids;
2247 
2248  QgsAttributeTableConfig mAttributeTableConfig;
2249 
2250  mutable QMutex mFeatureSourceConstructorMutex;
2251 
2252  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2253 
2255 };
2256 
2257 // clazy:excludeall=qstring-allocations
2258 
2259 #endif
QgsActionManager * actions()
Get all layer actions defined on this layer.
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:537
A rectangle specified with double values.
Definition: qgsrectangle.h:39
Base class for all map layer types.
Definition: qgsmaplayer.h:56
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
The QgsDefaultValue class provides a container for managing client side default values for fields...
Constraint
Constraints which may be present on a field.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
Setting options for loading vector layers.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
Class allowing to manage the auxiliary storage for a vector layer.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
LayerOptions(bool loadDefaultStyle=true, bool readExtentFromXml=false)
Constructor for LayerOptions.
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsFeature getFeature(QgsFeatureId fid) const
Query the layer for the feature with the given id.
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
QgsAbstractVectorLayerLabeling * labeling()
Access to labeling configuration.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
Class providing some utility methods to manage auxiliary storage.
Container of fields for a vector layer.
Definition: qgsfields.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
bool isEditCommandActive() const
Test if an edit command is active.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
QMap< QString, QString > QgsStringMap
Definition: qgis.h:443
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList()
Manages joined fields for a vector layer.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
QgsFields fields() const override
Returns the list of fields of this layer.
#define SIP_SKIP
Definition: qgis_sip.h:119
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsFeatureIterator getFeatures(const QString &expression)
Query the layer for features matching a given expression.
Defines left outer join from our vector layer to some other vector layer.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Reads and writes project states.
Definition: qgsproject.h:81
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QgsFeatureRenderer * renderer()
Return renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Add selection to current selection.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const QgsDiagramRenderer * diagramRenderer() const
Abstract interface for generating an expression context.
Partial snapshot of vector layer&#39;s state (only the members necessary for access to features) ...
Set selection, removing any existing selection.
QgsFeatureIterator getFeatures(const QgsRectangle &rectangle)
Query the layer for the features which intersect the specified rectangle.
Stores the settings for rendering of all diagrams for a layer.
QVector< QgsPoint > QgsPointSequence
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount() ...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:137
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Buffers information about expression fields for a vector layer.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:528
An interface for objects which provide features via a getFeatures method.
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
#define SIP_OUT
Definition: qgis_sip.h:51
The QgsConditionalLayerStyles class holds conditional style information for a layer.
This class represents a coordinate reference system (CRS).
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
QgsFields pendingFields() const
Returns the list of fields of this layer.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
const QgsFeatureRenderer * renderer() const
Return const renderer.
QSet< int > QgsAttributeIds
QList< int > QgsAttributeList
Definition: qgsfield.h:27
bool nextFeature(QgsFeature &f)
This is a container for configuration of the attribute table.
This is the base class for vector data providers.
QList< int > QgsAttributeList
const QgsActionManager * actions() const
Get all layer actions defined on this layer.
Represents a vector layer which manages a vector based data sets.
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations.
EditResult
Result of an edit operation.
QgsFeatureIterator getFeatures(const QgsFeatureIds &fids)
Query the layer for the features with the given ids.
Constraint must be honored before feature can be accepted.
Abstract base class for simplify geometries using a specific algorithm.
Aggregate
Available aggregates to calculate.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74
A bundle of parameters controlling aggregate calculation.