QGIS API Documentation  2.99.0-Master (d55fa22)
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 "qgsfields.h"
35 #include "qgsvectordataprovider.h"
37 #include "qgseditformconfig.h"
39 #include "qgsaggregatecalculator.h"
40 #include "qgsfeatureiterator.h"
42 
43 class QPainter;
44 class QImage;
45 
47 class QgsActionManager;
50 class QgsCurve;
52 class QgsDiagramRenderer;
55 class QgsFeatureRenderer;
56 class QgsGeometry;
57 class QgsGeometryVertexIndex;
58 class QgsMapToPixel;
59 class QgsRectangle;
60 class QgsRectangle;
61 class QgsRelation;
62 class QgsRelationManager;
64 class QgsSymbol;
70 class QgsPointV2;
72 
73 typedef QList<int> QgsAttributeList;
74 typedef QSet<int> QgsAttributeIds;
75 
76 
349 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionContextGenerator, public QgsFeatureSink
350 {
351  Q_OBJECT
352 
353  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
354  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
355  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
356  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
357 
358  public:
359 
362  {
363  Success = 0,
364  EmptyGeometry = 1,
365  EditFailed = 2,
366  FetchFeatureFailed = 3,
367  InvalidLayer = 4,
368  };
369 
372  {
377  };
378 
392  QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
393  const QString &providerLib = "ogr", bool loadDefaultStyleFlag = true );
394 
395 
396  virtual ~QgsVectorLayer();
397 
399  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
401  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
402 
410  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
411 
413  QString storageType() const;
414 
416  QString capabilitiesString() const;
417 
419  QString dataComment() const;
420 
428  QString displayField() const;
429 
436  void setDisplayExpression( const QString &displayExpression );
437 
444  QString displayExpression() const;
445 
446  QgsVectorDataProvider *dataProvider() override;
447  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
448 
450  void setProviderEncoding( const QString &encoding );
451 
453  void setCoordinateSystem();
454 
458  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
459 
462  bool removeJoin( const QString &joinLayerId );
463 
468  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
469  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
470 
479  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
480 
488  virtual QSet<QgsMapLayerDependency> dependencies() const override;
489 
500  int addExpressionField( const QString &exp, const QgsField &fld );
501 
509  void removeExpressionField( int index );
510 
520  QString expressionField( int index ) const;
521 
531  void updateExpressionField( int index, const QString &exp );
532 
539  QgsActionManager *actions() { return mActions; }
540 
546  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
547 
553  int selectedFeatureCount() const;
554 
564  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
565 
574  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
575 
585  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
586 
599  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
600 
602  void invertSelection();
603 
605  void selectAll();
606 
608  QgsFeatureIds allFeatureIds() const;
609 
617  void invertSelectionInRectangle( QgsRectangle &rect );
618 
627  QgsFeatureList selectedFeatures() const;
628 
640  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
641 
648  const QgsFeatureIds &selectedFeatureIds() const;
649 
651  QgsRectangle boundingBoxOfSelected() const;
652 
657  bool labelsEnabled() const;
658 
663  bool diagramsEnabled() const;
664 
666  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
667  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
668 
669  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
670  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
671 
673  QgsFeatureRenderer *renderer() { return mRenderer; }
674 
678  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
679 
684  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
685 
687  QgsWkbTypes::GeometryType geometryType() const;
688 
690  bool hasGeometryType() const;
691 
693  QgsWkbTypes::Type wkbType() const;
694 
696  QString providerType() const;
697 
701  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
702 
706  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
707 
711  void resolveReferences( QgsProject *project );
712 
721  virtual void saveStyleToDatabase( const QString &name, const QString &description,
722  bool useAsDefault, const QString &uiFileContent,
723  QString &msgError SIP_OUT );
724 
733  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
734  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
735 
739  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
740 
748  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
749 
756  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
757 
762  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
763 
770  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
771 
778  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
779 
787  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
788 
796  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
797 
806  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
807 
808  bool readSld( const QDomNode &node, QString &errorMessage ) override;
809 
815  long featureCount( const QString &legendKey ) const;
816 
827  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
828 
840  bool countSymbolFeatures();
841 
849  virtual bool setSubsetString( const QString &subset );
850 
855  virtual QString subsetString() const;
856 
862  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const;
863 
867  inline QgsFeatureIterator getFeatures( const QString &expression )
868  {
869  return getFeatures( QgsFeatureRequest( expression ) );
870  }
871 
877  {
878  QgsFeature feature;
879  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
880  return feature;
881  }
882 
887  {
888  return getFeatures( QgsFeatureRequest( fids ) );
889  }
890 
894  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
895  {
896  return getFeatures( QgsFeatureRequest( rectangle ) );
897  }
898 
899  bool addFeature( QgsFeature &feature ) override;
900 
907  bool updateFeature( QgsFeature &f );
908 
913  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
914 
919  bool insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex );
920 
925  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
926 
932  bool moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
933 
939  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
940 
944  bool deleteSelectedFeatures( int *deletedCount = nullptr );
945 
958  // TODO QGIS 3.0 returns an enum instead of a magic constant
959  int addRing( const QList<QgsPoint> &ring, QgsFeatureId *featureId = nullptr );
960 
971  // TODO QGIS 3.0 returns an enum instead of a magic constant
972  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
973 
985  // TODO QGIS 3.0 returns an enum instead of a magic constant
986  int addPart( const QList<QgsPoint> &ring );
987 
1000  // TODO QGIS 3.0 returns an enum instead of a magic constant
1001  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1002 
1004  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1005 
1012  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1013 
1021  // TODO QGIS 3.0 returns an enum instead of a magic constant
1022  int splitParts( const QList<QgsPoint> &splitLine, bool topologicalEditing = false );
1023 
1031  // TODO QGIS 3.0 returns an enum instead of a magic constant
1032  int splitFeatures( const QList<QgsPoint> &splitLine, bool topologicalEditing = false );
1033 
1039  int addTopologicalPoints( const QgsGeometry &geom );
1040 
1048  int addTopologicalPoints( const QgsPoint &p );
1049 
1053  const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; }
1054 
1058  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1059 
1061  virtual bool isEditable() const override;
1062 
1063  virtual bool isSpatial() const override;
1064 
1066  virtual bool isModified() const;
1067 
1069  virtual void reload() override;
1070 
1074  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1075 
1077  QgsRectangle extent() const override;
1078 
1085  inline QgsFields fields() const { return mFields; }
1086 
1094  inline QgsFields pendingFields() const { return mFields; }
1095 
1100  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1101 
1106  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1107 
1112  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1113 
1115  QgsAttributeList pkAttributeList() const;
1116 
1121  inline long pendingFeatureCount() const { return featureCount(); }
1122 
1127  long featureCount() const;
1128 
1132  bool setReadOnly( bool readonly = true );
1133 
1135  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
1136 
1147  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1148 
1152  bool addAttribute( const QgsField &field );
1153 
1159  void setFieldAlias( int index, const QString &aliasString );
1160 
1166  void removeFieldAlias( int index );
1167 
1173  bool renameAttribute( int index, const QString &newName );
1174 
1181  QString attributeAlias( int index ) const;
1182 
1184  QString attributeDisplayName( int index ) const;
1185 
1187  QgsStringMap attributeAliases() const;
1188 
1192  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1193 
1197  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1198 
1202  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1203 
1207  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1208 
1210  bool deleteAttribute( int attr );
1211 
1219  bool deleteAttributes( QList<int> attrs );
1220 
1221  bool addFeatures( QgsFeatureList &features ) override;
1222 
1224  bool deleteFeature( QgsFeatureId fid );
1225 
1233  bool deleteFeatures( const QgsFeatureIds &fids );
1234 
1251  bool commitChanges();
1252 
1257  QStringList commitErrors() const;
1258 
1262  bool rollBack( bool deleteBuffer = true );
1263 
1270  QList<QgsRelation> referencingRelations( int idx ) const;
1271 
1273  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1274 
1277  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1278 
1283  void beginEditCommand( const QString &text );
1284 
1286  void endEditCommand();
1287 
1289  void destroyEditCommand();
1290 
1293  {
1296  NoMarker
1297  };
1298 
1300  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1301 
1303  void updateFields();
1304 
1318  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1319  QgsExpressionContext *context = nullptr ) const;
1320 
1329  void setDefaultValueExpression( int index, const QString &expression );
1330 
1339  QString defaultValueExpression( int index ) const;
1340 
1348  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1349 
1355  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1356 
1366 
1374  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1375 
1383  QString constraintExpression( int index ) const;
1384 
1392  QString constraintDescription( int index ) const;
1393 
1402  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1403 
1407  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1408 
1415  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1416 
1428  void uniqueValues( int index, QList<QVariant> &uniqueValues SIP_OUT, int limit = -1 ) const;
1429 
1443  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1444  QgsFeedback *feedback = nullptr ) const;
1445 
1453  QVariant minimumValue( int index ) const;
1454 
1462  QVariant maximumValue( int index ) const;
1463 
1473  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1474  const QString &fieldOrExpression,
1476  QgsExpressionContext *context = nullptr,
1477  bool *ok = nullptr ) const;
1478 
1488  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1489 
1501  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1502 
1504  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1506  QPainter::CompositionMode featureBlendMode() const;
1507 
1509  void setLayerTransparency( int layerTransparency );
1511  int layerTransparency() const;
1512 
1513  QString htmlMetadata() const override;
1514 
1518  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1519 
1523  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1524 
1529  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1530 
1538  QgsConditionalLayerStyles *conditionalStyles() const;
1539 
1544  QgsAttributeTableConfig attributeTableConfig() const;
1545 
1550  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1551 
1559  QString mapTipTemplate() const;
1560 
1568  void setMapTipTemplate( const QString &mapTipTemplate );
1569 
1571 
1580  QgsEditFormConfig editFormConfig() const;
1581 
1590  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1591 
1592  public slots:
1593 
1601  void select( QgsFeatureId featureId );
1602 
1610  void select( const QgsFeatureIds &featureIds );
1611 
1619  void deselect( const QgsFeatureId featureId );
1620 
1628  void deselect( const QgsFeatureIds &featureIds );
1629 
1635  void removeSelection();
1636 
1640  virtual void updateExtents();
1641 
1648  bool startEditing();
1649 
1650 
1651  protected slots:
1652  void invalidateSymbolCountedFlag();
1653 
1654  signals:
1655 
1663  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1664 
1666  void layerModified();
1667 
1669  void beforeModifiedCheck() const;
1670 
1672  void beforeEditingStarted();
1673 
1675  void editingStarted();
1676 
1678  void editingStopped();
1679 
1681  void beforeCommitChanges();
1682 
1684  void beforeRollBack();
1685 
1694  void attributeAdded( int idx );
1695 
1702  void beforeAddingExpressionField( const QString &fieldName );
1703 
1712  void attributeDeleted( int idx );
1713 
1720  void beforeRemovingExpressionField( int idx );
1721 
1727  void featureAdded( QgsFeatureId fid );
1728 
1737  void featureDeleted( QgsFeatureId fid );
1738 
1748  void featuresDeleted( const QgsFeatureIds &fids );
1749 
1754  void updatedFields();
1755 
1756 
1765  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1766 
1774  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1775 
1777  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1779  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1781  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1783  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1785  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1787  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1788 
1790  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1791 
1793  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1794 
1796  void layerTransparencyChanged( int layerTransparency );
1797 
1803  void editCommandStarted( const QString &text );
1804 
1810  void editCommandEnded();
1811 
1817  void editCommandDestroyed();
1818 
1828  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
1829 
1839  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
1840 
1846  void mapTipTemplateChanged();
1847 
1853  void displayExpressionChanged();
1854 
1858  void raiseError( const QString &msg );
1859 
1865  void editFormConfigChanged();
1866 
1873  void readOnlyChanged();
1874 
1880  void symbolFeatureCountMapChanged();
1881 
1882  private slots:
1883  void onJoinedFieldsChanged();
1884  void onFeatureDeleted( QgsFeatureId fid );
1885  void onRelationsLoaded();
1886  void onSymbolsCounted();
1887 
1888  protected:
1890  void setExtent( const QgsRectangle &rect ) override;
1891 
1892  private: // Private methods
1893 
1897  virtual bool isReadOnly() const override;
1898 
1903  bool setDataProvider( QString const &provider );
1904 
1906  QgsFeatureId findFreeId();
1907 
1909  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1910 
1912  void readSldLabeling( const QDomNode &node );
1913 
1915  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
1916 
1917 #ifdef SIP_RUN
1918  QgsVectorLayer( const QgsVectorLayer &rhs );
1919 #endif
1920 
1921  private: // Private attributes
1922  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
1923 
1925  QgsVectorDataProvider *mDataProvider = nullptr;
1926 
1928  QString mDisplayExpression;
1929 
1930  QString mMapTipTemplate;
1931 
1933  QString mProviderKey;
1934 
1936  QgsActionManager *mActions = nullptr;
1937 
1939  bool mReadOnly;
1940 
1945  QgsFeatureIds mSelectedFeatureIds;
1946 
1948  QgsFields mFields;
1949 
1951  QgsStringMap mAttributeAliasMap;
1952 
1954  QgsStringMap mDefaultExpressionMap;
1955 
1957  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
1958 
1960  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
1961 
1963  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
1964 
1965  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
1966 
1968  QgsEditFormConfig mEditFormConfig;
1969 
1971  QSet<QString> mExcludeAttributesWMS;
1972 
1974  QSet<QString> mExcludeAttributesWFS;
1975 
1977  QgsWkbTypes::Type mWkbType;
1978 
1980  QgsFeatureRenderer *mRenderer = nullptr;
1981 
1983  QgsVectorSimplifyMethod mSimplifyMethod;
1984 
1986  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
1987 
1989  bool mLabelFontNotFoundNotified;
1990 
1992  QPainter::CompositionMode mFeatureBlendMode;
1993 
1995  int mLayerTransparency;
1996 
1998  bool mVertexMarkerOnlyForSelection;
1999 
2000  QStringList mCommitErrors;
2001 
2003  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2005 
2006  //stores information about joined layers
2007  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2008 
2010  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2011 
2012  //diagram rendering object. 0 if diagram drawing is disabled
2013  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2014 
2015  //stores infos about diagram placement (placement type, priority, position distance)
2016  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2017 
2018  mutable bool mValidExtent;
2019  mutable bool mLazyExtent;
2020 
2021  // Features in renderer classes counted
2022  bool mSymbolFeatureCounted;
2023 
2024  // Feature counts for each renderer legend key
2025  QHash<QString, long> mSymbolFeatureCountMap;
2026 
2028  bool mEditCommandActive;
2029 
2030  QgsFeatureIds mDeletedFids;
2031 
2032  QgsAttributeTableConfig mAttributeTableConfig;
2033 
2034  mutable QMutex mFeatureSourceConstructorMutex;
2035 
2036  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2037 
2039 };
2040 
2041 #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
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.
QList< QgsPointV2 > QgsPointSequence
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
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.
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 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:330
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.
QgsFields fields() const
Returns the list of fields of this 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...
#define SIP_SKIP
Definition: qgis_sip.h:87
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
virtual bool addFeatures(QgsFeatureList &features)=0
Adds a list of features to the sink.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:37
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.
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:48
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
Add selection to current selection.
A class to represent a point.
Definition: qgspoint.h:37
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
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
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.
virtual bool addFeature(QgsFeature &feature)
Adds a single feature to the sink.
#define SIP_OUT
Definition: qgis_sip.h:39
The QgsConditionalLayerStyles class holds conditional style information for a layer.
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:28
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:62
A bundle of parameters controlling aggregate calculation.
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.