QGIS API Documentation  2.99.0-Master (6c64c5a)
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;
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 
389  {
390 
394  explicit LayerOptions( bool loadDefaultStyle = true, bool readExtentFromXml = false )
395  : loadDefaultStyle( loadDefaultStyle )
396  , readExtentFromXml( readExtentFromXml )
397  {}
398 
400  bool loadDefaultStyle = true;
401 
406  bool readExtentFromXml = false;
407 
408  };
409 
423  explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
424  const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
425 
426 
427  ~QgsVectorLayer() override;
428 
430  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
432  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
433 
442  QgsVectorLayer *clone() const override SIP_FACTORY;
443 
448  QString storageType() const;
449 
453  QString capabilitiesString() const;
454 
458  QString dataComment() const;
459 
467  QString displayField() const;
468 
476  void setDisplayExpression( const QString &displayExpression );
477 
484  QString displayExpression() const;
485 
486  QgsVectorDataProvider *dataProvider() override;
487  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
488 
490  void setProviderEncoding( const QString &encoding );
491 
493  void setCoordinateSystem();
494 
499  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
500 
504  bool removeJoin( const QString &joinLayerId );
505 
510  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
511  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
512 
521  bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
522 
530  QSet<QgsMapLayerDependency> dependencies() const override;
531 
542  int addExpressionField( const QString &exp, const QgsField &fld );
543 
551  void removeExpressionField( int index );
552 
562  QString expressionField( int index ) const;
563 
573  void updateExpressionField( int index, const QString &exp );
574 
581  QgsActionManager *actions() { return mActions; }
582 
588  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
589 
595  int selectedFeatureCount() const;
596 
606  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
607 
617  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
618 
629  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
630 
643  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
644 
646  void invertSelection();
647 
649  void selectAll();
650 
658  void invertSelectionInRectangle( QgsRectangle &rect );
659 
668  QgsFeatureList selectedFeatures() const;
669 
681  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
682 
689  const QgsFeatureIds &selectedFeatureIds() const;
690 
692  QgsRectangle boundingBoxOfSelected() const;
693 
701  bool labelsEnabled() const;
702 
712  void setLabelsEnabled( bool enabled );
713 
719  bool diagramsEnabled() const;
720 
722  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
723  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
724 
725  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
726  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
727 
729  QgsFeatureRenderer *renderer() { return mRenderer; }
730 
735  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
736 
741  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
742 
744  QgsWkbTypes::GeometryType geometryType() const;
745 
747  QgsWkbTypes::Type wkbType() const override;
748 
750  QString providerType() const;
751 
752  QgsCoordinateReferenceSystem sourceCrs() const override;
753  QString sourceName() const override;
754 
759  bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
760 
765  bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
766 
771  void resolveReferences( QgsProject *project ) override;
772 
781  virtual void saveStyleToDatabase( const QString &name, const QString &description,
782  bool useAsDefault, const QString &uiFileContent,
783  QString &msgError SIP_OUT );
784 
793  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
794  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
795 
799  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
800 
808  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
809 
816  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
817 
822  QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
823 
837  bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
838 
848  void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
849 
855  QgsAuxiliaryLayer *auxiliaryLayer();
856 
862  const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
863 
871  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
872 
880  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
881 
890  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
891 
900  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
901 
910  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
911 
912  bool readSld( const QDomNode &node, QString &errorMessage ) override;
913 
919  long featureCount( const QString &legendKey ) const;
920 
931  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
932 
945  QgsVectorLayerFeatureCounter *countSymbolFeatures();
946 
954  virtual bool setSubsetString( const QString &subset );
955 
960  virtual QString subsetString() const;
961 
967  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
968 
972  inline QgsFeatureIterator getFeatures( const QString &expression )
973  {
974  return getFeatures( QgsFeatureRequest( expression ) );
975  }
976 
981  inline QgsFeature getFeature( QgsFeatureId fid ) const
982  {
983  QgsFeature feature;
984  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
985  return feature;
986  }
987 
992  {
993  return getFeatures( QgsFeatureRequest( fids ) );
994  }
995 
999  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
1000  {
1001  return getFeatures( QgsFeatureRequest( rectangle ) );
1002  }
1003 
1004  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override;
1005 
1031  bool updateFeature( const QgsFeature &feature, bool skipDefaultValues = false );
1032 
1043  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1044 
1055  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1056 
1067  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1068 
1079  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1080 
1091  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
1092 
1097  bool deleteSelectedFeatures( int *deletedCount = nullptr );
1098 
1117  QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
1118 
1137  QgsGeometry::OperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1138 
1156  QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring );
1157 
1175  QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1176 
1184  QgsGeometry::OperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1185 
1197  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1198 
1216  QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1217 
1235  QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1236 
1247  int addTopologicalPoints( const QgsGeometry &geom );
1248 
1261  int addTopologicalPoints( const QgsPointXY &p );
1262 
1269  const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1270 
1277  QgsAbstractVectorLayerLabeling *labeling() { return mLabeling; }
1278 
1283  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1284 
1286  bool isEditable() const override;
1287 
1289  bool isSpatial() const override;
1290 
1292  virtual bool isModified() const;
1293 
1300  bool isAuxiliaryField( int index, int &srcIndex ) const;
1301 
1303  void reload() override;
1304 
1309  QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1310 
1311  QgsRectangle extent() const override;
1312  QgsRectangle sourceExtent() const override;
1313 
1320  inline QgsFields fields() const override { return mFields; }
1321 
1325  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1326 
1330  QgsAttributeList primaryKeyAttributes() const;
1331 
1336  long featureCount() const override;
1337 
1342  bool setReadOnly( bool readonly = true );
1343 
1364  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geometry, bool skipDefaultValue = false );
1365 
1396  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false );
1397 
1433  bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false );
1434 
1444  bool addAttribute( const QgsField &field );
1445 
1451  void setFieldAlias( int index, const QString &aliasString );
1452 
1458  void removeFieldAlias( int index );
1459 
1470  bool renameAttribute( int index, const QString &newName );
1471 
1478  QString attributeAlias( int index ) const;
1479 
1481  QString attributeDisplayName( int index ) const;
1482 
1484  QgsStringMap attributeAliases() const;
1485 
1489  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1490 
1494  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1495 
1499  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1500 
1504  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1505 
1514  virtual bool deleteAttribute( int attr );
1515 
1523  bool deleteAttributes( QList<int> attrs );
1524 
1525  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) override;
1526 
1535  bool deleteFeature( QgsFeatureId fid );
1536 
1549  bool deleteFeatures( const QgsFeatureIds &fids );
1550 
1571  bool commitChanges();
1572 
1578  QStringList commitErrors() const;
1579 
1589  bool rollBack( bool deleteBuffer = true );
1590 
1597  QList<QgsRelation> referencingRelations( int idx ) const;
1598 
1600  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1601 
1606  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1607 
1612  void beginEditCommand( const QString &text );
1613 
1615  void endEditCommand();
1616 
1618  void destroyEditCommand();
1619 
1622  {
1625  NoMarker
1626  };
1627 
1629  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1630 
1639  void updateFields();
1640 
1655  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1656  QgsExpressionContext *context = nullptr ) const;
1657 
1669  void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
1670 
1681  QgsDefaultValue defaultValueDefinition( int index ) const;
1682 
1690  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1691 
1697  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1698 
1708 
1716  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1717 
1725  QString constraintExpression( int index ) const;
1726 
1734  QString constraintDescription( int index ) const;
1735 
1744  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1745 
1749  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1750 
1757  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1758 
1770  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1771 
1785  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1786  QgsFeedback *feedback = nullptr ) const;
1787 
1796  QVariant minimumValue( int index ) const override;
1797 
1806  QVariant maximumValue( int index ) const override;
1807 
1818  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1819  const QString &fieldOrExpression,
1821  QgsExpressionContext *context = nullptr,
1822  bool *ok = nullptr ) const;
1823 
1825  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1827  QPainter::CompositionMode featureBlendMode() const;
1828 
1836  void setOpacity( double opacity );
1837 
1845  double opacity() const;
1846 
1847  QString htmlMetadata() const override;
1848 
1853  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1854 
1859  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1860 
1866  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1867 
1875  QgsConditionalLayerStyles *conditionalStyles() const;
1876 
1881  QgsAttributeTableConfig attributeTableConfig() const;
1882 
1887  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1888 
1896  QString mapTipTemplate() const;
1897 
1905  void setMapTipTemplate( const QString &mapTipTemplate );
1906 
1907  QgsExpressionContext createExpressionContext() const override;
1908 
1909  QgsExpressionContextScope *createExpressionContextScope() const override SIP_FACTORY;
1910 
1919  QgsEditFormConfig editFormConfig() const;
1920 
1929  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1930 
1938  void setReadExtentFromXml( bool readExtentFromXml );
1939 
1947  bool readExtentFromXml() const;
1948 
1954  bool isEditCommandActive() const { return mEditCommandActive; }
1955 
1956  public slots:
1957 
1965  void select( QgsFeatureId featureId );
1966 
1974  void select( const QgsFeatureIds &featureIds );
1975 
1983  void deselect( const QgsFeatureId featureId );
1984 
1992  void deselect( const QgsFeatureIds &featureIds );
1993 
1999  void removeSelection();
2000 
2007  virtual void updateExtents( bool force = false );
2008 
2023  bool startEditing();
2024 
2025  signals:
2026 
2034  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
2035 
2037  void layerModified();
2038 
2040  void beforeModifiedCheck() const;
2041 
2043  void beforeEditingStarted();
2044 
2046  void editingStarted();
2047 
2049  void editingStopped();
2050 
2052  void beforeCommitChanges();
2053 
2055  void beforeRollBack();
2056 
2065  void attributeAdded( int idx );
2066 
2073  void beforeAddingExpressionField( const QString &fieldName );
2074 
2083  void attributeDeleted( int idx );
2084 
2091  void beforeRemovingExpressionField( int idx );
2092 
2098  void featureAdded( QgsFeatureId fid );
2099 
2108  void featureDeleted( QgsFeatureId fid );
2109 
2119  void featuresDeleted( const QgsFeatureIds &fids );
2120 
2125  void updatedFields();
2126 
2127 
2136  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
2137 
2145  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
2146 
2148  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2150  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
2152  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
2154  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
2156  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
2158  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
2159 
2161  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
2162 
2164  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2165 
2173  void opacityChanged( double opacity );
2174 
2180  void editCommandStarted( const QString &text );
2181 
2187  void editCommandEnded();
2188 
2194  void editCommandDestroyed();
2195 
2205  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2206 
2216  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2217 
2223  void mapTipTemplateChanged();
2224 
2230  void displayExpressionChanged();
2231 
2235  void raiseError( const QString &msg );
2236 
2242  void editFormConfigChanged();
2243 
2250  void readOnlyChanged();
2251 
2257  void symbolFeatureCountMapChanged();
2258 
2259  private slots:
2260  void invalidateSymbolCountedFlag();
2261  void onFeatureCounterCompleted();
2262  void onFeatureCounterTerminated();
2263  void onJoinedFieldsChanged();
2264  void onFeatureDeleted( QgsFeatureId fid );
2265  void onRelationsLoaded();
2266  void onSymbolsCounted();
2267  void onDirtyTransaction( const QString &sql, const QString &name );
2268 
2269  protected:
2271  void setExtent( const QgsRectangle &rect ) override;
2272 
2273  private: // Private methods
2274 
2275  void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );
2276 
2280  bool isReadOnly() const override;
2281 
2287  bool setDataProvider( QString const &provider );
2288 
2290  void readSldLabeling( const QDomNode &node );
2291 
2293  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2294 
2295 #ifdef SIP_RUN
2296  QgsVectorLayer( const QgsVectorLayer &rhs );
2297 #endif
2298 
2299  private: // Private attributes
2300  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2301 
2303  QgsVectorDataProvider *mDataProvider = nullptr;
2304 
2306  QString mDisplayExpression;
2307 
2308  QString mMapTipTemplate;
2309 
2311  QString mProviderKey;
2312 
2314  QgsActionManager *mActions = nullptr;
2315 
2317  bool mReadOnly = false;
2318 
2324  QgsFeatureIds mSelectedFeatureIds;
2325 
2327  QgsFields mFields;
2328 
2330  QgsStringMap mAttributeAliasMap;
2331 
2333  QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2334 
2336  QSet<int> mDefaultValueOnUpdateFields;
2337 
2339  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2340 
2342  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2343 
2345  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2346 
2347  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2348 
2350  QgsEditFormConfig mEditFormConfig;
2351 
2353  QSet<QString> mExcludeAttributesWMS;
2354 
2356  QSet<QString> mExcludeAttributesWFS;
2357 
2360 
2362  QgsFeatureRenderer *mRenderer = nullptr;
2363 
2365  QgsVectorSimplifyMethod mSimplifyMethod;
2366 
2368  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2369 
2371  bool mLabelsEnabled = false;
2372 
2374  bool mLabelFontNotFoundNotified = false;
2375 
2377  QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
2378 
2380  double mLayerOpacity = 1.0;
2381 
2383  bool mVertexMarkerOnlyForSelection = false;
2384 
2385  QStringList mCommitErrors;
2386 
2388  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2391 
2392  //stores information about joined layers
2393  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2394 
2396  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2397 
2398  //diagram rendering object. 0 if diagram drawing is disabled
2399  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2400 
2401  //stores infos about diagram placement (placement type, priority, position distance)
2402  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2403 
2404  mutable bool mValidExtent = false;
2405  mutable bool mLazyExtent = true;
2406 
2408  std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
2409 
2411  QString mAuxiliaryLayerKey;
2412 
2413  // Features in renderer classes counted
2414  bool mSymbolFeatureCounted = false;
2415 
2416  // Feature counts for each renderer legend key
2417  QHash<QString, long> mSymbolFeatureCountMap;
2418 
2420  bool mEditCommandActive = false;
2421 
2422  bool mReadExtentFromXml;
2423  QgsRectangle mXmlExtent;
2424 
2425  QgsFeatureIds mDeletedFids;
2426 
2427  QgsAttributeTableConfig mAttributeTableConfig;
2428 
2429  mutable QMutex mFeatureSourceConstructorMutex;
2430 
2431  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2432 
2434 };
2435 
2436 // clazy:excludeall=qstring-allocations
2437 
2438 #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:479
OperationResult
Success or failure of a geometry operation.
Definition: qgsgeometry.h:120
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.
QMap< int, QVariant > QgsAttributeMap
Definition: qgsattributes.h:39
#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:82
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() 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
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...
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
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.