QGIS API Documentation  2.99.0-Master (37c43df)
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 <QMap>
23 #include <QSet>
24 #include <QList>
25 #include <QStringList>
26 #include <QFont>
27 #include <QMutex>
28 
29 #include "qgis.h"
30 #include "qgsmaplayer.h"
31 #include "qgsfeature.h"
32 #include "qgsfeaturerequest.h"
33 #include "qgseditorwidgetconfig.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 
459  virtual ~QgsVectorLayer();
460 
462  QString storageType() const;
463 
465  QString capabilitiesString() const;
466 
468  QString dataComment() const;
469 
477  QString displayField() const;
478 
485  void setDisplayExpression( const QString& displayExpression );
486 
493  QString displayExpression() const;
494 
496  QgsVectorDataProvider* dataProvider();
497 
501  const QgsVectorDataProvider* dataProvider() const;
502 
504  void setProviderEncoding( const QString& encoding );
505 
507  void setCoordinateSystem();
508 
512  bool addJoin( const QgsVectorJoinInfo& joinInfo );
513 
516  bool removeJoin( const QString& joinLayerId );
517 
522  QgsVectorLayerJoinBuffer* joinBuffer() { return mJoinBuffer; }
523  const QList<QgsVectorJoinInfo> vectorJoins() const;
524 
533  virtual bool setDependencies( const QSet<QgsMapLayerDependency>& layers ) override;
534 
542  virtual QSet<QgsMapLayerDependency> dependencies() const override;
543 
554  int addExpressionField( const QString& exp, const QgsField& fld );
555 
563  void removeExpressionField( int index );
564 
574  QString expressionField( int index ) const;
575 
585  void updateExpressionField( int index, const QString& exp );
586 
593  QgsActionManager* actions() { return mActions; }
594 
600  int selectedFeatureCount() const;
601 
611  void selectByRect( QgsRectangle & rect, SelectBehaviour behaviour = SetSelection );
612 
621  void selectByExpression( const QString& expression, SelectBehaviour behaviour = SetSelection );
622 
632  void selectByIds( const QgsFeatureIds &ids, SelectBehaviour behaviour = SetSelection );
633 
646  void modifySelection( const QgsFeatureIds& selectIds, const QgsFeatureIds &deselectIds );
647 
649  void invertSelection();
650 
652  void selectAll();
653 
655  QgsFeatureIds allFeatureIds() const;
656 
664  void invertSelectionInRectangle( QgsRectangle & rect );
665 
674  QgsFeatureList selectedFeatures() const;
675 
687  QgsFeatureIterator selectedFeaturesIterator( QgsFeatureRequest request = QgsFeatureRequest() ) const;
688 
695  const QgsFeatureIds &selectedFeaturesIds() const;
696 
698  QgsRectangle boundingBoxOfSelected() const;
699 
704  bool labelsEnabled() const;
705 
710  bool diagramsEnabled() const;
711 
713  void setDiagramRenderer( QgsDiagramRenderer* r );
714  const QgsDiagramRenderer* diagramRenderer() const { return mDiagramRenderer; }
715 
716  void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
717  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
718 
720  QgsFeatureRenderer* renderer() { return mRenderer; }
721 
725  const QgsFeatureRenderer* renderer() const { return mRenderer; }
726 
731  void setRenderer( QgsFeatureRenderer* r );
732 
734  QgsWkbTypes::GeometryType geometryType() const;
735 
737  bool hasGeometryType() const;
738 
740  QgsWkbTypes::Type wkbType() const;
741 
743  QString providerType() const;
744 
748  virtual bool readXml( const QDomNode& layer_node ) override;
749 
753  virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ) const override;
754 
763  virtual void saveStyleToDatabase( const QString& name, const QString& description,
764  bool useAsDefault, const QString& uiFileContent,
765  QString &msgError );
766 
775  virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
776  QStringList &descriptions, QString &msgError );
777 
781  virtual QString getStyleFromDatabase( const QString& styleId, QString &msgError );
782 
789  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag, bool loadFromLocalDb );
790 
795  virtual QString loadNamedStyle( const QString &theURI, bool &theResultFlag ) override;
796 
802  bool readSymbology( const QDomNode& node, QString& errorMessage ) override;
803 
809  bool readStyle( const QDomNode& node, QString& errorMessage ) override;
810 
817  bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
818 
825  bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const override;
826 
835  bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
836 
837  bool readSld( const QDomNode& node, QString& errorMessage ) override;
838 
844  long featureCount( const QString& legendKey ) const;
845 
856  void setDataSource( const QString& dataSource, const QString& baseName, const QString& provider, bool loadDefaultStyleFlag = false );
857 
863  bool countSymbolFeatures( bool showProgress = true );
864 
872  virtual bool setSubsetString( const QString& subset );
873 
878  virtual QString subsetString() const;
879 
885  QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() ) const;
886 
890  inline QgsFeatureIterator getFeatures( const QString& expression )
891  {
892  return getFeatures( QgsFeatureRequest( expression ) );
893  }
894 
900  {
901  QgsFeature feature;
902  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
903  return feature;
904  }
905 
910  {
911  return getFeatures( QgsFeatureRequest( fids ) );
912  }
913 
917  inline QgsFeatureIterator getFeatures( const QgsRectangle& rectangle )
918  {
919  return getFeatures( QgsFeatureRequest( rectangle ) );
920  }
921 
927  bool addFeature( QgsFeature& feature, bool alsoUpdateExtent = true );
928 
935  bool updateFeature( QgsFeature &f );
936 
941  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
942 
947  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
948 
954  bool moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex );
955 
961  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
962 
966  bool deleteSelectedFeatures( int *deletedCount = nullptr );
967 
980  // TODO QGIS 3.0 returns an enum instead of a magic constant
981  int addRing( const QList<QgsPoint>& ring, QgsFeatureId* featureId = nullptr );
982 
993  // TODO QGIS 3.0 returns an enum instead of a magic constant
994  int addRing( QgsCurve* ring, QgsFeatureId* featureId = nullptr );
995 
1007  // TODO QGIS 3.0 returns an enum instead of a magic constant
1008  int addPart( const QList<QgsPoint>& ring );
1009 
1022  // TODO QGIS 3.0 returns an enum instead of a magic constant
1023  int addPart( const QgsPointSequence &ring );
1024 
1026  int addPart( QgsCurve* ring );
1027 
1034  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1035 
1043  // TODO QGIS 3.0 returns an enum instead of a magic constant
1044  int splitParts( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1045 
1053  // TODO QGIS 3.0 returns an enum instead of a magic constant
1054  int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );
1055 
1061  int addTopologicalPoints( const QgsGeometry& geom );
1062 
1070  int addTopologicalPoints( const QgsPoint& p );
1071 
1077  int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapResults );
1078 
1083  const QgsAbstractVectorLayerLabeling* labeling() const { return mLabeling; }
1084 
1089  void setLabeling( QgsAbstractVectorLayerLabeling* labeling );
1090 
1092  virtual bool isEditable() const override;
1093 
1094  virtual bool isSpatial() const override;
1095 
1097  virtual bool isModified() const;
1098 
1105  bool snapPoint( QgsPoint& point, double tolerance );
1106 
1114  int snapWithContext( const QgsPoint& startPoint,
1115  double snappingTolerance,
1116  QMultiMap < double, QgsSnappingResult > &snappingResults,
1117  QgsSnapper::SnappingType snap_to );
1118 
1120  virtual void reload() override;
1121 
1125  virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) override;
1126 
1128  QgsRectangle extent() const override;
1129 
1136  inline QgsFields fields() const { return mFields; }
1137 
1145  inline QgsFields pendingFields() const { return mFields; }
1146 
1151  inline QgsAttributeList pendingAllAttributesList() const { return mFields.allAttributesList(); }
1152 
1157  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1158 
1163  inline QgsAttributeList pendingPkAttributesList() const { return pkAttributeList(); }
1164 
1166  QgsAttributeList pkAttributeList() const;
1167 
1172  inline long pendingFeatureCount() const { return featureCount(); }
1173 
1178  long featureCount() const;
1179 
1183  bool setReadOnly( bool readonly = true );
1184 
1186  bool changeGeometry( QgsFeatureId fid, const QgsGeometry& geom );
1187 
1198  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
1199 
1203  bool addAttribute( const QgsField &field );
1204 
1210  void setFieldAlias( int index, const QString& aliasString );
1211 
1217  void removeFieldAlias( int index );
1218 
1224  bool renameAttribute( int index, const QString& newName );
1225 
1232  QString attributeAlias( int index ) const;
1233 
1235  QString attributeDisplayName( int index ) const;
1236 
1238  QgsStringMap attributeAliases() const;
1239 
1243  const QSet<QString>& excludeAttributesWms() const { return mExcludeAttributesWMS; }
1244 
1248  void setExcludeAttributesWms( const QSet<QString>& att ) { mExcludeAttributesWMS = att; }
1249 
1253  const QSet<QString>& excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1254 
1258  void setExcludeAttributesWfs( const QSet<QString>& att ) { mExcludeAttributesWFS = att; }
1259 
1261  bool deleteAttribute( int attr );
1262 
1270  bool deleteAttributes( QList<int> attrs );
1271 
1273  bool addFeatures( QgsFeatureList features, bool makeSelected = true );
1274 
1276  bool deleteFeature( QgsFeatureId fid );
1277 
1285  bool deleteFeatures( const QgsFeatureIds& fids );
1286 
1303  bool commitChanges();
1304 
1309  QStringList commitErrors() const;
1310 
1314  bool rollBack( bool deleteBuffer = true );
1315 
1317  QString annotationForm() const { return mAnnotationForm; }
1318 
1320  void setAnnotationForm( const QString& ui );
1321 
1328  QList<QgsRelation> referencingRelations( int idx ) const;
1329 
1331  QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; }
1332 
1334  const QgsVectorLayerEditBuffer* editBuffer() const { return mEditBuffer; }
1335 
1340  void beginEditCommand( const QString& text );
1341 
1343  void endEditCommand();
1344 
1346  void destroyEditCommand();
1347 
1350  {
1353  NoMarker
1354  };
1355 
1357  static void drawVertexMarker( double x, double y, QPainter& p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1358 
1360  void updateFields();
1361 
1363  // marked as const as these are just caches, and need to be created from const accessors
1364  void createJoinCaches() const;
1365 
1379  QVariant defaultValue( int index, const QgsFeature& feature = QgsFeature(),
1380  QgsExpressionContext* context = nullptr ) const;
1381 
1390  void setDefaultValueExpression( int index, const QString& expression );
1391 
1400  QString defaultValueExpression( int index ) const;
1401 
1409  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1410 
1420 
1428  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1429 
1437  QString constraintExpression( int index ) const;
1438 
1446  QString constraintDescription( int index ) const;
1447 
1456  void setConstraintExpression( int index, const QString& expression, const QString& description = QString() );
1457 
1469  void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 ) const;
1470 
1484  QStringList uniqueStringsMatching( int index, const QString& substring, int limit = -1,
1485  QgsFeedback* feedback = nullptr ) const;
1486 
1494  QVariant minimumValue( int index ) const;
1495 
1503  QVariant maximumValue( int index ) const;
1504 
1514  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1515  const QString& fieldOrExpression,
1517  QgsExpressionContext* context = nullptr,
1518  bool* ok = nullptr ) const;
1519 
1528  QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false ) const;
1529 
1540  QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = nullptr ) const;
1541 
1543  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1545  QPainter::CompositionMode featureBlendMode() const;
1546 
1548  void setLayerTransparency( int layerTransparency );
1550  int layerTransparency() const;
1551 
1552  QString metadata() const override;
1553 
1555  inline QgsGeometryCache* cache() { return mCache; }
1556 
1560  void setSimplifyMethod( const QgsVectorSimplifyMethod& simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1561 
1565  inline const QgsVectorSimplifyMethod& simplifyMethod() const { return mSimplifyMethod; }
1566 
1571  bool simplifyDrawingCanbeApplied( const QgsRenderContext& renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1572 
1580  QgsConditionalLayerStyles *conditionalStyles() const;
1581 
1586  QgsAttributeTableConfig attributeTableConfig() const;
1587 
1592  void setAttributeTableConfig( const QgsAttributeTableConfig& attributeTableConfig );
1593 
1601  QString mapTipTemplate() const;
1602 
1610  void setMapTipTemplate( const QString& mapTipTemplate );
1611 
1613 
1622  QgsEditFormConfig editFormConfig() const;
1623 
1632  void setEditFormConfig( const QgsEditFormConfig& editFormConfig );
1633 
1634  public slots:
1635 
1643  void select( QgsFeatureId featureId );
1644 
1652  void select( const QgsFeatureIds& featureIds );
1653 
1661  void deselect( const QgsFeatureId featureId );
1662 
1670  void deselect( const QgsFeatureIds& featureIds );
1671 
1677  void removeSelection();
1678 
1682  virtual void updateExtents();
1683 
1685  void checkJoinLayerRemove( const QString& theLayerId );
1686 
1693  bool startEditing();
1694 
1695 
1696  protected slots:
1697  void invalidateSymbolCountedFlag();
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 
1841  void layerTransparencyChanged( int layerTransparency );
1842 
1848  void editCommandStarted( const QString& text );
1849 
1855  void editCommandEnded();
1856 
1862  void editCommandDestroyed();
1863 
1873  void readCustomSymbology( const QDomElement& element, QString& errorMessage );
1874 
1884  void writeCustomSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage ) const;
1885 
1891  void mapTipTemplateChanged();
1892 
1898  void displayExpressionChanged();
1899 
1903  void raiseError( const QString& msg );
1904 
1910  void editFormConfigChanged();
1911 
1918  void readOnlyChanged();
1919 
1920 
1921  private slots:
1922  void onJoinedFieldsChanged();
1923  void onFeatureDeleted( QgsFeatureId fid );
1924  void onRelationsLoaded();
1925 
1926  protected:
1928  void setExtent( const QgsRectangle &rect ) override;
1929 
1930  private: // Private methods
1931 
1935  virtual bool isReadOnly() const override;
1936 
1938  QgsVectorLayer( const QgsVectorLayer & rhs );
1939 
1941  QgsVectorLayer & operator=( QgsVectorLayer const & rhs );
1942 
1943 
1948  bool setDataProvider( QString const & provider );
1949 
1951  QgsFeatureId findFreeId();
1952 
1961  void snapToGeometry( const QgsPoint& startPoint,
1962  QgsFeatureId featureId,
1963  const QgsGeometry& geom,
1964  double sqrSnappingTolerance,
1965  QMultiMap<double, QgsSnappingResult>& snappingResults,
1966  QgsSnapper::SnappingType snap_to ) const;
1967 
1969  //void addJoinedAttributes( QgsFeature& f, bool all = false );
1970 
1972  void readSldLabeling( const QDomNode& node );
1973 
1974  private: // Private attributes
1975 
1976  QgsConditionalLayerStyles * mConditionalStyles;
1977 
1979  QgsVectorDataProvider *mDataProvider;
1980 
1982  QString mDisplayExpression;
1983 
1984  QString mMapTipTemplate;
1985 
1987  QString mProviderKey;
1988 
1990  QgsActionManager* mActions;
1991 
1993  bool mReadOnly;
1994 
1999  QgsFeatureIds mSelectedFeatureIds;
2000 
2002  QgsFields mFields;
2003 
2005  QgsStringMap mAttributeAliasMap;
2006 
2008  QgsStringMap mDefaultExpressionMap;
2009 
2011  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2012 
2014  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2015 
2017  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2018 
2020  QgsEditFormConfig mEditFormConfig;
2021 
2023  QSet<QString> mExcludeAttributesWMS;
2024 
2026  QSet<QString> mExcludeAttributesWFS;
2027 
2029  QgsWkbTypes::Type mWkbType;
2030 
2032  QgsFeatureRenderer *mRenderer;
2033 
2035  QgsVectorSimplifyMethod mSimplifyMethod;
2036 
2038  QgsAbstractVectorLayerLabeling* mLabeling;
2039 
2041  bool mLabelFontNotFoundNotified;
2042 
2044  QPainter::CompositionMode mFeatureBlendMode;
2045 
2047  int mLayerTransparency;
2048 
2050  bool mVertexMarkerOnlyForSelection;
2051 
2052  QStringList mCommitErrors;
2053 
2055  QString mAnnotationForm;
2056 
2058  QgsGeometryCache* mCache;
2059 
2061  QgsVectorLayerEditBuffer* mEditBuffer;
2063 
2064  //stores information about joined layers
2065  QgsVectorLayerJoinBuffer* mJoinBuffer;
2066 
2068  QgsExpressionFieldBuffer* mExpressionFieldBuffer;
2069 
2070  //diagram rendering object. 0 if diagram drawing is disabled
2071  QgsDiagramRenderer* mDiagramRenderer;
2072 
2073  //stores infos about diagram placement (placement type, priority, position distance)
2074  QgsDiagramLayerSettings *mDiagramLayerSettings;
2075 
2076  mutable bool mValidExtent;
2077  mutable bool mLazyExtent;
2078 
2079  // Features in renderer classes counted
2080  bool mSymbolFeatureCounted;
2081 
2082  // Feature counts for each renderer legend key
2083  QHash<QString, long> mSymbolFeatureCountMap;
2084 
2086  bool mEditCommandActive;
2087 
2088  QgsFeatureIds mDeletedFids;
2089 
2090  QgsAttributeTableConfig mAttributeTableConfig;
2091 
2092  mutable QMutex mFeatureSourceConstructorMutex;
2093 
2095 };
2096 
2097 #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:353
static unsigned index
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Base class for all map layer types.
Definition: qgsmaplayer.h:49
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:343
QString targetFieldName
Join field in the target layer.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
Modify current selection to include only select features which match.
Constraint
Constraints which may be present on a field.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:355
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:360
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:290
VertexMarkerType
Editing vertex markers.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
Definition: qgsfields.h:36
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:78
const QSet< QString > & excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
Set selection, removing any existing selection.
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:135
QMap< QString, QString > QgsStringMap
Definition: qgis.h:328
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
const QSet< QString > & excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
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:40
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:71
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.
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:35
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsFeatureIterator getFeatures(const QString &expression)
Query the layer for features matching a given expression.
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:32
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:47
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.
A class to represent a point.
Definition: qgspoint.h:111
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:536
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsVectorLayerJoinBuffer * joinBuffer()
Acccessor 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) ...
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()...
SelectBehaviour
Selection behaviour.
Add selection to current selection.
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:350
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
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:32
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...
Remove from current selection.
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.