16 #ifndef QQGSDATAPROVIDER_H 17 #define QQGSDATAPROVIDER_H 19 #include "qgis_core.h" 23 #include <QStringList> 45 if ( qobject_cast<QgsVectorDataProvider *>( sipCpp ) )
47 sipType = sipType_QgsVectorDataProvider;
49 else if ( qobject_cast<QgsRasterDataProvider *>( sipCpp ) )
51 sipType = sipType_QgsRasterDataProvider;
53 else if ( qobject_cast<QgsMeshDataProvider *>( sipCpp ) )
55 sipType = sipType_QgsMeshDataProvider;
69 NoDataCapabilities = 0,
106 : mDataSourceURI( uri )
126 mDataSourceURI = uri;
140 if ( expandAuthConfig && mDataSourceURI.contains( QLatin1String(
"authcfg" ) ) )
143 return uri.
uri( expandAuthConfig );
147 return mDataSourceURI;
158 mDataSourceURI = uri.
uri(
true );
182 virtual bool isValid()
const = 0;
204 Q_UNUSED( updateFeatureCount );
236 return QStringList();
255 return QStringList();
276 if ( layers.count() < 1 )
290 if ( name.isEmpty() || !vis )
313 virtual QString name()
const = 0;
328 virtual QString description()
const = 0;
369 virtual QDateTime
timestamp()
const {
return mTimestamp; }
436 void setProviderProperty(
ProviderProperty property,
const QVariant &value );
444 void setProviderProperty(
int property,
const QVariant &value );
452 QVariant providerProperty(
ProviderProperty property,
const QVariant &defaultValue = QVariant() )
const;
460 QVariant providerProperty(
int property,
const QVariant &defaultValue )
const;
472 virtual void setListening(
bool isListening );
484 double lastRenderingTimeMs = -1;
487 double maxRenderingTimeMs = MAXIMUM_LAYER_PREVIEW_TIME_MS;
533 void fullExtentCalculated();
556 void notify(
const QString &msg );
581 QString mDataSourceURI;
583 QMap< int, QVariant > mProviderProperties;
virtual void setSubLayerVisibility(const QString &name, bool vis)
Set the visibility of the given sublayer name.
virtual bool setSubsetString(const QString &subset, bool updateFeatureCount=true)
Set the subset string used to create a subset of features in the layer.
A rectangle specified with double values.
virtual QString subsetString() const
Returns the subset definition string (typically sql) currently in use by the layer and used by the pr...
static QString SUBLAYER_SEPARATOR
String sequence used for separating components of sublayers strings.
virtual void updateExtents()
Update the extents of the layer.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &options=QgsDataProvider::ProviderOptions())
Create a new dataprovider with the specified in the uri.
virtual QgsError error() const
Gets current status error.
virtual QString fileRasterFilters() const
Returns raster file filter string.
QDateTime mTimestamp
Timestamp of data in the moment when the data were loaded by provider.
virtual QStringList subLayers() const
Sub-layers handled by this provider, in order from bottom to top.
virtual uint subLayerCount() const
Returns the number of layers for the current data source.
Abstract base class for spatial data provider implementations.
const QgsCoordinateReferenceSystem & crs
virtual QgsLayerMetadata layerMetadata() const
Returns layer metadata collected from the provider's source.
virtual QDateTime dataTimestamp() const
Current time stamp of data source.
void setUri(const QgsDataSourceUri &uri)
Set the data source specification.
virtual QString dataSourceUri(bool expandAuthConfig=false) const
Gets the data source specification.
QgsDataSourceUri uri() const
Gets the data source specification.
void appendError(const QgsErrorMessage &message)
Add error message.
virtual void setLayerOrder(const QStringList &layers)
Reorder the list of layer names to be rendered by this provider (in order from bottom to top) ...
virtual bool supportsSubsetString() const
Returns true if the provider supports setting of subset strings.
QgsErrorMessage represents single error message.
virtual void setDataSourceUri(const QString &uri)
Set the data source specification.
void append(const QString &message, const QString &tag)
Append new error message.
QString uri(bool expandAuthConfig=true) const
Returns complete uri.
Setting options for creating vector data providers.
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
QgsError is container for error messages (report).
virtual QString fileVectorFilters() const
Returns vector file filter string.
void setError(const QgsError &error)
Sets error message.
virtual void reloadData()
Reloads the data from the source.
This class represents a coordinate reference system (CRS).
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
virtual bool enterUpdateMode()
Enter update mode.
virtual QStringList subLayerStyles() const
Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top...
virtual bool writeLayerMetadata(const QgsLayerMetadata &metadata)
Writes layer metadata to the underlying provider source.
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
virtual void invalidateConnections(const QString &connection)
Invalidate connections corresponding to specified name.
Stores settings related to the context in which a preview job runs.
ProviderProperty
Properties are used to pass custom configuration options into data providers.
Evaluate default values on provider side when calling QgsVectorDataProvider::defaultValue( int index ...
virtual bool leaveUpdateMode()
Leave update mode.