16#ifndef QQGSDATAPROVIDER_H
17#define QQGSDATAPROVIDER_H
46 if ( qobject_cast<QgsVectorDataProvider *>( sipCpp ) )
48 sipType = sipType_QgsVectorDataProvider;
50 else if ( qobject_cast<QgsRasterDataProvider *>( sipCpp ) )
52 sipType = sipType_QgsRasterDataProvider;
54 else if ( qobject_cast<QgsMeshDataProvider *>( sipCpp ) )
56 sipType = sipType_QgsMeshDataProvider;
58 else if ( qobject_cast<QgsPointCloudDataProvider *>( sipCpp ) )
60 sipType = sipType_QgsPointCloudDataProvider;
125 mDataSourceURI =
uri;
139 if ( expandAuthConfig && mDataSourceURI.contains( QLatin1String(
"authcfg" ) ) )
142 return uri.uri( expandAuthConfig );
146 return mDataSourceURI;
164 virtual QString htmlMetadata()
const;
178 virtual QVariantMap
metadata()
const {
return QVariantMap(); }
186 mDataSourceURI =
uri.uri(
true );
196 mDataSourceURI =
uri;
273 return extent().toBox3d( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
301 virtual QString subsetStringDialect()
const;
314 virtual QString subsetStringHelpUrl()
const;
331 virtual bool setSubsetString(
const QString &subset,
bool updateFeatureCount =
true );
339 virtual bool supportsSubsetString()
const;
357 virtual QString subsetString()
const;
369 return QStringList();
381 return QStringList();
402 if ( layers.count() < 1 )
416 if (
name.isEmpty() || !vis )
436 virtual QString
name()
const = 0;
483 virtual void reloadData();
549 void setProviderProperty( ProviderProperty property,
const QVariant &value );
556 void setProviderProperty(
int property,
const QVariant &value );
563 QVariant providerProperty( ProviderProperty property,
const QVariant &defaultValue = QVariant() )
const;
570 QVariant providerProperty(
int property,
const QVariant &defaultValue )
const;
581 virtual void setListening(
bool isListening );
657 static QString sublayerSeparator();
664 virtual
Qgis::ProviderStyleStorageCapabilities styleStorageCapabilities() const;
724 QString mDataSourceURI;
728 QMap< int, QVariant > mProviderProperties;
733 mutable QMutex mOptionsMutex;
739 virtual void reloadProviderData() {}
Provides global constants and enumerations for use throughout the application.
QFlags< DataProviderFlag > DataProviderFlags
Data provider flags.
static const int MAXIMUM_LAYER_PREVIEW_TIME_MS
Maximum rendering time for a layer of a preview job.
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
A 3-dimensional box composed of x, y, z coordinates.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Base class for handling elevation related properties for a data provider.
Base class for handling properties relating to a data provider's temporal capabilities.
virtual void invalidateConnections(const QString &connection)
Invalidate connections corresponding to specified name.
virtual bool leaveUpdateMode()
Leave update mode.
void setUri(const QgsDataSourceUri &uri)
Set the data source specification.
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 QString name() const =0
Returns a provider name.
void setError(const QgsError &error)
Sets error message.
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
void dataChanged()
Emitted whenever a change is made to the data provider which may have caused changes in the provider'...
virtual QString dataComment() const
Returns a short comment for the data that this provider is providing access to (e....
virtual QVariantMap metadata() const
Returns provider specific metadata.
void setUri(const QString &uri)
Set the data source specification.
void fullExtentCalculated()
Emitted whenever a deferred extent calculation is completed by the provider.
ProviderProperty
Properties are used to pass custom configuration options into data providers.
@ EvaluateDefaultValues
Evaluate default values on provider side when calling QgsVectorDataProvider::defaultValue( int index ...
@ CustomData
Custom properties for 3rd party providers or very provider-specific properties which are not expected...
virtual QgsBox3D extent3D() const
Returns the 3D extent of the layer.
virtual QgsLayerMetadata layerMetadata() const
Returns layer metadata collected from the provider's source.
virtual bool isValid() const =0
Returns true if this is a valid layer.
QDateTime mTimestamp
Timestamp of data in the moment when the data were loaded by provider.
virtual void setDataSourceUri(const QString &uri)
Set the data source specification.
virtual QString fileRasterFilters() const
Returns raster file filter string.
virtual QgsError error() const
Gets current status error.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags())
Create a new dataprovider with the specified in the uri.
virtual QDateTime dataTimestamp() const
Current time stamp of data source.
virtual QString dataSourceUri(bool expandAuthConfig=false) const
Gets the data source specification.
virtual QString description() const =0
Returns description.
QgsDataSourceUri uri() const
Gets the data source specification.
void notify(const QString &msg)
Emitted when the datasource issues a notification.
virtual QString fileVectorFilters() const
Returns vector file filter string.
virtual QStringList subLayerStyles() const
Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top.
Qgis::DataProviderReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when needed.
virtual void updateExtents()
Update the extents of the layer.
virtual uint subLayerCount() const
Returns the number of layers for the current data source.
virtual QStringList subLayers() const
Sub-layers handled by this provider, in order from bottom to top.
virtual bool writeLayerMetadata(const QgsLayerMetadata &metadata)
Writes layer metadata to the underlying provider source.
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
friend class TestQgsProject
virtual bool enterUpdateMode()
Enter update mode.
virtual QgsRectangle extent() const =0
Returns the extent of the layer.
virtual void setSubLayerVisibility(const QString &name, bool vis)
Set the visibility of the given sublayer name.
void appendError(const QgsErrorMessage &message)
Add error message.
Stores the component parts of a data source URI (e.g.
Represents a single error message.
A container for error messages.
A rectangle specified with double values.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Stores settings related to the context in which a preview job runs.
double maxRenderingTimeMs
Default maximum allowable render time, in ms.
double lastRenderingTimeMs
Previous rendering time for the layer, in ms.
Setting options for creating vector data providers.
QgsCoordinateTransformContext transformContext
Coordinate transform context.