QGIS API Documentation  2.99.0-Master (9fdd060)
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QSet>
25 #include <QList>
26 #include <QStringList>
27 #include <QFont>
28 #include <QMutex>
29 
30 #include "qgis.h"
31 #include "qgsmaplayer.h"
32 #include "qgsfeature.h"
33 #include "qgsfeaturerequest.h"
34 #include "qgsfeaturesource.h"
35 #include "qgsfields.h"
36 #include "qgsvectordataprovider.h"
38 #include "qgseditformconfig.h"
40 #include "qgsaggregatecalculator.h"
41 #include "qgsfeatureiterator.h"
43 
44 class QPainter;
45 class QImage;
46 
48 class QgsActionManager;
51 class QgsCurve;
53 class QgsDiagramRenderer;
56 class QgsFeatureRenderer;
57 class QgsGeometry;
58 class QgsGeometryVertexIndex;
59 class QgsMapToPixel;
60 class QgsRectangle;
61 class QgsRectangle;
62 class QgsRelation;
63 class QgsRelationManager;
65 class QgsSymbol;
71 class QgsPoint;
72 class QgsFeedback;
75 
76 typedef QList<int> QgsAttributeList;
77 typedef QSet<int> QgsAttributeIds;
78 
79 
354 {
355  Q_OBJECT
356 
357  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
358  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
359  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
360  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
361  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
362 
363  public:
364 
367  {
368  Success = 0,
369  EmptyGeometry = 1,
370  EditFailed = 2,
371  FetchFeatureFailed = 3,
372  InvalidLayer = 4,
373  };
374 
377  {
382  };
383 
399  QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
400  const QString &providerLib = "ogr", bool loadDefaultStyleFlag = true,
401  bool readExtentFromXml = false );
402 
403 
404  virtual ~QgsVectorLayer();
405 
407  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
409  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
410 
419  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
420 
425  QString storageType() const;
426 
430  QString capabilitiesString() const;
431 
435  QString dataComment() const;
436 
444  QString displayField() const;
445 
453  void setDisplayExpression( const QString &displayExpression );
454 
461  QString displayExpression() const;
462 
463  QgsVectorDataProvider *dataProvider() override;
464  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
465 
467  void setProviderEncoding( const QString &encoding );
468 
470  void setCoordinateSystem();
471 
476  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
477 
481  bool removeJoin( const QString &joinLayerId );
482 
487  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
488  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
489 
498  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
499 
507  virtual QSet<QgsMapLayerDependency> dependencies() const override;
508 
519  int addExpressionField( const QString &exp, const QgsField &fld );
520 
528  void removeExpressionField( int index );
529 
539  QString expressionField( int index ) const;
540 
550  void updateExpressionField( int index, const QString &exp );
551 
558  QgsActionManager *actions() { return mActions; }
559 
565  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
566 
572  int selectedFeatureCount() const;
573 
583  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
584 
594  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
595 
606  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
607 
620  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
621 
623  void invertSelection();
624 
626  void selectAll();
627 
635  void invertSelectionInRectangle( QgsRectangle &rect );
636 
645  QgsFeatureList selectedFeatures() const;
646 
658  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
659 
666  const QgsFeatureIds &selectedFeatureIds() const;
667 
669  QgsRectangle boundingBoxOfSelected() const;
670 
676  bool labelsEnabled() const;
677 
683  bool diagramsEnabled() const;
684 
686  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
687  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
688 
689  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
690  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
691 
693  QgsFeatureRenderer *renderer() { return mRenderer; }
694 
699  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
700 
705  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
706 
708  QgsWkbTypes::GeometryType geometryType() const;
709 
711  QgsWkbTypes::Type wkbType() const override;
712 
714  QString providerType() const;
715 
716  QgsCoordinateReferenceSystem sourceCrs() const override;
717  QString sourceName() const override;
718 
723  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
724 
729  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
730 
735  virtual void resolveReferences( QgsProject *project ) override;
736 
745  virtual void saveStyleToDatabase( const QString &name, const QString &description,
746  bool useAsDefault, const QString &uiFileContent,
747  QString &msgError SIP_OUT );
748 
757  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
758  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
759 
763  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
764 
772  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
773 
780  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
781 
786  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
787 
801  bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
802 
812  void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
813 
819  QgsAuxiliaryLayer *auxiliaryLayer();
820 
826  const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
827 
835  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
836 
844  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
845 
854  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
855 
864  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
865 
874  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
875 
876  bool readSld( const QDomNode &node, QString &errorMessage ) override;
877 
883  long featureCount( const QString &legendKey ) const;
884 
895  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
896 
909  QgsVectorLayerFeatureCounter *countSymbolFeatures();
910 
918  virtual bool setSubsetString( const QString &subset );
919 
924  virtual QString subsetString() const;
925 
931  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
932 
936  inline QgsFeatureIterator getFeatures( const QString &expression )
937  {
938  return getFeatures( QgsFeatureRequest( expression ) );
939  }
940 
945  inline QgsFeature getFeature( QgsFeatureId fid ) const
946  {
947  QgsFeature feature;
948  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
949  return feature;
950  }
951 
956  {
957  return getFeatures( QgsFeatureRequest( fids ) );
958  }
959 
963  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
964  {
965  return getFeatures( QgsFeatureRequest( rectangle ) );
966  }
967 
968  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
969 
980  bool updateFeature( const QgsFeature &feature, bool skipDefaultValues = false );
981 
987  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
988 
994  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
995 
1001  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1002 
1009  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1010 
1017  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
1018 
1023  bool deleteSelectedFeatures( int *deletedCount = nullptr );
1024 
1038  // TODO QGIS 3.0 returns an enum instead of a magic constant
1039  int addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
1040 
1052  // TODO QGIS 3.0 returns an enum instead of a magic constant
1053  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1054 
1067  // TODO QGIS 3.0 returns an enum instead of a magic constant
1068  int addPart( const QList<QgsPointXY> &ring );
1069 
1083  // TODO QGIS 3.0 returns an enum instead of a magic constant
1084  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1085 
1087  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1088 
1096  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1097 
1106  // TODO QGIS 3.0 returns an enum instead of a magic constant
1107  int splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1108 
1117  // TODO QGIS 3.0 returns an enum instead of a magic constant
1118  int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1119 
1126  int addTopologicalPoints( const QgsGeometry &geom );
1127 
1136  int addTopologicalPoints( const QgsPointXY &p );
1137 
1142  const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1143 
1148  QgsAbstractVectorLayerLabeling *labeling() { return mLabeling; }
1149 
1154  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1155 
1157  virtual bool isEditable() const override;
1158 
1160  virtual bool isSpatial() const override;
1161 
1163  virtual bool isModified() const;
1164 
1171  bool isAuxiliaryField( int index, int &srcIndex ) const;
1172 
1174  virtual void reload() override;
1175 
1180  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1181 
1182  QgsRectangle extent() const override;
1183  QgsRectangle sourceExtent() const override;
1184 
1191  inline QgsFields fields() const override { return mFields; }
1192 
1200  inline QgsFields pendingFields() const { return mFields; }
1201 
1206  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1207 
1212  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1213 
1218  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1219 
1221  QgsAttributeList pkAttributeList() const;
1222 
1227  inline long pendingFeatureCount() const { return featureCount(); }
1228 
1233  long featureCount() const override;
1234 
1239  bool setReadOnly( bool readonly = true );
1240 
1242  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom, bool skipDefaultValue = false );
1243 
1256  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false );
1257 
1262  bool addAttribute( const QgsField &field );
1263 
1269  void setFieldAlias( int index, const QString &aliasString );
1270 
1276  void removeFieldAlias( int index );
1277 
1284  bool renameAttribute( int index, const QString &newName );
1285 
1292  QString attributeAlias( int index ) const;
1293 
1295  QString attributeDisplayName( int index ) const;
1296 
1298  QgsStringMap attributeAliases() const;
1299 
1303  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1304 
1308  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1309 
1313  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1314 
1318  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1319 
1321  virtual bool deleteAttribute( int attr );
1322 
1330  bool deleteAttributes( QList<int> attrs );
1331 
1332  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1333 
1335  bool deleteFeature( QgsFeatureId fid );
1336 
1344  bool deleteFeatures( const QgsFeatureIds &fids );
1345 
1362  bool commitChanges();
1363 
1369  QStringList commitErrors() const;
1370 
1375  bool rollBack( bool deleteBuffer = true );
1376 
1383  QList<QgsRelation> referencingRelations( int idx ) const;
1384 
1386  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1387 
1392  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1393 
1398  void beginEditCommand( const QString &text );
1399 
1401  void endEditCommand();
1402 
1404  void destroyEditCommand();
1405 
1408  {
1411  NoMarker
1412  };
1413 
1415  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1416 
1425  void updateFields();
1426 
1441  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1442  QgsExpressionContext *context = nullptr ) const;
1443 
1455  void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
1456 
1467  QgsDefaultValue defaultValueDefinition( int index ) const;
1468 
1476  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1477 
1483  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1484 
1494 
1502  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1503 
1511  QString constraintExpression( int index ) const;
1512 
1520  QString constraintDescription( int index ) const;
1521 
1530  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1531 
1535  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1536 
1543  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1544 
1556  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1557 
1571  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1572  QgsFeedback *feedback = nullptr ) const;
1573 
1582  QVariant minimumValue( int index ) const override;
1583 
1592  QVariant maximumValue( int index ) const override;
1593 
1604  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1605  const QString &fieldOrExpression,
1607  QgsExpressionContext *context = nullptr,
1608  bool *ok = nullptr ) const;
1609 
1620  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1621 
1634  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1635 
1637  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1639  QPainter::CompositionMode featureBlendMode() const;
1640 
1648  void setOpacity( double opacity );
1649 
1657  double opacity() const;
1658 
1659  QString htmlMetadata() const override;
1660 
1665  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1666 
1671  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1672 
1678  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1679 
1687  QgsConditionalLayerStyles *conditionalStyles() const;
1688 
1693  QgsAttributeTableConfig attributeTableConfig() const;
1694 
1699  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1700 
1708  QString mapTipTemplate() const;
1709 
1717  void setMapTipTemplate( const QString &mapTipTemplate );
1718 
1720 
1729  QgsEditFormConfig editFormConfig() const;
1730 
1739  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1740 
1748  void setReadExtentFromXml( bool readExtentFromXml );
1749 
1757  bool readExtentFromXml() const;
1758 
1764  bool isEditCommandActive() const { return mEditCommandActive; }
1765 
1766  public slots:
1767 
1775  void select( QgsFeatureId featureId );
1776 
1784  void select( const QgsFeatureIds &featureIds );
1785 
1793  void deselect( const QgsFeatureId featureId );
1794 
1802  void deselect( const QgsFeatureIds &featureIds );
1803 
1809  void removeSelection();
1810 
1817  virtual void updateExtents( bool force = false );
1818 
1825  bool startEditing();
1826 
1827  signals:
1828 
1836  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1837 
1839  void layerModified();
1840 
1842  void beforeModifiedCheck() const;
1843 
1845  void beforeEditingStarted();
1846 
1848  void editingStarted();
1849 
1851  void editingStopped();
1852 
1854  void beforeCommitChanges();
1855 
1857  void beforeRollBack();
1858 
1867  void attributeAdded( int idx );
1868 
1875  void beforeAddingExpressionField( const QString &fieldName );
1876 
1885  void attributeDeleted( int idx );
1886 
1893  void beforeRemovingExpressionField( int idx );
1894 
1900  void featureAdded( QgsFeatureId fid );
1901 
1910  void featureDeleted( QgsFeatureId fid );
1911 
1921  void featuresDeleted( const QgsFeatureIds &fids );
1922 
1927  void updatedFields();
1928 
1929 
1938  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1939 
1947  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1948 
1950  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1952  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1954  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1956  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1958  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1960  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1961 
1963  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1964 
1966  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1967 
1975  void opacityChanged( double opacity );
1976 
1982  void editCommandStarted( const QString &text );
1983 
1989  void editCommandEnded();
1990 
1996  void editCommandDestroyed();
1997 
2007  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2008 
2018  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2019 
2025  void mapTipTemplateChanged();
2026 
2032  void displayExpressionChanged();
2033 
2037  void raiseError( const QString &msg );
2038 
2044  void editFormConfigChanged();
2045 
2052  void readOnlyChanged();
2053 
2059  void symbolFeatureCountMapChanged();
2060 
2061  private slots:
2062  void invalidateSymbolCountedFlag();
2063  void onFeatureCounterCompleted();
2064  void onFeatureCounterTerminated();
2065  void onJoinedFieldsChanged();
2066  void onFeatureDeleted( QgsFeatureId fid );
2067  void onRelationsLoaded();
2068  void onSymbolsCounted();
2069 
2070  protected:
2072  void setExtent( const QgsRectangle &rect ) override;
2073 
2074  private: // Private methods
2075 
2076  void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );
2077 
2081  virtual bool isReadOnly() const override;
2082 
2088  bool setDataProvider( QString const &provider );
2089 
2091  void readSldLabeling( const QDomNode &node );
2092 
2094  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2095 
2096 #ifdef SIP_RUN
2097  QgsVectorLayer( const QgsVectorLayer &rhs );
2098 #endif
2099 
2100  private: // Private attributes
2101  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2102 
2104  QgsVectorDataProvider *mDataProvider = nullptr;
2105 
2107  QString mDisplayExpression;
2108 
2109  QString mMapTipTemplate;
2110 
2112  QString mProviderKey;
2113 
2115  QgsActionManager *mActions = nullptr;
2116 
2118  bool mReadOnly = false;
2119 
2125  QgsFeatureIds mSelectedFeatureIds;
2126 
2128  QgsFields mFields;
2129 
2131  QgsStringMap mAttributeAliasMap;
2132 
2134  QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2135 
2137  QSet<int> mDefaultValueOnUpdateFields;
2138 
2140  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2141 
2143  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2144 
2146  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2147 
2148  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2149 
2151  QgsEditFormConfig mEditFormConfig;
2152 
2154  QSet<QString> mExcludeAttributesWMS;
2155 
2157  QSet<QString> mExcludeAttributesWFS;
2158 
2161 
2163  QgsFeatureRenderer *mRenderer = nullptr;
2164 
2166  QgsVectorSimplifyMethod mSimplifyMethod;
2167 
2169  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2170 
2172  bool mLabelFontNotFoundNotified = false;
2173 
2175  QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
2176 
2178  double mLayerOpacity = 1.0;
2179 
2181  bool mVertexMarkerOnlyForSelection = false;
2182 
2183  QStringList mCommitErrors;
2184 
2186  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2188 
2189  //stores information about joined layers
2190  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2191 
2193  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2194 
2195  //diagram rendering object. 0 if diagram drawing is disabled
2196  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2197 
2198  //stores infos about diagram placement (placement type, priority, position distance)
2199  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2200 
2201  mutable bool mValidExtent = false;
2202  mutable bool mLazyExtent = true;
2203 
2205  std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
2206 
2208  QString mAuxiliaryLayerKey;
2209 
2210  // Features in renderer classes counted
2211  bool mSymbolFeatureCounted = false;
2212 
2213  // Feature counts for each renderer legend key
2214  QHash<QString, long> mSymbolFeatureCountMap;
2215 
2217  bool mEditCommandActive = false;
2218 
2219  bool mReadExtentFromXml;
2220  QgsRectangle mXmlExtent;
2221 
2222  QgsFeatureIds mDeletedFids;
2223 
2224  QgsAttributeTableConfig mAttributeTableConfig;
2225 
2226  mutable QMutex mFeatureSourceConstructorMutex;
2227 
2228  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2229 
2231 };
2232 
2233 // clazy:excludeall=qstring-allocations
2234 
2235 #endif
QgsActionManager * actions()
Get all layer actions defined on this layer.
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:537
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
A rectangle specified with double values.
Definition: qgsrectangle.h:39
Base class for all map layer types.
Definition: qgsmaplayer.h:56
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
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.
The QgsDefaultValue class provides a container for managing client side default values for fields...
Constraint
Constraints which may be present on a field.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
Class allowing to manage the auxiliary storage for a vector layer.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsFeature getFeature(QgsFeatureId fid) const
Query the layer for the feature with the given id.
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:375
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
QgsAbstractVectorLayerLabeling * labeling()
Access to labeling configuration.
Remove from current selection.
virtual void resolveReferences(QgsProject *project)
Resolve references to other layers (kept as layer IDs after reading XML) into layer objects...
SimplifyHint
Simplification flags for fast rendering of features.
Class providing some utility methods to manage auxiliary storage.
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:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:94
bool isEditCommandActive() const
Test if an edit command is active.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
QMap< QString, QString > QgsStringMap
Definition: qgis.h:443
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList()
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:44
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
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:81
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QgsFeatureRenderer * renderer()
Return renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Add selection to current selection.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
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:649
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:137
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:528
An interface for objects which provide features via a getFeatures method.
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
#define SIP_OUT
Definition: qgis_sip.h:51
The QgsConditionalLayerStyles class holds conditional style information for a layer.
This class represents a coordinate reference system (CRS).
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
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.