15 #ifndef QGSVECTORDATAPROVIDER_H
16 #define QGSVECTORDATAPROVIDER_H
65 DeleteFeatures = 1 << 1,
67 ChangeAttributeValues = 1 << 2,
69 AddAttributes = 1 << 3,
71 DeleteAttributes = 1 << 4,
73 SaveAsShapefile = 1 << 5,
75 CreateSpatialIndex = 1 << 6,
79 ChangeGeometries = 1 << 8,
81 SelectGeometryAtId = 1 << 9,
83 RandomSelectGeometryAtId = 1 << 10,
85 SequentialSelectGeometryAtId = 1 << 11,
86 CreateAttributeIndex = 1 << 12,
88 SelectEncoding = 1 << 13,
90 SimplifyGeometries = 1 << 14,
92 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
96 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
97 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes;
131 virtual QString storageType()
const;
148 virtual long featureCount()
const = 0;
155 virtual const QgsFields &fields()
const = 0;
161 virtual QString dataComment()
const;
171 virtual QVariant minimumValue(
int index );
181 virtual QVariant maximumValue(
int index );
191 virtual void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
200 virtual void enumValues(
int index, QStringList& enumList ) { Q_UNUSED( index ); enumList.clear(); }
221 virtual bool addAttributes(
const QList<QgsField> &attributes );
240 virtual QVariant defaultValue(
int fieldId );
249 virtual bool changeGeometryValues(
QgsGeometryMap & geometry_map );
255 virtual bool createSpatialIndex();
258 virtual bool createAttributeIndex(
int field );
265 virtual int capabilities()
const;
270 QString capabilitiesString()
const;
275 virtual void setEncoding(
const QString& e );
280 QString encoding()
const;
285 int fieldNameIndex(
const QString& fieldName )
const;
290 QMap<QString, int> fieldNameMap()
const;
312 bool supportedType(
const QgsField &field )
const;
316 NativeType( QString typeDesc, QString typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 ) :
317 mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMinLen( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {};
332 const QList< NativeType > &nativeTypes()
const;
340 static const QStringList &availableEncodings();
358 QStringList errors();
367 static QVariant convertValue( QVariant::Type type, QString value );
370 void clearMinMaxCache();
371 void fillMinMaxCache();
391 void pushError( QString msg );
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
bool mFetchGeom
True if geometry should be added to the features in nextFeature calls.
QMap< QString, QVariant::Type > mOldTypeList
old notation
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.
QSet< QgsFeatureId > QgsFeatureIds
QList< QgsFeature > QgsFeatureList
NativeType(QString typeDesc, QString typeName, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0)
Container of fields for a vector layer.
Abstract base class for spatial data provider implementations.
QList< int > QgsAttributeList
WkbType
Used for symbology operations.
virtual QgsAttributeList pkAttributeIndexes()
Return list of indexes of fields that make up the primary key.
virtual QgsAbstractFeatureSource * featureSource() const
Return feature source object that can be used for querying provider's data.
bool mFetchFeaturesWithoutGeom
should provider fetch also features that don't have geometry?
QSet< int > QgsAttributeIds
QTextCodec * mEncoding
Encoding.
virtual QgsAttrPalIndexNameHash palAttributeIndexNames() const
Return list of indexes to names for QgsPalLabeling fix.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QList< int > QgsAttributeList
QList< NativeType > mNativeTypes
The names of the providers native types.
Encapsulate a field in an attribute table or data source.
base class that can be used for any class that is capable of returning features
QStringList mErrors
list of errors
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
static QStringList smEncodings
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
Capability
enumeration with capabilities that providers might implement
QgsAttrPalIndexNameHash mAttrPalIndexName
Old-style mapping of index to name for QgsPalLabeling fix.
This is the base class for vector data providers.
QHash< int, QString > QgsAttrPalIndexNameHash
QMap< int, QVariant > mCacheMinValues
virtual bool isSaveAndLoadStyleToDBSupported()
It returns false by default.