QGIS API Documentation  2.99.0-Master (0a63d1f)
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;
70 class QgsPointV2;
72 
73 typedef QList<int> QgsAttributeList;
74 typedef QSet<int> QgsAttributeIds;
75 typedef QList<QgsPointV2> QgsPointSequence;
76 
77 
78 struct CORE_EXPORT QgsVectorJoinInfo
79 {
81  : memoryCache( false )
82  , cacheDirty( true )
83  , targetFieldIndex( -1 )
84  , joinFieldIndex( -1 )
85  {}
86 
88  QString targetFieldName;
90  QString joinLayerId;
92  QString joinFieldName;
96  bool cacheDirty;
97 
101  QHash< QString, QgsAttributes> cachedAttributes;
102 
107 
111  QString prefix;
112 
113  bool operator==( const QgsVectorJoinInfo& other ) const
114  {
115  return targetFieldName == other.targetFieldName &&
116  joinLayerId == other.joinLayerId &&
117  joinFieldName == other.joinFieldName &&
118  joinFieldsSubset == other.joinFieldsSubset &&
119  memoryCache == other.memoryCache &&
120  prefix == other.prefix;
121  }
122 
125  void setJoinFieldNamesSubset( QStringList* fieldNamesSubset ) { joinFieldsSubset = QSharedPointer<QStringList>( fieldNamesSubset ); }
126 
129  QStringList* joinFieldNamesSubset() const { return joinFieldsSubset.data(); }
130 
131 protected:
133  QSharedPointer<QStringList> joinFieldsSubset;
134 };
135 
136 
137 
412 class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionContextGenerator
413 {
414  Q_OBJECT
415 
416  Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
417  Q_PROPERTY( QString mapTipTemplate READ mapTipTemplate WRITE setMapTipTemplate NOTIFY mapTipTemplateChanged )
418  Q_PROPERTY( QgsEditFormConfig editFormConfig READ editFormConfig WRITE setEditFormConfig NOTIFY editFormConfigChanged )
419  Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
420 
421  public:
422 
425  {
426  Success = 0,
427  EmptyGeometry = 1,
428  EditFailed = 2,
429  FetchFeatureFailed = 3,
430  InvalidLayer = 4,
431  };
432 
435  {
440  };
441 
455  QgsVectorLayer( const QString& path = QString::null, const QString& baseName = QString::null,
456  const QString& providerLib = QString::null, bool loadDefaultStyleFlag = true );
457 
458 
459  virtual ~QgsVectorLayer();
460 
462  QgsVectorLayer( const QgsVectorLayer & rhs ) = delete;
464  QgsVectorLayer & operator=( QgsVectorLayer const & rhs ) = delete;
465 
467  QString storageType() const;
468 
470  QString capabilitiesString() const;
471 
473  QString dataComment() const;
474 
482  QString displayField() const;
483 
490  void setDisplayExpression( const QString& displayExpression );
491 
498  QString displayExpression() const;
499 
501  QgsVectorDataProvider* dataProvider();
502 
506  const QgsVectorDataProvider* dataProvider() const;
507 
509  void setProviderEncoding( const QString& encoding );
510 
512  void setCoordinateSystem();
513 
517  bool addJoin( const QgsVectorJoinInfo& joinInfo );
518 
521  bool removeJoin( const QString& joinLayerId );
522 
527  QgsVectorLayerJoinBuffer* joinBuffer() { return mJoinBuffer; }
528  const QList<QgsVectorJoinInfo> vectorJoins() const;
529 
538  virtual bool setDependencies( const QSet<QgsMapLayerDependency>& layers ) override;
539 
547  virtual QSet<QgsMapLayerDependency> dependencies() const override;
548 
559  int addExpressionField( const QString& exp, const QgsField& fld );
560 
568  void removeExpressionField( int index );
569 
579  QString expressionField( int index ) const;
580 
590  void updateExpressionField( int index, const QString& exp );
591 
598  QgsActionManager* actions() { return mActions; }
599 
605  int selectedFeatureCount() const;
606 
616  void selectByRect( QgsRectangle & rect, SelectBehavior behavior = SetSelection );
617 
626  void selectByExpression( const QString& expression, SelectBehavior behavior = SetSelection );
627 
637  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
638 
651  void modifySelection( const QgsFeatureIds& selectIds, const QgsFeatureIds &deselectIds );
652 
654  void invertSelection();
655 
657  void selectAll();
658 
660  QgsFeatureIds allFeatureIds() const;
661 
669  void invertSelectionInRectangle( QgsRectangle & rect );
670 
679  QgsFeatureList selectedFeatures() const;
680 
692  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() ) const;
693 
700  const QgsFeatureIds &selectedFeatureIds() const;
701 
703  QgsRectangle boundingBoxOfSelected() const;
704 
709  bool labelsEnabled() const;
710 
715  bool diagramsEnabled() const;
716 
718  void setDiagramRenderer( QgsDiagramRenderer* r );
719  const QgsDiagramRenderer* diagramRenderer() const { return mDiagramRenderer; }
720 
721  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
722  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
723 
725  QgsFeatureRenderer* renderer() { return mRenderer; }
726 
730  const QgsFeatureRenderer* renderer() const { return mRenderer; }
731 
736  void setRenderer( QgsFeatureRenderer* r );
737 
739  QgsWkbTypes::GeometryType geometryType() const;
740 
742  bool hasGeometryType() const;
743 
745  QgsWkbTypes::Type wkbType() const;
746 
748  QString providerType() const;
749 
753  virtual bool readXml( const QDomNode& layer_node ) override;
754 
758  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) const override;
759 
768  virtual void saveStyleToDatabase( const QString& name, const QString& description,
769  bool useAsDefault, const QString& uiFileContent,
770  QString &msgError );
771 
780  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
781  QStringList &descriptions, QString &msgError );
782 
786  virtual QString getStyleFromDatabase( const QString& styleId, QString &msgError );
787 
794  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
795 
800  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
801 
807  bool readSymbology( const QDomNode& layerNode, QString& errorMessage ) override;
808 
814  bool readStyle( const QDomNode& node, QString& errorMessage ) override;
815 
822  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
823 
830  bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
831 
840  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
841 
842  bool readSld( const QDomNode& node, QString& errorMessage ) override;
843 
849  long featureCount( const QString& legendKey ) const;
850 
861  void setDataSource( const QString& dataSource, const QString& baseName, const QString& provider, bool loadDefaultStyleFlag = false );
862 
868  bool countSymbolFeatures( bool showProgress = true );
869 
877  virtual bool setSubsetString( const QString& subset );
878 
883  virtual QString subsetString() const;
884 
890  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() ) const;
891 
895  inline QgsFeatureIterator getFeatures( const QString& expression )
896  {
897  return getFeatures( QgsFeatureRequest( expression ) );
898  }
899 
905  {
906  QgsFeature feature;
907  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
908  return feature;
909  }
910 
915  {
916  return getFeatures( QgsFeatureRequest( fids ) );
917  }
918 
922  inline QgsFeatureIterator getFeatures( const QgsRectangle& rectangle )
923  {
924  return getFeatures( QgsFeatureRequest( rectangle ) );
925  }
926 
932  bool addFeature( QgsFeature& feature, bool alsoUpdateExtent = true );
933 
940  bool updateFeature( QgsFeature &f );
941 
946  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
947 
952  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
953 
959  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
960 
966  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
967 
971  bool deleteSelectedFeatures( int *deletedCount = nullptr );
972 
985  // TODO QGIS 3.0 returns an enum instead of a magic constant
986  int addRing( const QList<QgsPoint>& ring, QgsFeatureId* featureId = nullptr );
987 
998  // TODO QGIS 3.0 returns an enum instead of a magic constant
999  int addRing( QgsCurve* ring, QgsFeatureId* featureId = nullptr );
1000 
1012  // TODO QGIS 3.0 returns an enum instead of a magic constant
1013  int addPart( const QList<QgsPoint>& ring );
1014 
1027  // TODO QGIS 3.0 returns an enum instead of a magic constant
1028  int addPart( const QgsPointSequence &ring );
1029 
1031  int addPart( QgsCurve* ring );
1032 
1039  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1040 
1048  // TODO QGIS 3.0 returns an enum instead of a magic constant
1049  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1050 
1058  // TODO QGIS 3.0 returns an enum instead of a magic constant
1059  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1060 
1066  int addTopologicalPoints( const QgsGeometry& geom );
1067 
1075  int addTopologicalPoints( const QgsPoint& p );
1076 
1082  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1083 
1088  const QgsAbstractVectorLayerLabeling* labeling() const { return mLabeling; }
1089 
1094  void setLabeling( QgsAbstractVectorLayerLabeling* labeling );
1095 
1097  virtual bool isEditable() const override;
1098 
1099  virtual bool isSpatial() const override;
1100 
1102  virtual bool isModified() const;
1103 
1110  bool snapPoint( QgsPoint& point, double tolerance );
1111 
1119  int snapWithContext( const QgsPoint& startPoint,
1120  double snappingTolerance,
1121  QMultiMap < double, QgsSnappingResult > &snappingResults,
1122  QgsSnapper::SnappingType snap_to );
1123 
1125  virtual void reload() override;
1126 
1130  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1131 
1133  QgsRectangle extent() const override;
1134 
1141  inline QgsFields fields() const { return mFields; }
1142 
1150  inline QgsFields pendingFields() const { return mFields; }
1151 
1156  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1157 
1162  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1163 
1168  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1169 
1171  QgsAttributeList pkAttributeList() const;
1172 
1177  inline long pendingFeatureCount() const { return featureCount(); }
1178 
1183  long featureCount() const;
1184 
1188  bool setReadOnly( bool readonly = true );
1189 
1191  bool changeGeometry( QgsFeatureId fid, const QgsGeometry& geom );
1192 
1203  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1204 
1208  bool addAttribute( const QgsField &field );
1209 
1215  void setFieldAlias( int index, const QString& aliasString );
1216 
1222  void removeFieldAlias( int index );
1223 
1229  bool renameAttribute( int index, const QString& newName );
1230 
1237  QString attributeAlias( int index ) const;
1238 
1240  QString attributeDisplayName( int index ) const;
1241 
1243  QgsStringMap attributeAliases() const;
1244 
1248  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1249 
1253  void setExcludeAttributesWms( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1254 
1258  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1259 
1263  void setExcludeAttributesWfs( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1264 
1266  bool deleteAttribute( int attr );
1267 
1275  bool deleteAttributes( QList<int> attrs );
1276 
1278  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1279 
1281  bool deleteFeature( QgsFeatureId fid );
1282 
1290  bool deleteFeatures( const QgsFeatureIds& fids );
1291 
1308  bool commitChanges();
1309 
1314  QStringList commitErrors() const;
1315 
1319  bool rollBack( bool deleteBuffer = true );
1320 
1322  QString annotationForm() const { return mAnnotationForm; }
1323 
1325  void setAnnotationForm( const QString& ui );
1326 
1333  QList<QgsRelation> referencingRelations( int idx ) const;
1334 
1336  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1337 
1339  const QgsVectorLayerEditBuffer* editBuffer() const { return mEditBuffer; }
1340 
1345  void beginEditCommand( const QString& text );
1346 
1348  void endEditCommand();
1349 
1351  void destroyEditCommand();
1352 
1355  {
1358  NoMarker
1359  };
1360 
1362  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1363 
1365  void updateFields();
1366 
1368  // marked as const as these are just caches, and need to be created from const accessors
1369  void createJoinCaches() const;
1370 
1384  QVariant defaultValue( int index, const QgsFeature& feature = QgsFeature(),
1385  QgsExpressionContext* context = nullptr ) const;
1386 
1395  void setDefaultValueExpression( int index, const QString& expression );
1396 
1405  QString defaultValueExpression( int index ) const;
1406 
1414  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1415 
1425 
1433  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1434 
1442  QString constraintExpression( int index ) const;
1443 
1451  QString constraintDescription( int index ) const;
1452 
1461  void setConstraintExpression( int index, const QString& expression, const QString& description = QString() );
1462 
1466  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup& setup );
1467 
1474  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1475 
1487  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 ) const;
1488 
1502  QStringList uniqueStringsMatching( int index, const QString& substring, int limit = -1,
1503  QgsFeedback* feedback = nullptr ) const;
1504 
1512  QVariant minimumValue( int index ) const;
1513 
1521  QVariant maximumValue( int index ) const;
1522 
1532  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1533  const QString& fieldOrExpression,
1535  QgsExpressionContext* context = nullptr,
1536  bool* ok = nullptr ) const;
1537 
1546  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false ) const;
1547 
1558  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = nullptr ) const;
1559 
1561  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1563  QPainter::CompositionMode featureBlendMode() const;
1564 
1566  void setLayerTransparency( int layerTransparency );
1568  int layerTransparency() const;
1569 
1570  QString metadata() const override;
1571 
1573  inline QgsGeometryCache* cache() { return mCache; }
1574 
1578  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1579 
1583  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1584 
1589  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1590 
1598  QgsConditionalLayerStyles *conditionalStyles() const;
1599 
1604  QgsAttributeTableConfig attributeTableConfig() const;
1605 
1610  void setAttributeTableConfig( const QgsAttributeTableConfig& attributeTableConfig );
1611 
1619  QString mapTipTemplate() const;
1620 
1628  void setMapTipTemplate( const QString& mapTipTemplate );
1629 
1631 
1640  QgsEditFormConfig editFormConfig() const;
1641 
1650  void setEditFormConfig( const QgsEditFormConfig& editFormConfig );
1651 
1652  public slots:
1653 
1661  void select( QgsFeatureId featureId );
1662 
1670  void select( const QgsFeatureIds& featureIds );
1671 
1679  void deselect( const QgsFeatureId featureId );
1680 
1688  void deselect( const QgsFeatureIds& featureIds );
1689 
1695  void removeSelection();
1696 
1700  virtual void updateExtents();
1701 
1703  void checkJoinLayerRemove( const QString& theLayerId );
1704 
1711  bool startEditing();
1712 
1713 
1714  protected slots:
1715  void invalidateSymbolCountedFlag();
1716 
1717  signals:
1718 
1726  void selectionChanged( const QgsFeatureIds& selected, const QgsFeatureIds& deselected, const bool clearAndSelect );
1727 
1729  void layerModified();
1730 
1732  void beforeModifiedCheck() const;
1733 
1735  void beforeEditingStarted();
1736 
1738  void editingStarted();
1739 
1741  void editingStopped();
1742 
1744  void beforeCommitChanges();
1745 
1747  void beforeRollBack();
1748 
1757  void attributeAdded( int idx );
1758 
1765  void beforeAddingExpressionField( const QString& fieldName );
1766 
1775  void attributeDeleted( int idx );
1776 
1783  void beforeRemovingExpressionField( int idx );
1784 
1790  void featureAdded( QgsFeatureId fid );
1791 
1800  void featureDeleted( QgsFeatureId fid );
1801 
1811  void featuresDeleted( const QgsFeatureIds& fids );
1812 
1817  void updatedFields();
1818 
1819 
1828  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant& value );
1829 
1837  void geometryChanged( QgsFeatureId fid, const QgsGeometry& geometry );
1838 
1840  void committedAttributesDeleted( const QString& layerId, const QgsAttributeList& deletedAttributes );
1842  void committedAttributesAdded( const QString& layerId, const QList<QgsField>& addedAttributes );
1844  void committedFeaturesAdded( const QString& layerId, const QgsFeatureList& addedFeatures );
1846  void committedFeaturesRemoved( const QString& layerId, const QgsFeatureIds& deletedFeatureIds );
1848  void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
1850  void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );
1851 
1853  void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfamily );
1854 
1856  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1857 
1859  void layerTransparencyChanged( int layerTransparency );
1860 
1866  void editCommandStarted( const QString& text );
1867 
1873  void editCommandEnded();
1874 
1880  void editCommandDestroyed();
1881 
1891  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1892 
1902  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1903 
1909  void mapTipTemplateChanged();
1910 
1916  void displayExpressionChanged();
1917 
1921  void raiseError( const QString& msg );
1922 
1928  void editFormConfigChanged();
1929 
1936  void readOnlyChanged();
1937 
1938 
1939  private slots:
1940  void onJoinedFieldsChanged();
1941  void onFeatureDeleted( QgsFeatureId fid );
1942  void onRelationsLoaded();
1943 
1944  protected:
1946  void setExtent( const QgsRectangle &rect ) override;
1947 
1948  private: // Private methods
1949 
1953  virtual bool isReadOnly() const override;
1954 
1959  bool setDataProvider( QString const & provider );
1960 
1962  QgsFeatureId findFreeId();
1963 
1972  void snapToGeometry( const QgsPoint& startPoint,
1973  QgsFeatureId featureId,
1974  const QgsGeometry& geom,
1975  double sqrSnappingTolerance,
1976  QMultiMap<double, QgsSnappingResult>& snappingResults,
1977  QgsSnapper::SnappingType snap_to ) const;
1978 
1980  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1981 
1983  void readSldLabeling( const QDomNode& node );
1984 
1985  private: // Private attributes
1986 
1987  QgsConditionalLayerStyles * mConditionalStyles;
1988 
1990  QgsVectorDataProvider *mDataProvider;
1991 
1993  QString mDisplayExpression;
1994 
1995  QString mMapTipTemplate;
1996 
1998  QString mProviderKey;
1999 
2001  QgsActionManager* mActions;
2002 
2004  bool mReadOnly;
2005 
2010  QgsFeatureIds mSelectedFeatureIds;
2011 
2013  QgsFields mFields;
2014 
2016  QgsStringMap mAttributeAliasMap;
2017 
2019  QgsStringMap mDefaultExpressionMap;
2020 
2022  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2023 
2025  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2026 
2028  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2029 
2030  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2031 
2033  QgsEditFormConfig mEditFormConfig;
2034 
2036  QSet<QString> mExcludeAttributesWMS;
2037 
2039  QSet<QString> mExcludeAttributesWFS;
2040 
2042  QgsWkbTypes::Type mWkbType;
2043 
2045  QgsFeatureRenderer *mRenderer;
2046 
2048  QgsVectorSimplifyMethod mSimplifyMethod;
2049 
2051  QgsAbstractVectorLayerLabeling* mLabeling;
2052 
2054  bool mLabelFontNotFoundNotified;
2055 
2057  QPainter::CompositionMode mFeatureBlendMode;
2058 
2060  int mLayerTransparency;
2061 
2063  bool mVertexMarkerOnlyForSelection;
2064 
2065  QStringList mCommitErrors;
2066 
2068  QString mAnnotationForm;
2069 
2071  QgsGeometryCache* mCache;
2072 
2074  QgsVectorLayerEditBuffer* mEditBuffer;
2076 
2077  //stores information about joined layers
2078  QgsVectorLayerJoinBuffer* mJoinBuffer;
2079 
2081  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2082 
2083  //diagram rendering object. 0 if diagram drawing is disabled
2084  QgsDiagramRenderer* mDiagramRenderer;
2085 
2086  //stores infos about diagram placement (placement type, priority, position distance)
2087  QgsDiagramLayerSettings *mDiagramLayerSettings;
2088 
2089  mutable bool mValidExtent;
2090  mutable bool mLazyExtent;
2091 
2092  // Features in renderer classes counted
2093  bool mSymbolFeatureCounted;
2094 
2095  // Feature counts for each renderer legend key
2096  QHash<QString, long> mSymbolFeatureCountMap;
2097 
2099  bool mEditCommandActive;
2100 
2101  QgsFeatureIds mDeletedFids;
2102 
2103  QgsAttributeTableConfig mAttributeTableConfig;
2104 
2105  mutable QMutex mFeatureSourceConstructorMutex;
2106 
2108 };
2109 
2110 #endif
QgsActionManager * actions()
Get all layer actions defined on this layer.
bool cacheDirty
True if the cached join attributes need to be updated.
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:346
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:36
Base class for all map layer types.
Definition: qgsmaplayer.h:50
QString joinFieldName
Join field in the source layer.
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
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:349
QString targetFieldName
Join field in the target layer.
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:348
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:353
Manages an editor widget Widget and wrapper share the same parent.
int joinFieldIndex
Join field index in the source layer. For backward compatibility with 1.x (x>=7)
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 ...
virtual void reload()
Synchronises with changes in the datasource.
Definition: qgsmaplayer.h:296
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
bool memoryCache
True if the join is cached in virtual memory.
int targetFieldIndex
Join field index in the target layer. For backward compatibility with 1.x (x>=7)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:136
QMap< QString, QString > QgsStringMap
Definition: qgis.h:325
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
virtual QgsRectangle extent() const
Returns the extent of the layer.
Manages joined fields for a vector layer.
QgsFields fields() const
Returns the list of fields of this layer.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Definition: qgsfeedback.h:42
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:72
QString prefix
An optional prefix.
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...
void setJoinFieldNamesSubset(QStringList *fieldNamesSubset)
Set subset of fields to be used from joined layer.
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...
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document) const
Called by writeLayerXML(), used by children to write state specific to them to project files...
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.
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.
QList< int > QgsAttributeList
Storage and management of actions associated with a layer.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer. null = use all fields.
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: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.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
QString annotationForm() const
Get annotation form.
Add selection to current selection.
A class to represent a point.
Definition: qgspoint.h:143
virtual bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage) const
Write just the style information for the layer into the document.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Definition: qgsmaplayer.h:542
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsVectorLayerJoinBuffer * joinBuffer()
Accessor to the join buffer object.
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.
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:131
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.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:343
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.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
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
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 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
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 metadata() const
Obtain Metadata for this layer.
QList< int > QgsAttributeList
QList< QgsPointV2 > QgsPointSequence
Represents a vector layer which manages a vector based data sets.
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
EditResult
Result of an edit operation.
QString joinLayerId
Source layer.
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
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.
bool operator==(const QgsVectorJoinInfo &other) const
A bundle of parameters controlling aggregate calculation.
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.