QGIS API Documentation  2.99.0-Master (7705179)
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QSet>
25 #include <QList>
26 #include <QStringList>
27 #include <QFont>
28 #include <QMutex>
29 
30 #include "qgis.h"
31 #include "qgsmaplayer.h"
32 #include "qgsfeature.h"
33 #include "qgsfeaturerequest.h"
34 #include "qgsfeaturesource.h"
35 #include "qgsfields.h"
36 #include "qgsvectordataprovider.h"
38 #include "qgseditformconfig.h"
40 #include "qgsaggregatecalculator.h"
41 #include "qgsfeatureiterator.h"
43 
44 class QPainter;
45 class QImage;
46 
48 class QgsActionManager;
51 class QgsCurve;
53 class QgsDiagramRenderer;
56 class QgsFeatureRenderer;
57 class QgsGeometry;
58 class QgsGeometryVertexIndex;
59 class QgsMapToPixel;
60 class QgsRectangle;
61 class QgsRectangle;
62 class QgsRelation;
63 class QgsRelationManager;
65 class QgsSymbol;
71 class QgsPoint;
73 
74 typedef QList<int> QgsAttributeList;
75 typedef QSet<int> QgsAttributeIds;
76 
77 
351 {
352  Q_OBJECT
353 
354  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
355  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
356  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
357  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
358  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
359 
360  public:
361 
364  {
365  Success = 0,
366  EmptyGeometry = 1,
367  EditFailed = 2,
368  FetchFeatureFailed = 3,
369  InvalidLayer = 4,
370  };
371 
374  {
379  };
380 
395  QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
396  const QString &providerLib = "ogr", bool loadDefaultStyleFlag = true,
397  bool readExtentFromXml = false );
398 
399 
400  virtual ~QgsVectorLayer();
401 
403  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
405  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
406 
414  virtual QgsVectorLayer *clone() const override SIP_FACTORY;
415 
420  QString storageType() const;
421 
425  QString capabilitiesString() const;
426 
430  QString dataComment() const;
431 
439  QString displayField() const;
440 
447  void setDisplayExpression( const QString &displayExpression );
448 
455  QString displayExpression() const;
456 
457  QgsVectorDataProvider *dataProvider() override;
458  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
459 
461  void setProviderEncoding( const QString &encoding );
462 
464  void setCoordinateSystem();
465 
469  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
470 
473  bool removeJoin( const QString &joinLayerId );
474 
479  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
480  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
481 
490  virtual bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
491 
499  virtual QSet<QgsMapLayerDependency> dependencies() const override;
500 
511  int addExpressionField( const QString &exp, const QgsField &fld );
512 
520  void removeExpressionField( int index );
521 
531  QString expressionField( int index ) const;
532 
542  void updateExpressionField( int index, const QString &exp );
543 
550  QgsActionManager *actions() { return mActions; }
551 
557  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
558 
564  int selectedFeatureCount() const;
565 
575  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
576 
585  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
586 
596  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
597 
610  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
611 
613  void invertSelection();
614 
616  void selectAll();
617 
625  void invertSelectionInRectangle( QgsRectangle &rect );
626 
635  QgsFeatureList selectedFeatures() const;
636 
648  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
649 
656  const QgsFeatureIds &selectedFeatureIds() const;
657 
659  QgsRectangle boundingBoxOfSelected() const;
660 
665  bool labelsEnabled() const;
666 
671  bool diagramsEnabled() const;
672 
674  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
675  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
676 
677  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
678  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
679 
681  QgsFeatureRenderer *renderer() { return mRenderer; }
682 
686  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
687 
692  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
693 
695  QgsWkbTypes::GeometryType geometryType() const;
696 
698  QgsWkbTypes::Type wkbType() const override;
699 
701  QString providerType() const;
702 
703  QgsCoordinateReferenceSystem sourceCrs() const override;
704  QString sourceName() const override;
705 
709  virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context ) override;
710 
714  virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
715 
719  void resolveReferences( QgsProject *project );
720 
729  virtual void saveStyleToDatabase( const QString &name, const QString &description,
730  bool useAsDefault, const QString &uiFileContent,
731  QString &msgError SIP_OUT );
732 
741  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
742  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
743 
747  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
748 
756  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
757 
764  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
765 
770  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
771 
778  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, const QgsReadWriteContext &context ) override;
779 
786  bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context ) override;
787 
795  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
796 
804  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
805 
814  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
815 
816  bool readSld( const QDomNode &node, QString &errorMessage ) override;
817 
823  long featureCount( const QString &legendKey ) const;
824 
835  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false );
836 
849  QgsVectorLayerFeatureCounter *countSymbolFeatures();
850 
858  virtual bool setSubsetString( const QString &subset );
859 
864  virtual QString subsetString() const;
865 
871  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
872 
876  inline QgsFeatureIterator getFeatures( const QString &expression )
877  {
878  return getFeatures( QgsFeatureRequest( expression ) );
879  }
880 
885  inline QgsFeature getFeature( QgsFeatureId fid ) const
886  {
887  QgsFeature feature;
888  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
889  return feature;
890  }
891 
896  {
897  return getFeatures( QgsFeatureRequest( fids ) );
898  }
899 
903  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
904  {
905  return getFeatures( QgsFeatureRequest( rectangle ) );
906  }
907 
908  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
909 
916  bool updateFeature( QgsFeature &f );
917 
922  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
923 
928  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
929 
934  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
935 
941  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
942 
948  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
949 
953  bool deleteSelectedFeatures( int *deletedCount = nullptr );
954 
967  // TODO QGIS 3.0 returns an enum instead of a magic constant
968  int addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
969 
980  // TODO QGIS 3.0 returns an enum instead of a magic constant
981  int addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
982 
994  // TODO QGIS 3.0 returns an enum instead of a magic constant
995  int addPart( const QList<QgsPointXY> &ring );
996 
1009  // TODO QGIS 3.0 returns an enum instead of a magic constant
1010  int addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1011 
1013  int addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1014 
1021  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1022 
1030  // TODO QGIS 3.0 returns an enum instead of a magic constant
1031  int splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1032 
1040  // TODO QGIS 3.0 returns an enum instead of a magic constant
1041  int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
1042 
1048  int addTopologicalPoints( const QgsGeometry &geom );
1049 
1057  int addTopologicalPoints( const QgsPointXY &p );
1058 
1062  const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; }
1063 
1067  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1068 
1070  virtual bool isEditable() const override;
1071 
1073  virtual bool isSpatial() const override;
1074 
1076  virtual bool isModified() const;
1077 
1079  virtual void reload() override;
1080 
1084  virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1085 
1086  QgsRectangle extent() const override;
1087  QgsRectangle sourceExtent() const override;
1088 
1095  inline QgsFields fields() const override { return mFields; }
1096 
1104  inline QgsFields pendingFields() const { return mFields; }
1105 
1110  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1111 
1116  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1117 
1122  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1123 
1125  QgsAttributeList pkAttributeList() const;
1126 
1131  inline long pendingFeatureCount() const { return featureCount(); }
1132 
1137  long featureCount() const override;
1138 
1142  bool setReadOnly( bool readonly = true );
1143 
1145  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom );
1146 
1157  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1158 
1162  bool addAttribute( const QgsField &field );
1163 
1169  void setFieldAlias( int index, const QString &aliasString );
1170 
1176  void removeFieldAlias( int index );
1177 
1183  bool renameAttribute( int index, const QString &newName );
1184 
1191  QString attributeAlias( int index ) const;
1192 
1194  QString attributeDisplayName( int index ) const;
1195 
1197  QgsStringMap attributeAliases() const;
1198 
1202  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1203 
1207  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1208 
1212  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1213 
1217  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1218 
1220  bool deleteAttribute( int attr );
1221 
1229  bool deleteAttributes( QList<int> attrs );
1230 
1231  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;
1232 
1234  bool deleteFeature( QgsFeatureId fid );
1235 
1243  bool deleteFeatures( const QgsFeatureIds &fids );
1244 
1261  bool commitChanges();
1262 
1267  QStringList commitErrors() const;
1268 
1272  bool rollBack( bool deleteBuffer = true );
1273 
1280  QList<QgsRelation> referencingRelations( int idx ) const;
1281 
1283  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1284 
1287  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1288 
1293  void beginEditCommand( const QString &text );
1294 
1296  void endEditCommand();
1297 
1299  void destroyEditCommand();
1300 
1303  {
1306  NoMarker
1307  };
1308 
1310  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1311 
1313  void updateFields();
1314 
1328  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1329  QgsExpressionContext *context = nullptr ) const;
1330 
1339  void setDefaultValueExpression( int index, const QString &expression );
1340 
1349  QString defaultValueExpression( int index ) const;
1350 
1358  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1359 
1365  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1366 
1376 
1384  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1385 
1393  QString constraintExpression( int index ) const;
1394 
1402  QString constraintDescription( int index ) const;
1403 
1412  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1413 
1417  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1418 
1425  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1426 
1437  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1438 
1452  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1453  QgsFeedback *feedback = nullptr ) const;
1454 
1462  QVariant minimumValue( int index ) const override;
1463 
1471  QVariant maximumValue( int index ) const override;
1472 
1482  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1483  const QString &fieldOrExpression,
1485  QgsExpressionContext *context = nullptr,
1486  bool *ok = nullptr ) const;
1487 
1497  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = nullptr ) const;
1498 
1510  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int *nullCount = nullptr, QgsFeedback *feedback = nullptr ) const;
1511 
1513  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1515  QPainter::CompositionMode featureBlendMode() const;
1516 
1524  void setOpacity( double opacity );
1525 
1533  double opacity() const;
1534 
1535  QString htmlMetadata() const override;
1536 
1540  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1541 
1545  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1546 
1551  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1552 
1560  QgsConditionalLayerStyles *conditionalStyles() const;
1561 
1566  QgsAttributeTableConfig attributeTableConfig() const;
1567 
1572  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1573 
1581  QString mapTipTemplate() const;
1582 
1590  void setMapTipTemplate( const QString &mapTipTemplate );
1591 
1593 
1602  QgsEditFormConfig editFormConfig() const;
1603 
1612  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1613 
1621  void setReadExtentFromXml( bool readExtentFromXml );
1622 
1630  bool readExtentFromXml() const;
1631 
1632  public slots:
1633 
1641  void select( QgsFeatureId featureId );
1642 
1650  void select( const QgsFeatureIds &featureIds );
1651 
1659  void deselect( const QgsFeatureId featureId );
1660 
1668  void deselect( const QgsFeatureIds &featureIds );
1669 
1675  void removeSelection();
1676 
1682  virtual void updateExtents( bool force = false );
1683 
1690  bool startEditing();
1691 
1697  bool isEditCommandActive() const { return mEditCommandActive; }
1698 
1699  signals:
1700 
1708  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, const bool clearAndSelect );
1709 
1711  void layerModified();
1712 
1714  void beforeModifiedCheck() const;
1715 
1717  void beforeEditingStarted();
1718 
1720  void editingStarted();
1721 
1723  void editingStopped();
1724 
1726  void beforeCommitChanges();
1727 
1729  void beforeRollBack();
1730 
1739  void attributeAdded( int idx );
1740 
1747  void beforeAddingExpressionField( const QString &fieldName );
1748 
1757  void attributeDeleted( int idx );
1758 
1765  void beforeRemovingExpressionField( int idx );
1766 
1772  void featureAdded( QgsFeatureId fid );
1773 
1782  void featureDeleted( QgsFeatureId fid );
1783 
1793  void featuresDeleted( const QgsFeatureIds &fids );
1794 
1799  void updatedFields();
1800 
1801 
1810  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
1811 
1819  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
1820 
1822  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
1824  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
1826  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
1828  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
1830  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
1832  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
1833 
1835  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
1836 
1838  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1839 
1847  void opacityChanged( double opacity );
1848 
1854  void editCommandStarted( const QString &text );
1855 
1861  void editCommandEnded();
1862 
1868  void editCommandDestroyed();
1869 
1879  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
1880 
1890  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
1891 
1897  void mapTipTemplateChanged();
1898 
1904  void displayExpressionChanged();
1905 
1909  void raiseError( const QString &msg );
1910 
1916  void editFormConfigChanged();
1917 
1924  void readOnlyChanged();
1925 
1931  void symbolFeatureCountMapChanged();
1932 
1933  private slots:
1934  void invalidateSymbolCountedFlag();
1935  void onFeatureCounterCompleted();
1936  void onFeatureCounterTerminated();
1937  void onJoinedFieldsChanged();
1938  void onFeatureDeleted( QgsFeatureId fid );
1939  void onRelationsLoaded();
1940  void onSymbolsCounted();
1941 
1942  protected:
1944  void setExtent( const QgsRectangle &rect ) override;
1945 
1946  private: // Private methods
1947 
1951  virtual bool isReadOnly() const override;
1952 
1957  bool setDataProvider( QString const &provider );
1958 
1960  void readSldLabeling( const QDomNode &node );
1961 
1963  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
1964 
1965 #ifdef SIP_RUN
1966  QgsVectorLayer( const QgsVectorLayer &rhs );
1967 #endif
1968 
1969  private: // Private attributes
1970  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
1971 
1973  QgsVectorDataProvider *mDataProvider = nullptr;
1974 
1976  QString mDisplayExpression;
1977 
1978  QString mMapTipTemplate;
1979 
1981  QString mProviderKey;
1982 
1984  QgsActionManager *mActions = nullptr;
1985 
1987  bool mReadOnly;
1988 
1993  QgsFeatureIds mSelectedFeatureIds;
1994 
1996  QgsFields mFields;
1997 
1999  QgsStringMap mAttributeAliasMap;
2000 
2002  QgsStringMap mDefaultExpressionMap;
2003 
2005  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2006 
2008  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2009 
2011  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2012 
2013  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2014 
2016  QgsEditFormConfig mEditFormConfig;
2017 
2019  QSet<QString> mExcludeAttributesWMS;
2020 
2022  QSet<QString> mExcludeAttributesWFS;
2023 
2025  QgsWkbTypes::Type mWkbType;
2026 
2028  QgsFeatureRenderer *mRenderer = nullptr;
2029 
2031  QgsVectorSimplifyMethod mSimplifyMethod;
2032 
2034  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2035 
2037  bool mLabelFontNotFoundNotified;
2038 
2040  QPainter::CompositionMode mFeatureBlendMode;
2041 
2043  double mLayerOpacity = 1.0;
2044 
2046  bool mVertexMarkerOnlyForSelection;
2047 
2048  QStringList mCommitErrors;
2049 
2051  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2053 
2054  //stores information about joined layers
2055  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2056 
2058  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2059 
2060  //diagram rendering object. 0 if diagram drawing is disabled
2061  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2062 
2063  //stores infos about diagram placement (placement type, priority, position distance)
2064  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2065 
2066  mutable bool mValidExtent;
2067  mutable bool mLazyExtent;
2068 
2069  // Features in renderer classes counted
2070  bool mSymbolFeatureCounted;
2071 
2072  // Feature counts for each renderer legend key
2073  QHash<QString, long> mSymbolFeatureCountMap;
2074 
2076  bool mEditCommandActive;
2077 
2078  bool mReadExtentFromXml;
2079  QgsRectangle mXmlExtent;
2080 
2081  QgsFeatureIds mDeletedFids;
2082 
2083  QgsAttributeTableConfig mAttributeTableConfig;
2084 
2085  mutable QMutex mFeatureSourceConstructorMutex;
2086 
2087  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2088 
2090 };
2091 
2092 // clazy:excludeall=qstring-allocations
2093 
2094 #endif
QgsActionManager * actions()
Get all layer actions defined on this layer.
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:512
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
A rectangle specified with double values.
Definition: qgsrectangle.h:38
Base class for all map layer types.
Definition: qgsmaplayer.h:54
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=0)=0
Adds a list of features to the sink.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
Constraint
Constraints which may be present on a field.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:519
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:524
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
A class to represent a 2D point.
Definition: qgspointxy.h:42
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:343
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
virtual bool readXml(const QDomNode &layer_node, const QgsReadWriteContext &context)
Called by readLayerXML(), used by children to read state specific to them from project files...
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document, const QgsReadWriteContext &context) const
Called by writeLayerXML(), used by children to write state specific to them to project files...
Container of fields for a vector layer.
Definition: qgsfields.h:41
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:92
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:61
QMap< QString, QString > QgsStringMap
Definition: qgis.h:366
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList()
virtual bool readSymbology(const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context)=0
Read the symbology for the current layer from the Dom node supplied.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this layer.
virtual QgsRectangle extent() const
Returns the extent of the layer.
Manages joined fields for a vector layer.
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context) const =0
Write the symbology for the layer into the docment provided.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:43
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:35
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:66
virtual 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:79
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QgsFeatureRenderer * renderer()
Return renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:34
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:46
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
Add selection to current selection.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:36
virtual QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const
Returns the set of unique values contained within the specified fieldIndex from this source...
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:588
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const QgsDiagramRenderer * diagramRenderer() const
virtual QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
Abstract interface for generating an expression context.
Partial snapshot of vector layer&#39;s state (only the members necessary for access to features) ...
Set selection, removing any existing selection.
QgsFeatureIterator getFeatures(const QgsRectangle &rectangle)
Query the layer for the features which intersect the specified rectangle.
Stores the settings for rendering of all diagrams for a layer.
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount() ...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:136
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
virtual bool readStyle(const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context)
Read the style for the current layer from the Dom node supplied.
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Buffers information about expression fields for a vector layer.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:503
An interface for objects which provide features via a getFeatures method.
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
#define SIP_OUT
Definition: qgis_sip.h: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.