15#ifndef QGSVECTORDATAPROVIDER_H
16#define QGSVECTORDATAPROVIDER_H
76 DeleteFeatures = 1 << 1,
77 ChangeAttributeValues = 1 << 2,
78 AddAttributes = 1 << 3,
79 DeleteAttributes = 1 << 4,
80 CreateSpatialIndex = 1 << 6,
82 ChangeGeometries = 1 << 8,
83 SelectEncoding = 1 << 13,
84 CreateAttributeIndex = 1 << 12,
85 SimplifyGeometries = 1 << 14,
86 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
87 TransactionSupport = 1 << 16,
88 CircularGeometries = 1 << 17,
89 ChangeFeatures = 1 << 18,
90 RenameAttributes = 1 << 19,
91 FastTruncate = 1 << 20,
92 ReadLayerMetadata = 1 << 21,
93 WriteLayerMetadata = 1 << 22,
94 CancelSupport = 1 << 23,
95 CreateRenderer = 1 << 24,
96 CreateLabeling = 1 << 25,
98 FeatureSymbology = 1 << 27,
101 Q_DECLARE_FLAGS( Capabilities, Capability )
104 static const
int EditingCapabilities = AddFeatures | DeleteFeatures |
105 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
139 virtual QString storageType() const;
151 Qgis::WkbType wkbType() const override = 0;
157 long long featureCount() const override = 0;
164 virtual
bool empty() const;
175 virtual
bool isSqlQuery() const;
183 virtual
Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
195 Qgis::FeatureAvailability hasFeatures() const override;
204 QgsBox3D sourceExtent3D() const override;
205 QString sourceName()
const override {
return QString(); }
242 virtual QStringList uniqueStringsMatching(
int index,
const QString &substring,
int limit = -1,
269 virtual void enumValues(
int index, QStringList &enumList
SIP_OUT )
const { Q_UNUSED( index ) enumList.clear(); }
288 virtual bool truncate();
296 virtual bool cancelReload();
303 virtual bool addAttributes(
const QList<QgsField> &attributes );
321 virtual bool renameAttributes(
const QgsFieldNameMap &renamedAttributes );
358 virtual QVariant defaultValue(
int fieldIndex )
const;
366 virtual QString defaultValueClause(
int fieldIndex )
const;
373 QgsFieldConstraints::Constraints fieldConstraints(
int fieldIndex )
const;
390 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
396 virtual bool createSpatialIndex();
399 virtual bool createAttributeIndex(
int field );
409 Q_INVOKABLE
virtual QgsVectorDataProvider::Capabilities capabilities()
const;
414 QString capabilitiesString()
const;
422 virtual Qgis::VectorDataProviderAttributeEditCapabilities attributeEditCapabilities()
const;
436 virtual void setEncoding(
const QString &e );
443 QString encoding()
const;
448 int fieldNameIndex(
const QString &fieldName )
const;
453 QMap<QString, int> fieldNameMap()
const;
475 bool supportedType( const
QgsField &field ) const;
479 NativeType(
const QString &typeDesc,
const QString &
typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0, QVariant::Type subType = QVariant::Invalid )
480 : mTypeDesc( typeDesc )
485 , mMinPrec( minPrec )
486 , mMaxPrec( maxPrec )
487 , mSubType( subType )
503 QList< QgsVectorDataProvider::NativeType > nativeTypes()
const;
512 static QStringList availableEncodings();
517 bool hasErrors()
const;
527 QStringList errors()
const;
563 static QVariant convertValue( QVariant::Type type, const QString &value );
578 virtual QSet<QgsMapLayerDependency> dependencies()
const;
586 virtual QList<QgsRelation> discoverRelations(
const QgsVectorLayer *target,
const QList<QgsVectorLayer *> &layers )
const;
592 virtual QVariantMap
metadata()
const {
return QVariantMap(); }
607 virtual QString
translateMetadataValue(
const QString &mdKey,
const QVariant &value )
const { Q_UNUSED( mdKey )
return value.toString(); }
637 void raiseError( const QString &msg ) const;
645 void clearMinMaxCache();
650 void fillMinMaxCache() const;
660 void pushError( const QString &msg ) const;
682 QTextCodec *textEncoding()
const;
694 mutable bool mCacheMinMaxDirty =
true;
695 mutable QMap<int, QVariant> mCacheMinValues, mCacheMaxValues;
698 QTextCodec *mEncoding =
nullptr;
704 QList< NativeType > mNativeTypes;
707 mutable QStringList mErrors;
709 std::unique_ptr< QgsVectorDataProviderTemporalCapabilities > mTemporalCapabilities;
710 std::unique_ptr< QgsDataProviderElevationProperties > mElevationProperties;
712 static QStringList sEncodings;
The Qgis class provides global constants for use throughout the application.
Aggregate
Available aggregates to calculate.
WkbType
The WKB type describes the number of dimensions a geometry has.
Base class that can be used for any class that is capable of returning features.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
A 3-dimensional box composed of x, y, z coordinates.
This class represents a coordinate reference system (CRS).
Base class for handling elevation related properties for a data provider.
Abstract base class for spatial data provider implementations.
virtual QString dataComment() const
Returns a short comment for the data that this provider is providing access to (e....
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
virtual void reloadData()
Reloads the data from the source for providers with data caches to synchronize, changes in the data s...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Wrapper for iterator of features from vector data provider or vector layer.
This class 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 QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
An interface for objects which provide features via a getFeatures method.
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error.
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Constraint
Constraints which may be present on a field.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Implementation of data provider temporal properties for QgsVectorDataProviders.
This is the base class for vector data providers.
virtual void enumValues(int index, QStringList &enumList) const
Returns the possible enum values of an attribute.
Capability
enumeration with capabilities that providers might implement
virtual QString translateMetadataValue(const QString &mdKey, const QVariant &value) const
Gets the translated metadata value.
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
virtual bool hasMetadata() const
Returns true if the data source has metadata, false otherwise.
virtual QString translateMetadataKey(const QString &mdKey) const
Gets the translated metadata key.
virtual QVariantMap metadata() const
Gets metadata, dependent on the provider type, that will be display in the metadata tab of the layer ...
Represents a vector layer which manages a vector based data sets.
#define SIP_ENUM_BASETYPE(type)
QMap< int, QString > QgsFieldNameMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
QList< int > QgsAttributeList
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
QList< int > QgsAttributeList
QSet< int > QgsAttributeIds
QHash< int, QString > QgsAttrPalIndexNameHash
const QgsAttributeList & attributeIndexes
A bundle of parameters controlling aggregate calculation.
Setting options for creating vector data providers.
NativeType(const QString &typeDesc, const QString &typeName, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0, QVariant::Type subType=QVariant::Invalid)