QGIS API Documentation 3.35.0-Master (6cf940c20d6)
Loading...
Searching...
No Matches
qgsdataprovider.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsdataprovider.cpp - DataProvider Interface
3 --------------------------------------
4 Date : May 2016
5 Copyright : (C) 2016 by Matthias Kuhn
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include <QMutexLocker>
17#include "qgsdataprovider.h"
19#include "qgsthreadingutils.h"
20
21#define SUBLAYER_SEPARATOR QStringLiteral( "!!::!!" )
22
23QgsDataProvider::QgsDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions,
24 QgsDataProvider::ReadFlags flags )
25 : mDataSourceURI( uri ),
26 mOptions( providerOptions )
27{
29}
30
32{
34
35 return QString();
36}
37
38Qgis::DataProviderFlags QgsDataProvider::flags() const
39{
41
42 return Qgis::DataProviderFlags();
43}
44
51
58
65
72
74{
75 // Because QgsVirtualLayerTask is not thread safe:
77
78 reloadProviderData();
79 emit dataChanged();
80}
81
83{
85
86 mProviderProperties.insert( property, value );
87}
88
89void QgsDataProvider::setProviderProperty( int property, const QVariant &value )
90{
92
93 mProviderProperties.insert( property, value );
94}
95
96QVariant QgsDataProvider::providerProperty( QgsDataProvider::ProviderProperty property, const QVariant &defaultValue ) const
97{
99
100 return mProviderProperties.value( property, defaultValue );
101}
102
103QVariant QgsDataProvider::providerProperty( int property, const QVariant &defaultValue = QVariant() ) const
104{
106
107 return mProviderProperties.value( property, defaultValue );
108}
109
110void QgsDataProvider::setListening( bool isListening )
111{
113
114 Q_UNUSED( isListening )
115}
116
123
125{
127
128 const QMutexLocker locker( &mOptionsMutex );
129 return mOptions.transformContext;
130}
131
133{
135
136 const QMutexLocker locker( &mOptionsMutex );
137 mOptions.transformContext = value;
138}
139
144
145Qgis::ProviderStyleStorageCapabilities QgsDataProvider::styleStorageCapabilities() const
146{
147 return Qgis::ProviderStyleStorageCapabilities();
148}
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.
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
virtual void setListening(bool isListening)
Set whether the provider will listen to datasource notifications If set, the provider will issue noti...
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
void setProviderProperty(ProviderProperty property, const QVariant &value)
Allows setting arbitrary properties on the provider.
void dataChanged()
Emitted whenever a change is made to the data provider which may have caused changes in the provider'...
virtual Qgis::ProviderStyleStorageCapabilities styleStorageCapabilities() const
Returns the style storage capabilities.
ProviderProperty
Properties are used to pass custom configuration options into data providers.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), QgsDataProvider::ReadFlags flags=QgsDataProvider::ReadFlags())
Create a new dataprovider with the specified in the uri.
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
QgsDataProvider::ReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when needed.
static QString sublayerSeparator()
String sequence used for separating components of sublayers strings.
QVariant providerProperty(ProviderProperty property, const QVariant &defaultValue=QVariant()) const
Gets the current value of a certain provider property.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this data provider.
virtual QgsDataProviderElevationProperties * elevationProperties()
Returns the provider's elevation properties.
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
virtual void reloadData()
Reloads the data from the source for providers with data caches to synchronize, changes in the data s...
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets data coordinate transform context to transformContext.
#define SUBLAYER_SEPARATOR
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS_NON_FATAL
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
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.