QGIS API Documentation  2.99.0-Master (b95d432)
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;
73 
74 typedef QList<int> QgsAttributeList;
75 typedef QSet<int> QgsAttributeIds;
76 
77 
351 {
352  Q_OBJECT
353 
354  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
355  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
356  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
357  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
358  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
359 
360  public:
361 
364  {
365  Success = 0,
366  EmptyGeometry = 1,
367  EditFailed = 2,
368  FetchFeatureFailed = 3,
369  InvalidLayer = 4,
370  };
371 
374  {
379  };
380 
394  QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
395  const QString &providerLib = "ogr", bool loadDefaultStyleFlag = true );
396 
397 
398  virtual ~QgsVectorLayer();
399 
401  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
403  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
404 
412  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
413 
415  QString storageType() const;
416 
418  QString capabilitiesString() const;
419 
421  QString dataComment() const;
422 
430  QString displayField() const;
431 
438  void setDisplayExpression( const QString &displayExpression );
439 
446  QString displayExpression() const;
447 
448  QgsVectorDataProvider *dataProvider() override;
449  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
450 
452  void setProviderEncoding( const QString &encoding );
453 
455  void setCoordinateSystem();
456 
460  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
461 
464  bool removeJoin( const QString &joinLayerId );
465 
470  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
471  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
472 
481  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
482 
490  virtual QSet<QgsMapLayerDependency> dependencies() const override;
491 
502  int addExpressionField( const QString &exp, const QgsField &fld );
503 
511  void removeExpressionField( int index );
512 
522  QString expressionField( int index ) const;
523 
533  void updateExpressionField( int index, const QString &exp );
534 
541  QgsActionManager *actions() { return mActions; }
542 
548  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
549 
555  int selectedFeatureCount() const;
556 
566  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
567 
576  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
577 
587  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
588 
601  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
602 
604  void invertSelection();
605 
607  void selectAll();
608 
610  QgsFeatureIds allFeatureIds() const;
611 
619  void invertSelectionInRectangle( QgsRectangle &rect );
620 
629  QgsFeatureList selectedFeatures() const;
630 
642  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
643 
650  const QgsFeatureIds &selectedFeatureIds() const;
651 
653  QgsRectangle boundingBoxOfSelected() const;
654 
659  bool labelsEnabled() const;
660 
665  bool diagramsEnabled() const;
666 
668  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
669  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
670 
671  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
672  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
673 
675  QgsFeatureRenderer *renderer() { return mRenderer; }
676 
680  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
681 
686  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
687 
689  QgsWkbTypes::GeometryType geometryType() const;
690 
692  QgsWkbTypes::Type wkbType() const override;
693 
695  QString providerType() const;
696 
697  QgsCoordinateReferenceSystem sourceCrs() const override;
698  QString sourceName() const override;
699 
703  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
704 
708  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
709 
713  void resolveReferences( QgsProject *project );
714 
723  virtual void saveStyleToDatabase( const QString &name, const QString &description,
724  bool useAsDefault, const QString &uiFileContent,
725  QString &msgError SIP_OUT );
726 
735  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
736  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
737 
741  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
742 
750  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
751 
758  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
759 
764  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
765 
772  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
773 
780  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
781 
789  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
790 
798  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
799 
808  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
809 
810  bool readSld( const QDomNode &node, QString &errorMessage ) override;
811 
817  long featureCount( const QString &legendKey ) const;
818 
829  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
830 
842  bool countSymbolFeatures();
843 
851  virtual bool setSubsetString( const QString &subset );
852 
857  virtual QString subsetString() const;
858 
864  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
865 
869  inline QgsFeatureIterator getFeatures( const QString &expression )
870  {
871  return getFeatures( QgsFeatureRequest( expression ) );
872  }
873 
879  {
880  QgsFeature feature;
881  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
882  return feature;
883  }
884 
889  {
890  return getFeatures( QgsFeatureRequest( fids ) );
891  }
892 
896  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
897  {
898  return getFeatures( QgsFeatureRequest( rectangle ) );
899  }
900 
901  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
902 
909  bool updateFeature( QgsFeature &f );
910 
915  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
916 
921  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
922 
927  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
928 
934  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
935 
941  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
942 
946  bool deleteSelectedFeatures( int *deletedCount = nullptr );
947 
960  // TODO QGIS 3.0 returns an enum instead of a magic constant
961  int addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
962 
973  // TODO QGIS 3.0 returns an enum instead of a magic constant
974  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
975 
987  // TODO QGIS 3.0 returns an enum instead of a magic constant
988  int addPart( const QList<QgsPointXY> &ring );
989 
1002  // TODO QGIS 3.0 returns an enum instead of a magic constant
1003  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1004 
1006  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1007 
1014  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1015 
1023  // TODO QGIS 3.0 returns an enum instead of a magic constant
1024  int splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1025 
1033  // TODO QGIS 3.0 returns an enum instead of a magic constant
1034  int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1035 
1041  int addTopologicalPoints( const QgsGeometry &geom );
1042 
1050  int addTopologicalPoints( const QgsPointXY &p );
1051 
1055  const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; }
1056 
1060  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1061 
1063  virtual bool isEditable() const override;
1064 
1066  virtual bool isSpatial() const override;
1067 
1069  virtual bool isModified() const;
1070 
1072  virtual void reload() override;
1073 
1077  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1078 
1079  QgsRectangle extent() const override;
1080  QgsRectangle sourceExtent() const override;
1081 
1088  inline QgsFields fields() const override { return mFields; }
1089 
1097  inline QgsFields pendingFields() const { return mFields; }
1098 
1103  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1104 
1109  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1110 
1115  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1116 
1118  QgsAttributeList pkAttributeList() const;
1119 
1124  inline long pendingFeatureCount() const { return featureCount(); }
1125 
1130  long featureCount() const override;
1131 
1135  bool setReadOnly( bool readonly = true );
1136 
1138  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
1139 
1150  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1151 
1155  bool addAttribute( const QgsField &field );
1156 
1162  void setFieldAlias( int index, const QString &aliasString );
1163 
1169  void removeFieldAlias( int index );
1170 
1176  bool renameAttribute( int index, const QString &newName );
1177 
1184  QString attributeAlias( int index ) const;
1185 
1187  QString attributeDisplayName( int index ) const;
1188 
1190  QgsStringMap attributeAliases() const;
1191 
1195  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1196 
1200  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1201 
1205  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1206 
1210  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1211 
1213  bool deleteAttribute( int attr );
1214 
1222  bool deleteAttributes( QList<int> attrs );
1223 
1224  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1225 
1227  bool deleteFeature( QgsFeatureId fid );
1228 
1236  bool deleteFeatures( const QgsFeatureIds &fids );
1237 
1254  bool commitChanges();
1255 
1260  QStringList commitErrors() const;
1261 
1265  bool rollBack( bool deleteBuffer = true );
1266 
1273  QList<QgsRelation> referencingRelations( int idx ) const;
1274 
1276  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1277 
1280  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1281 
1286  void beginEditCommand( const QString &text );
1287 
1289  void endEditCommand();
1290 
1292  void destroyEditCommand();
1293 
1296  {
1299  NoMarker
1300  };
1301 
1303  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1304 
1306  void updateFields();
1307 
1321  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1322  QgsExpressionContext *context = nullptr ) const;
1323 
1332  void setDefaultValueExpression( int index, const QString &expression );
1333 
1342  QString defaultValueExpression( int index ) const;
1343 
1351  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1352 
1358  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1359 
1369 
1377  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1378 
1386  QString constraintExpression( int index ) const;
1387 
1395  QString constraintDescription( int index ) const;
1396 
1405  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1406 
1410  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1411 
1418  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1419 
1430  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1431 
1445  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1446  QgsFeedback *feedback = nullptr ) const;
1447 
1455  QVariant minimumValue( int index ) const override;
1456 
1464  QVariant maximumValue( int index ) const override;
1465 
1475  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1476  const QString &fieldOrExpression,
1478  QgsExpressionContext *context = nullptr,
1479  bool *ok = nullptr ) const;
1480 
1490  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1491 
1503  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1504 
1506  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1508  QPainter::CompositionMode featureBlendMode() const;
1509 
1517  void setOpacity( double opacity );
1518 
1526  double opacity() const;
1527 
1528  QString htmlMetadata() const override;
1529 
1533  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1534 
1538  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1539 
1544  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1545 
1553  QgsConditionalLayerStyles *conditionalStyles() const;
1554 
1559  QgsAttributeTableConfig attributeTableConfig() const;
1560 
1565  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1566 
1574  QString mapTipTemplate() const;
1575 
1583  void setMapTipTemplate( const QString &mapTipTemplate );
1584 
1586 
1595  QgsEditFormConfig editFormConfig() const;
1596 
1605  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1606 
1607  public slots:
1608 
1616  void select( QgsFeatureId featureId );
1617 
1625  void select( const QgsFeatureIds &featureIds );
1626 
1634  void deselect( const QgsFeatureId featureId );
1635 
1643  void deselect( const QgsFeatureIds &featureIds );
1644 
1650  void removeSelection();
1651 
1655  virtual void updateExtents();
1656 
1663  bool startEditing();
1664 
1665 
1666  protected slots:
1667  void invalidateSymbolCountedFlag();
1668 
1669  signals:
1670 
1678  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1679 
1681  void layerModified();
1682 
1684  void beforeModifiedCheck() const;
1685 
1687  void beforeEditingStarted();
1688 
1690  void editingStarted();
1691 
1693  void editingStopped();
1694 
1696  void beforeCommitChanges();
1697 
1699  void beforeRollBack();
1700 
1709  void attributeAdded( int idx );
1710 
1717  void beforeAddingExpressionField( const QString &fieldName );
1718 
1727  void attributeDeleted( int idx );
1728 
1735  void beforeRemovingExpressionField( int idx );
1736 
1742  void featureAdded( QgsFeatureId fid );
1743 
1752  void featureDeleted( QgsFeatureId fid );
1753 
1763  void featuresDeleted( const QgsFeatureIds &fids );
1764 
1769  void updatedFields();
1770 
1771 
1780  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1781 
1789  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1790 
1792  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1794  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1796  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1798  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1800  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1802  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1803 
1805  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1806 
1808  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1809 
1817  void opacityChanged( double opacity );
1818 
1824  void editCommandStarted( const QString &text );
1825 
1831  void editCommandEnded();
1832 
1838  void editCommandDestroyed();
1839 
1849  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
1850 
1860  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
1861 
1867  void mapTipTemplateChanged();
1868 
1874  void displayExpressionChanged();
1875 
1879  void raiseError( const QString &msg );
1880 
1886  void editFormConfigChanged();
1887 
1894  void readOnlyChanged();
1895 
1901  void symbolFeatureCountMapChanged();
1902 
1903  private slots:
1904  void onJoinedFieldsChanged();
1905  void onFeatureDeleted( QgsFeatureId fid );
1906  void onRelationsLoaded();
1907  void onSymbolsCounted();
1908 
1909  protected:
1911  void setExtent( const QgsRectangle &rect ) override;
1912 
1913  private: // Private methods
1914 
1918  virtual bool isReadOnly() const override;
1919 
1924  bool setDataProvider( QString const &provider );
1925 
1927  QgsFeatureId findFreeId();
1928 
1930  void readSldLabeling( const QDomNode &node );
1931 
1933  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
1934 
1935 #ifdef SIP_RUN
1936  QgsVectorLayer( const QgsVectorLayer &rhs );
1937 #endif
1938 
1939  private: // Private attributes
1940  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
1941 
1943  QgsVectorDataProvider *mDataProvider = nullptr;
1944 
1946  QString mDisplayExpression;
1947 
1948  QString mMapTipTemplate;
1949 
1951  QString mProviderKey;
1952 
1954  QgsActionManager *mActions = nullptr;
1955 
1957  bool mReadOnly;
1958 
1963  QgsFeatureIds mSelectedFeatureIds;
1964 
1966  QgsFields mFields;
1967 
1969  QgsStringMap mAttributeAliasMap;
1970 
1972  QgsStringMap mDefaultExpressionMap;
1973 
1975  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
1976 
1978  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
1979 
1981  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
1982 
1983  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
1984 
1986  QgsEditFormConfig mEditFormConfig;
1987 
1989  QSet<QString> mExcludeAttributesWMS;
1990 
1992  QSet<QString> mExcludeAttributesWFS;
1993 
1995  QgsWkbTypes::Type mWkbType;
1996 
1998  QgsFeatureRenderer *mRenderer = nullptr;
1999 
2001  QgsVectorSimplifyMethod mSimplifyMethod;
2002 
2004  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2005 
2007  bool mLabelFontNotFoundNotified;
2008 
2010  QPainter::CompositionMode mFeatureBlendMode;
2011 
2013  double mLayerOpacity = 1.0;
2014 
2016  bool mVertexMarkerOnlyForSelection;
2017 
2018  QStringList mCommitErrors;
2019 
2021  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2023 
2024  //stores information about joined layers
2025  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2026 
2028  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2029 
2030  //diagram rendering object. 0 if diagram drawing is disabled
2031  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2032 
2033  //stores infos about diagram placement (placement type, priority, position distance)
2034  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2035 
2036  mutable bool mValidExtent;
2037  mutable bool mLazyExtent;
2038 
2039  // Features in renderer classes counted
2040  bool mSymbolFeatureCounted;
2041 
2042  // Feature counts for each renderer legend key
2043  QHash<QString, long> mSymbolFeatureCountMap;
2044 
2046  bool mEditCommandActive;
2047 
2048  QgsFeatureIds mDeletedFids;
2049 
2050  QgsAttributeTableConfig mAttributeTableConfig;
2051 
2052  mutable QMutex mFeatureSourceConstructorMutex;
2053 
2054  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2055 
2057 };
2058 
2059 #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:512
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
A rectangle specified with double values.
Definition: qgsrectangle.h:38
Base class for all map layer types.
Definition: qgsmaplayer.h:54
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=0)=0
Adds a list of features to the sink.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
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.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:519
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:524
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
A class to represent a 2D point.
Definition: qgspointxy.h:42
virtual QString loadNamedStyle(const QString &uri, bool &resultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
virtual QgsWkbTypes::Type wkbType() const =0
Returns the geometry type for features returned by this source.
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:347
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
virtual bool readXml(const QDomNode &layer_node, const QgsReadWriteContext &context)
Called by readLayerXML(), used by children to read state specific to them from project files...
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by children to write state specific to them to project files...
Container of fields for a vector layer.
Definition: qgsfields.h:41
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:96
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:61
QMap< QString, QString > QgsStringMap
Definition: qgis.h:340
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList()
virtual bool readSymbology(const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context)=0
Read the symbology for the current layer from the Dom node supplied.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this layer.
virtual QgsRectangle extent() const
Returns the extent of the layer.
Manages joined fields for a vector layer.
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context) const =0
Write the symbology for the layer into the docment provided.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:43
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:35
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:66
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error...
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
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.
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsMapLayer & operator=(QgsMapLayer const &)=delete
QgsMapLayer cannot be copied.
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)...
virtual bool isEditable() const
Returns true if the layer can be edited.
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=0)
Adds a single feature to the sink.
Reads and writes project states.
Definition: qgsproject.h:78
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:34
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:46
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
Add selection to current selection.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:36
virtual QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const
Returns the set of unique values contained within the specified fieldIndex from this source...
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:592
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const QgsDiagramRenderer * diagramRenderer() const
virtual QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
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.
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:136
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
virtual bool readStyle(const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context)
Read the style for the current layer from the Dom node supplied.
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:503
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).
QgsFeature getFeature(QgsFeatureId fid)
Query the layer for the feature with the given id.
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.
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
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...
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context) const
Write just the style information for the layer into the document.
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)=0
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
const QgsFeatureRenderer * renderer() const
Return const renderer.
QSet< int > QgsAttributeIds
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error...
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.
virtual QString sourceName() const =0
Returns a friendly display name for the source.
QList< QgsPoint > QgsPointSequence
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.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74
A bundle of parameters controlling aggregate calculation.
virtual long featureCount() const =0
Returns the number of features contained in the source, or -1 if the feature count is unknown...
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.