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();
qlonglong toLongLong(bool *ok) const
QString encoding() const
Get encoding which is used for accessing data.
Wrapper for iterator of features from vector data provider or vector layer.
static QVariant convertValue(QVariant::Type type, const QString &value)
QgsAttributes attributes() const
Returns the feature's attributes.
QMap< QString, int > fieldNameMap() const
Return a map where the key is the name of the field and the value is its index.
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.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
Circular string geometry type.
Supports simplification of geometries on provider side according to a distance tolerance.
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.
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.
int precision() const
Gets the precision of the field.
QMap< int, QVariant > mCacheMaxValues
Abstract base class for spatial data provider implementations.
Allows deletion of attributes (fields)
QString join(const QString &separator) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
virtual bool addFeatures(QgsFeatureList &flist)
Adds a list of features.
int count() const
Return number of items.
QString tr(const char *sourceText, const char *disambiguation, int n)
QTextCodec * codecForLocale()
QString name() const
Gets the name of the field.
virtual QString name() const =0
Return a provider name.
virtual bool createAttributeIndex(int field)
Create an attribute index on the datasource.
virtual QgsAbstractGeometryV2 * toCurveType() const
Returns the geometry converted to the more generic curve type.
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.
bool supportedType(const QgsField &field) const
check if provider supports type of field
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
Allows creation of spatial index.
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).
QString number(int n, int base)
void append(const T &value)
QTextCodec * mEncoding
Encoding.
QgsAttributeList allAttributesList() const
Utility function to get list of attribute indexes.
int toInt(bool *ok) const
Allows addition of new attributes (fields)
#define QgsDebugMsgLevel(str, level)
static bool isCurvedType(Type type)
Returns true if the WKB type is a curved type or can contain curved geometries.
bool hasErrors()
Provider has errors to report.
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.
const char * constData() const
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)
virtual QSet< QString > layerDependencies() const
Get the list of layer ids on which this layer depends.
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.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
bool isEmpty() const
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry)...
Allows modifications of geometries.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Query the provider for features specified in request.
void clearErrors()
Clear recorded errors.
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.
const QList< NativeType > & nativeTypes() const
Returns the names of the supported types.
virtual QGis::WkbType geometryType() const =0
Get feature type.
Fast access to features using their ID.
virtual bool changeGeometryValues(const QgsGeometryMap &geometry_map)
Changes geometries of existing features.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
static QgsAbstractGeometryV2 * geomFromWkbType(QgsWKBTypes::Type t)
Return empty geometry from wkb type.
Compound curve geometry type.
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.
Supports joint updates for attributes and geometry Providers supporting this should still define Chan...
Supports topological simplification of geometries on provider side according to a distance tolerance...
QString capabilitiesString() const
Returns the above in friendly format.
const char * typeToName(Type typ)
const T & at(int i) const
QVariant value(const QString &key, const QVariant &defaultValue) const
QList< QByteArray > availableCodecs()
const QgsCurveV2 * curveAt(int i) const
Returns the curve at the specified index.
virtual const QgsFields & fields() const =0
Return a map of indexes with field names for this layer.
QgsAbstractGeometryV2 * geometry() const
Returns the underlying geometry store.
virtual QVariant defaultValue(int fieldId)
Returns the default value for field specified by fieldId.
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
virtual QVariant minimumValue(int index)
Returns the minimum value of an attribute.
QTextCodec * codecForName(const QByteArray &name)
virtual QString dataComment() const
Return a short comment for the data that this provider is providing access to (e.g.
virtual bool addGeometry(QgsAbstractGeometryV2 *g)
Adds a geometry and takes ownership.
virtual ~QgsVectorDataProvider()
Destructor.
int length() const
Gets the length of the field.
virtual bool deleteAttributes(const QgsAttributeIds &attributes)
Deletes existing attributes.
virtual QgsAbstractGeometryV2 * segmentize() const
Returns a version of the geometry without curves.
int nCurves() const
Returns the number of curves in the geometry.
Allows deletion of features.
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)
void pushError(const QString &msg)
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
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)
Provider has no capabilities.
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.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
int compare(const QString &other) const
QgsGeometry * convertToProviderType(const QgsGeometry &geom) const
Converts the geometry to the provider type if possible / necessary.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Allows modification of attribute values.
bool isNull(const QVariant &v)
QMap< int, QVariant > mCacheMinValues