QGIS API Documentation  2.99.0-Master (08c2e66)
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QSet>
25 #include <QList>
26 #include <QStringList>
27 #include <QFont>
28 #include <QMutex>
29 
30 #include "qgis.h"
31 #include "qgsmaplayer.h"
32 #include "qgsfeature.h"
33 #include "qgsfeaturerequest.h"
34 #include "qgsfields.h"
35 #include "qgssnapper.h"
37 #include "qgseditformconfig.h"
39 #include "qgsaggregatecalculator.h"
40 #include "qgsfeatureiterator.h"
42 
43 class QPainter;
44 class QImage;
45 
47 class QgsActionManager;
50 class QgsCurve;
52 class QgsDiagramRenderer;
55 class QgsFeatureRenderer;
56 class QgsGeometry;
57 class QgsGeometryCache;
58 class QgsGeometryVertexIndex;
59 class QgsMapToPixel;
60 class QgsRectangle;
61 class QgsRectangle;
62 class QgsRelation;
63 class QgsRelationManager;
65 class QgsSymbol;
71 class QgsPointV2;
73 
74 typedef QList<int> QgsAttributeList;
75 typedef QSet<int> QgsAttributeIds;
76 typedef QList<QgsPointV2> QgsPointSequence;
77 
78 
79 
354 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionContextGenerator
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 
363  public:
364 
367  {
368  Success = 0,
369  EmptyGeometry = 1,
370  EditFailed = 2,
371  FetchFeatureFailed = 3,
372  InvalidLayer = 4,
373  };
374 
377  {
382  };
383 
397  QgsVectorLayer( const QString& path = QString::null, const QString& baseName = QString::null,
398  const QString& providerLib = "ogr", bool loadDefaultStyleFlag = true );
399 
400 
401  virtual ~QgsVectorLayer();
402 
404  QgsVectorLayer( const QgsVectorLayer & rhs ) = delete;
406  QgsVectorLayer & operator=( QgsVectorLayer const & rhs ) = delete;
407 
409  QString storageType() const;
410 
412  QString capabilitiesString() const;
413 
415  QString dataComment() const;
416 
424  QString displayField() const;
425 
432  void setDisplayExpression( const QString& displayExpression );
433 
440  QString displayExpression() const;
441 
443  QgsVectorDataProvider* dataProvider();
444 
448  const QgsVectorDataProvider* dataProvider() const;
449 
451  void setProviderEncoding( const QString& encoding );
452 
454  void setCoordinateSystem();
455 
459  bool addJoin( const QgsVectorLayerJoinInfo& joinInfo );
460 
463  bool removeJoin( const QString& joinLayerId );
464 
469  QgsVectorLayerJoinBuffer* joinBuffer() { return mJoinBuffer; }
470  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
471 
480  virtual bool setDependencies( const QSet<QgsMapLayerDependency>& layers ) override;
481 
489  virtual QSet<QgsMapLayerDependency> dependencies() const override;
490 
501  int addExpressionField( const QString& exp, const QgsField& fld );
502 
510  void removeExpressionField( int index );
511 
521  QString expressionField( int index ) const;
522 
532  void updateExpressionField( int index, const QString& exp );
533 
540  QgsActionManager* actions() { return mActions; }
541 
547  int selectedFeatureCount() const;
548 
558  void selectByRect( QgsRectangle & rect, SelectBehavior behavior = SetSelection );
559 
568  void selectByExpression( const QString& expression, SelectBehavior behavior = SetSelection );
569 
579  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
580 
593  void modifySelection( const QgsFeatureIds& selectIds, const QgsFeatureIds &deselectIds );
594 
596  void invertSelection();
597 
599  void selectAll();
600 
602  QgsFeatureIds allFeatureIds() const;
603 
611  void invertSelectionInRectangle( QgsRectangle & rect );
612 
621  QgsFeatureList selectedFeatures() const;
622 
634  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() ) const;
635 
642  const QgsFeatureIds &selectedFeatureIds() const;
643 
645  QgsRectangle boundingBoxOfSelected() const;
646 
651  bool labelsEnabled() const;
652 
657  bool diagramsEnabled() const;
658 
660  void setDiagramRenderer( QgsDiagramRenderer* r );
661  const QgsDiagramRenderer* diagramRenderer() const { return mDiagramRenderer; }
662 
663  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
664  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
665 
667  QgsFeatureRenderer* renderer() { return mRenderer; }
668 
672  const QgsFeatureRenderer* renderer() const { return mRenderer; }
673 
678  void setRenderer( QgsFeatureRenderer* r );
679 
681  QgsWkbTypes::GeometryType geometryType() const;
682 
684  bool hasGeometryType() const;
685 
687  QgsWkbTypes::Type wkbType() const;
688 
690  QString providerType() const;
691 
695  virtual bool readXml( const QDomNode& layer_node ) override;
696 
700  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) const override;
701 
705  void resolveReferences( QgsProject* project );
706 
715  virtual void saveStyleToDatabase( const QString& name, const QString& description,
716  bool useAsDefault, const QString& uiFileContent,
717  QString &msgError );
718 
727  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
728  QStringList &descriptions, QString &msgError );
729 
733  virtual QString getStyleFromDatabase( const QString& styleId, QString &msgError );
734 
742  virtual bool deleteStyleFromDatabase( const QString& styleId, QString &msgError );
743 
750  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag, bool loadFromLocalDb );
751 
756  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag ) override;
757 
763  bool readSymbology( const QDomNode& layerNode, QString& errorMessage ) override;
764 
770  bool readStyle( const QDomNode& node, QString& errorMessage ) override;
771 
778  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
779 
786  bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
787 
796  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
797 
798  bool readSld( const QDomNode& node, QString& errorMessage ) override;
799 
805  long featureCount( const QString& legendKey ) const;
806 
817  void setDataSource( const QString& dataSource, const QString& baseName, const QString& provider, bool loadDefaultStyleFlag = false );
818 
824  bool countSymbolFeatures( bool showProgress = true );
825 
833  virtual bool setSubsetString( const QString& subset );
834 
839  virtual QString subsetString() const;
840 
846  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() ) const;
847 
851  inline QgsFeatureIterator getFeatures( const QString& expression )
852  {
853  return getFeatures( QgsFeatureRequest( expression ) );
854  }
855 
861  {
862  QgsFeature feature;
863  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
864  return feature;
865  }
866 
871  {
872  return getFeatures( QgsFeatureRequest( fids ) );
873  }
874 
878  inline QgsFeatureIterator getFeatures( const QgsRectangle& rectangle )
879  {
880  return getFeatures( QgsFeatureRequest( rectangle ) );
881  }
882 
888  bool addFeature( QgsFeature& feature, bool alsoUpdateExtent = true );
889 
896  bool updateFeature( QgsFeature &f );
897 
902  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
903 
908  bool insertVertex( const QgsPointV2& point, QgsFeatureId atFeatureId, int beforeVertex );
909 
914  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
915 
921  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
922 
928  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
929 
933  bool deleteSelectedFeatures( int *deletedCount = nullptr );
934 
947  // TODO QGIS 3.0 returns an enum instead of a magic constant
948  int addRing( const QList<QgsPoint>& ring, QgsFeatureId* featureId = nullptr );
949 
960  // TODO QGIS 3.0 returns an enum instead of a magic constant
961  int addRing( QgsCurve* ring, QgsFeatureId* featureId = nullptr );
962 
974  // TODO QGIS 3.0 returns an enum instead of a magic constant
975  int addPart( const QList<QgsPoint>& ring );
976 
989  // TODO QGIS 3.0 returns an enum instead of a magic constant
990  int addPart( const QgsPointSequence &ring );
991 
993  int addPart( QgsCurve* ring );
994 
1001  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1002 
1010  // TODO QGIS 3.0 returns an enum instead of a magic constant
1011  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1012 
1020  // TODO QGIS 3.0 returns an enum instead of a magic constant
1021  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1022 
1028  int addTopologicalPoints( const QgsGeometry& geom );
1029 
1037  int addTopologicalPoints( const QgsPoint& p );
1038 
1044  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1045 
1050  const QgsAbstractVectorLayerLabeling* labeling() const { return mLabeling; }
1051 
1056  void setLabeling( QgsAbstractVectorLayerLabeling* labeling );
1057 
1059  virtual bool isEditable() const override;
1060 
1061  virtual bool isSpatial() const override;
1062 
1064  virtual bool isModified() const;
1065 
1072  bool snapPoint( QgsPoint& point, double tolerance );
1073 
1081  int snapWithContext( const QgsPoint& startPoint,
1082  double snappingTolerance,
1083  QMultiMap < double, QgsSnappingResult > &snappingResults,
1084  QgsSnapper::SnappingType snap_to );
1085 
1087  virtual void reload() override;
1088 
1092  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1093 
1095  QgsRectangle extent() const override;
1096 
1103  inline QgsFields fields() const { return mFields; }
1104 
1112  inline QgsFields pendingFields() const { return mFields; }
1113 
1118  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1119 
1124  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1125 
1130  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1131 
1133  QgsAttributeList pkAttributeList() const;
1134 
1139  inline long pendingFeatureCount() const { return featureCount(); }
1140 
1145  long featureCount() const;
1146 
1150  bool setReadOnly( bool readonly = true );
1151 
1153  bool changeGeometry( QgsFeatureId fid, const QgsGeometry& geom );
1154 
1165  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1166 
1170  bool addAttribute( const QgsField &field );
1171 
1177  void setFieldAlias( int index, const QString& aliasString );
1178 
1184  void removeFieldAlias( int index );
1185 
1191  bool renameAttribute( int index, const QString& newName );
1192 
1199  QString attributeAlias( int index ) const;
1200 
1202  QString attributeDisplayName( int index ) const;
1203 
1205  QgsStringMap attributeAliases() const;
1206 
1210  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1211 
1215  void setExcludeAttributesWms( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1216 
1220  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1221 
1225  void setExcludeAttributesWfs( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1226 
1228  bool deleteAttribute( int attr );
1229 
1237  bool deleteAttributes( QList<int> attrs );
1238 
1240  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1241 
1243  bool deleteFeature( QgsFeatureId fid );
1244 
1252  bool deleteFeatures( const QgsFeatureIds& fids );
1253 
1270  bool commitChanges();
1271 
1276  QStringList commitErrors() const;
1277 
1281  bool rollBack( bool deleteBuffer = true );
1282 
1284  QString annotationForm() const { return mAnnotationForm; }
1285 
1287  void setAnnotationForm( const QString& ui );
1288 
1295  QList<QgsRelation> referencingRelations( int idx ) const;
1296 
1298  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1299 
1301  const QgsVectorLayerEditBuffer* editBuffer() const { return mEditBuffer; }
1302 
1307  void beginEditCommand( const QString& text );
1308 
1310  void endEditCommand();
1311 
1313  void destroyEditCommand();
1314 
1317  {
1320  NoMarker
1321  };
1322 
1324  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1325 
1327  void updateFields();
1328 
1342  QVariant defaultValue( int index, const QgsFeature& feature = QgsFeature(),
1343  QgsExpressionContext* context = nullptr ) const;
1344 
1353  void setDefaultValueExpression( int index, const QString& expression );
1354 
1363  QString defaultValueExpression( int index ) const;
1364 
1372  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1373 
1383 
1391  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1392 
1400  QString constraintExpression( int index ) const;
1401 
1409  QString constraintDescription( int index ) const;
1410 
1419  void setConstraintExpression( int index, const QString& expression, const QString& description = QString() );
1420 
1424  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup& setup );
1425 
1432  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1433 
1445  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 ) const;
1446 
1460  QStringList uniqueStringsMatching( int index, const QString& substring, int limit = -1,
1461  QgsFeedback* feedback = nullptr ) const;
1462 
1470  QVariant minimumValue( int index ) const;
1471 
1479  QVariant maximumValue( int index ) const;
1480 
1490  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1491  const QString& fieldOrExpression,
1493  QgsExpressionContext* context = nullptr,
1494  bool* ok = nullptr ) const;
1495 
1505  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback* feedback = nullptr ) const;
1506 
1518  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = nullptr, QgsFeedback* feedback = nullptr ) const;
1519 
1521  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1523  QPainter::CompositionMode featureBlendMode() const;
1524 
1526  void setLayerTransparency( int layerTransparency );
1528  int layerTransparency() const;
1529 
1530  QString metadata() const override;
1531 
1533  inline QgsGeometryCache* cache() { return mCache; }
1534 
1538  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1539 
1543  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1544 
1549  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1550 
1558  QgsConditionalLayerStyles *conditionalStyles() const;
1559 
1564  QgsAttributeTableConfig attributeTableConfig() const;
1565 
1570  void setAttributeTableConfig( const QgsAttributeTableConfig& attributeTableConfig );
1571 
1579  QString mapTipTemplate() const;
1580 
1588  void setMapTipTemplate( const QString& mapTipTemplate );
1589 
1591 
1600  QgsEditFormConfig editFormConfig() const;
1601 
1610  void setEditFormConfig( const QgsEditFormConfig& editFormConfig );
1611 
1612  public slots:
1613 
1621  void select( QgsFeatureId featureId );
1622 
1630  void select( const QgsFeatureIds& featureIds );
1631 
1639  void deselect( const QgsFeatureId featureId );
1640 
1648  void deselect( const QgsFeatureIds& featureIds );
1649 
1655  void removeSelection();
1656 
1660  virtual void updateExtents();
1661 
1668  bool startEditing();
1669 
1670 
1671  protected slots:
1672  void invalidateSymbolCountedFlag();
1673 
1674  signals:
1675 
1683  void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );
1684 
1686  void layerModified();
1687 
1689  void beforeModifiedCheck() const;
1690 
1692  void beforeEditingStarted();
1693 
1695  void editingStarted();
1696 
1698  void editingStopped();
1699 
1701  void beforeCommitChanges();
1702 
1704  void beforeRollBack();
1705 
1714  void attributeAdded( int idx );
1715 
1722  void beforeAddingExpressionField( const QString& fieldName );
1723 
1732  void attributeDeleted( int idx );
1733 
1740  void beforeRemovingExpressionField( int idx );
1741 
1747  void featureAdded( QgsFeatureId fid );
1748 
1757  void featureDeleted( QgsFeatureId fid );
1758 
1768  void featuresDeleted( const QgsFeatureIds& fids );
1769 
1774  void updatedFields();
1775 
1776 
1785  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant& value );
1786 
1794  void geometryChanged( QgsFeatureId fid, const QgsGeometry& geometry );
1795 
1797  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1799  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1801  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1803  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1805  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1807  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1808 
1810  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1811 
1813  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1814 
1816  void layerTransparencyChanged( int layerTransparency );
1817 
1823  void editCommandStarted( const QString& text );
1824 
1830  void editCommandEnded();
1831 
1837  void editCommandDestroyed();
1838 
1848  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1849 
1859  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1860 
1866  void mapTipTemplateChanged();
1867 
1873  void displayExpressionChanged();
1874 
1878  void raiseError( const QString& msg );
1879 
1885  void editFormConfigChanged();
1886 
1893  void readOnlyChanged();
1894 
1895 
1896  private slots:
1897  void onJoinedFieldsChanged();
1898  void onFeatureDeleted( QgsFeatureId fid );
1899  void onRelationsLoaded();
1900 
1901  protected:
1903  void setExtent( const QgsRectangle &rect ) override;
1904 
1905  private: // Private methods
1906 
1910  virtual bool isReadOnly() const override;
1911 
1916  bool setDataProvider( QString const & provider );
1917 
1919  QgsFeatureId findFreeId();
1920 
1929  void snapToGeometry( const QgsPoint& startPoint,
1930  QgsFeatureId featureId,
1931  const QgsGeometry& geom,
1932  double sqrSnappingTolerance,
1933  QMultiMap<double, QgsSnappingResult>& snappingResults,
1934  QgsSnapper::SnappingType snap_to ) const;
1935 
1937  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1938 
1940  void readSldLabeling( const QDomNode& node );
1941 
1942  private: // Private attributes
1943 
1944  QgsConditionalLayerStyles * mConditionalStyles = nullptr;
1945 
1947  QgsVectorDataProvider *mDataProvider = nullptr;
1948 
1950  QString mDisplayExpression;
1951 
1952  QString mMapTipTemplate;
1953 
1955  QString mProviderKey;
1956 
1958  QgsActionManager* mActions = nullptr;
1959 
1961  bool mReadOnly;
1962 
1967  QgsFeatureIds mSelectedFeatureIds;
1968 
1970  QgsFields mFields;
1971 
1973  QgsStringMap mAttributeAliasMap;
1974 
1976  QgsStringMap mDefaultExpressionMap;
1977 
1979  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
1980 
1982  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
1983 
1985  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
1986 
1987  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
1988 
1990  QgsEditFormConfig mEditFormConfig;
1991 
1993  QSet<QString> mExcludeAttributesWMS;
1994 
1996  QSet<QString> mExcludeAttributesWFS;
1997 
1999  QgsWkbTypes::Type mWkbType;
2000 
2002  QgsFeatureRenderer *mRenderer = nullptr;
2003 
2005  QgsVectorSimplifyMethod mSimplifyMethod;
2006 
2008  QgsAbstractVectorLayerLabeling* mLabeling = nullptr;
2009 
2011  bool mLabelFontNotFoundNotified;
2012 
2014  QPainter::CompositionMode mFeatureBlendMode;
2015 
2017  int mLayerTransparency;
2018 
2020  bool mVertexMarkerOnlyForSelection;
2021 
2022  QStringList mCommitErrors;
2023 
2025  QString mAnnotationForm;
2026 
2028  QgsGeometryCache* mCache = nullptr;
2029 
2031  QgsVectorLayerEditBuffer* mEditBuffer = nullptr;
2033 
2034  //stores information about joined layers
2035  QgsVectorLayerJoinBuffer* mJoinBuffer = nullptr;
2036 
2038  QgsExpressionFieldBuffer* mExpressionFieldBuffer = nullptr;
2039 
2040  //diagram rendering object. 0 if diagram drawing is disabled
2041  QgsDiagramRenderer* mDiagramRenderer = nullptr;
2042 
2043  //stores infos about diagram placement (placement type, priority, position distance)
2044  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2045 
2046  mutable bool mValidExtent;
2047  mutable bool mLazyExtent;
2048 
2049  // Features in renderer classes counted
2050  bool mSymbolFeatureCounted;
2051 
2052  // Feature counts for each renderer legend key
2053  QHash<QString, long> mSymbolFeatureCountMap;
2054 
2056  bool mEditCommandActive;
2057 
2058  QgsFeatureIds mDeletedFids;
2059 
2060  QgsAttributeTableConfig mAttributeTableConfig;
2061 
2062  mutable QMutex mFeatureSourceConstructorMutex;
2063 
2065 };
2066 
2067 #endif
virtual bool isEditable() const
Returns true if the layer can be edited.
QgsActionManager * actions()
Get all layer actions defined on this layer.
Wrapper for iterator of features from vector data provider or vector layer.
QString annotationForm() const
Get annotation form.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:353
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:36
Base class for all map layer types.
Definition: qgsmaplayer.h:52
QgsAttributeList attributeList() const
Returns list of attribute indexes.
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
Constraint
Constraints which may be present on a field.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:355
QgsFields fields() const
Returns the list of fields of this layer.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:360
Manages an editor widget Widget and wrapper share the same parent.
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage) const
Write just the style information for the layer into the document.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage)=0
Read the symbology for the current layer from the Dom node supplied.
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 ...
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:299
VertexMarkerType
Editing vertex markers.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfields.h:39
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:79
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:136
const QgsDiagramLayerSettings * diagramLayerSettings() const
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
QMap< QString, QString > QgsStringMap
Definition: qgis.h:330
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
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:42
const QgsFeatureRenderer * renderer() const
Return const renderer.
virtual QString metadata() const
Obtain Metadata for this layer.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:72
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsFields pendingFields() const
Returns the list of fields of this layer.
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:65
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
virtual QgsRectangle extent() const
Returns the extent of the layer.
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:36
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.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QList< int > QgsAttributeList
Reads and writes project states.
Definition: qgsproject.h:74
Storage and management of actions associated with a layer.
QgsFeatureRenderer * renderer()
Return renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:33
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:45
virtual bool readStyle(const QDomNode &node, QString &errorMessage)
Read the style for the current layer from the Dom node supplied.
Add selection to current selection.
A class to represent a point.
Definition: qgspoint.h:143
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:533
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QgsVectorLayerJoinBuffer * joinBuffer()
Accessor to the join buffer object.
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.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:131
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
const QgsDiagramRenderer * diagramRenderer() const
Buffers information about expression fields for a vector layer.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:350
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document) const
Called by writeLayerXML(), used by children to write state specific to them to project files...
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
virtual bool readXml(const QDomNode &layer_node)
Called by readLayerXML(), used by children to read state specific to them from project files...
QgsFeature getFeature(QgsFeatureId fid)
Query the layer for the feature with the given id.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Class for doing transforms between two map coordinate systems.
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:33
Base class for utility classes that encapsulate information necessary for rendering of map layers...
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)=0
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
QSet< int > QgsAttributeIds
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
QList< QgsPointV2 > QgsPointSequence
Represents a vector layer which manages a vector based data sets.
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 bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
Definition: qgsmaplayer.h:352
A bundle of parameters controlling aggregate calculation.
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.