15 #ifndef QGSVECTORDATAPROVIDER_H 16 #define QGSVECTORDATAPROVIDER_H 70 DeleteFeatures = 1 << 1,
72 ChangeAttributeValues = 1 << 2,
74 AddAttributes = 1 << 3,
76 DeleteAttributes = 1 << 4,
78 SaveAsShapefile = 1 << 5,
80 CreateSpatialIndex = 1 << 6,
84 ChangeGeometries = 1 << 8,
86 SelectGeometryAtId = 1 << 9,
88 RandomSelectGeometryAtId = 1 << 10,
90 SequentialSelectGeometryAtId = 1 << 11,
92 CreateAttributeIndex = 1 << 12,
94 SelectEncoding = 1 << 13,
96 SimplifyGeometries = 1 << 14,
98 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
100 TransactionSupport = 1 << 16,
102 CircularGeometries = 1 << 17,
106 ChangeFeatures = 1 << 18,
108 RenameAttributes = 1 << 19,
112 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
113 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
148 virtual QString storageType()
const;
165 virtual long featureCount()
const = 0;
173 virtual const QgsFields &fields()
const = 0;
179 virtual QString dataComment()
const;
268 virtual bool renameAttributes(
const QgsFieldNameMap& renamedAttributes );
293 virtual QVariant defaultValue(
int fieldId,
bool forceLazyEval =
false );
302 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
308 virtual bool createSpatialIndex();
311 virtual bool createAttributeIndex(
int field );
318 virtual int capabilities()
const;
323 QString capabilitiesString()
const;
328 virtual void setEncoding(
const QString& e );
338 int fieldNameIndex(
const QString& fieldName )
const;
363 bool supportedType(
const QgsField &field )
const;
367 NativeType(
const QString& typeDesc,
const QString& typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 )
368 : mTypeDesc( typeDesc )
369 , mTypeName( typeName )
373 , mMinPrec( minPrec )
374 , mMaxPrec( maxPrec )
422 static QVariant convertValue( QVariant::Type type,
const QString& value );
448 void raiseError(
const QString& msg );
451 void clearMinMaxCache();
452 void fillMinMaxCache();
466 void pushError(
const QString& msg );
Wrapper for iterator of features from vector data provider or vector layer.
virtual bool addFeatures(QgsFeatureList &features)
Insert a copy of the given features into the layer (but does not commit it)
QgsAttributeList mAttributesToFetch
List of attribute indices to fetch with nextFeature calls.
virtual void enumValues(int index, QStringList &enumList)
Returns the possible enum values of an attribute.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
WkbType
Used for symbology operations.
Abstract base class for spatial data provider implementations.
QList< int > QgsAttributeList
virtual QgsAttributeList pkAttributeIndexes()
Return list of indexes of fields that make up the primary key.
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
QSet< int > QgsAttributeIds
QTextCodec * mEncoding
Encoding.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Capability
enumeration with capabilities that providers might implement
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QList< NativeType > mNativeTypes
The names of the providers native types.
virtual bool deleteFeatures(const QgsFeatureIds &fid)
Deletes a set of features from the layer (but does not commit it)
Encapsulate a field in an attribute table or data source.
virtual bool changeAttributeValues(QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues)
Changes values of attributes (but does not commit it).
Base class that can be used for any class that is capable of returning features.
virtual QgsTransaction * transaction() const
Returns the transaction this data provider is included in, if any.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
QgsAttrPalIndexNameHash mAttrPalIndexName
Old-style mapping of index to name for QgsPalLabeling fix.
NativeType(const QString &typeDesc, const QString &typeName, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0)
virtual void forceReload()
Forces a reload of the underlying datasource if the provider implements this method.
This is the base class for vector data providers.
virtual QgsAttrPalIndexNameHash palAttributeIndexNames() const
Return list of indexes to names for QgsPalLabeling fix.
QHash< int, QString > QgsAttrPalIndexNameHash
Aggregate
Available aggregates to calculate.
QMap< int, QVariant > mCacheMinValues
virtual bool isSaveAndLoadStyleToDBSupported()
It returns false by default.
A bundle of parameters controlling aggregate calculation.