QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
qgsvectorlayer.h
Go to the documentation of this file.
1
2/***************************************************************************
3 -------------------
4 begin : Oct 29, 2003
5 copyright : (C) 2003 by Gary E.Sherman
6 email : sherman at mrcc.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSVECTORLAYER_H
19#define QGSVECTORLAYER_H
20
21#include "qgis.h"
22#include "qgis_core.h"
26#include "qgseditformconfig.h"
30#include "qgsfeature.h"
31#include "qgsfeatureiterator.h"
32#include "qgsfeaturerequest.h"
33#include "qgsfeaturesource.h"
34#include "qgsfields.h"
35#include "qgsmaplayer.h"
39
40#include <QFont>
41#include <QList>
42#include <QMap>
43#include <QMutex>
44#include <QSet>
45#include <QString>
46#include <QStringList>
47
48using namespace Qt::StringLiterals;
49
50class QPainter;
51class QImage;
52
56class QgsCurve;
62class QgsGeometry;
63class QgsGeometryVertexIndex;
64class QgsMapToPixel;
65class QgsRectangle;
66class QgsRectangle;
67class QgsRelation;
68class QgsWeakRelation;
72class QgsSymbol;
79class QgsPoint;
80class QgsFeedback;
91
92#ifndef SIP_RUN
93template<class T> class QgsSettingsEntryEnumFlag;
94#endif
97
98
99typedef QList<int> QgsAttributeList;
100typedef QSet<int> QgsAttributeIds;
101
102// TODO QGIS 5: Remove virtual from non-inherited methods (like isModified)
103
407class CORE_EXPORT QgsVectorLayer : public QgsMapLayer,
410 public QgsFeatureSink,
411 public QgsFeatureSource,
413{
414 Q_OBJECT
415
416 Q_PROPERTY( QString subsetString READ subsetString WRITE setSubsetString NOTIFY subsetStringChanged )
419 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
421 Q_PROPERTY( QgsFields fields READ fields NOTIFY updatedFields )
422
423 public:
425
428 static const QgsSettingsEntryEnumFlag<Qgis::VectorSimplificationAlgorithm> *settingsSimplifyAlgorithm SIP_SKIP;
429 static const QgsSettingsEntryEnumFlag<Qgis::VectorRenderingSimplificationFlags> *settingsSimplifyDrawingHints SIP_SKIP;
430
537
542 struct CORE_EXPORT DeleteContext
543 {
547 explicit DeleteContext( bool cascade = false, QgsProject *project = nullptr )
548 : cascade( cascade )
549 , project( project )
550 {}
551
558 QList<QgsVectorLayer *> handledLayers( bool includeAuxiliaryLayers = true ) const;
559
563 QgsFeatureIds handledFeatures( QgsVectorLayer *layer ) const;
564
565 QMap<QgsVectorLayer *, QgsFeatureIds> mHandledFeatures SIP_SKIP;
568 };
569
583 explicit QgsVectorLayer(
584 const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions()
585 );
586
587 ~QgsVectorLayer() override;
588
589 QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
590 QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
591
592#ifdef SIP_RUN
593 // clang-format off
594 SIP_PYOBJECT __repr__();
595 % MethodCode
596 QString str = u"<QgsVectorLayer: '%1' (%2)>"_s.arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : u"Invalid"_s );
597 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
598 % End
599// clang-format on
600#endif
601
609 QgsVectorLayer *clone() const override SIP_FACTORY;
610
615 QString storageType() const;
616
620 QString capabilitiesString() const;
621
622
632 bool isSqlQuery() const;
633
640 Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
641
642
646 QString dataComment() const;
647
655 QString displayField() const;
656
664 void setDisplayExpression( const QString &displayExpression );
665
672 QString displayExpression() const;
673
674 bool hasMapTips() const final;
675
677 const QgsVectorDataProvider *dataProvider() const final SIP_SKIP;
681 QgsAbstractProfileSource *profileSource() override { return this; }
682 QString profileSourceId() const override { return id(); }
683 QString profileSourceName() const override { return name(); }
685
696 void setProviderEncoding( const QString &encoding );
697
699 void setCoordinateSystem();
700
706 bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
707
712 bool removeJoin( const QString &joinLayerId );
713
717 QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
718
723 const QgsVectorLayerJoinBuffer *joinBuffer() const { return mJoinBuffer; }
724 SIP_SKIP;
725
726 const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
727
735 bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) final;
736
743 QSet<QgsMapLayerDependency> dependencies() const final;
744
754 int addExpressionField( const QString &exp, const QgsField &fld );
755
762 void removeExpressionField( int index );
763
772 QString expressionField( int index ) const;
773
782 void updateExpressionField( int index, const QString &exp );
783
790 QgsActionManager *actions() { return mActions; }
791
797 const QgsActionManager *actions() const SIP_SKIP { return mActions; }
798
804 int selectedFeatureCount() const;
805
815 Q_INVOKABLE void selectByRect( const QgsRectangle &rect, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
816
826 Q_INVOKABLE void selectByExpression( const QString &expression, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, QgsExpressionContext *context = nullptr );
827
840 Q_INVOKABLE void selectByIds( const QgsFeatureIds &ids, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, bool validateIds = false );
841
853 Q_INVOKABLE void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
854
856 Q_INVOKABLE void invertSelection();
857
859 Q_INVOKABLE void selectAll();
860
868 Q_INVOKABLE void invertSelectionInRectangle( const QgsRectangle &rect );
869
882 Q_INVOKABLE QgsFeatureList selectedFeatures() const;
883
899 QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
900
908 Q_INVOKABLE const QgsFeatureIds &selectedFeatureIds() const;
909
911 Q_INVOKABLE QgsRectangle boundingBoxOfSelected() const;
912
919 bool labelsEnabled() const;
920
930 void setLabelsEnabled( bool enabled );
931
936 bool diagramsEnabled() const;
937
939 void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
940 const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
941
942 void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
943 const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
944
951 QgsFeatureRenderer *renderer() { return mRenderer; }
952
960 const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
961
968 void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
969
979 void addFeatureRendererGenerator( QgsFeatureRendererGenerator *generator SIP_TRANSFER );
980
990 void removeFeatureRendererGenerator( const QString &id );
991
999 QList< const QgsFeatureRendererGenerator * > featureRendererGenerators() const;
1000
1002 Q_INVOKABLE Qgis::GeometryType geometryType() const;
1003
1005 Q_INVOKABLE Qgis::WkbType wkbType() const final;
1006
1007 QgsCoordinateReferenceSystem sourceCrs() const final;
1008 QString sourceName() const final;
1009
1014 bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) final;
1015
1020 bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const final;
1021
1022 QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const final;
1023 QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const final;
1024
1028 void resolveReferences( QgsProject *project ) final;
1029
1042 bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
1043
1052 void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
1053
1058 QgsAuxiliaryLayer *auxiliaryLayer();
1059
1064 const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
1065
1066 bool readSymbology( const QDomNode &layerNode, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1067 bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1068 bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1069 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1070
1080 Q_DECL_DEPRECATED bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props = QVariantMap() ) const SIP_DEPRECATED;
1081
1090 bool writeSld( QDomNode &node, QDomDocument &doc, QgsSldExportContext &context ) const;
1091
1092 bool readSld( const QDomNode &node, QString &errorMessage ) final;
1093
1099 long long featureCount( const QString &legendKey ) const;
1100
1107 QgsFeatureIds symbolFeatureIds( const QString &legendKey ) const;
1108
1119 Qgis::FeatureAvailability hasFeatures() const final;
1120
1121 QString loadDefaultStyle( bool &resultFlag SIP_OUT ) final;
1122
1135 QgsVectorLayerFeatureCounter *countSymbolFeatures( bool storeSymbolFids = false );
1136
1144 virtual bool setSubsetString( const QString &subset );
1145
1150 virtual QString subsetString() const;
1151
1157 QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const final;
1158
1162 inline QgsFeatureIterator getFeatures( const QString &expression ) { return getFeatures( QgsFeatureRequest( expression ) ); }
1163
1168 Q_INVOKABLE inline QgsFeature getFeature( QgsFeatureId fid ) const
1169 {
1170 QgsFeature feature;
1171 getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
1172 return feature;
1173 }
1174
1179 QgsGeometry getGeometry( QgsFeatureId fid ) const;
1180
1184 inline QgsFeatureIterator getFeatures( const QgsFeatureIds &fids ) { return getFeatures( QgsFeatureRequest( fids ) ); }
1185
1189 inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle ) { return getFeatures( QgsFeatureRequest( rectangle ) ); }
1190
1191 bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
1192
1218 bool updateFeature( QgsFeature &feature, bool skipDefaultValues = false );
1219
1231 bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1232
1244 bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1245
1256 bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1257
1268 bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1269
1279 Qgis::VectorEditResult deleteVertex( QgsFeatureId featureId, int vertex );
1280
1288 Q_INVOKABLE bool deleteSelectedFeatures( int *deletedCount = nullptr, QgsVectorLayer::DeleteContext *context = nullptr );
1289
1310 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr ) SIP_DEPRECATED;
1311
1312
1332 Q_INVOKABLE Qgis::GeometryOperationResult addRing( const QgsPointSequence &ring, QgsFeatureId *featureId = nullptr );
1333
1354 Q_INVOKABLE Qgis::GeometryOperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1355
1375 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart( const QList<QgsPointXY> &ring ) SIP_DEPRECATED;
1376
1396 Q_INVOKABLE Qgis::GeometryOperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1397
1408 Q_INVOKABLE Qgis::GeometryOperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1409
1421 Q_INVOKABLE int translateFeature( QgsFeatureId featureId, double dx, double dy );
1422
1443 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1444
1464 Q_INVOKABLE Qgis::GeometryOperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1465
1486 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1487
1507 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1508
1531 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsCurve *curve, QgsPointSequence &topologyTestPoints SIP_OUT, bool preserveCircular = false, bool topologicalEditing = false );
1532
1546 int addTopologicalPoints( const QgsGeometry &geom );
1547
1564 Q_DECL_DEPRECATED int addTopologicalPoints( const QgsPointXY &p ) SIP_DEPRECATED;
1565
1582 int addTopologicalPoints( const QgsPoint &p );
1583
1600 int addTopologicalPoints( const QgsPointSequence &ps );
1601
1607 const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1608
1615
1619 void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1620
1622 bool isEditable() const final;
1623
1625 bool isSpatial() const final;
1626
1628 bool isModified() const override;
1629
1635 bool isAuxiliaryField( int index, int &srcIndex ) const;
1636
1638 void reload() final;
1639
1643 QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) final SIP_FACTORY;
1644
1645 QgsRectangle extent() const final;
1646 QgsRectangle sourceExtent() const final;
1647
1648 QgsBox3D extent3D() const final;
1649 QgsBox3D sourceExtent3D() const final;
1650
1657 QgsFields fields() const final;
1658
1662 Q_INVOKABLE inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1663
1667 QgsAttributeList primaryKeyAttributes() const;
1668
1674 long long featureCount() const final;
1675
1682 bool setReadOnly( bool readonly = true );
1683
1689 Q_INVOKABLE bool supportsEditing() const override;
1690
1711 bool changeGeometry( QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue = false );
1712
1745 Q_INVOKABLE bool changeAttributeValue(
1746 QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr
1747 );
1748
1785 Q_INVOKABLE bool changeAttributeValues(
1786 QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr
1787 );
1788
1798 Q_INVOKABLE bool addAttribute( const QgsField &field );
1799
1804 Q_INVOKABLE void setFieldAlias( int index, const QString &aliasString );
1805
1810 Q_INVOKABLE void removeFieldAlias( int index );
1811
1818 Q_INVOKABLE void setFieldCustomComment( int index, const QString &customCommentString );
1819
1825 Q_INVOKABLE void removeFieldCustomComment( int index );
1826
1832 Q_INVOKABLE QString attributeCustomComment( int index ) const;
1833
1839 QgsStringMap attributeCustomComments() const;
1840
1850 Q_INVOKABLE bool renameAttribute( int index, const QString &newName );
1851
1858 Q_INVOKABLE QString attributeAlias( int index ) const;
1859
1861 Q_INVOKABLE QString attributeDisplayName( int index ) const;
1862
1864 QgsStringMap attributeAliases() const;
1865
1866#ifndef SIP_RUN
1867
1873 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1874
1880 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1881
1887 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1888#else
1889 // clang-format off
1890
1897 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1898
1899 % MethodCode
1900 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1901 {
1902 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1903 sipIsErr = 1;
1904 }
1905 else
1906 {
1907 sipCpp->setFieldSplitPolicy( a0, a1 );
1908 }
1909 % End
1910
1917 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1918
1919 % MethodCode
1920 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1921 {
1922 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1923 sipIsErr = 1;
1924 }
1925 else
1926 {
1927 sipCpp->setFieldDuplicatePolicy( a0, a1 );
1928 }
1929 % End
1930
1937 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1938
1939 % MethodCode
1940 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1941 {
1942 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1943 sipIsErr = 1;
1944 }
1945 else
1946 {
1947 sipCpp->setFieldMergePolicy( a0, a1 );
1948 }
1949 % End
1950// clang-format on
1951#endif
1952
1957 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWms() const SIP_DEPRECATED;
1958
1963 Q_DECL_DEPRECATED void setExcludeAttributesWms( const QSet<QString> &att ) SIP_DEPRECATED;
1964
1969 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWfs() const SIP_DEPRECATED;
1970
1975 Q_DECL_DEPRECATED void setExcludeAttributesWfs( const QSet<QString> &att ) SIP_DEPRECATED;
1976
1985 Q_INVOKABLE virtual bool deleteAttribute( int attr );
1986
1994 Q_INVOKABLE bool deleteAttributes( const QList<int> &attrs );
1995
1996 using QgsFeatureSink::addFeatures;
1997 bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
1998
2009 Q_INVOKABLE bool deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteContext *context = nullptr );
2010
2024 Q_INVOKABLE bool deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context = nullptr );
2025
2049 Q_INVOKABLE bool commitChanges( bool stopEditing = true );
2050
2056 QStringList commitErrors() const;
2057
2067 Q_INVOKABLE bool rollBack( bool deleteBuffer = true );
2068
2075 QList<QgsRelation> referencingRelations( int idx ) const;
2076
2086 QList<QgsWeakRelation> weakRelations() const SIP_SKIP;
2087
2096 void setWeakRelations( const QList< QgsWeakRelation > &relations ) SIP_SKIP;
2097
2099 Q_INVOKABLE QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
2100
2105 const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
2106
2111 void beginEditCommand( const QString &text );
2112
2114 void endEditCommand();
2115
2117 void destroyEditCommand();
2118
2123 Q_DECL_DEPRECATED static void drawVertexMarker( double x, double y, QPainter &p, Qgis::VertexMarkerType type, int vertexSize );
2124
2133 void updateFields();
2134
2148 QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(), QgsExpressionContext *context = nullptr ) const;
2149
2160 void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
2161
2171 QgsDefaultValue defaultValueDefinition( int index ) const;
2172
2179 QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
2180
2185 QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
2186
2195
2202 void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
2203
2210 QString constraintExpression( int index ) const;
2211
2218 QString constraintDescription( int index ) const;
2219
2227 void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
2228
2234 void setFieldConfigurationFlags( int index, Qgis::FieldConfigurationFlags flags );
2235
2240 void setFieldConfigurationFlag( int index, Qgis::FieldConfigurationFlag flag, bool active );
2241
2247 Qgis::FieldConfigurationFlags fieldConfigurationFlags( int index ) const;
2248
2257 void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
2258
2267 QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
2268
2280 Q_INVOKABLE QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const final;
2281
2295 QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1, QgsFeedback *feedback = nullptr ) const;
2296
2311 Q_INVOKABLE QVariant minimumValue( int index ) const final;
2312
2327 Q_INVOKABLE QVariant maximumValue( int index ) const final;
2328
2329
2349 void minimumAndMaximumValue( int index, QVariant &minimum SIP_OUT, QVariant &maximum SIP_OUT ) const;
2350
2364 QVariant aggregate(
2365 Qgis::Aggregate aggregate,
2366 const QString &fieldOrExpression,
2367 const QgsAggregateCalculator::AggregateParameters &parameters = QgsAggregateCalculator::AggregateParameters(),
2368 QgsExpressionContext *context = nullptr,
2369 bool *ok = nullptr,
2370 QgsFeatureIds *fids = nullptr,
2371 QgsFeedback *feedback = nullptr,
2372 QString *error SIP_PYARGREMOVE = nullptr
2373 ) const;
2374
2376 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
2378 QPainter::CompositionMode featureBlendMode() const;
2379
2380 QString htmlMetadata() const final;
2381
2386
2390 inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
2391
2396 bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, Qgis::VectorRenderingSimplificationFlag simplifyHint ) const;
2397
2404 QgsConditionalLayerStyles *conditionalStyles() const;
2405
2410 QgsAttributeTableConfig attributeTableConfig() const;
2411
2416 void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
2417
2419
2420 QgsExpressionContextScope *createExpressionContextScope() const final SIP_FACTORY;
2421
2428 QgsEditFormConfig editFormConfig() const;
2429
2435 void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
2436
2443 void setReadExtentFromXml( bool readExtentFromXml );
2444
2451 bool readExtentFromXml() const;
2452
2457 bool isEditCommandActive() const { return mEditCommandActive; }
2458
2464 QgsGeometryOptions *geometryOptions() const;
2465
2483 bool allowCommit() const SIP_SKIP;
2484
2502 void setAllowCommit( bool allowCommit ) SIP_SKIP;
2503
2509 QgsStoredExpressionManager *storedExpressionManager() { return mStoredExpressionManager; }
2510
2511 public slots:
2512
2520 void select( QgsFeatureId featureId );
2521
2529 Q_INVOKABLE void select( const QgsFeatureIds &featureIds );
2530
2538 void deselect( QgsFeatureId featureId );
2539
2547 Q_INVOKABLE void deselect( const QgsFeatureIds &featureIds );
2548
2555 Q_INVOKABLE void removeSelection();
2556
2567 void reselect();
2568
2575 virtual void updateExtents( bool force = false );
2576
2591 Q_INVOKABLE bool startEditing();
2592
2598 void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;
2599
2601
2602 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
2603
2604 bool accept( QgsObjectEntityVisitorInterface *visitor, const QgsObjectVisitorContext &context ) const override;
2605
2606 signals:
2607
2615 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
2616
2623
2626
2629
2635 void beforeCommitChanges( bool stopEditing );
2636
2639
2645
2651
2660 void attributeAdded( int idx );
2661
2668 void beforeAddingExpressionField( const QString &fieldName );
2669
2678 void attributeDeleted( int idx );
2679
2687
2694
2704
2714 void featuresDeleted( const QgsFeatureIds &fids );
2715
2721
2727
2736 void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
2737
2745 void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
2746
2748 void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2750 void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
2752 void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
2754 void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
2756 void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
2758 void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
2759
2761 void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
2762
2764 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2765
2771 void editCommandStarted( const QString &text );
2772
2779
2786
2796 void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2797
2807 void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2808
2814
2818 void raiseError( const QString &msg );
2819
2825
2834
2841
2847
2848 protected:
2850 void setExtent( const QgsRectangle &rect ) final;
2852 void setExtent3D( const QgsBox3D &rect ) final;
2853
2854 private slots:
2855 void invalidateSymbolCountedFlag();
2856 void onFeatureCounterCompleted();
2857 void onFeatureCounterTerminated();
2858 void onJoinedFieldsChanged();
2859 void onFeatureAdded( QgsFeatureId fid );
2860 void onFeatureDeleted( QgsFeatureId fid );
2861 void onRelationsLoaded();
2862 void onSymbolsCounted();
2863 void onDirtyTransaction( const QString &sql, const QString &name );
2864 void onDependencyAfterCommitChanges();
2865 void emitDataChanged();
2866
2867 private:
2868 void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature(), QgsExpressionContext *context = nullptr );
2869
2879 bool isReadOnly() const final;
2880
2887 bool setDataProvider( QString const &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() );
2888
2900 void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags ) override;
2901
2903 void readSldLabeling( const QDomNode &node );
2904
2906 bool readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSettings &settings ) const;
2907
2909 QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2910
2911 bool deleteFeatureCascade( QgsFeatureId fid, DeleteContext *context = nullptr );
2912
2913#ifdef SIP_RUN
2914 QgsVectorLayer( const QgsVectorLayer &rhs );
2915#endif
2917 void minimumOrMaximumValue( int index, QVariant *minimum, QVariant *maximum ) const;
2918
2919 void createEditBuffer();
2920 void clearEditBuffer();
2921
2922 QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2923 QgsVectorDataProvider *mDataProvider = nullptr;
2924 QgsVectorLayerSelectionProperties *mSelectionProperties = nullptr;
2925 QgsVectorLayerTemporalProperties *mTemporalProperties = nullptr;
2926 QgsVectorLayerElevationProperties *mElevationProperties = nullptr;
2927
2929 QString mDisplayExpression;
2930
2932 QgsActionManager *mActions = nullptr;
2933
2935 bool mDataSourceReadOnly = false;
2936
2943 bool mReadOnly = false;
2944
2950 QgsFeatureIds mSelectedFeatureIds;
2951
2955 QgsFeatureIds mPreviousSelectedFeatureIds;
2956
2958 QgsFields mFields;
2959
2961 QgsStringMap mAttributeAliasMap;
2962
2964 QgsStringMap mAttributeCustomCommentMap;
2965
2967 QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2968
2970 QMap< QString, Qgis::FieldDomainSplitPolicy > mAttributeSplitPolicy;
2971
2973 QMap< QString, Qgis::FieldDuplicatePolicy > mAttributeDuplicatePolicy;
2974
2976 QMap< QString, Qgis::FieldDomainMergePolicy > mAttributeMergePolicy;
2977
2979 QSet<int> mDefaultValueOnUpdateFields;
2980
2982 QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2983
2985 QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2986
2988 QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2989
2990 QMap< QString, Qgis::FieldConfigurationFlags > mFieldConfigurationFlags;
2991 QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2992
2994 QgsEditFormConfig mEditFormConfig;
2995
2998
3000 QgsFeatureRenderer *mRenderer = nullptr;
3001
3003 QgsVectorSimplifyMethod mSimplifyMethod;
3004
3006 QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
3007
3009 bool mLabelsEnabled = false;
3010
3012 bool mLabelFontNotFoundNotified = false;
3013
3015 QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
3016
3018 bool mVertexMarkerOnlyForSelection = false;
3019
3020 QStringList mCommitErrors;
3021
3023 QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
3027
3028 //stores information about joined layers
3029 QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
3030
3032 QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
3033
3034 //diagram rendering object. 0 if diagram drawing is disabled
3035 QgsDiagramRenderer *mDiagramRenderer = nullptr;
3036
3037 //stores infos about diagram placement (placement type, priority, position distance)
3038 QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
3039
3040 mutable bool mValidExtent2D = false;
3041 mutable bool mLazyExtent2D = true;
3042 mutable bool mValidExtent3D = false;
3043 mutable bool mLazyExtent3D = true;
3044
3046 std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
3047
3049 QString mAuxiliaryLayerKey;
3050
3051 // Features in renderer classes counted
3052 bool mSymbolFeatureCounted = false;
3053
3054 // Feature counts for each renderer legend key
3055 QHash<QString, long long> mSymbolFeatureCountMap;
3056 QHash<QString, QgsFeatureIds> mSymbolFeatureIdMap;
3057
3059 bool mEditCommandActive = false;
3060
3062 bool mCommitChangesActive = false;
3063
3064 bool mReadExtentFromXml;
3065 QgsRectangle mXmlExtent2D;
3066 QgsBox3D mXmlExtent3D;
3067
3068 QgsFeatureIds mDeletedFids;
3069
3070 QgsAttributeTableConfig mAttributeTableConfig;
3071
3072 mutable QMutex mFeatureSourceConstructorMutex;
3073
3074 QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
3075
3076 std::unique_ptr<QgsGeometryOptions> mGeometryOptions;
3077
3078 bool mAllowCommit = true;
3079
3081 QgsStoredExpressionManager *mStoredExpressionManager = nullptr;
3082
3084
3086 bool mDataChangedFired = false;
3087
3088 QList<QgsWeakRelation> mWeakRelations;
3089
3090 bool mSetLegendFromStyle = false;
3091
3092 QList< QgsFeatureRendererGenerator * > mRendererGenerators;
3093
3095 QTimer *mRefreshRendererTimer = nullptr;
3096
3100 bool mLoadAllStoredStyle = false;
3101};
3102
3103
3104// clazy:excludeall=qstring-allocations
3105
3106#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
SpatialIndexPresence
Enumeration of spatial index presence states.
Definition qgis.h:585
VectorRenderingSimplificationFlag
Simplification flags for vector feature rendering.
Definition qgis.h:3197
FieldDomainMergePolicy
Merge policy for field domains.
Definition qgis.h:4107
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:4090
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:379
FieldDuplicatePolicy
Duplicate policy for fields.
Definition qgis.h:4127
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition qgis.h:1953
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:294
@ Unknown
Unknown.
Definition qgis.h:295
FieldConfigurationFlag
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1841
QFlags< FieldConfigurationFlag > FieldConfigurationFlags
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1856
SelectBehavior
Specifies how a selection should be applied.
Definition qgis.h:1891
@ SetSelection
Set selection, removing any existing selection.
Definition qgis.h:1892
Abstract base class for simplifying geometries using a specific algorithm.
Abstract base class for objects which generate elevation profiles.
Interface for classes which can generate elevation profiles.
virtual QgsAbstractProfileGenerator * createProfileGenerator(const QgsProfileRequest &request)=0
Given a profile request, returns a new profile generator ready for generating elevation profiles.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Storage and management of actions associated with a layer.
Utility class for calculating aggregates for a field (or expression) over the features from a vector ...
A container for configuration of the attribute table.
Allows managing the auxiliary storage for a vector layer.
Providing some utility methods to manage auxiliary storage.
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:45
Holds conditional style information for a layer.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Abstract base class for curved geometry type.
Definition qgscurve.h:36
Abstract base class for spatial data provider implementations.
Provides a container for managing client side default values for fields.
Stores the settings for rendering of all diagrams for a layer.
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
Contains configuration settings for an editor form.
Holder for the widget type and its configuration for a field.
Manages an editor widget.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Abstract interface for generating an expression context scope.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Buffers information about expression fields for a vector layer.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
An interface for objects which generate feature renderers for vector layers.
Abstract base class for all 2D vector feature renderers.
Wraps a request for features to a vector layer (or directly its vector data provider).
An interface for objects which accept features via addFeature(s) methods.
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
QFlags< Flag > Flags
An interface for objects which provide features via a getFeatures method.
virtual QSet< QVariant > uniqueValues(int fieldIndex, int limit=-1) const
Returns the set of unique values contained within the specified fieldIndex from this source.
virtual Qgis::WkbType wkbType() const =0
Returns the geometry type for features returned by this source.
virtual Qgis::SpatialIndexPresence hasSpatialIndex() const
Returns an enum value representing the presence of a valid spatial index on the source,...
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
virtual long long featureCount() const =0
Returns the number of features contained in the source, or -1 if the feature count is unknown.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
ConstraintStrength
Strength of constraints.
@ ConstraintStrengthHard
Constraint must be honored before feature can be accepted.
Constraint
Constraints which may be present on a field.
QFlags< Constraint > Constraints
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:56
Container of fields for a vector layer.
Definition qgsfields.h:46
Contains options to automatically adjust geometries to constraints on a layer.
A geometry is the spatial representation of a feature.
Base class for storage of map layer elevation properties.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Base class for storage of map layer selection properties.
Base class for storage of map layer temporal properties.
Base class for all map layer types.
Definition qgsmaplayer.h:83
QString name
Definition qgsmaplayer.h:87
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the layer.
virtual bool setDependencies(const QSet< QgsMapLayerDependency > &layers)
Sets the list of dependencies.
virtual void setExtent3D(const QgsBox3D &box)
Sets the extent.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of dependencies.
friend class QgsVectorLayer
QString id
Definition qgsmaplayer.h:86
QgsMapLayer(Qgis::LayerType type=Qgis::LayerType::Vector, const QString &name=QString(), const QString &source=QString())
Constructor for QgsMapLayer.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
virtual bool isEditable() const
Returns true if the layer can be edited.
QgsMapLayer::LayerFlags flags
Definition qgsmaplayer.h:99
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)=0
Sets the coordinate transform context to transformContext.
Perform transforms between map coordinates and device coordinates.
An interface for classes which can visit various object entity (e.g.
A QgsObjectEntityVisitorInterface context object.
Contains settings for how a map layer will be labeled.
Represents a 2D point.
Definition qgspointxy.h:62
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:114
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
Manages a set of relations between layers.
Represents a relationship between two vector layers.
Definition qgsrelation.h:42
Contains information about the context of a rendering operation.
A boolean settings entry.
A double settings entry.
A template class for enum and flag settings entry.
A feature renderer which renders all features with the same symbol.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
Manages stored expressions regarding creation, modification and storing in the project.
An interface for classes which can visit style entity (e.g.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
Base class for vector data providers.
Stores queued vector layer edit operations prior to committing changes to the layer's data provider.
Vector layer specific subclass of QgsMapLayerElevationProperties.
Counts the features in a QgsVectorLayer in task.
Manages joined fields for a vector layer.
Defines left outer join from our vector layer to some other vector layer.
Implementation of layer selection properties for vector layers.
Implementation of map layer temporal properties for vector layers.
Contains settings which reflect the context in which vector layer tool operations should be considere...
Represents a vector layer which manages a vector based dataset.
void committedFeaturesAdded(const QString &layerId, const QgsFeatureList &addedFeatures)
Emitted when features are added to the provider if not in transaction mode.
static const QgsSettingsEntryEnumFlag< Qgis::VectorRenderingSimplificationFlags > * settingsSimplifyDrawingHints
void labelingFontNotFound(QgsVectorLayer *layer, const QString &fontfamily)
Emitted when the font family defined for labeling layer is not found on system.
void featureBlendModeChanged(QPainter::CompositionMode blendMode)
Signal emitted when setFeatureBlendMode() is called.
Q_INVOKABLE QgsAttributeList attributeList() const
Returns list of attribute indexes.
void beforeRemovingExpressionField(int idx)
Will be emitted, when an expression field is going to be deleted from this vector layer.
void committedGeometriesChanges(const QString &layerId, const QgsGeometryMap &changedGeometries)
Emitted when geometry changes are saved to the provider if not in transaction mode.
void beforeCommitChanges(bool stopEditing)
Emitted before changes are committed to the data provider.
QgsVectorLayer(const QString &path=QString(), const QString &baseName=QString(), const QString &providerLib="ogr", const QgsVectorLayer::LayerOptions &options=QgsVectorLayer::LayerOptions())
Constructor - creates a vector layer.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
void attributeAdded(int idx)
Will be emitted, when a new attribute has been added to this vector layer.
QString capabilitiesString() const
Capabilities for this layer, comma separated and translated.
QgsAbstractVectorLayerLabeling * labeling()
Access to labeling configuration.
void allowCommitChanged()
Emitted whenever the allowCommit() property of this layer changes.
friend class QgsVectorLayerEditBuffer
void editCommandStarted(const QString &text)
Signal emitted when a new edit command has been started.
const QgsDiagramLayerSettings * diagramLayerSettings() const
const QgsVectorLayerJoinBuffer * joinBuffer() const
Returns a const pointer on join buffer object.
friend class QgsVectorLayerEditPassthrough
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Sets the simplification settings for fast rendering of features.
void editCommandDestroyed()
Signal emitted, when an edit command is destroyed.
static const QgsSettingsEntryEnumFlag< Qgis::VectorSimplificationAlgorithm > * settingsSimplifyAlgorithm
QgsVectorLayer(const QgsVectorLayer &rhs)=delete
QgsFeatureIterator getFeatures(const QString &expression)
Queries the layer for features matching a given expression.
void featuresDeleted(const QgsFeatureIds &fids)
Emitted when features have been deleted.
Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const
Returns the vector layer type flags.
void subsetStringChanged()
Emitted when the layer's subset string has changed.
void committedFeaturesRemoved(const QString &layerId, const QgsFeatureIds &deletedFeatureIds)
Emitted when features are deleted from the provider if not in transaction mode.
static const QgsSettingsEntryDouble * settingsSimplifyMaxScale
bool hasMapTips() const final
Returns true if the layer contains map tips.
QgsStoredExpressionManager * storedExpressionManager()
Returns the manager of the stored expressions for this layer.
void symbolFeatureCountMapChanged()
Emitted when the feature count for symbols on this layer has been recalculated.
bool isEditCommandActive() const
Tests if an edit command is active.
void writeCustomSymbology(QDomElement &element, QDomDocument &doc, QString &errorMessage) const
Signal emitted whenever the symbology (QML-file) for this layer is being written.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
void setDisplayExpression(const QString &displayExpression)
Set the preview expression, used to create a human readable preview string.
static const QgsSettingsEntryBool * settingsSimplifyLocal
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
QString dataComment() const
Returns a description for this layer as defined in the data provider.
void attributeDeleted(int idx)
Will be emitted, when an attribute has been deleted from this vector layer.
QgsVectorLayer & operator=(QgsVectorLayer const &rhs)=delete
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
void beforeEditingStarted()
Emitted before editing on this layer is started.
void committedAttributeValuesChanges(const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues)
Emitted when attribute value changes are saved to the provider if not in transaction mode.
void committedAttributesAdded(const QString &layerId, const QList< QgsField > &addedAttributes)
Emitted when attributes are added to the provider if not in transaction mode.
Q_INVOKABLE QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on.
void setEditFormConfig(const QgsEditFormConfig &editFormConfig)
Sets the editFormConfig (configuration) of the form used to represent this vector layer.
void committedAttributesDeleted(const QString &layerId, const QgsAttributeList &deletedAttributes)
Emitted when attributes are deleted from the provider if not in transaction mode.
QString displayExpression
void displayExpressionChanged()
Emitted when the display expression changes.
QString profileSourceId() const override
Returns a unique identifier for this profile source.
const QgsActionManager * actions() const
Returns all layer actions defined on this layer.
bool setReadOnly(bool readonly=true)
Makes layer read-only (editing disabled) or not.
void editFormConfigChanged()
Will be emitted whenever the edit form configuration of this layer changes.
QgsVectorLayerJoinBuffer * joinBuffer()
Returns the join buffer object.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const final
Queries the layer for features specified in request.
void afterCommitChanges()
Emitted after changes are committed to the data provider.
QgsActionManager * actions()
Returns all layer actions defined on this layer.
void raiseError(const QString &msg)
Signals an error related to this vector layer.
void editCommandEnded()
Signal emitted, when an edit command successfully ended.
void supportsEditingChanged()
Emitted when the read only state or the data provider of this layer is changed.
void readOnlyChanged()
Emitted when the read only state of this layer is changed.
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &value)
Emitted whenever an attribute value change is done in the edit buffer.
QgsFeatureIterator getFeatures(const QgsFeatureIds &fids)
Queries the layer for the features with the given ids.
friend class QgsVectorLayerFeatureSource
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
void afterRollBack()
Emitted after changes are rolled back.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect)
Emitted when selection was changed.
void beforeAddingExpressionField(const QString &fieldName)
Will be emitted, when an expression field is going to be added to this vector layer.
void updatedFields()
Emitted whenever the fields available from this layer have been changed.
void featureAdded(QgsFeatureId fid)
Emitted when a new feature has been added to the layer.
void featureDeleted(QgsFeatureId fid)
Emitted when a feature has been deleted.
void readCustomSymbology(const QDomElement &element, QString &errorMessage)
Signal emitted whenever the symbology (QML-file) for this layer is being read.
QString profileSourceName() const override
Returns a name for displaying this profile source in the elevation profile layer tree.
const QgsVectorLayerEditBuffer * editBuffer() const
Buffer with uncommitted editing operations.
bool isSqlQuery() const
Returns true if the layer is a query (SQL) layer.
void beforeRollBack()
Emitted before changes are rolled back.
QgsAbstractProfileSource * profileSource() override
Returns the layer's profile source if it has profile capabilities.
QString displayField() const
This is a shorthand for accessing the displayExpression if it is a simple field.
void geometryChanged(QgsFeatureId fid, const QgsGeometry &geometry)
Emitted whenever a geometry change is done in the edit buffer.
QgsFeatureIterator getFeatures(const QgsRectangle &rectangle)
Queries the layer for the features which intersect the specified rectangle.
QgsEditFormConfig editFormConfig
const QgsFeatureRenderer * renderer() const
Returns the feature renderer used for rendering the features in the layer in 2D map views.
void beforeModifiedCheck() const
Emitted when the layer is checked for modifications. Use for last-minute additions.
Q_INVOKABLE QgsFeature getFeature(QgsFeatureId fid) const
Queries the layer for the feature with the given id.
const QgsDiagramRenderer * diagramRenderer() const
QgsMapLayerSelectionProperties * selectionProperties() override
Returns the layer's selection properties.
QgsVectorDataProvider * dataProvider() final
Returns the layer's data provider, it may be nullptr.
static const QgsSettingsEntryDouble * settingsSimplifyDrawingTol
friend class QgsVectorLayerEditBufferGroup
Contains settings for simplifying geometries fetched from a vector layer.
Represent a QgsRelation with possibly unresolved layers or unmatched fields.
QMap< QString, QString > QgsStringMap
Definition qgis.h:7649
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_PYNAME(name)
Definition qgis_sip.h:88
#define SIP_PYARGREMOVE
Definition qgis_sip.h:158
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_OUT
Definition qgis_sip.h:57
#define SIP_FACTORY
Definition qgis_sip.h:83
QVector< QgsPoint > QgsPointSequence
QMap< int, QVariant > QgsAttributeMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList
Definition qgsfield.h:30
QSet< int > QgsAttributeIds
QList< int > QgsAttributeList
Context for cascade delete features.
DeleteContext(bool cascade=false, QgsProject *project=nullptr)
Constructor for DeleteContext.
QMap< QgsVectorLayer *, QgsFeatureIds > mHandledFeatures
Setting options for loading vector layers.
bool readExtentFromXml
If true, the layer extent will be read from XML (i.e.
bool skipCrsValidation
Controls whether the layer is allowed to have an invalid/unknown CRS.
LayerOptions(bool loadDefaultStyle=true, bool readExtentFromXml=false)
Constructor for LayerOptions.
bool forceReadOnly
Controls whether the layer is forced to be load as Read Only.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
QgsCoordinateTransformContext transformContext
Coordinate transform context.
LayerOptions(const QgsCoordinateTransformContext &transformContext, bool loadDefaultStyle=true, bool readExtentFromXml=false)
Constructor for LayerOptions.
QgsCoordinateReferenceSystem fallbackCrs
Fallback layer coordinate reference system.
Qgis::WkbType fallbackWkbType
Fallback geometry type.
bool loadAllStoredStyles
Controls whether the stored styles will be all loaded.