QGIS API Documentation 3.99.0-Master (752b475928d)
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 <QStringList>
46
47class QPainter;
48class QImage;
49
53class QgsCurve;
59class QgsGeometry;
60class QgsGeometryVertexIndex;
61class QgsMapToPixel;
62class QgsRectangle;
63class QgsRectangle;
64class QgsRelation;
65class QgsWeakRelation;
69class QgsSymbol;
76class QgsPoint;
77class QgsFeedback;
88
89#ifndef SIP_RUN
90template<class T>
92#endif
95
96
97typedef QList<int> QgsAttributeList;
98typedef QSet<int> QgsAttributeIds;
99
100// TODO QGIS4: Remove virtual from non-inherited methods (like isModified)
101
406{
407 Q_OBJECT
408
409 Q_PROPERTY( QString subsetString READ subsetString WRITE setSubsetString NOTIFY subsetStringChanged )
412 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged )
414 Q_PROPERTY( QgsFields fields READ fields NOTIFY updatedFields )
415
416 public:
417
419
422 static const QgsSettingsEntryEnumFlag<Qgis::VectorSimplificationAlgorithm> *settingsSimplifyAlgorithm SIP_SKIP;
423 static const QgsSettingsEntryEnumFlag<Qgis::VectorRenderingSimplificationFlags> *settingsSimplifyDrawingHints SIP_SKIP;
424
536
541 struct CORE_EXPORT DeleteContext
542 {
543
547 explicit DeleteContext( bool cascade = false, QgsProject *project = nullptr ): cascade( cascade ), project( project ) {}
548
555 QList<QgsVectorLayer *> handledLayers( bool includeAuxiliaryLayers = true ) const;
556
560 QgsFeatureIds handledFeatures( QgsVectorLayer *layer ) const;
561
562 QMap<QgsVectorLayer *, QgsFeatureIds> mHandledFeatures SIP_SKIP;
565 };
566
580 explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
581 const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
582
583 ~QgsVectorLayer() override;
584
585 QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
586 QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
587
588#ifdef SIP_RUN
589 SIP_PYOBJECT __repr__();
590 % MethodCode
591 QString str = QStringLiteral( "<QgsVectorLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
592 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
593 % End
594#endif
595
603 QgsVectorLayer *clone() const override SIP_FACTORY;
604
609 QString storageType() const;
610
614 QString capabilitiesString() const;
615
616
626 bool isSqlQuery() const;
627
634 Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
635
636
640 QString dataComment() const;
641
649 QString displayField() const;
650
658 void setDisplayExpression( const QString &displayExpression );
659
666 QString displayExpression() const;
667
668 bool hasMapTips() const final;
669
671 const QgsVectorDataProvider *dataProvider() const final SIP_SKIP;
675 QgsAbstractProfileSource *profileSource() override {return this;}
676 QString profileSourceId() const override {return id();}
677 QString profileSourceName() const override {return name();}
679
690 void setProviderEncoding( const QString &encoding );
691
693 void setCoordinateSystem();
694
700 bool addJoin( const QgsVectorLayerJoinInfo &joinInfo );
701
706 bool removeJoin( const QString &joinLayerId );
707
711 QgsVectorLayerJoinBuffer *joinBuffer() { return mJoinBuffer; }
712
717 const QgsVectorLayerJoinBuffer *joinBuffer() const { return mJoinBuffer; } SIP_SKIP;
718
719 const QList<QgsVectorLayerJoinInfo> vectorJoins() const;
720
728 bool setDependencies( const QSet<QgsMapLayerDependency> &layers ) final;
729
736 QSet<QgsMapLayerDependency> dependencies() const final;
737
747 int addExpressionField( const QString &exp, const QgsField &fld );
748
755 void removeExpressionField( int index );
756
765 QString expressionField( int index ) const;
766
775 void updateExpressionField( int index, const QString &exp );
776
783 QgsActionManager *actions() { return mActions; }
784
790 const QgsActionManager *actions() const SIP_SKIP { return mActions; }
791
797 int selectedFeatureCount() const;
798
808 Q_INVOKABLE void selectByRect( QgsRectangle &rect, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
809
819 Q_INVOKABLE void selectByExpression( const QString &expression, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection, QgsExpressionContext *context = nullptr );
820
830 Q_INVOKABLE void selectByIds( const QgsFeatureIds &ids, Qgis::SelectBehavior behavior = Qgis::SelectBehavior::SetSelection );
831
843 Q_INVOKABLE void modifySelection( const QgsFeatureIds &selectIds, const QgsFeatureIds &deselectIds );
844
846 Q_INVOKABLE void invertSelection();
847
849 Q_INVOKABLE void selectAll();
850
858 Q_INVOKABLE void invertSelectionInRectangle( QgsRectangle &rect );
859
872 Q_INVOKABLE QgsFeatureList selectedFeatures() const;
873
889 QgsFeatureIterator getSelectedFeatures( QgsFeatureRequest request = QgsFeatureRequest() ) const;
890
898 Q_INVOKABLE const QgsFeatureIds &selectedFeatureIds() const;
899
901 Q_INVOKABLE QgsRectangle boundingBoxOfSelected() const;
902
909 bool labelsEnabled() const;
910
920 void setLabelsEnabled( bool enabled );
921
926 bool diagramsEnabled() const;
927
929 void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );
930 const QgsDiagramRenderer *diagramRenderer() const { return mDiagramRenderer; }
931
932 void setDiagramLayerSettings( const QgsDiagramLayerSettings &s );
933 const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }
934
941 QgsFeatureRenderer *renderer() { return mRenderer; }
942
950 const QgsFeatureRenderer *renderer() const SIP_SKIP { return mRenderer; }
951
958 void setRenderer( QgsFeatureRenderer *r SIP_TRANSFER );
959
969 void addFeatureRendererGenerator( QgsFeatureRendererGenerator *generator SIP_TRANSFER );
970
980 void removeFeatureRendererGenerator( const QString &id );
981
989 QList< const QgsFeatureRendererGenerator * > featureRendererGenerators() const;
990
992 Q_INVOKABLE Qgis::GeometryType geometryType() const;
993
995 Q_INVOKABLE Qgis::WkbType wkbType() const final;
996
997 QgsCoordinateReferenceSystem sourceCrs() const final;
998 QString sourceName() const final;
999
1004 bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context ) final;
1005
1010 bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const final;
1011
1012 QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const final;
1013 QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const final;
1014
1018 void resolveReferences( QgsProject *project ) final;
1019
1032 bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
1033
1042 void setAuxiliaryLayer( QgsAuxiliaryLayer *layer SIP_TRANSFER = nullptr );
1043
1048 QgsAuxiliaryLayer *auxiliaryLayer();
1049
1054 const QgsAuxiliaryLayer *auxiliaryLayer() const SIP_SKIP;
1055
1056 bool readSymbology( const QDomNode &layerNode, QString &errorMessage,
1057 QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1058 bool readStyle( const QDomNode &node, QString &errorMessage,
1059 QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) final;
1060 bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
1061 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1062 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
1063 const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const final;
1064
1074 Q_DECL_DEPRECATED bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props = QVariantMap() ) const SIP_DEPRECATED;
1075
1084 bool writeSld( QDomNode &node, QDomDocument &doc, QgsSldExportContext &context ) const;
1085
1086 bool readSld( const QDomNode &node, QString &errorMessage ) final;
1087
1093 long long featureCount( const QString &legendKey ) const;
1094
1101 QgsFeatureIds symbolFeatureIds( const QString &legendKey ) const;
1102
1113 Qgis::FeatureAvailability hasFeatures() const final;
1114
1115 QString loadDefaultStyle( bool &resultFlag SIP_OUT ) final;
1116
1129 QgsVectorLayerFeatureCounter *countSymbolFeatures( bool storeSymbolFids = false );
1130
1138 virtual bool setSubsetString( const QString &subset );
1139
1144 virtual QString subsetString() const;
1145
1151 QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const final;
1152
1156 inline QgsFeatureIterator getFeatures( const QString &expression )
1157 {
1158 return getFeatures( QgsFeatureRequest( expression ) );
1159 }
1160
1165 Q_INVOKABLE inline QgsFeature getFeature( QgsFeatureId fid ) const
1166 {
1167 QgsFeature feature;
1168 getFeatures( QgsFeatureRequest( fid ) ).nextFeature( feature );
1169 return feature;
1170 }
1171
1176 QgsGeometry getGeometry( QgsFeatureId fid ) const;
1177
1182 {
1183 return getFeatures( QgsFeatureRequest( fids ) );
1184 }
1185
1190 {
1191 return getFeatures( QgsFeatureRequest( rectangle ) );
1192 }
1193
1194 bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
1195
1221 Q_INVOKABLE bool updateFeature( QgsFeature &feature, bool skipDefaultValues = false );
1222
1234 bool insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex );
1235
1247 bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex );
1248
1259 bool moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex );
1260
1271 bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 );
1272
1282 Qgis::VectorEditResult deleteVertex( QgsFeatureId featureId, int vertex );
1283
1291 Q_INVOKABLE bool deleteSelectedFeatures( int *deletedCount = nullptr, QgsVectorLayer::DeleteContext *context = nullptr );
1292
1313 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr ) SIP_DEPRECATED;
1314
1315
1335 Q_INVOKABLE Qgis::GeometryOperationResult addRing( const QgsPointSequence &ring, QgsFeatureId *featureId = nullptr );
1336
1357 Q_INVOKABLE Qgis::GeometryOperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );
1358
1378 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart( const QList<QgsPointXY> &ring ) SIP_DEPRECATED;
1379
1380#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1381
1402 Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart( const QVector<QgsPointXY> &ring ) SIP_PYNAME( addPartV2 ) SIP_DEPRECATED;
1403#endif
1404
1424 Q_INVOKABLE Qgis::GeometryOperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
1425
1436 Q_INVOKABLE Qgis::GeometryOperationResult addPart( QgsCurve *ring SIP_TRANSFER ) SIP_PYNAME( addCurvedPart );
1437
1449 Q_INVOKABLE int translateFeature( QgsFeatureId featureId, double dx, double dy );
1450
1471 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1472
1492 Q_INVOKABLE Qgis::GeometryOperationResult splitParts( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1493
1514 Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false ) SIP_DEPRECATED;
1515
1535 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsPointSequence &splitLine, bool topologicalEditing = false );
1536
1559 Q_INVOKABLE Qgis::GeometryOperationResult splitFeatures( const QgsCurve *curve, QgsPointSequence &topologyTestPoints SIP_OUT, bool preserveCircular = false, bool topologicalEditing = false );
1560
1574 int addTopologicalPoints( const QgsGeometry &geom );
1575
1592 Q_DECL_DEPRECATED int addTopologicalPoints( const QgsPointXY &p ) SIP_DEPRECATED;
1593
1610 int addTopologicalPoints( const QgsPoint &p );
1611
1628 int addTopologicalPoints( const QgsPointSequence &ps );
1629
1635 const QgsAbstractVectorLayerLabeling *labeling() const SIP_SKIP { return mLabeling; }
1636
1643
1647 void setLabeling( QgsAbstractVectorLayerLabeling *labeling SIP_TRANSFER );
1648
1650 bool isEditable() const final;
1651
1653 bool isSpatial() const final;
1654
1656 bool isModified() const override;
1657
1663 bool isAuxiliaryField( int index, int &srcIndex ) const;
1664
1666 void reload() final;
1667
1671 QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) final SIP_FACTORY;
1672
1673 QgsRectangle extent() const final;
1674 QgsRectangle sourceExtent() const final;
1675
1676 QgsBox3D extent3D() const final;
1677 QgsBox3D sourceExtent3D() const final;
1678
1685 QgsFields fields() const final;
1686
1690 Q_INVOKABLE inline QgsAttributeList attributeList() const { return mFields.allAttributesList(); }
1691
1695 QgsAttributeList primaryKeyAttributes() const;
1696
1702 long long featureCount() const final;
1703
1710 bool setReadOnly( bool readonly = true );
1711
1717 Q_INVOKABLE bool supportsEditing() const override;
1718
1739 Q_INVOKABLE bool changeGeometry( QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue = false );
1740
1773 Q_INVOKABLE bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr );
1774
1811 Q_INVOKABLE bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues = QgsAttributeMap(), bool skipDefaultValues = false, QgsVectorLayerToolsContext *context = nullptr );
1812
1822 Q_INVOKABLE bool addAttribute( const QgsField &field );
1823
1828 Q_INVOKABLE void setFieldAlias( int index, const QString &aliasString );
1829
1834 Q_INVOKABLE void removeFieldAlias( int index );
1835
1845 Q_INVOKABLE bool renameAttribute( int index, const QString &newName );
1846
1853 Q_INVOKABLE QString attributeAlias( int index ) const;
1854
1856 Q_INVOKABLE QString attributeDisplayName( int index ) const;
1857
1859 QgsStringMap attributeAliases() const;
1860
1861#ifndef SIP_RUN
1862
1868 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1869
1875 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1876
1882 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1883#else
1884
1891 void setFieldSplitPolicy( int index, Qgis::FieldDomainSplitPolicy policy );
1892
1893 % MethodCode
1894 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1895 {
1896 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1897 sipIsErr = 1;
1898 }
1899 else
1900 {
1901 sipCpp->setFieldSplitPolicy( a0, a1 );
1902 }
1903 % End
1904
1911 void setFieldDuplicatePolicy( int index, Qgis::FieldDuplicatePolicy policy );
1912
1913 % MethodCode
1914 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1915 {
1916 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1917 sipIsErr = 1;
1918 }
1919 else
1920 {
1921 sipCpp->setFieldDuplicatePolicy( a0, a1 );
1922 }
1923 % End
1924
1931 void setFieldMergePolicy( int index, Qgis::FieldDomainMergePolicy policy );
1932
1933 % MethodCode
1934 if ( a0 < 0 || a0 >= sipCpp->fields().count() )
1935 {
1936 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
1937 sipIsErr = 1;
1938 }
1939 else
1940 {
1941 sipCpp->setFieldMergePolicy( a0, a1 );
1942 }
1943 % End
1944#endif
1945
1950 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWms() const SIP_DEPRECATED;
1951
1956 Q_DECL_DEPRECATED void setExcludeAttributesWms( const QSet<QString> &att ) SIP_DEPRECATED;
1957
1962 Q_DECL_DEPRECATED QSet<QString> excludeAttributesWfs() const SIP_DEPRECATED;
1963
1968 Q_DECL_DEPRECATED void setExcludeAttributesWfs( const QSet<QString> &att ) SIP_DEPRECATED;
1969
1978 Q_INVOKABLE virtual bool deleteAttribute( int attr );
1979
1987 Q_INVOKABLE bool deleteAttributes( const QList<int> &attrs );
1988
1989 using QgsFeatureSink::addFeatures;
1990 bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() ) final;
1991
2002 Q_INVOKABLE bool deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteContext *context = nullptr );
2003
2017 Q_INVOKABLE bool deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context = nullptr );
2018
2042 Q_INVOKABLE bool commitChanges( bool stopEditing = true );
2043
2049 QStringList commitErrors() const;
2050
2060 Q_INVOKABLE bool rollBack( bool deleteBuffer = true );
2061
2068 QList<QgsRelation> referencingRelations( int idx ) const;
2069
2079 QList<QgsWeakRelation> weakRelations() const SIP_SKIP;
2080
2089 void setWeakRelations( const QList< QgsWeakRelation > &relations ) SIP_SKIP;
2090
2092 Q_INVOKABLE QgsVectorLayerEditBuffer *editBuffer() { return mEditBuffer; }
2093
2098 const QgsVectorLayerEditBuffer *editBuffer() const SIP_SKIP { return mEditBuffer; }
2099
2104 void beginEditCommand( const QString &text );
2105
2107 void endEditCommand();
2108
2110 void destroyEditCommand();
2111
2116 Q_DECL_DEPRECATED static void drawVertexMarker( double x, double y, QPainter &p, Qgis::VertexMarkerType type, int vertexSize );
2117
2126 void updateFields();
2127
2141 QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
2142 QgsExpressionContext *context = nullptr ) const;
2143
2154 void setDefaultValueDefinition( int index, const QgsDefaultValue &definition );
2155
2165 QgsDefaultValue defaultValueDefinition( int index ) const;
2166
2173 QgsFieldConstraints::Constraints fieldConstraints( int fieldIndex ) const;
2174
2179 QMap< QgsFieldConstraints::Constraint, QgsFieldConstraints::ConstraintStrength> fieldConstraintsAndStrength( int fieldIndex ) const;
2180
2189
2196 void removeFieldConstraint( int index, QgsFieldConstraints::Constraint constraint );
2197
2204 QString constraintExpression( int index ) const;
2205
2212 QString constraintDescription( int index ) const;
2213
2221 void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
2222
2228 void setFieldConfigurationFlags( int index, Qgis::FieldConfigurationFlags flags );
2229
2234 void setFieldConfigurationFlag( int index, Qgis::FieldConfigurationFlag flag, bool active );
2235
2241 Qgis::FieldConfigurationFlags fieldConfigurationFlags( int index ) const;
2242
2251 void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
2252
2261 QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
2262
2274 QSet<QVariant> uniqueValues( int fieldIndex, int limit = -1 ) const final;
2275
2289 QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
2290 QgsFeedback *feedback = nullptr ) const;
2291
2306 QVariant minimumValue( int index ) const final;
2307
2322 QVariant maximumValue( int index ) const final;
2323
2324
2344 void minimumAndMaximumValue( int index, QVariant &minimum SIP_OUT, QVariant &maximum SIP_OUT ) const;
2345
2359 QVariant aggregate( Qgis::Aggregate aggregate,
2360 const QString &fieldOrExpression,
2361 const QgsAggregateCalculator::AggregateParameters &parameters = QgsAggregateCalculator::AggregateParameters(),
2362 QgsExpressionContext *context = nullptr,
2363 bool *ok = nullptr,
2364 QgsFeatureIds *fids = nullptr,
2365 QgsFeedback *feedback = nullptr,
2366 QString *error SIP_PYARGREMOVE = nullptr ) const;
2367
2369 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
2371 QPainter::CompositionMode featureBlendMode() const;
2372
2373 QString htmlMetadata() const final;
2374
2379
2383 inline const QgsVectorSimplifyMethod &simplifyMethod() const { return mSimplifyMethod; }
2384
2389 bool simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, Qgis::VectorRenderingSimplificationFlag simplifyHint ) const;
2390
2397 QgsConditionalLayerStyles *conditionalStyles() const;
2398
2403 QgsAttributeTableConfig attributeTableConfig() const;
2404
2409 void setAttributeTableConfig( const QgsAttributeTableConfig &attributeTableConfig );
2410
2412
2413 QgsExpressionContextScope *createExpressionContextScope() const final SIP_FACTORY;
2414
2421 QgsEditFormConfig editFormConfig() const;
2422
2428 void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
2429
2436 void setReadExtentFromXml( bool readExtentFromXml );
2437
2444 bool readExtentFromXml() const;
2445
2450 bool isEditCommandActive() const { return mEditCommandActive; }
2451
2457 QgsGeometryOptions *geometryOptions() const;
2458
2476 bool allowCommit() const SIP_SKIP;
2477
2495 void setAllowCommit( bool allowCommit ) SIP_SKIP;
2496
2502 QgsStoredExpressionManager *storedExpressionManager() { return mStoredExpressionManager; }
2503
2504 public slots:
2505
2513 void select( QgsFeatureId featureId );
2514
2522 Q_INVOKABLE void select( const QgsFeatureIds &featureIds );
2523
2531 void deselect( QgsFeatureId featureId );
2532
2540 Q_INVOKABLE void deselect( const QgsFeatureIds &featureIds );
2541
2548 Q_INVOKABLE void removeSelection();
2549
2560 void reselect();
2561
2568 virtual void updateExtents( bool force = false );
2569
2584 Q_INVOKABLE bool startEditing();
2585
2591 void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;
2592
2594
2595 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
2596
2597 bool accept( QgsObjectEntityVisitorInterface *visitor, const QgsObjectVisitorContext &context ) const override;
2598
2599 signals:
2600
2608 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
2609
2616
2619
2622
2628 void beforeCommitChanges( bool stopEditing );
2629
2632
2638
2644
2653 void attributeAdded( int idx );
2654
2661 void beforeAddingExpressionField( const QString &fieldName );
2662
2671 void attributeDeleted( int idx );
2672
2680
2687
2697
2707 void featuresDeleted( const QgsFeatureIds &fids );
2708
2714
2720
2729 void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
2730
2738 void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
2739
2741 void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
2743 void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
2745 void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
2747 void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
2749 void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
2751 void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
2752
2754 void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
2755
2757 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2758
2764 void editCommandStarted( const QString &text );
2765
2772
2779
2789 void readCustomSymbology( const QDomElement &element, QString &errorMessage );
2790
2800 void writeCustomSymbology( QDomElement &element, QDomDocument &doc, QString &errorMessage ) const;
2801
2807
2811 void raiseError( const QString &msg );
2812
2818
2827
2834
2840
2841 protected:
2843 void setExtent( const QgsRectangle &rect ) final;
2845 void setExtent3D( const QgsBox3D &rect ) final;
2846
2847 private slots:
2848 void invalidateSymbolCountedFlag();
2849 void onFeatureCounterCompleted();
2850 void onFeatureCounterTerminated();
2851 void onJoinedFieldsChanged();
2852 void onFeatureAdded( QgsFeatureId fid );
2853 void onFeatureDeleted( QgsFeatureId fid );
2854 void onRelationsLoaded();
2855 void onSymbolsCounted();
2856 void onDirtyTransaction( const QString &sql, const QString &name );
2857 void emitDataChanged();
2858
2859 private:
2860 void updateDefaultValues( QgsFeatureId fid, QgsFeature feature = QgsFeature(), QgsExpressionContext *context = nullptr );
2861
2871 bool isReadOnly() const final;
2872
2879 bool setDataProvider( QString const &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() );
2880
2892 void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags ) override;
2893
2895 void readSldLabeling( const QDomNode &node );
2896
2898 bool readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSettings &settings ) const;
2899
2901 QgsAbstractVectorLayerLabeling *readLabelingFromCustomProperties();
2902
2903 bool deleteFeatureCascade( QgsFeatureId fid, DeleteContext *context = nullptr );
2904
2905#ifdef SIP_RUN
2906 QgsVectorLayer( const QgsVectorLayer &rhs );
2907#endif
2909 void minimumOrMaximumValue( int index, QVariant *minimum, QVariant *maximum ) const;
2910
2911 void createEditBuffer();
2912 void clearEditBuffer();
2913
2914 QgsConditionalLayerStyles *mConditionalStyles = nullptr;
2915 QgsVectorDataProvider *mDataProvider = nullptr;
2916 QgsVectorLayerSelectionProperties *mSelectionProperties = nullptr;
2917 QgsVectorLayerTemporalProperties *mTemporalProperties = nullptr;
2918 QgsVectorLayerElevationProperties *mElevationProperties = nullptr;
2919
2921 QString mDisplayExpression;
2922
2924 QgsActionManager *mActions = nullptr;
2925
2927 bool mDataSourceReadOnly = false;
2928
2935 bool mReadOnly = false;
2936
2942 QgsFeatureIds mSelectedFeatureIds;
2943
2947 QgsFeatureIds mPreviousSelectedFeatureIds;
2948
2950 QgsFields mFields;
2951
2953 QgsStringMap mAttributeAliasMap;
2954
2956 QMap<QString, QgsDefaultValue> mDefaultExpressionMap;
2957
2959 QMap< QString, Qgis::FieldDomainSplitPolicy > mAttributeSplitPolicy;
2960
2962 QMap< QString, Qgis::FieldDuplicatePolicy > mAttributeDuplicatePolicy;
2963
2965 QMap< QString, Qgis::FieldDomainMergePolicy > mAttributeMergePolicy;
2966
2968 QSet<int> mDefaultValueOnUpdateFields;
2969
2971 QMap< QString, QgsFieldConstraints::Constraints > mFieldConstraints;
2972
2974 QMap< QPair< QString, QgsFieldConstraints::Constraint >, QgsFieldConstraints::ConstraintStrength > mFieldConstraintStrength;
2975
2977 QMap< QString, QPair< QString, QString > > mFieldConstraintExpressions;
2978
2979 QMap< QString, Qgis::FieldConfigurationFlags > mFieldConfigurationFlags;
2980 QMap< QString, QgsEditorWidgetSetup > mFieldWidgetSetups;
2981
2983 QgsEditFormConfig mEditFormConfig;
2984
2987
2989 QgsFeatureRenderer *mRenderer = nullptr;
2990
2992 QgsVectorSimplifyMethod mSimplifyMethod;
2993
2995 QgsAbstractVectorLayerLabeling *mLabeling = nullptr;
2996
2998 bool mLabelsEnabled = false;
2999
3001 bool mLabelFontNotFoundNotified = false;
3002
3004 QPainter::CompositionMode mFeatureBlendMode = QPainter::CompositionMode_SourceOver;
3005
3007 bool mVertexMarkerOnlyForSelection = false;
3008
3009 QStringList mCommitErrors;
3010
3012 QgsVectorLayerEditBuffer *mEditBuffer = nullptr;
3016
3017 //stores information about joined layers
3018 QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
3019
3021 QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;
3022
3023 //diagram rendering object. 0 if diagram drawing is disabled
3024 QgsDiagramRenderer *mDiagramRenderer = nullptr;
3025
3026 //stores infos about diagram placement (placement type, priority, position distance)
3027 QgsDiagramLayerSettings *mDiagramLayerSettings = nullptr;
3028
3029 mutable bool mValidExtent2D = false;
3030 mutable bool mLazyExtent2D = true;
3031 mutable bool mValidExtent3D = false;
3032 mutable bool mLazyExtent3D = true;
3033
3035 std::unique_ptr<QgsAuxiliaryLayer> mAuxiliaryLayer;
3036
3038 QString mAuxiliaryLayerKey;
3039
3040 // Features in renderer classes counted
3041 bool mSymbolFeatureCounted = false;
3042
3043 // Feature counts for each renderer legend key
3044 QHash<QString, long long> mSymbolFeatureCountMap;
3045 QHash<QString, QgsFeatureIds> mSymbolFeatureIdMap;
3046
3048 bool mEditCommandActive = false;
3049
3051 bool mCommitChangesActive = false;
3052
3053 bool mReadExtentFromXml;
3054 QgsRectangle mXmlExtent2D;
3055 QgsBox3D mXmlExtent3D;
3056
3057 QgsFeatureIds mDeletedFids;
3058
3059 QgsAttributeTableConfig mAttributeTableConfig;
3060
3061 mutable QMutex mFeatureSourceConstructorMutex;
3062
3063 QgsVectorLayerFeatureCounter *mFeatureCounter = nullptr;
3064
3065 std::unique_ptr<QgsGeometryOptions> mGeometryOptions;
3066
3067 bool mAllowCommit = true;
3068
3070 QgsStoredExpressionManager *mStoredExpressionManager = nullptr;
3071
3073
3075 bool mDataChangedFired = false;
3076
3077 QList<QgsWeakRelation> mWeakRelations;
3078
3079 bool mSetLegendFromStyle = false;
3080
3081 QList< QgsFeatureRendererGenerator * > mRendererGenerators;
3082
3084 QTimer *mRefreshRendererTimer = nullptr;
3085
3089 bool mLoadAllStoredStyle = false;
3090
3091};
3092
3093
3094
3095// clazy:excludeall=qstring-allocations
3096
3097#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
GeometryOperationResult
Success or failure of a geometry operation.
Definition qgis.h:2042
SpatialIndexPresence
Enumeration of spatial index presence states.
Definition qgis.h:558
VectorRenderingSimplificationFlag
Simplification flags for vector feature rendering.
Definition qgis.h:3029
FieldDomainMergePolicy
Merge policy for field domains.
Definition qgis.h:3923
FieldDomainSplitPolicy
Split policy for field domains.
Definition qgis.h:3906
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:358
FieldDuplicatePolicy
Duplicate policy for fields.
Definition qgis.h:3943
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition qgis.h:1833
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:277
@ Unknown
Unknown.
Definition qgis.h:278
FieldConfigurationFlag
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1721
QFlags< FieldConfigurationFlag > FieldConfigurationFlags
Configuration flags for fields These flags are meant to be user-configurable and are not describing a...
Definition qgis.h:1736
SelectBehavior
Specifies how a selection should be applied.
Definition qgis.h:1771
@ SetSelection
Set selection, removing any existing selection.
Definition qgis.h:1772
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:42
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:58
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:54
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:80
QString name
Definition qgsmaplayer.h:84
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:83
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:96
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:60
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
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:109
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:231
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
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:7132
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_PYNAME(name)
Definition qgis_sip.h:89
#define SIP_PYARGREMOVE
Definition qgis_sip.h:159
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:84
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:28
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.