QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsvectorlayer.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  qgsvectorlayer.h - description
4  -------------------
5  begin : Oct 29, 2003
6  copyright : (C) 2003 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
21 
22 #include "qgis_core.h"
23 #include <QMap>
24 #include <QSet>
25 #include <QList>
26 #include <QStringList>
27 #include <QFont>
28 #include <QMutex>
29 
30 #include "qgis.h"
31 #include "qgsmaplayer.h"
32 #include "qgsfeature.h"
33 #include "qgsfeaturerequest.h"
34 #include "qgsfeaturesource.h"
35 #include "qgsfields.h"
36 #include "qgsvectordataprovider.h"
38 #include "qgseditformconfig.h"
40 #include "qgsaggregatecalculator.h"
41 #include "qgsfeatureiterator.h"
44 
45 class QPainter;
46 class QImage;
47 
49 class QgsActionManager;
51 class QgsCurve;
53 class QgsDiagramRenderer;
56 class QgsFeatureRenderer;
57 class QgsGeometry;
58 class QgsGeometryVertexIndex;
59 class QgsMapToPixel;
60 class QgsRectangle;
61 class QgsRectangle;
62 class QgsRelation;
63 class QgsRelationManager;
65 class QgsSymbol;
71 class QgsPoint;
72 class QgsFeedback;
75 
76 typedef QList<int> QgsAttributeList;
77 typedef QSet<int> QgsAttributeIds;
78 
79 
354 {
355  Q_OBJECT
356 
357  Q_PROPERTY( QString subsetString READ subsetString WRITE setSubsetString NOTIFY subsetStringChanged )
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  Q_PROPERTY( double opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
363 
364  public:
365 
368  {
369  Success = 0,
370  EmptyGeometry = 1,
371  EditFailed = 2,
372  FetchFeatureFailed = 3,
373  InvalidLayer = 4,
374  };
375 
378  {
383  };
384 
390  {
391 
395  explicit LayerOptions( bool loadDefaultStyle = true, bool readExtentFromXml = false )
396  : loadDefaultStyle( loadDefaultStyle )
397  , readExtentFromXml( readExtentFromXml )
398  {}
399 
401  bool loadDefaultStyle = true;
402 
407  bool readExtentFromXml = false;
408 
409  };
410 
424  explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
425  const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
426 
427 
428  ~QgsVectorLayer() override;
429 
431  QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
433  QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
434 
443  QgsVectorLayer *clone() const override SIP_FACTORY;
444 
449  QString storageType() const;
450 
454  QString capabilitiesString() const;
455 
459  QString dataComment() const;
460 
468  QString displayField() const;
469 
477  void setDisplayExpression( const QString &displayExpression );
478 
485  QString displayExpression() const;
486 
487  QgsVectorDataProvider *dataProvider() override;
488  const QgsVectorDataProvider *dataProvider() const override SIP_SKIP;
489 
491  void setProviderEncoding( const QString &encoding );
492 
494  void setCoordinateSystem();
495 
500  bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
501 
505  bool removeJoin( const QString &joinLayerId );
506 
511  QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
512  const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
513 
522  bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) override;
523 
531  QSet<QgsMapLayerDependency> dependencies() const override;
532 
543  int addExpressionField( const QString &exp, const QgsField &fld );
544 
552  void removeExpressionField( int index );
553 
563  QString expressionField( int index ) const;
564 
574  void updateExpressionField( int index, const QString &exp );
575 
582  QgsActionManager *actions() { return mActions; }
583 
589  const QgsActionManager *actions() const SIP_SKIP { return mActions; }
590 
596  int selectedFeatureCount() const;
597 
607  void selectByRect( QgsRectangle &rect, SelectBehavior behavior = SetSelection );
608 
618  void selectByExpression( const QString &expression, SelectBehavior behavior = SetSelection );
619 
630  void selectByIds( const QgsFeatureIds &ids, SelectBehavior behavior = SetSelection );
631 
643  void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
644 
646  void invertSelection();
647 
649  void selectAll();
650 
658  void invertSelectionInRectangle( QgsRectangle &rect );
659 
672  QgsFeatureList selectedFeatures() const;
673 
689  QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
690 
697  const QgsFeatureIds &selectedFeatureIds() const;
698 
700  QgsRectangle boundingBoxOfSelected() const;
701 
709  bool labelsEnabled() const;
710 
720  void setLabelsEnabled( bool enabled );
721 
727  bool diagramsEnabled() const;
728 
730  void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
731  const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
732 
733  void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
734  const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
735 
737  QgsFeatureRenderer *renderer() { return mRenderer; }
738 
743  const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
744 
749  void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
750 
752  QgsWkbTypes::GeometryType geometryType() const;
753 
755  QgsWkbTypes::Type wkbType() const override;
756 
758  QString providerType() const;
759 
760  QgsCoordinateReferenceSystem sourceCrs() const override;
761  QString sourceName() const override;
762 
767  bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) override;
768 
773  bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
774 
775  QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const override;
776  QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const override;
777 
782  void resolveReferences( QgsProject *project ) override;
783 
792  virtual void saveStyleToDatabase( const QString &name, const QString &description,
793  bool useAsDefault, const QString &uiFileContent,
794  QString &msgError SIP_OUT );
795 
805  virtual int listStylesInDatabase( QStringList &ids SIP_OUT, QStringList &names SIP_OUT,
806  QStringList &descriptions SIP_OUT, QString &msgError SIP_OUT );
807 
811  virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
812 
820  virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError SIP_OUT );
821 
828  virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT, bool loadFromLocalDb );
829 
834  QString loadNamedStyle( const QString &theURI, bool &resultFlag SIP_OUT ) override;
835 
849  bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
850 
860  void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
861 
867  QgsAuxiliaryLayer *auxiliaryLayer();
868 
874  const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
875 
883  bool readSymbology( const QDomNode &layerNode, QString &errorMessage, QgsReadWriteContext &context ) override;
884 
892  bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context ) override;
893 
902  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
903 
912  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const override;
913 
922  bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
923 
924  bool readSld( const QDomNode &node, QString &errorMessage ) override;
925 
931  long featureCount( const QString &legendKey ) const;
932 
944  Q_DECL_DEPRECATED void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false ) SIP_DEPRECATED;
945 
957  void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false );
958 
959  QString loadDefaultStyle( bool &resultFlag SIP_OUT ) override;
960 
973  QgsVectorLayerFeatureCounter *countSymbolFeatures();
974 
982  virtual bool setSubsetString( const QString &subset );
983 
988  virtual QString subsetString() const;
989 
995  QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
996 
1000  inline QgsFeatureIterator getFeatures( const QString &expression )
1001  {
1002  return getFeatures( QgsFeatureRequest( expression ) );
1003  }
1004 
1009  inline QgsFeature getFeature( QgsFeatureId fid ) const
1010  {
1011  QgsFeature feature;
1012  getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
1013  return feature;
1014  }
1015 
1020  {
1021  return getFeatures( QgsFeatureRequest( fids ) );
1022  }
1023 
1027  inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle )
1028  {
1029  return getFeatures( QgsFeatureRequest( rectangle ) );
1030  }
1031 
1032  bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override;
1033 
1059  bool updateFeature( const QgsFeature &feature, bool skipDefaultValues = false );
1060 
1071  bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1072 
1083  bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1084 
1095  bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1096 
1107  bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1108 
1119  EditResult deleteVertex( QgsFeatureId featureId, int vertex );
1120 
1125  bool deleteSelectedFeatures( int *deletedCount = nullptr );
1126 
1145  QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
1146 
1165  QgsGeometry::OperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1166 
1184  QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring );
1185 
1203  QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1204 
1212  QgsGeometry::OperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1213 
1225  int translateFeature( QgsFeatureId featureId, double dx, double dy );
1226 
1244  QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1245 
1263  QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
1264 
1275  int addTopologicalPoints( const QgsGeometry &geom );
1276 
1289  int addTopologicalPoints( const QgsPointXY &p );
1290 
1297  const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1298 
1305  QgsAbstractVectorLayerLabeling *labeling() { return mLabeling; }
1306 
1311  void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1312 
1314  bool isEditable() const override;
1315 
1317  bool isSpatial() const override;
1318 
1320  virtual bool isModified() const;
1321 
1328  bool isAuxiliaryField( int index, int &srcIndex ) const;
1329 
1331  void reload() override;
1332 
1337  QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
1338 
1339  QgsRectangle extent() const override;
1340  QgsRectangle sourceExtent() const override;
1341 
1348  inline QgsFields fields() const override { return mFields; }
1349 
1353  inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1354 
1358  QgsAttributeList primaryKeyAttributes() const;
1359 
1364  long featureCount() const override;
1365 
1370  bool setReadOnly( bool readonly = true );
1371 
1392  bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geometry, bool skipDefaultValue = false );
1393 
1424  bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false );
1425 
1461  bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false );
1462 
1472  bool addAttribute( const QgsField &field );
1473 
1479  void setFieldAlias( int index, const QString &aliasString );
1480 
1486  void removeFieldAlias( int index );
1487 
1498  bool renameAttribute( int index, const QString &newName );
1499 
1506  QString attributeAlias( int index ) const;
1507 
1509  QString attributeDisplayName( int index ) const;
1510 
1512  QgsStringMap attributeAliases() const;
1513 
1517  QSet<QString> excludeAttributesWms() const { return mExcludeAttributesWMS; }
1518 
1522  void setExcludeAttributesWms( const QSet<QString> &att ) { mExcludeAttributesWMS = att; }
1523 
1527  QSet<QString> excludeAttributesWfs() const { return mExcludeAttributesWFS; }
1528 
1532  void setExcludeAttributesWfs( const QSet<QString> &att ) { mExcludeAttributesWFS = att; }
1533 
1542  virtual bool deleteAttribute( int attr );
1543 
1551  bool deleteAttributes( const QList<int> &attrs );
1552 
1553  bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) override;
1554 
1563  bool deleteFeature( QgsFeatureId fid );
1564 
1577  bool deleteFeatures( const QgsFeatureIds &fids );
1578 
1599  bool commitChanges();
1600 
1606  QStringList commitErrors() const;
1607 
1617  bool rollBack( bool deleteBuffer = true );
1618 
1625  QList<QgsRelation> referencingRelations( int idx ) const;
1626 
1628  QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
1629 
1634  const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
1635 
1640  void beginEditCommand( const QString &text );
1641 
1643  void endEditCommand();
1644 
1646  void destroyEditCommand();
1647 
1650  {
1653  NoMarker
1654  };
1655 
1657  static void drawVertexMarker( double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize );
1658 
1667  void updateFields();
1668 
1683  QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
1684  QgsExpressionContext *context = nullptr ) const;
1685 
1697  void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
1698 
1709  QgsDefaultValue defaultValueDefinition( int index ) const;
1710 
1718  QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
1719 
1725  QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
1726 
1736 
1744  void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
1745 
1753  QString constraintExpression( int index ) const;
1754 
1762  QString constraintDescription( int index ) const;
1763 
1772  void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
1773 
1777  void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
1778 
1785  QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
1786 
1798  QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const override;
1799 
1813  QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
1814  QgsFeedback *feedback = nullptr ) const;
1815 
1824  QVariant minimumValue( int index ) const override;
1825 
1834  QVariant maximumValue( int index ) const override;
1835 
1846  QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
1847  const QString &fieldOrExpression,
1849  QgsExpressionContext *context = nullptr,
1850  bool *ok = nullptr ) const;
1851 
1853  void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1855  QPainter::CompositionMode featureBlendMode() const;
1856 
1864  void setOpacity( double opacity );
1865 
1873  double opacity() const;
1874 
1875  QString htmlMetadata() const override;
1876 
1881  void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod ) { mSimplifyMethod = simplifyMethod; }
1882 
1887  inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
1888 
1894  bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const;
1895 
1903  QgsConditionalLayerStyles *conditionalStyles() const;
1904 
1909  QgsAttributeTableConfig attributeTableConfig() const;
1910 
1915  void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
1916 
1924  QString mapTipTemplate() const;
1925 
1933  void setMapTipTemplate( const QString &mapTipTemplate );
1934 
1935  QgsExpressionContext createExpressionContext() const override;
1936 
1937  QgsExpressionContextScope *createExpressionContextScope() const override SIP_FACTORY;
1938 
1947  QgsEditFormConfig editFormConfig() const;
1948 
1955  void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
1956 
1964  void setReadExtentFromXml( bool readExtentFromXml );
1965 
1973  bool readExtentFromXml() const;
1974 
1980  bool isEditCommandActive() const { return mEditCommandActive; }
1981 
1982  public slots:
1983 
1991  void select( QgsFeatureId featureId );
1992 
2000  void select( const QgsFeatureIds &featureIds );
2001 
2009  void deselect( QgsFeatureId featureId );
2010 
2018  void deselect( const QgsFeatureIds &featureIds );
2019 
2025  void removeSelection();
2026 
2033  virtual void updateExtents( bool force = false );
2034 
2049  bool startEditing();
2050 
2051  signals:
2052 
2060  void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
2061 
2063  void layerModified();
2064 
2066  void beforeModifiedCheck() const;
2067 
2069  void beforeEditingStarted();
2070 
2072  void editingStarted();
2073 
2075  void editingStopped();
2076 
2078  void beforeCommitChanges();
2079 
2081  void beforeRollBack();
2082 
2091  void attributeAdded( int idx );
2092 
2099  void beforeAddingExpressionField( const QString &fieldName );
2100 
2109  void attributeDeleted( int idx );
2110 
2117  void beforeRemovingExpressionField( int idx );
2118 
2124  void featureAdded( QgsFeatureId fid );
2125 
2134  void featureDeleted( QgsFeatureId fid );
2135 
2145  void featuresDeleted( const QgsFeatureIds &fids );
2146 
2151  void updatedFields();
2152 
2157  void subsetStringChanged();
2158 
2167  void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
2168 
2176  void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
2177 
2179  void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2181  void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
2183  void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
2185  void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
2187  void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
2189  void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
2190 
2192  void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
2193 
2195  void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2196 
2204  void opacityChanged( double opacity );
2205 
2211  void editCommandStarted( const QString &text );
2212 
2218  void editCommandEnded();
2219 
2225  void editCommandDestroyed();
2226 
2236  void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2237 
2247  void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2248 
2254  void mapTipTemplateChanged();
2255 
2261  void displayExpressionChanged();
2262 
2266  void raiseError( const QString &msg );
2267 
2273  void editFormConfigChanged();
2274 
2281  void readOnlyChanged();
2282 
2288  void symbolFeatureCountMapChanged();
2289 
2290  private slots:
2291  void invalidateSymbolCountedFlag();
2292  void onFeatureCounterCompleted();
2293  void onFeatureCounterTerminated();
2294  void onJoinedFieldsChanged();
2295  void onFeatureDeleted( QgsFeatureId fid );
2296  void onRelationsLoaded();
2297  void onSymbolsCounted();
2298  void onDirtyTransaction( const QString &sql, const QString &name );
2299 
2300  protected:
2302  void setExtent( const QgsRectangle &rect ) override;
2303 
2304  private: // Private methods
2305 
2306  void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature() );
2307 
2311  bool isReadOnly() const override;
2312 
2318  bool setDataProvider( QString const &provider, const QgsDataProvider::ProviderOptions &options );
2319 
2321  void readSldLabeling( const QDomNode &node );
2322 
2324  QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2325 
2326 #ifdef SIP_RUN
2327  QgsVectorLayer( const QgsVectorLayer &rhs );
2328 #endif
2329 
2330  private: // Private attributes
2331  QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2332 
2334  QgsVectorDataProvider *mDataProvider = nullptr;
2335 
2337  QString mDisplayExpression;
2338 
2339  QString mMapTipTemplate;
2340 
2342  QString mProviderKey;
2343 
2345  QgsActionManager *mActions = nullptr;
2346 
2348  bool mReadOnly = false;
2349 
2355  QgsFeatureIds mSelectedFeatureIds;
2356 
2358  QgsFields mFields;
2359 
2361  QgsStringMap mAttributeAliasMap;
2362 
2364  QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2365 
2367  QSet<int> mDefaultValueOnUpdateFields;
2368 
2370  QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2371 
2373  QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2374 
2376  QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2377 
2378  QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2379 
2381  QgsEditFormConfig mEditFormConfig;
2382 
2384  QSet<QString> mExcludeAttributesWMS;
2385 
2387  QSet<QString> mExcludeAttributesWFS;
2388 
2391 
2393  QgsFeatureRenderer *mRenderer = nullptr;
2394 
2396  QgsVectorSimplifyMethod mSimplifyMethod;
2397 
2399  QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2400 
2402  bool mLabelsEnabled = false;
2403 
2405  bool mLabelFontNotFoundNotified = false;
2406 
2408  QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
2409 
2411  double mLayerOpacity = 1.0;
2412 
2414  bool mVertexMarkerOnlyForSelection = false;
2415 
2416  QStringList mCommitErrors;
2417 
2419  QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
2422 
2423  //stores information about joined layers
2424  QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
2425 
2427  QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
2428 
2429  //diagram rendering object. 0 if diagram drawing is disabled
2430  QgsDiagramRenderer *mDiagramRenderer = nullptr;
2431 
2432  //stores infos about diagram placement (placement type, priority, position distance)
2433  QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
2434 
2435  mutable bool mValidExtent = false;
2436  mutable bool mLazyExtent = true;
2437 
2439  std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
2440 
2442  QString mAuxiliaryLayerKey;
2443 
2444  // Features in renderer classes counted
2445  bool mSymbolFeatureCounted = false;
2446 
2447  // Feature counts for each renderer legend key
2448  QHash<QString, long> mSymbolFeatureCountMap;
2449 
2451  bool mEditCommandActive = false;
2452 
2453  bool mReadExtentFromXml;
2454  QgsRectangle mXmlExtent;
2455 
2456  QgsFeatureIds mDeletedFids;
2457 
2458  QgsAttributeTableConfig mAttributeTableConfig;
2459 
2460  mutable QMutex mFeatureSourceConstructorMutex;
2461 
2462  QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
2463 
2465 };
2466 
2467 
2468 
2469 // clazy:excludeall=qstring-allocations
2470 
2471 #endif
QgsActionManager * actions()
Returns all layer actions defined on this layer.
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
Definition: qgsfeature.h:537
A rectangle specified with double values.
Definition: qgsrectangle.h:40
Base class for all map layer types.
Definition: qgsmaplayer.h:61
void setExcludeAttributesWms(const QSet< QString > &att)
A set of attributes that are not advertised in WMS requests with QGIS server.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
The QgsDefaultValue class provides a container for managing client side default values for fields...
Constraint
Constraints which may be present on a field.
QSet< QString > excludeAttributesWfs() const
A set of attributes that are not advertised in WFS requests with QGIS server.
Setting options for loading vector layers.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
Class allowing to manage the auxiliary storage for a vector layer.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
Manages an editor widget Widget and wrapper share the same parent.
Counts the features in a QgsVectorLayer in task.
LayerOptions(bool loadDefaultStyle=true, bool readExtentFromXml=false)
Constructor for LayerOptions.
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsFeature getFeature(QgsFeatureId fid) const
Query the layer for the feature with the given id.
VertexMarkerType
Editing vertex markers.
An interface for objects which accept features via addFeature(s) methods.
QgsAbstractVectorLayerLabeling * labeling()
Access to labeling configuration.
Remove from current selection.
SimplifyHint
Simplification flags for fast rendering of features.
Class providing some utility methods to manage auxiliary storage.
Container of fields for a vector layer.
Definition: qgsfields.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:104
bool isEditCommandActive() const
Test if an edit command is active.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
QMap< QString, QString > QgsStringMap
Definition: qgis.h:501
OperationResult
Success or failure of a geometry operation.
Definition: qgsgeometry.h:113
Manages joined fields for a vector layer.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
void setExcludeAttributesWfs(const QSet< QString > &att)
A set of attributes that are not advertised in WFS requests with QGIS server.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
QgsFields fields() const override
Returns the list of fields of this layer.
#define SIP_SKIP
Definition: qgis_sip.h:119
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsFeatureIterator getFeatures(const QString &expression)
Query the layer for features matching a given expression.
Defines left outer join from our vector layer to some other vector layer.
QMap< int, QVariant > QgsAttributeMap
Definition: qgsattributes.h:39
#define SIP_TRANSFER
Definition: qgis_sip.h:36
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Reads and writes project states.
Definition: qgsproject.h:85
Storage and management of actions associated with a layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsFeatureRenderer * renderer()
Returns renderer.
Abstract base class for curved geometry type.
Definition: qgscurve.h:35
#define SIP_FACTORY
Definition: qgis_sip.h:69
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Add selection to current selection.
#define SIP_DEPRECATED
Definition: qgis_sip.h:99
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
const QgsDiagramRenderer * diagramRenderer() const
Abstract interface for generating an expression context.
Partial snapshot of vector layer&#39;s state (only the members necessary for access to features) ...
Set selection, removing any existing selection.
QgsFeatureIterator getFeatures(const QgsRectangle &rectangle)
Query the layer for the features which intersect the specified rectangle.
Stores the settings for rendering of all diagrams for a layer.
QVector< QgsPoint > QgsPointSequence
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:137
Modify current selection to include only select features which match.
SelectBehavior
Selection behavior.
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Setting options for creating vector data providers.
Buffers information about expression fields for a vector layer.
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
Definition: qgsfeature.h:528
Abstract interface for generating an expression context scope.
An interface for objects which provide features via a getFeatures method.
const QgsDiagramLayerSettings * diagramLayerSettings() const
ConstraintStrength
Strength of constraints.
Holder for the widget type and its configuration for a field.
This class manages a set of relations between layers.
#define SIP_OUT
Definition: qgis_sip.h:51
The QgsConditionalLayerStyles class holds conditional style information for a layer.
This class represents a coordinate reference system (CRS).
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
qint64 QgsFeatureId
Definition: qgsfeature.h:37
Base class for utility classes that encapsulate information necessary for rendering of map layers...
const QgsFeatureRenderer * renderer() const
Returns const renderer.
QSet< int > QgsAttributeIds
QList< int > QgsAttributeList
Definition: qgsfield.h:27
bool nextFeature(QgsFeature &f)
This is a container for configuration of the attribute table.
This is the base class for vector data providers.
QList< int > QgsAttributeList
const QgsActionManager * actions() const
Returns all layer actions defined on this layer.
Represents a vector layer which manages a vector based data sets.
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations.
EditResult
Result of an edit operation.
QgsFeatureIterator getFeatures(const QgsFeatureIds &fids)
Query the layer for the features with the given ids.
Constraint must be honored before feature can be accepted.
Abstract base class for simplify geometries using a specific algorithm.
Aggregate
Available aggregates to calculate.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74
A bundle of parameters controlling aggregate calculation.