QGIS API Documentation  2.99.0-Master (23ddace)
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  bool hasGeometryType() const;
693 
695  QgsWkbTypes::Type wkbType() const override;
696 
698  QString providerType() const;
699 
700  QgsCoordinateReferenceSystem sourceCrs() const override;
701  QString sourceName() const override;
702 
706  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
707 
711  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
712 
716  void resolveReferences( QgsProject *project );
717 
726  virtual void saveStyleToDatabase( const QString &name, const QString &description,
727  bool useAsDefault, const QString &uiFileContent,
728  QString &msgError SIP_OUT );
729 
738  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
739  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
740 
744  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
745 
753  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
754 
761  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
762 
767  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
768 
775  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
776 
783  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
784 
792  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
793 
801  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
802 
811  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
812 
813  bool readSld( const QDomNode &node, QString &errorMessage ) override;
814 
820  long featureCount( const QString &legendKey ) const;
821 
832  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
833 
845  bool countSymbolFeatures();
846 
854  virtual bool setSubsetString( const QString &subset );
855 
860  virtual QString subsetString() const;
861 
867  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
868 
872  inline QgsFeatureIterator getFeatures( const QString &expression )
873  {
874  return getFeatures( QgsFeatureRequest( expression ) );
875  }
876 
882  {
883  QgsFeature feature;
884  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
885  return feature;
886  }
887 
892  {
893  return getFeatures( QgsFeatureRequest( fids ) );
894  }
895 
899  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
900  {
901  return getFeatures( QgsFeatureRequest( rectangle ) );
902  }
903 
904  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
905 
912  bool updateFeature( QgsFeature &f );
913 
918  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
919 
924  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
925 
930  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
931 
937  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
938 
944  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
945 
949  bool deleteSelectedFeatures( int *deletedCount = nullptr );
950 
963  // TODO QGIS 3.0 returns an enum instead of a magic constant
964  int addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
965 
976  // TODO QGIS 3.0 returns an enum instead of a magic constant
977  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
978 
990  // TODO QGIS 3.0 returns an enum instead of a magic constant
991  int addPart( const QList<QgsPointXY> &ring );
992 
1005  // TODO QGIS 3.0 returns an enum instead of a magic constant
1006  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1007 
1009  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1010 
1017  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1018 
1026  // TODO QGIS 3.0 returns an enum instead of a magic constant
1027  int splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1028 
1036  // TODO QGIS 3.0 returns an enum instead of a magic constant
1037  int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1038 
1044  int addTopologicalPoints( const QgsGeometry &geom );
1045 
1053  int addTopologicalPoints( const QgsPointXY &p );
1054 
1058  const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; }
1059 
1063  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1064 
1066  virtual bool isEditable() const override;
1067 
1068  virtual bool isSpatial() const override;
1069 
1071  virtual bool isModified() const;
1072 
1074  virtual void reload() override;
1075 
1079  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1080 
1081  QgsRectangle extent() const override;
1082  QgsRectangle sourceExtent() const override;
1083 
1090  inline QgsFields fields() const override { return mFields; }
1091 
1099  inline QgsFields pendingFields() const { return mFields; }
1100 
1105  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1106 
1111  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1112 
1117  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1118 
1120  QgsAttributeList pkAttributeList() const;
1121 
1126  inline long pendingFeatureCount() const { return featureCount(); }
1127 
1132  long featureCount() const override;
1133 
1137  bool setReadOnly( bool readonly = true );
1138 
1140  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
1141 
1152  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1153 
1157  bool addAttribute( const QgsField &field );
1158 
1164  void setFieldAlias( int index, const QString &aliasString );
1165 
1171  void removeFieldAlias( int index );
1172 
1178  bool renameAttribute( int index, const QString &newName );
1179 
1186  QString attributeAlias( int index ) const;
1187 
1189  QString attributeDisplayName( int index ) const;
1190 
1192  QgsStringMap attributeAliases() const;
1193 
1197  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1198 
1202  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1203 
1207  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1208 
1212  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1213 
1215  bool deleteAttribute( int attr );
1216 
1224  bool deleteAttributes( QList<int> attrs );
1225 
1226  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1227 
1229  bool deleteFeature( QgsFeatureId fid );
1230 
1238  bool deleteFeatures( const QgsFeatureIds &fids );
1239 
1256  bool commitChanges();
1257 
1262  QStringList commitErrors() const;
1263 
1267  bool rollBack( bool deleteBuffer = true );
1268 
1275  QList<QgsRelation> referencingRelations( int idx ) const;
1276 
1278  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1279 
1282  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1283 
1288  void beginEditCommand( const QString &text );
1289 
1291  void endEditCommand();
1292 
1294  void destroyEditCommand();
1295 
1298  {
1301  NoMarker
1302  };
1303 
1305  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1306 
1308  void updateFields();
1309 
1323  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1324  QgsExpressionContext *context = nullptr ) const;
1325 
1334  void setDefaultValueExpression( int index, const QString &expression );
1335 
1344  QString defaultValueExpression( int index ) const;
1345 
1353  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1354 
1360  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1361 
1371 
1379  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1380 
1388  QString constraintExpression( int index ) const;
1389 
1397  QString constraintDescription( int index ) const;
1398 
1407  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1408 
1412  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1413 
1420  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1421 
1432  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1433 
1447  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1448  QgsFeedback *feedback = nullptr ) const;
1449 
1457  QVariant minimumValue( int index ) const;
1458 
1466  QVariant maximumValue( int index ) const;
1467 
1477  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1478  const QString &fieldOrExpression,
1480  QgsExpressionContext *context = nullptr,
1481  bool *ok = nullptr ) const;
1482 
1492  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1493 
1505  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1506 
1508  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1510  QPainter::CompositionMode featureBlendMode() const;
1511 
1519  void setOpacity( double opacity );
1520 
1528  double opacity() const;
1529 
1530  QString htmlMetadata() const override;
1531 
1535  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1536 
1540  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1541 
1546  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1547 
1555  QgsConditionalLayerStyles *conditionalStyles() const;
1556 
1561  QgsAttributeTableConfig attributeTableConfig() const;
1562 
1567  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1568 
1576  QString mapTipTemplate() const;
1577 
1585  void setMapTipTemplate( const QString &mapTipTemplate );
1586 
1588 
1597  QgsEditFormConfig editFormConfig() const;
1598 
1607  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1608 
1609  public slots:
1610 
1618  void select( QgsFeatureId featureId );
1619 
1627  void select( const QgsFeatureIds &featureIds );
1628 
1636  void deselect( const QgsFeatureId featureId );
1637 
1645  void deselect( const QgsFeatureIds &featureIds );
1646 
1652  void removeSelection();
1653 
1657  virtual void updateExtents();
1658 
1665  bool startEditing();
1666 
1667 
1668  protected slots:
1669  void invalidateSymbolCountedFlag();
1670 
1671  signals:
1672 
1680  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1681 
1683  void layerModified();
1684 
1686  void beforeModifiedCheck() const;
1687 
1689  void beforeEditingStarted();
1690 
1692  void editingStarted();
1693 
1695  void editingStopped();
1696 
1698  void beforeCommitChanges();
1699 
1701  void beforeRollBack();
1702 
1711  void attributeAdded( int idx );
1712 
1719  void beforeAddingExpressionField( const QString &fieldName );
1720 
1729  void attributeDeleted( int idx );
1730 
1737  void beforeRemovingExpressionField( int idx );
1738 
1744  void featureAdded( QgsFeatureId fid );
1745 
1754  void featureDeleted( QgsFeatureId fid );
1755 
1765  void featuresDeleted( const QgsFeatureIds &fids );
1766 
1771  void updatedFields();
1772 
1773 
1782  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1783 
1791  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1792 
1794  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1796  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1798  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1800  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1802  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1804  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1805 
1807  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1808 
1810  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1811 
1819  void opacityChanged( double opacity );
1820 
1826  void editCommandStarted( const QString &text );
1827 
1833  void editCommandEnded();
1834 
1840  void editCommandDestroyed();
1841 
1851  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
1852 
1862  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
1863 
1869  void mapTipTemplateChanged();
1870 
1876  void displayExpressionChanged();
1877 
1881  void raiseError( const QString &msg );
1882 
1888  void editFormConfigChanged();
1889 
1896  void readOnlyChanged();
1897 
1903  void symbolFeatureCountMapChanged();
1904 
1905  private slots:
1906  void onJoinedFieldsChanged();
1907  void onFeatureDeleted( QgsFeatureId fid );
1908  void onRelationsLoaded();
1909  void onSymbolsCounted();
1910 
1911  protected:
1913  void setExtent( const QgsRectangle &rect ) override;
1914 
1915  private: // Private methods
1916 
1920  virtual bool isReadOnly() const override;
1921 
1926  bool setDataProvider( QString const &provider );
1927 
1929  QgsFeatureId findFreeId();
1930 
1932  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1933 
1935  void readSldLabeling( const QDomNode &node );
1936 
1938  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
1939 
1940 #ifdef SIP_RUN
1941  QgsVectorLayer( const QgsVectorLayer &rhs );
1942 #endif
1943 
1944  private: // Private attributes
1945  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
1946 
1948  QgsVectorDataProvider *mDataProvider = nullptr;
1949 
1951  QString mDisplayExpression;
1952 
1953  QString mMapTipTemplate;
1954 
1956  QString mProviderKey;
1957 
1959  QgsActionManager *mActions = nullptr;
1960 
1962  bool mReadOnly;
1963 
1968  QgsFeatureIds mSelectedFeatureIds;
1969 
1971  QgsFields mFields;
1972 
1974  QgsStringMap mAttributeAliasMap;
1975 
1977  QgsStringMap mDefaultExpressionMap;
1978 
1980  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
1981 
1983  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
1984 
1986  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
1987 
1988  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
1989 
1991  QgsEditFormConfig mEditFormConfig;
1992 
1994  QSet<QString> mExcludeAttributesWMS;
1995 
1997  QSet<QString> mExcludeAttributesWFS;
1998 
2000  QgsWkbTypes::Type mWkbType;
2001 
2003  QgsFeatureRenderer *mRenderer = nullptr;
2004 
2006  QgsVectorSimplifyMethod mSimplifyMethod;
2007 
2009  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2010 
2012  bool mLabelFontNotFoundNotified;
2013 
2015  QPainter::CompositionMode mFeatureBlendMode;
2016 
2018  double mLayerOpacity = 1.0;
2019 
2021  bool mVertexMarkerOnlyForSelection;
2022 
2023  QStringList mCommitErrors;
2024 
2026  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2028 
2029  //stores information about joined layers
2030  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2031 
2033  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2034 
2035  //diagram rendering object. 0 if diagram drawing is disabled
2036  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2037 
2038  //stores infos about diagram placement (placement type, priority, position distance)
2039  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2040 
2041  mutable bool mValidExtent;
2042  mutable bool mLazyExtent;
2043 
2044  // Features in renderer classes counted
2045  bool mSymbolFeatureCounted;
2046 
2047  // Feature counts for each renderer legend key
2048  QHash<QString, long> mSymbolFeatureCountMap;
2049 
2051  bool mEditCommandActive;
2052 
2053  QgsFeatureIds mDeletedFids;
2054 
2055  QgsAttributeTableConfig mAttributeTableConfig;
2056 
2057  mutable QMutex mFeatureSourceConstructorMutex;
2058 
2059  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2060 
2062 };
2063 
2064 #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 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:107
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:24
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:57
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:39
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
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:62
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.