QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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  : mDataSourceURI( uri ),
24  mOptions( providerOptions )
25 {
26 }
27 
29 {
30  return nullptr;
31 }
32 
34 {
35  return nullptr;
36 }
37 
39 {
40  reloadProviderData();
41  emit dataChanged();
42 }
43 
45 {
46  mProviderProperties.insert( property, value );
47 }
48 
49 void QgsDataProvider::setProviderProperty( int property, const QVariant &value )
50 {
51  mProviderProperties.insert( property, value );
52 }
53 
54 QVariant QgsDataProvider::providerProperty( QgsDataProvider::ProviderProperty property, const QVariant &defaultValue ) const
55 {
56  return mProviderProperties.value( property, defaultValue );
57 }
58 
59 QVariant QgsDataProvider::providerProperty( int property, const QVariant &defaultValue = QVariant() ) const
60 {
61  return mProviderProperties.value( property, defaultValue );
62 }
63 
64 void QgsDataProvider::setListening( bool isListening )
65 {
66  Q_UNUSED( isListening )
67 }
68 
70 {
71  return context.lastRenderingTimeMs <= context.maxRenderingTimeMs;
72 }
73 
75 {
76  QMutexLocker locker( &mOptionsMutex );
77  return mOptions.transformContext;
78 }
79 
81 {
82  QMutexLocker locker( &mOptionsMutex );
83  mOptions.transformContext = value;
84 }
85 
87 {
88  return SUBLAYER_SEPARATOR;
89 }
QgsCoordinateTransformContext
Definition: qgscoordinatetransformcontext.h:57
QgsDataProvider::ProviderOptions
Setting options for creating vector data providers.
Definition: qgsdataprovider.h:104
qgsdataprovidertemporalcapabilities.h
QgsDataProvider::QgsDataProvider
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions())
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:90
QgsDataProvider::transformContext
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
Definition: qgsdataprovider.cpp:74
QgsDataProviderTemporalCapabilities
Definition: qgsdataprovidertemporalcapabilities.h:33
QgsDataProvider::reloadData
virtual void reloadData()
Reloads the data from the source by calling reloadProviderData() implemented by providers with data c...
Definition: qgsdataprovider.cpp:38
QgsDataProvider::PreviewContext
Stores settings related to the context in which a preview job runs.
Definition: qgsdataprovider.h:508
SUBLAYER_SEPARATOR
#define SUBLAYER_SEPARATOR
Definition: qgsdataprovider.cpp:20
QgsDataProvider::PreviewContext::maxRenderingTimeMs
double maxRenderingTimeMs
Default maximum allowable render time, in ms.
Definition: qgsdataprovider.h:514
QgsDataProvider::renderInPreview
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
Definition: qgsdataprovider.cpp:69
QgsDataProvider::temporalCapabilities
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
Definition: qgsdataprovider.cpp:28
QgsDataProvider::setTransformContext
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets data coordinate transform context to transformContext.
Definition: qgsdataprovider.cpp:80
QgsDataProvider::sublayerSeparator
static QString sublayerSeparator()
String sequence used for separating components of sublayers strings.
Definition: qgsdataprovider.cpp:86
QgsDataProvider::setProviderProperty
void setProviderProperty(ProviderProperty property, const QVariant &value)
Allows setting arbitrary properties on the provider.
Definition: qgsdataprovider.cpp:44
QgsDataProvider::ProviderOptions::transformContext
QgsCoordinateTransformContext transformContext
Definition: qgsdataprovider.h:106
qgsdataprovider.h
QgsDataProvider::PreviewContext::lastRenderingTimeMs
double lastRenderingTimeMs
Previous rendering time for the layer, in ms.
Definition: qgsdataprovider.h:511
QgsDataProvider::providerProperty
QVariant providerProperty(ProviderProperty property, const QVariant &defaultValue=QVariant()) const
Gets the current value of a certain provider property.
Definition: qgsdataprovider.cpp:54
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:64