QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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
6  email : [email protected]
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 
20 #define SUBLAYER_SEPARATOR QStringLiteral( "!!::!!" )
21 
22 QgsDataProvider::QgsDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions,
23  QgsDataProvider::ReadFlags flags )
24  : mDataSourceURI( uri ),
25  mOptions( providerOptions )
26 {
27  mReadFlags = flags;
28 }
29 
31 {
32  return nullptr;
33 }
34 
36 {
37  return nullptr;
38 }
39 
41 {
42  reloadProviderData();
43  emit dataChanged();
44 }
45 
47 {
48  mProviderProperties.insert( property, value );
49 }
50 
51 void QgsDataProvider::setProviderProperty( int property, const QVariant &value )
52 {
53  mProviderProperties.insert( property, value );
54 }
55 
56 QVariant QgsDataProvider::providerProperty( QgsDataProvider::ProviderProperty property, const QVariant &defaultValue ) const
57 {
58  return mProviderProperties.value( property, defaultValue );
59 }
60 
61 QVariant QgsDataProvider::providerProperty( int property, const QVariant &defaultValue = QVariant() ) const
62 {
63  return mProviderProperties.value( property, defaultValue );
64 }
65 
66 void QgsDataProvider::setListening( bool isListening )
67 {
68  Q_UNUSED( isListening )
69 }
70 
72 {
73  return context.lastRenderingTimeMs <= context.maxRenderingTimeMs;
74 }
75 
77 {
78  QMutexLocker locker( &mOptionsMutex );
79  return mOptions.transformContext;
80 }
81 
83 {
84  QMutexLocker locker( &mOptionsMutex );
85  mOptions.transformContext = value;
86 }
87 
89 {
90  return SUBLAYER_SEPARATOR;
91 }
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:58
QgsDataProvider::ProviderOptions
Setting options for creating vector data providers.
Definition: qgsdataprovider.h:105
qgsdataprovidertemporalcapabilities.h
QgsDataProvider::QgsDataProvider
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.
Definition: qgsdataprovider.cpp:22
QgsDataProvider::dataChanged
void dataChanged()
Emitted whenever a change is made to the data provider which may have caused changes in the provider'...
QgsDataProvider::ProviderProperty
ProviderProperty
Properties are used to pass custom configuration options into data providers.
Definition: qgsdataprovider.h:91
QgsDataProvider::transformContext
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
Definition: qgsdataprovider.cpp:76
QgsDataProviderTemporalCapabilities
Base class for handling properties relating to a data provider's temporal capabilities.
Definition: qgsdataprovidertemporalcapabilities.h:34
QgsDataProvider::reloadData
virtual void reloadData()
Reloads the data from the source by calling reloadProviderData() implemented by providers with data c...
Definition: qgsdataprovider.cpp:40
QgsDataProvider::PreviewContext
Stores settings related to the context in which a preview job runs.
Definition: qgsdataprovider.h:526
SUBLAYER_SEPARATOR
#define SUBLAYER_SEPARATOR
Definition: qgsdataprovider.cpp:20
QgsDataProvider::PreviewContext::maxRenderingTimeMs
double maxRenderingTimeMs
Default maximum allowable render time, in ms.
Definition: qgsdataprovider.h:531
QgsDataProvider::renderInPreview
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
Definition: qgsdataprovider.cpp:71
QgsDataProvider::mReadFlags
QgsDataProvider::ReadFlags mReadFlags
Read flags. It's up to the subclass to respect these when needed.
Definition: qgsdataprovider.h:649
QgsDataProvider::setTransformContext
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets data coordinate transform context to transformContext.
Definition: qgsdataprovider.cpp:82
QgsDataProvider::temporalCapabilities
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
Definition: qgsdataprovider.cpp:30
QgsDataProvider::sublayerSeparator
static QString sublayerSeparator()
String sequence used for separating components of sublayers strings.
Definition: qgsdataprovider.cpp:88
QgsDataProvider::setProviderProperty
void setProviderProperty(ProviderProperty property, const QVariant &value)
Allows setting arbitrary properties on the provider.
Definition: qgsdataprovider.cpp:46
QgsDataProvider::ProviderOptions::transformContext
QgsCoordinateTransformContext transformContext
Coordinate transform context.
Definition: qgsdataprovider.h:110
qgsdataprovider.h
QgsDataProvider::PreviewContext::lastRenderingTimeMs
double lastRenderingTimeMs
Previous rendering time for the layer, in ms.
Definition: qgsdataprovider.h:528
QgsDataProvider::providerProperty
QVariant providerProperty(ProviderProperty property, const QVariant &defaultValue=QVariant()) const
Gets the current value of a certain provider property.
Definition: qgsdataprovider.cpp:56
QgsDataProvider::setListening
virtual void setListening(bool isListening)
Set whether the provider will listen to datasource notifications If set, the provider will issue noti...
Definition: qgsdataprovider.cpp:66