38 , mCacheMinMaxDirty( true )
52 return "Generic vector file";
74 Q_UNUSED( attributes );
80 Q_UNUSED( attributes );
98 Q_UNUSED( geometry_map );
105 Q_UNUSED( attr_map );
106 Q_UNUSED( geometry_map );
164 abilitiesList +=
tr(
"Add Features" );
170 abilitiesList +=
tr(
"Delete Features" );
176 abilitiesList +=
tr(
"Change Attribute Values" );
177 QgsDebugMsg(
"Capability: Change Attribute Values" );
182 abilitiesList +=
tr(
"Add Attributes" );
188 abilitiesList +=
tr(
"Delete Attributes" );
195 abilitiesList +=
tr(
"Create Spatial Index" );
201 abilitiesList +=
tr(
"Fast Access to Features at ID" );
207 abilitiesList +=
tr(
"Change Geometries" );
213 abilitiesList +=
tr(
"Presimplify Geometries" );
214 QgsDebugMsg(
"Capability: Simplify Geometries before fetching the feature" );
219 abilitiesList +=
tr(
"Presimplify Geometries with Validity Check" );
220 QgsDebugMsg(
"Capability: Simplify Geometries before fetch the feature ensuring that the result is a valid geometry" );
225 abilitiesList +=
tr(
"Simultaneous Geometry and Attribute Updates" );
226 QgsDebugMsg(
"Capability: change both feature attributes and geometry at once" );
229 return abilitiesList.
join(
", " );
237 for (
int i = 0; i < theFields.
count(); ++i )
252 for (
int i = 0; i < theFields.
count(); ++i )
280 QgsDebugMsgLevel(
QString(
"native field type = %1 min length = %2 max length = %3 min precision = %4 max precision = %5" )
290 if ( field.
length() == -1 )
340 if ( index < 0 || index >=
fields().count() )
356 if ( index < 0 || index >=
fields().count() )
388 if ( limit >= 0 && values.
size() >= limit )
404 for (
int i = 0; i < flds.
count(); ++i )
406 if ( flds[i].type() == QVariant::Int )
411 else if ( flds[i].type() == QVariant::LongLong )
416 else if ( flds[i].type() == QVariant::Double )
443 if ( flds[*it].type() == QVariant::Int )
445 int value = varValue.
toInt();
451 else if ( flds[*it].type() == QVariant::LongLong )
459 else if ( flds[*it].type() == QVariant::Double )
506 smEncodings << codec;
509 smEncodings <<
"BIG5";
510 smEncodings <<
"BIG5-HKSCS";
511 smEncodings <<
"EUCJP";
512 smEncodings <<
"EUCKR";
513 smEncodings <<
"GB2312";
514 smEncodings <<
"GBK";
515 smEncodings <<
"GB18030";
516 smEncodings <<
"JIS7";
517 smEncodings <<
"SHIFT-JIS";
518 smEncodings <<
"TSCII";
519 smEncodings <<
"UTF-8";
520 smEncodings <<
"UTF-16";
521 smEncodings <<
"KOI8-R";
522 smEncodings <<
"KOI8-U";
523 smEncodings <<
"ISO8859-1";
524 smEncodings <<
"ISO8859-2";
525 smEncodings <<
"ISO8859-3";
526 smEncodings <<
"ISO8859-4";
527 smEncodings <<
"ISO8859-5";
528 smEncodings <<
"ISO8859-6";
529 smEncodings <<
"ISO8859-7";
530 smEncodings <<
"ISO8859-8";
531 smEncodings <<
"ISO8859-8-I";
532 smEncodings <<
"ISO8859-9";
533 smEncodings <<
"ISO8859-10";
534 smEncodings <<
"ISO8859-11";
535 smEncodings <<
"ISO8859-12";
536 smEncodings <<
"ISO8859-13";
537 smEncodings <<
"ISO8859-14";
538 smEncodings <<
"ISO8859-15";
539 smEncodings <<
"IBM 850";
540 smEncodings <<
"IBM 866";
541 smEncodings <<
"CP874";
542 smEncodings <<
"CP1250";
543 smEncodings <<
"CP1251";
544 smEncodings <<
"CP1252";
545 smEncodings <<
"CP1253";
546 smEncodings <<
"CP1254";
547 smEncodings <<
"CP1255";
548 smEncodings <<
"CP1256";
549 smEncodings <<
"CP1257";
550 smEncodings <<
"CP1258";
551 smEncodings <<
"Apple Roman";
552 smEncodings <<
"TIS-620";
553 smEncodings <<
"System";
606 if ( geometry->
wkbType() == providerGeomType )
619 if ( compoundCurve->
nCurves() == 1 )
622 if ( circularString )
624 outputGeom = circularString->
clone();
635 if ( geomCollection )
648 outputGeom = curveGeom;
657 if ( segmentizedGeom )
660 outputGeom = segmentizedGeom;
669 outputGeom = geometry->
clone();
677 outputGeom = geometry->
clone();
virtual QSet< QString > layerDependencies() const
Get the list of layer ids on which this layer depends.
qlonglong toLongLong(bool *ok) const
Wrapper for iterator of features from vector data provider or vector layer.
Supports topological simplification of geometries on provider side according to a distance tolerance...
Allows modification of attribute values.
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
static QVariant convertValue(QVariant::Type type, const QString &value)
Allows modifications of geometries.
bool contains(const Key &key) const
virtual QByteArray name() const =0
static bool _compareEncodings(const QString &s1, const QString &s2)
virtual bool addAttributes(const QList< QgsField > &attributes)
Adds new attributes.
QString capabilitiesString() const
Returns the above in friendly format.
QgsGeometry * convertToProviderType(const QgsGeometry &geom) const
Converts the geometry to the provider type if possible / necessary.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
QgsAbstractGeometryV2 * geometry() const
Returns the underlying geometry store.
Circular string geometry type.
virtual QgsAttributeList attributeIndexes()
Return list of indexes to fetch all attributes in nextFeature()
virtual bool deleteFeatures(const QgsFeatureIds &id)
Deletes one or more features.
virtual void setEncoding(const QString &e)
Set encoding used for accessing data from layer.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
int precision() const
Gets the precision of the field.
Allows creation of spatial index.
Abstract base class for all geometries.
virtual void uniqueValues(int index, QList< QVariant > &uniqueValues, int limit=-1)
Return unique values of an attribute.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
QStringList errors()
Get recorded errors.
QMap< int, QVariant > mCacheMaxValues
Abstract base class for spatial data provider implementations.
QString join(const QString &separator) const
const_iterator insert(const T &value)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
virtual bool addFeatures(QgsFeatureList &flist)
Adds a list of features.
QString tr(const char *sourceText, const char *disambiguation, int n)
QTextCodec * codecForLocale()
virtual QString name() const =0
Return a provider name.
virtual bool createAttributeIndex(int field)
Create an attribute index on the datasource.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
static const QStringList & availableEncodings()
Returns a list of available encodings.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
QList< Key > keys() const
QString encoding() const
Get encoding which is used for accessing data.
virtual QVariant maximumValue(int index)
Returns the maximum value of an attribute.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
Supports simplification of geometries on provider side according to a distance tolerance.
QString number(int n, int base)
void append(const T &value)
QTextCodec * mEncoding
Encoding.
bool supportedType(const QgsField &field) const
check if provider supports type of field
Fast access to features using their ID.
int toInt(bool *ok) const
#define QgsDebugMsgLevel(str, level)
virtual QString dataComment() const
Return a short comment for the data that this provider is providing access to (e.g.
static bool isCurvedType(Type type)
Returns true if the WKB type is a curved type or can contain curved geometries.
QgsAttributes attributes() const
Returns the feature's attributes.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
Provider has no capabilities.
bool hasErrors()
Provider has errors to report.
QString name() const
Gets the name of the field.
virtual bool changeAttributeValues(const QgsChangedAttributesMap &attr_map)
Changes attribute values of existing features.
virtual bool changeFeatures(const QgsChangedAttributesMap &attr_map, const QgsGeometryMap &geometry_map)
Changes attribute values and geometries of existing features.
Allows deletion of attributes (fields)
const char * constData() const
const QList< NativeType > & nativeTypes() const
Returns the names of the supported types.
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
static void logMessage(const QString &message, const QString &tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
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 QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Query the provider for features specified in request.
const QgsCurveV2 * curveAt(int i) const
Returns the curve at the specified index.
void clearErrors()
Clear recorded errors.
int count() const
Return number of items.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
Encapsulate a field in an attribute table or data source.
virtual QGis::WkbType geometryType() const =0
Get feature type.
virtual bool changeGeometryValues(const QgsGeometryMap &geometry_map)
Changes geometries of existing features.
QMap< QString, int > fieldNameMap() const
Return a map where the key is the name of the field and the value is its index.
static QgsAbstractGeometryV2 * geomFromWkbType(QgsWKBTypes::Type t)
Return empty geometry from wkb type.
Compound curve geometry type.
Allows deletion of features.
QgsVectorDataProvider(const QString &uri=QString())
Constructor of the vector provider.
QByteArray toLocal8Bit() const
void raiseError(const QString &msg)
Signals an error in this provider.
virtual QgsCircularStringV2 * clone() const override
Clones the geometry by performing a deep copy.
virtual QgsAbstractGeometryV2 * segmentize() const
Returns a version of the geometry without curves.
bool contains(const T &value) const
const char * typeToName(Type typ)
const T & at(int i) const
QVariant value(const QString &key, const QVariant &defaultValue) const
QList< QByteArray > availableCodecs()
virtual const QgsFields & fields() const =0
Return a map of indexes with field names for this layer.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
virtual QVariant defaultValue(int fieldId)
Returns the default value for field specified by fieldId.
virtual QVariant minimumValue(int index)
Returns the minimum value of an attribute.
QTextCodec * codecForName(const QByteArray &name)
virtual bool addGeometry(QgsAbstractGeometryV2 *g)
Adds a geometry and takes ownership.
int length() const
Gets the length of the field.
virtual ~QgsVectorDataProvider()
Destructor.
Supports joint updates for attributes and geometry Providers supporting this should still define Chan...
virtual bool deleteAttributes(const QgsAttributeIds &attributes)
Deletes existing attributes.
static Type flatType(Type type)
Returns the flat type for a WKB type.
double toDouble(bool *ok) const
iterator insert(const Key &key, const T &value)
bool isEmpty() const
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry)...
Allows addition of new attributes (fields)
void pushError(const QString &msg)
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
bool nextFeature(QgsFeature &f)
virtual QgsAbstractGeometryV2 * clone() const =0
Clones the geometry by performing a deep copy.
Geometry is not required. It may still be returned if e.g. required for a filter condition.
int compare(const QString &other) const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QgsAttributeList allAttributesList() const
Utility function to get list of attribute indexes.
int nCurves() const
Returns the number of curves in the geometry.
bool isNull(const QVariant &v)
QMap< int, QVariant > mCacheMinValues
virtual QgsAbstractGeometryV2 * toCurveType() const
Returns the geometry converted to the more generic curve type.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.