QGIS API Documentation  2.99.0-Master (19b062c)
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"
44 
45 class QPainter;
46 class QImage;
47 
49 class QgsActionManager;
52 class QgsCurve;
54 class QgsDiagramRenderer;
57 class QgsFeatureRenderer;
58 class QgsGeometry;
59 class QgsGeometryVertexIndex;
60 class QgsMapToPixel;
61 class QgsRectangle;
62 class QgsRectangle;
63 class QgsRelation;
64 class QgsRelationManager;
66 class QgsSymbol;
72 class QgsPoint;
73 class QgsFeedback;
76 
77 typedef QList<int> QgsAttributeList;
78 typedef QSet<int> QgsAttributeIds;
79 
80 
355 {
356  Q_OBJECT
357 
358  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
359  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
360  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
361  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
362  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
363 
364  public:
365 
368  {
369  Success = 0,
370  EmptyGeometry = 1,
371  EditFailed = 2,
372  FetchFeatureFailed = 3,
373  InvalidLayer = 4,
374  };
375 
378  {
383  };
384 
390  {
391 
395  explicit LayerOptions( bool loadDefaultStyle = true, bool readExtentFromXml = false )
396  : loadDefaultStyle( loadDefaultStyle )
397  , readExtentFromXml( readExtentFromXml )
398  {}
399 
401  bool loadDefaultStyle = true;
402 
407  bool readExtentFromXml = false;
408 
409  };
410 
424  explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
425  const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
426 
427 
428  virtual ~QgsVectorLayer();
429 
431  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
433  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
434 
443  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
444 
449  QString storageType() const;
450 
454  QString capabilitiesString() const;
455 
459  QString dataComment() const;
460 
468  QString displayField() const;
469 
477  void setDisplayExpression( const QString &displayExpression );
478 
485  QString displayExpression() const;
486 
487  QgsVectorDataProvider *dataProvider() override;
488  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
489 
491  void setProviderEncoding( const QString &encoding );
492 
494  void setCoordinateSystem();
495 
500  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
501 
505  bool removeJoin( const QString &joinLayerId );
506 
511  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
512  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
513 
522  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
523 
531  virtual QSet<QgsMapLayerDependency> dependencies() const override;
532 
543  int addExpressionField( const QString &exp, const QgsField &fld );
544 
552  void removeExpressionField( int index );
553 
563  QString expressionField( int index ) const;
564 
574  void updateExpressionField( int index, const QString &exp );
575 
582  QgsActionManager *actions() { return mActions; }
583 
589  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
590 
596  int selectedFeatureCount() const;
597 
607  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
608 
618  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
619 
630  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
631 
644  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
645 
647  void invertSelection();
648 
650  void selectAll();
651 
659  void invertSelectionInRectangle( QgsRectangle &rect );
660 
669  QgsFeatureList selectedFeatures() const;
670 
682  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
683 
690  const QgsFeatureIds &selectedFeatureIds() const;
691 
693  QgsRectangle boundingBoxOfSelected() const;
694 
700  bool labelsEnabled() const;
701 
707  bool diagramsEnabled() const;
708 
710  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
711  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
712 
713  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
714  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
715 
717  QgsFeatureRenderer *renderer() { return mRenderer; }
718 
723  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
724 
729  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
730 
732  QgsWkbTypes::GeometryType geometryType() const;
733 
735  QgsWkbTypes::Type wkbType() const override;
736 
738  QString providerType() const;
739 
740  QgsCoordinateReferenceSystem sourceCrs() const override;
741  QString sourceName() const override;
742 
747  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
748 
753  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
754 
759  virtual void resolveReferences( QgsProject *project ) override;
760 
769  virtual void saveStyleToDatabase( const QString &name, const QString &description,
770  bool useAsDefault, const QString &uiFileContent,
771  QString &msgError SIP_OUT );
772 
781  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
782  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
783 
787  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
788 
796  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
797 
804  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
805 
810  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
811 
825  bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
826 
836  void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
837 
843  QgsAuxiliaryLayer *auxiliaryLayer();
844 
850  const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
851 
859  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
860 
868  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
869 
878  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
879 
888  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
889 
898  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
899 
900  bool readSld( const QDomNode &node, QString &errorMessage ) override;
901 
907  long featureCount( const QString &legendKey ) const;
908 
919  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
920 
933  QgsVectorLayerFeatureCounter *countSymbolFeatures();
934 
942  virtual bool setSubsetString( const QString &subset );
943 
948  virtual QString subsetString() const;
949 
955  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
956 
960  inline QgsFeatureIterator getFeatures( const QString &expression )
961  {
962  return getFeatures( QgsFeatureRequest( expression ) );
963  }
964 
969  inline QgsFeature getFeature( QgsFeatureId fid ) const
970  {
971  QgsFeature feature;
972  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
973  return feature;
974  }
975 
980  {
981  return getFeatures( QgsFeatureRequest( fids ) );
982  }
983 
987  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
988  {
989  return getFeatures( QgsFeatureRequest( rectangle ) );
990  }
991 
992  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
993 
1004  bool updateFeature( const QgsFeature &feature, bool skipDefaultValues = false );
1005 
1011  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1012 
1018  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1019 
1025  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1026 
1033  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1034 
1041  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
1042 
1047  bool deleteSelectedFeatures( int *deletedCount = nullptr );
1048 
1062  QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
1063 
1078  QgsGeometry::OperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1079 
1092  QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring );
1093 
1107  QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1108 
1110  QgsGeometry::OperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1111 
1119  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1120 
1134  QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1135 
1149  QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1150 
1157  int addTopologicalPoints( const QgsGeometry &geom );
1158 
1167  int addTopologicalPoints( const QgsPointXY &p );
1168 
1173  const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1174 
1179  QgsAbstractVectorLayerLabeling *labeling() { return mLabeling; }
1180 
1185  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1186 
1188  virtual bool isEditable() const override;
1189 
1191  virtual bool isSpatial() const override;
1192 
1194  virtual bool isModified() const;
1195 
1202  bool isAuxiliaryField( int index, int &srcIndex ) const;
1203 
1205  virtual void reload() override;
1206 
1211  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1212 
1213  QgsRectangle extent() const override;
1214  QgsRectangle sourceExtent() const override;
1215 
1222  inline QgsFields fields() const override { return mFields; }
1223 
1231  inline QgsFields pendingFields() const { return mFields; }
1232 
1237  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1238 
1243  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1244 
1249  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1250 
1252  QgsAttributeList pkAttributeList() const;
1253 
1258  inline long pendingFeatureCount() const { return featureCount(); }
1259 
1264  long featureCount() const override;
1265 
1270  bool setReadOnly( bool readonly = true );
1271 
1273  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom, bool skipDefaultValue = false );
1274 
1287  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false );
1288 
1293  bool addAttribute( const QgsField &field );
1294 
1300  void setFieldAlias( int index, const QString &aliasString );
1301 
1307  void removeFieldAlias( int index );
1308 
1315  bool renameAttribute( int index, const QString &newName );
1316 
1323  QString attributeAlias( int index ) const;
1324 
1326  QString attributeDisplayName( int index ) const;
1327 
1329  QgsStringMap attributeAliases() const;
1330 
1334  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1335 
1339  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1340 
1344  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1345 
1349  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1350 
1352  virtual bool deleteAttribute( int attr );
1353 
1361  bool deleteAttributes( QList<int> attrs );
1362 
1363  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1364 
1366  bool deleteFeature( QgsFeatureId fid );
1367 
1375  bool deleteFeatures( const QgsFeatureIds &fids );
1376 
1393  bool commitChanges();
1394 
1400  QStringList commitErrors() const;
1401 
1406  bool rollBack( bool deleteBuffer = true );
1407 
1414  QList<QgsRelation> referencingRelations( int idx ) const;
1415 
1417  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1418 
1423  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1424 
1429  void beginEditCommand( const QString &text );
1430 
1432  void endEditCommand();
1433 
1435  void destroyEditCommand();
1436 
1439  {
1442  NoMarker
1443  };
1444 
1446  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1447 
1456  void updateFields();
1457 
1472  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1473  QgsExpressionContext *context = nullptr ) const;
1474 
1486  void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
1487 
1498  QgsDefaultValue defaultValueDefinition( int index ) const;
1499 
1507  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1508 
1514  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1515 
1525 
1533  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1534 
1542  QString constraintExpression( int index ) const;
1543 
1551  QString constraintDescription( int index ) const;
1552 
1561  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1562 
1566  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1567 
1574  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1575 
1587  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1588 
1602  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1603  QgsFeedback *feedback = nullptr ) const;
1604 
1613  QVariant minimumValue( int index ) const override;
1614 
1623  QVariant maximumValue( int index ) const override;
1624 
1635  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1636  const QString &fieldOrExpression,
1638  QgsExpressionContext *context = nullptr,
1639  bool *ok = nullptr ) const;
1640 
1651  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1652 
1665  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1666 
1668  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1670  QPainter::CompositionMode featureBlendMode() const;
1671 
1679  void setOpacity( double opacity );
1680 
1688  double opacity() const;
1689 
1690  QString htmlMetadata() const override;
1691 
1696  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1697 
1702  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1703 
1709  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1710 
1718  QgsConditionalLayerStyles *conditionalStyles() const;
1719 
1724  QgsAttributeTableConfig attributeTableConfig() const;
1725 
1730  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1731 
1739  QString mapTipTemplate() const;
1740 
1748  void setMapTipTemplate( const QString &mapTipTemplate );
1749 
1750  QgsExpressionContext createExpressionContext() const override;
1751 
1752  QgsExpressionContextScope *createExpressionContextScope() const override SIP_FACTORY;
1753 
1762  QgsEditFormConfig editFormConfig() const;
1763 
1772  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1773 
1781  void setReadExtentFromXml( bool readExtentFromXml );
1782 
1790  bool readExtentFromXml() const;
1791 
1797  bool isEditCommandActive() const { return mEditCommandActive; }
1798 
1799  public slots:
1800 
1808  void select( QgsFeatureId featureId );
1809 
1817  void select( const QgsFeatureIds &featureIds );
1818 
1826  void deselect( const QgsFeatureId featureId );
1827 
1835  void deselect( const QgsFeatureIds &featureIds );
1836 
1842  void removeSelection();
1843 
1850  virtual void updateExtents( bool force = false );
1851 
1858  bool startEditing();
1859 
1860  signals:
1861 
1869  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1870 
1872  void layerModified();
1873 
1875  void beforeModifiedCheck() const;
1876 
1878  void beforeEditingStarted();
1879 
1881  void editingStarted();
1882 
1884  void editingStopped();
1885 
1887  void beforeCommitChanges();
1888 
1890  void beforeRollBack();
1891 
1900  void attributeAdded( int idx );
1901 
1908  void beforeAddingExpressionField( const QString &fieldName );
1909 
1918  void attributeDeleted( int idx );
1919 
1926  void beforeRemovingExpressionField( int idx );
1927 
1933  void featureAdded( QgsFeatureId fid );
1934 
1943  void featureDeleted( QgsFeatureId fid );
1944 
1954  void featuresDeleted( const QgsFeatureIds &fids );
1955 
1960  void updatedFields();
1961 
1962 
1971  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1972 
1980  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1981 
1983  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1985  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1987  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1989  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1991  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1993  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1994 
1996  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1997 
1999  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2000 
2008  void opacityChanged( double opacity );
2009 
2015  void editCommandStarted( const QString &text );
2016 
2022  void editCommandEnded();
2023 
2029  void editCommandDestroyed();
2030 
2040  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2041 
2051  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2052 
2058  void mapTipTemplateChanged();
2059 
2065  void displayExpressionChanged();
2066 
2070  void raiseError( const QString &msg );
2071 
2077  void editFormConfigChanged();
2078 
2085  void readOnlyChanged();
2086 
2092  void symbolFeatureCountMapChanged();
2093 
2094  private slots:
2095  void invalidateSymbolCountedFlag();
2096  void onFeatureCounterCompleted();
2097  void onFeatureCounterTerminated();
2098  void onJoinedFieldsChanged();
2099  void onFeatureDeleted( QgsFeatureId fid );
2100  void onRelationsLoaded();
2101  void onSymbolsCounted();
2102  void onDirtyTransaction( const QString &sql );
2103 
2104  protected:
2106  void setExtent( const QgsRectangle &rect ) override;
2107 
2108  private: // Private methods
2109 
2110  void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );
2111 
2115  virtual bool isReadOnly() const override;
2116 
2122  bool setDataProvider( QString const &provider );
2123 
2125  void readSldLabeling( const QDomNode &node );
2126 
2128  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2129 
2130 #ifdef SIP_RUN
2131  QgsVectorLayer( const QgsVectorLayer &rhs );
2132 #endif
2133 
2134  private: // Private attributes
2135  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2136 
2138  QgsVectorDataProvider *mDataProvider = nullptr;
2139 
2141  QString mDisplayExpression;
2142 
2143  QString mMapTipTemplate;
2144 
2146  QString mProviderKey;
2147 
2149  QgsActionManager *mActions = nullptr;
2150 
2152  bool mReadOnly = false;
2153 
2159  QgsFeatureIds mSelectedFeatureIds;
2160 
2162  QgsFields mFields;
2163 
2165  QgsStringMap mAttributeAliasMap;
2166 
2168  QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2169 
2171  QSet<int> mDefaultValueOnUpdateFields;
2172 
2174  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2175 
2177  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2178 
2180  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2181 
2182  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2183 
2185  QgsEditFormConfig mEditFormConfig;
2186 
2188  QSet<QString> mExcludeAttributesWMS;
2189 
2191  QSet<QString> mExcludeAttributesWFS;
2192 
2195 
2197  QgsFeatureRenderer *mRenderer = nullptr;
2198 
2200  QgsVectorSimplifyMethod mSimplifyMethod;
2201 
2203  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2204 
2206  bool mLabelFontNotFoundNotified = false;
2207 
2209  QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
2210 
2212  double mLayerOpacity = 1.0;
2213 
2215  bool mVertexMarkerOnlyForSelection = false;
2216 
2217  QStringList mCommitErrors;
2218 
2220  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2222 
2223  //stores information about joined layers
2224  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2225 
2227  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2228 
2229  //diagram rendering object. 0 if diagram drawing is disabled
2230  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2231 
2232  //stores infos about diagram placement (placement type, priority, position distance)
2233  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2234 
2235  mutable bool mValidExtent = false;
2236  mutable bool mLazyExtent = true;
2237 
2239  std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
2240 
2242  QString mAuxiliaryLayerKey;
2243 
2244  // Features in renderer classes counted
2245  bool mSymbolFeatureCounted = false;
2246 
2247  // Feature counts for each renderer legend key
2248  QHash<QString, long> mSymbolFeatureCountMap;
2249 
2251  bool mEditCommandActive = false;
2252 
2253  bool mReadExtentFromXml;
2254  QgsRectangle mXmlExtent;
2255 
2256  QgsFeatureIds mDeletedFids;
2257 
2258  QgsAttributeTableConfig mAttributeTableConfig;
2259 
2260  mutable QMutex mFeatureSourceConstructorMutex;
2261 
2262  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2263 
2265 };
2266 
2267 // clazy:excludeall=qstring-allocations
2268 
2269 #endif
QgsActionManager * actions()
Get all layer actions defined on this layer.
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:537
A rectangle specified with double values.
Definition: qgsrectangle.h:39
Base class for all map layer types.
Definition: qgsmaplayer.h:56
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
The QgsDefaultValue class provides a container for managing client side default values for fields...
Constraint
Constraints which may be present on a field.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
Setting options for loading vector layers.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
Class allowing to manage the auxiliary storage for a vector layer.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
LayerOptions(bool loadDefaultStyle=true, bool readExtentFromXml=false)
Constructor for LayerOptions.
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsFeature getFeature(QgsFeatureId fid) const
Query the layer for the feature with the given id.
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
QgsAbstractVectorLayerLabeling * labeling()
Access to labeling configuration.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
Class providing some utility methods to manage auxiliary storage.
Container of fields for a vector layer.
Definition: qgsfields.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
bool isEditCommandActive() const
Test if an edit command is active.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
QMap< QString, QString > QgsStringMap
Definition: qgis.h:443
OperationResult
Success or failure of a geometry operation.
Definition: qgsgeometry.h:119
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList()
Manages joined fields for a vector layer.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
QgsFields fields() const override
Returns the list of fields of this layer.
#define SIP_SKIP
Definition: qgis_sip.h:119
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsFeatureIterator getFeatures(const QString &expression)
Query the layer for features matching a given expression.
Defines left outer join from our vector layer to some other vector layer.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Reads and writes project states.
Definition: qgsproject.h:81
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QgsFeatureRenderer * renderer()
Return renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Add selection to current selection.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const QgsDiagramRenderer * diagramRenderer() const
Abstract interface for generating an expression context.
Partial snapshot of vector layer&#39;s state (only the members necessary for access to features) ...
Set selection, removing any existing selection.
QgsFeatureIterator getFeatures(const QgsRectangle &rectangle)
Query the layer for the features which intersect the specified rectangle.
Stores the settings for rendering of all diagrams for a layer.
QVector< QgsPoint > QgsPointSequence
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount() ...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:137
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Buffers information about expression fields for a vector layer.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:528
Abstract interface for generating an expression context scope.
An interface for objects which provide features via a getFeatures method.
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
#define SIP_OUT
Definition: qgis_sip.h:51
The QgsConditionalLayerStyles class holds conditional style information for a layer.
This class represents a coordinate reference system (CRS).
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
QgsFields pendingFields() const
Returns the list of fields of this layer.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
const QgsFeatureRenderer * renderer() const
Return const renderer.
QSet< int > QgsAttributeIds
QList< int > QgsAttributeList
Definition: qgsfield.h:27
bool nextFeature(QgsFeature &f)
This is a container for configuration of the attribute table.
This is the base class for vector data providers.
QList< int > QgsAttributeList
const QgsActionManager * actions() const
Get all layer actions defined on this layer.
Represents a vector layer which manages a vector based data sets.
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations.
EditResult
Result of an edit operation.
QgsFeatureIterator getFeatures(const QgsFeatureIds &fids)
Query the layer for the features with the given ids.
Constraint must be honored before feature can be accepted.
Abstract base class for simplify geometries using a specific algorithm.
Aggregate
Available aggregates to calculate.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74
A bundle of parameters controlling aggregate calculation.