QGIS API Documentation 4.3.0-Master (40e84817713)
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"
40
41#include <QFont>
42#include <QList>
43#include <QMap>
44#include <QMutex>
45#include <QSet>
46#include <QString>
47#include <QStringList>
48
49using namespace Qt::StringLiterals;
50
51class QPainter;
52class QImage;
53
57class QgsCurve;
58class QgsCurvePolygon;
64class QgsGeometry;
65class QgsGeometryVertexIndex;
66class QgsMapToPixel;
67class QgsRectangle;
68class QgsRectangle;
69class QgsRelation;
70class QgsWeakRelation;
74class QgsSymbol;
81class QgsPoint;
82class QgsFeedback;
92
93#ifndef SIP_RUN
94template<class T> class QgsSettingsEntryEnumFlag;
95#endif
98
99
100typedef QList<int> QgsAttributeList;
101typedef QSet<int> QgsAttributeIds;
102
103// TODO QGIS 5: Remove virtual from non-inherited methods (like isModified)
104
408class CORE_EXPORT QgsVectorLayer : public QgsMapLayer,
411 public QgsFeatureSink,
412 public QgsFeatureSource,
414{
415 Q_OBJECT
416
417 Q_PROPERTY( QString subsetString READ subsetString WRITE setSubsetString NOTIFY subsetStringChanged )
420 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
422 Q_PROPERTY( QgsFields fields READ fields NOTIFY updatedFields )
423
424 public:
426
429 static const QgsSettingsEntryEnumFlag<Qgis::VectorSimplificationAlgorithm> *settingsSimplifyAlgorithm SIP_SKIP;
430 static const QgsSettingsEntryEnumFlag<Qgis::VectorRenderingSimplificationFlags> *settingsSimplifyDrawingHints SIP_SKIP;
431
538
543 struct CORE_EXPORT DeleteContext
544 {
548 explicit DeleteContext( bool cascade = false, QgsProject *project = nullptr )
549 : cascade( cascade )
550 , project( project )
551 {}
552
559 QList<QgsVectorLayer *> handledLayers( bool includeAuxiliaryLayers = true ) const;
560
564 QgsFeatureIds handledFeatures( QgsVectorLayer *layer ) const;
565
566 QMap<QgsVectorLayer *, QgsFeatureIds> mHandledFeatures SIP_SKIP;
569 };
570
584 explicit QgsVectorLayer(
585 const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions()
586 );
587
588 ~QgsVectorLayer() override;
589
590 QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
591 QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
592
593#ifdef SIP_RUN
594 // clang-format off
595 SIP_PYOBJECT __repr__();
596 % MethodCode
597 QString str = u"<QgsVectorLayer: '%1' (%2)>"_s.arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : u"Invalid"_s );
598 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
599 % End
600// clang-format on
601#endif
602
610 QgsVectorLayer *clone() const override SIP_FACTORY;
611
616 QString storageType() const;
617
621 QString capabilitiesString() const;
622
623
633 bool isSqlQuery() const;
634
641 Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
642
643
647 QString dataComment() const;
648
656 QString displayField() const;
657
665 void setDisplayExpression( const QString &displayExpression );
666
673 QString displayExpression() const;
674
675 bool hasMapTips() const final;
676
678 const QgsVectorDataProvider *dataProvider() const final SIP_SKIP;
682 QgsAbstractProfileSource *profileSource() override { return this; }
683 QString profileSourceId() const override { return id(); }
684 QString profileSourceName() const override { return name(); }
686
697 void setProviderEncoding( const QString &encoding );
698
700 void setCoordinateSystem();
701
707 bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
708
713 bool removeJoin( const QString &joinLayerId );
714
718 QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
719
724 const QgsVectorLayerJoinBuffer *joinBuffer() const { return mJoinBuffer; }
725 SIP_SKIP;
726
727 const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
728
736 bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) final;
737
744 QSet<QgsMapLayerDependency> dependencies() const final;
745
755 int addExpressionField( const QString &exp, const QgsField &fld );
756
763 void removeExpressionField( int index );
764
773 QString expressionField( int index ) const;
774
783 void updateExpressionField( int index, const QString &exp );
784
791 QgsActionManager *actions() { return mActions; }
792
798 const QgsActionManager *actions() const SIP_SKIP { return mActions; }
799
805 int selectedFeatureCount() const;
806
816 Q_INVOKABLE void selectByRect( const QgsRectangle &rect, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
817
827 Q_INVOKABLE void selectByExpression( const QString &expression, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, QgsExpressionContext *context = nullptr );
828
841 Q_INVOKABLE void selectByIds( const QgsFeatureIds &ids, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, bool validateIds = false );
842
854 Q_INVOKABLE void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
855
857 Q_INVOKABLE void invertSelection();
858
860 Q_INVOKABLE void selectAll();
861
869 Q_INVOKABLE void invertSelectionInRectangle( const QgsRectangle &rect );
870
883 Q_INVOKABLE QgsFeatureList selectedFeatures() const;
884
900 QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
901
909 Q_INVOKABLE const QgsFeatureIds &selectedFeatureIds() const;
910
912 Q_INVOKABLE QgsRectangle boundingBoxOfSelected() const;
913
920 bool labelsEnabled() const;
921
931 void setLabelsEnabled( bool enabled );
932
937 bool diagramsEnabled() const;
938
940 void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
941 const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer.get(); }
942
943 void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
944 const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings.get(); }
945
952 QgsFeatureRenderer *renderer() { return mRenderer.get(); }
953
961 const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer.get(); }
962
969 void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
970
980 void addFeatureRendererGenerator( QgsFeatureRendererGenerator *generator SIP_TRANSFER );
981
991 void removeFeatureRendererGenerator( const QString &id );
992
1000 QList< const QgsFeatureRendererGenerator * > featureRendererGenerators() const;
1001
1003 Q_INVOKABLE Qgis::GeometryType geometryType() const;
1004
1006 Q_INVOKABLE Qgis::WkbType wkbType() const final;
1007
1008 QgsCoordinateReferenceSystem sourceCrs() const final;
1009 QString sourceName() const final;
1010
1015 bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) final;
1016
1021 bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const final;
1022
1023 QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const final;
1024 QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const final;
1025
1029 void resolveReferences( QgsProject *project ) final;
1030
1043 bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
1044
1053 void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
1054
1059 QgsAuxiliaryLayer *auxiliaryLayer();
1060
1065 const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
1066
1067 bool readSymbology( const QDomNode &layerNode, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1068 bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1069 bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1070 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1071
1081 Q_DECL_DEPRECATED bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props = QVariantMap() ) const SIP_DEPRECATED;
1082
1091 bool writeSld( QDomNode &node, QDomDocument &doc, QgsSldExportContext &context ) const;
1092
1093 bool readSld( const QDomNode &node, QString &errorMessage ) final;
1094
1100 long long featureCount( const QString &legendKey ) const;
1101
1108 QgsFeatureIds symbolFeatureIds( const QString &legendKey ) const;
1109
1120 Qgis::FeatureAvailability hasFeatures() const final;
1121
1122 QString loadDefaultStyle( bool &resultFlag SIP_OUT ) final;
1123
1136 QgsVectorLayerFeatureCounter *countSymbolFeatures( bool storeSymbolFids = false );
1137
1145 virtual bool setSubsetString( const QString &subset );
1146
1151 virtual QString subsetString() const;
1152
1158 QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const final;
1159
1163 inline QgsFeatureIterator getFeatures( const QString &expression ) { return getFeatures( QgsFeatureRequest( expression ) ); }
1164
1169 Q_INVOKABLE inline QgsFeature getFeature( QgsFeatureId fid ) const
1170 {
1171 QgsFeature feature;
1172 getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
1173 return feature;
1174 }
1175
1180 QgsGeometry getGeometry( QgsFeatureId fid ) const;
1181
1185 inline QgsFeatureIterator getFeatures( const QgsFeatureIds &fids ) { return getFeatures( QgsFeatureRequest( fids ) ); }
1186
1190 inline QgsFeatureIterator getFeatures( const QgsRectangle &rectangle ) { return getFeatures( QgsFeatureRequest( rectangle ) ); }
1191
1192 bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
1193
1219 bool updateFeature( QgsFeature &feature, bool skipDefaultValues = false );
1220
1232 bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1233
1245 bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1246
1257 bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1258
1269 bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1270
1280 Qgis::VectorEditResult deleteVertex( QgsFeatureId featureId, int vertex );
1281
1293 Qgis::VectorEditResult deleteVertices( QgsFeatureId featureId, const QSet<int> &vertices );
1294
1302 Q_INVOKABLE bool deleteSelectedFeatures( int *deletedCount SIP_OUT = nullptr, QgsVectorLayer::DeleteContext *context = nullptr );
1303
1324 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr ) SIP_DEPRECATED;
1325
1326
1346 Q_INVOKABLE Qgis::GeometryOperationResult addRing( const QgsPointSequence &ring, QgsFeatureId *featureId = nullptr );
1347
1368 Q_INVOKABLE Qgis::GeometryOperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1369
1389 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart( const QList<QgsPointXY> &ring ) SIP_DEPRECATED;
1390
1410 Q_INVOKABLE Qgis::GeometryOperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1411
1422 Q_INVOKABLE Qgis::GeometryOperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1423
1435 Q_INVOKABLE Qgis::GeometryOperationResult addPart( QgsCurvePolygon *polygon SIP_TRANSFER ) SIP_PYNAME( addPolygonPart );
1436
1448 Q_INVOKABLE int translateFeature( QgsFeatureId featureId, double dx, double dy );
1449
1470 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1471
1491 Q_INVOKABLE Qgis::GeometryOperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1492
1513 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1514
1534 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1535
1558 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsCurve *curve, QgsPointSequence &topologyTestPoints SIP_OUT, bool preserveCircular = false, bool topologicalEditing = false );
1559
1573 int addTopologicalPoints( const QgsGeometry &geom );
1574
1591 Q_DECL_DEPRECATED int addTopologicalPoints( const QgsPointXY &p ) SIP_DEPRECATED;
1592
1609 int addTopologicalPoints( const QgsPoint &p );
1610
1627 int addTopologicalPoints( const QgsPointSequence &ps );
1628
1634 const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling.get(); }
1635
1641 QgsAbstractVectorLayerLabeling *labeling() { return mLabeling.get(); }
1642
1646 void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1647
1649 bool isEditable() const final;
1650
1652 bool isSpatial() const final;
1653
1655 bool isModified() const override;
1656
1662 bool isAuxiliaryField( int index, int &srcIndex ) const;
1663
1665 void reload() final;
1666
1670 QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) final SIP_FACTORY;
1671
1672 QgsRectangle extent() const final;
1673 QgsRectangle sourceExtent() const final;
1674
1675 QgsBox3D extent3D() const final;
1676 QgsBox3D sourceExtent3D() const final;
1677
1684 QgsFields fields() const final;
1685
1689 Q_INVOKABLE inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1690
1694 QgsAttributeList primaryKeyAttributes() const;
1695
1701 long long featureCount() const final;
1702
1709 bool setReadOnly( bool readonly = true );
1710
1716 Q_INVOKABLE bool supportsEditing() const override;
1717
1738 bool changeGeometry( QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue = false );
1739
1772 Q_INVOKABLE bool changeAttributeValue(
1773 QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr
1774 );
1775
1812 Q_INVOKABLE bool changeAttributeValues(
1813 QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr
1814 );
1815
1825 Q_INVOKABLE bool addAttribute( const QgsField &field );
1826
1831 Q_INVOKABLE void setFieldAlias( int index, const QString &aliasString );
1832
1837 Q_INVOKABLE void removeFieldAlias( int index );
1838
1845 Q_INVOKABLE void setFieldCustomComment( int index, const QString &customCommentString );
1846
1852 Q_INVOKABLE void removeFieldCustomComment( int index );
1853
1859 Q_INVOKABLE QString attributeCustomComment( int index ) const;
1860
1866 QgsStringMap attributeCustomComments() const;
1867
1877 Q_INVOKABLE bool renameAttribute( int index, const QString &newName );
1878
1885 Q_INVOKABLE QString attributeAlias( int index ) const;
1886
1888 Q_INVOKABLE QString attributeDisplayName( int index ) const;
1889
1891 QgsStringMap attributeAliases() const;
1892
1893#ifndef SIP_RUN
1894
1900 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1901
1907 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1908
1914 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1915#else
1916 // clang-format off
1917
1924 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1925
1926 % MethodCode
1927 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1928 {
1929 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1930 sipIsErr = 1;
1931 }
1932 else
1933 {
1934 sipCpp->setFieldSplitPolicy( a0, a1 );
1935 }
1936 % End
1937
1944 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1945
1946 % MethodCode
1947 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1948 {
1949 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1950 sipIsErr = 1;
1951 }
1952 else
1953 {
1954 sipCpp->setFieldDuplicatePolicy( a0, a1 );
1955 }
1956 % End
1957
1964 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1965
1966 % MethodCode
1967 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1968 {
1969 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1970 sipIsErr = 1;
1971 }
1972 else
1973 {
1974 sipCpp->setFieldMergePolicy( a0, a1 );
1975 }
1976 % End
1977// clang-format on
1978#endif
1979
1984 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWms() const SIP_DEPRECATED;
1985
1990 Q_DECL_DEPRECATED void setExcludeAttributesWms( const QSet<QString> &att ) SIP_DEPRECATED;
1991
1996 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWfs() const SIP_DEPRECATED;
1997
2002 Q_DECL_DEPRECATED void setExcludeAttributesWfs( const QSet<QString> &att ) SIP_DEPRECATED;
2003
2012 Q_INVOKABLE virtual bool deleteAttribute( int attr );
2013
2021 Q_INVOKABLE bool deleteAttributes( const QList<int> &attrs );
2022
2023 using QgsFeatureSink::addFeatures;
2024 bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
2025
2036 Q_INVOKABLE bool deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteContext *context = nullptr );
2037
2051 Q_INVOKABLE bool deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context = nullptr );
2052
2076 Q_INVOKABLE bool commitChanges( bool stopEditing = true );
2077
2083 QStringList commitErrors() const;
2084
2094 Q_INVOKABLE bool rollBack( bool deleteBuffer = true );
2095
2102 QList<QgsRelation> referencingRelations( int idx ) const;
2103
2113 QList<QgsWeakRelation> weakRelations() const SIP_SKIP;
2114
2123 void setWeakRelations( const QList< QgsWeakRelation > &relations ) SIP_SKIP;
2124
2126 Q_INVOKABLE QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
2127
2132 const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
2133
2138 void beginEditCommand( const QString &text );
2139
2141 void endEditCommand();
2142
2144 void destroyEditCommand();
2145
2150 Q_DECL_DEPRECATED static void drawVertexMarker( double x, double y, QPainter &p, Qgis::VertexMarkerType type, int vertexSize );
2151
2160 void updateFields();
2161
2175 QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(), QgsExpressionContext *context = nullptr ) const;
2176
2187 void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
2188
2198 QgsDefaultValue defaultValueDefinition( int index ) const;
2199
2206 QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
2207
2212 QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
2213
2222
2229 void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
2230
2237 QString constraintExpression( int index ) const;
2238
2245 QString constraintDescription( int index ) const;
2246
2254 void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
2255
2261 void setFieldConfigurationFlags( int index, Qgis::FieldConfigurationFlags flags );
2262
2267 void setFieldConfigurationFlag( int index, Qgis::FieldConfigurationFlag flag, bool active );
2268
2274 Qgis::FieldConfigurationFlags fieldConfigurationFlags( int index ) const;
2275
2284 void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
2285
2294 QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
2295
2307 Q_INVOKABLE QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const final;
2308
2322 QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1, QgsFeedback *feedback = nullptr ) const;
2323
2338 Q_INVOKABLE QVariant minimumValue( int index ) const final;
2339
2354 Q_INVOKABLE QVariant maximumValue( int index ) const final;
2355
2356
2376 void minimumAndMaximumValue( int index, QVariant &minimum SIP_OUT, QVariant &maximum SIP_OUT ) const;
2377
2391 QVariant aggregate(
2392 Qgis::Aggregate aggregate,
2393 const QString &fieldOrExpression,
2394 const QgsAggregateCalculator::AggregateParameters &parameters = QgsAggregateCalculator::AggregateParameters(),
2395 QgsExpressionContext *context = nullptr,
2396 bool *ok = nullptr,
2397 QgsFeatureIds *fids = nullptr,
2398 QgsFeedback *feedback = nullptr,
2399 QString *error SIP_PYARGREMOVE = nullptr
2400 ) const;
2401
2403 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
2405 QPainter::CompositionMode featureBlendMode() const;
2406
2407 QString htmlMetadata() const final;
2408
2413
2417 inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
2418
2423 bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, Qgis::VectorRenderingSimplificationFlag simplifyHint ) const;
2424
2431 QgsConditionalLayerStyles *conditionalStyles() const;
2432
2437 QgsAttributeTableConfig attributeTableConfig() const;
2438
2443 void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
2444
2446
2447 QgsExpressionContextScope *createExpressionContextScope() const final SIP_FACTORY;
2448
2455 QgsEditFormConfig editFormConfig() const;
2456
2462 void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
2463
2470 void setReadExtentFromXml( bool readExtentFromXml );
2471
2478 bool readExtentFromXml() const;
2479
2484 bool isEditCommandActive() const { return mEditCommandActive; }
2485
2491 QgsGeometryOptions *geometryOptions() const;
2492
2510 bool allowCommit() const SIP_SKIP;
2511
2529 void setAllowCommit( bool allowCommit ) SIP_SKIP;
2530
2536 QgsStoredExpressionManager *storedExpressionManager() { return mStoredExpressionManager; }
2537
2538 public slots:
2539
2547 void select( QgsFeatureId featureId );
2548
2556 Q_INVOKABLE void select( const QgsFeatureIds &featureIds );
2557
2565 void deselect( QgsFeatureId featureId );
2566
2574 Q_INVOKABLE void deselect( const QgsFeatureIds &featureIds );
2575
2582 Q_INVOKABLE void removeSelection();
2583
2594 void reselect();
2595
2602 virtual void updateExtents( bool force = false );
2603
2618 Q_INVOKABLE bool startEditing();
2619
2625 void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;
2626
2628
2629 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
2630
2631 bool accept( QgsObjectEntityVisitorInterface *visitor, const QgsObjectVisitorContext &context ) const override;
2632
2633 signals:
2634
2642 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
2643
2650
2653
2656
2662 void beforeCommitChanges( bool stopEditing );
2663
2666
2672
2678
2687 void attributeAdded( int idx );
2688
2695 void beforeAddingExpressionField( const QString &fieldName );
2696
2705 void attributeDeleted( int idx );
2706
2714
2721
2731
2741 void featuresDeleted( const QgsFeatureIds &fids );
2742
2748
2754
2763 void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
2764
2772 void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
2773
2775 void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2777 void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
2779 void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
2781 void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
2783 void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
2785 void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
2786
2788 void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
2789
2791 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2792
2798 void editCommandStarted( const QString &text );
2799
2806
2813
2823 void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2824
2834 void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2835
2841
2845 void raiseError( const QString &msg );
2846
2852
2861
2868
2874
2875 protected:
2877 void setExtent( const QgsRectangle &rect ) final;
2879 void setExtent3D( const QgsBox3D &rect ) final;
2880
2881 private slots:
2882 void invalidateSymbolCountedFlag();
2883 void onFeatureCounterCompleted();
2884 void onFeatureCounterTerminated();
2885 void onJoinedFieldsChanged();
2886 void onFeatureAdded( QgsFeatureId fid );
2887 void onFeatureDeleted( QgsFeatureId fid );
2888 void onRelationsLoaded();
2889 void onSymbolsCounted();
2890 void onDirtyTransaction( const QString &sql, const QString &name );
2891 void onDependencyAfterCommitChanges();
2892 void emitDataChanged();
2893
2894 private:
2895 void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature(), QgsExpressionContext *context = nullptr );
2896
2906 bool isReadOnly() const final;
2907
2914 bool setDataProvider( QString const &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() );
2915
2927 void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags ) override;
2928
2930 void readSldLabeling( const QDomNode &node );
2931
2933 bool readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSettings &settings ) const;
2934
2936 QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2937
2938 bool deleteFeatureCascade( QgsFeatureId fid, DeleteContext *context = nullptr );
2939
2940#ifdef SIP_RUN
2941 QgsVectorLayer( const QgsVectorLayer &rhs );
2942#endif
2944 void minimumOrMaximumValue( int index, QVariant *minimum, QVariant *maximum ) const;
2945
2946 void createEditBuffer();
2947 void clearEditBuffer();
2948
2950 void applyRendererSettings();
2951
2952 QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2953 QgsVectorDataProvider *mDataProvider = nullptr;
2954 QgsVectorLayerSelectionProperties *mSelectionProperties = nullptr;
2955 QgsVectorLayerTemporalProperties *mTemporalProperties = nullptr;
2956 QgsVectorLayerElevationProperties *mElevationProperties = nullptr;
2957
2959 QString mDisplayExpression;
2960
2962 QgsActionManager *mActions = nullptr;
2963
2965 bool mDataSourceReadOnly = false;
2966
2973 bool mReadOnly = false;
2974
2980 QgsFeatureIds mSelectedFeatureIds;
2981
2985 QgsFeatureIds mPreviousSelectedFeatureIds;
2986
2988 QgsFields mFields;
2989
2991 QgsStringMap mAttributeAliasMap;
2992
2994 QgsStringMap mAttributeCustomCommentMap;
2995
2997 QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2998
3000 QMap< QString, Qgis::FieldDomainSplitPolicy > mAttributeSplitPolicy;
3001
3003 QMap< QString, Qgis::FieldDuplicatePolicy > mAttributeDuplicatePolicy;
3004
3006 QMap< QString, Qgis::FieldDomainMergePolicy > mAttributeMergePolicy;
3007
3009 QSet<int> mDefaultValueOnUpdateFields;
3010
3012 QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
3013
3015 QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
3016
3018 QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
3019
3020 QMap< QString, Qgis::FieldConfigurationFlags > mFieldConfigurationFlags;
3021 QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
3022
3024 QgsEditFormConfig mEditFormConfig;
3025
3028
3030 std::unique_ptr<QgsFeatureRenderer> mRenderer;
3031
3033 QgsVectorSimplifyMethod mSimplifyMethod;
3034
3036 std::unique_ptr<QgsAbstractVectorLayerLabeling> mLabeling;
3037
3039 bool mLabelsEnabled = false;
3040
3042 bool mLabelFontNotFoundNotified = false;
3043
3045 QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
3046
3048 bool mVertexMarkerOnlyForSelection = false;
3049
3050 QStringList mCommitErrors;
3051
3053 QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
3057
3058 //stores information about joined layers
3059 QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
3060
3062 std::unique_ptr<QgsExpressionFieldBuffer> mExpressionFieldBuffer;
3063
3064 //diagram rendering object. 0 if diagram drawing is disabled
3065 std::unique_ptr<QgsDiagramRenderer> mDiagramRenderer;
3066
3067 //stores infos about diagram placement (placement type, priority, position distance)
3068 std::unique_ptr<QgsDiagramLayerSettings> mDiagramLayerSettings;
3069
3070 mutable bool mValidExtent2D = false;
3071 mutable bool mLazyExtent2D = true;
3072 mutable bool mValidExtent3D = false;
3073 mutable bool mLazyExtent3D = true;
3074
3076 std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
3077
3079 QString mAuxiliaryLayerKey;
3080
3081 // Features in renderer classes counted
3082 bool mSymbolFeatureCounted = false;
3083
3084 // Feature counts for each renderer legend key
3085 QHash<QString, long long> mSymbolFeatureCountMap;
3086 QHash<QString, QgsFeatureIds> mSymbolFeatureIdMap;
3087
3089 bool mEditCommandActive = false;
3090
3092 bool mCommitChangesActive = false;
3093
3094 bool mReadExtentFromXml;
3095 QgsRectangle mXmlExtent2D;
3096 QgsBox3D mXmlExtent3D;
3097
3098 QgsFeatureIds mDeletedFids;
3099
3100 QgsAttributeTableConfig mAttributeTableConfig;
3101
3102 mutable QMutex mFeatureSourceConstructorMutex;
3103
3104 QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
3105
3106 std::unique_ptr<QgsGeometryOptions> mGeometryOptions;
3107
3108 bool mAllowCommit = true;
3109
3111 QgsStoredExpressionManager *mStoredExpressionManager = nullptr;
3112
3114
3116 bool mDataChangedFired = false;
3117
3118 QList<QgsWeakRelation> mWeakRelations;
3119
3120 bool mSetLegendFromStyle = false;
3121
3122 QList< QgsFeatureRendererGenerator * > mRendererGenerators;
3123
3125 QTimer *mRefreshRendererTimer = nullptr;
3126
3130 bool mLoadAllStoredStyle = false;
3131};
3132
3133
3134// clazy:excludeall=qstring-allocations
3135
3136#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:599
VectorRenderingSimplificationFlag
Simplification flags for vector feature rendering.
Definition qgis.h:3232
FieldDomainMergePolicy
Merge policy for field domains.
Definition qgis.h:4142
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:4125
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:4162
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition qgis.h:1983
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:1871
QFlags< FieldConfigurationFlag > FieldConfigurationFlags
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1886
SelectBehavior
Specifies how a selection should be applied.
Definition qgis.h:1921
@ SetSelection
Set selection, removing any existing selection.
Definition qgis.h:1922
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.
Curve polygon geometry type.
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:45
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:8031
#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.