QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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"
18 
19 QString QgsDataProvider::SUBLAYER_SEPARATOR = QString( "!!::!!" );
20 
21 QgsDataProvider::QgsDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions )
22  : mDataSourceURI( uri ),
23  mOptions( providerOptions )
24 {
25 }
26 
28 {
29  mProviderProperties.insert( property, value );
30 }
31 
32 void QgsDataProvider::setProviderProperty( int property, const QVariant &value )
33 {
34  mProviderProperties.insert( property, value );
35 }
36 
37 QVariant QgsDataProvider::providerProperty( QgsDataProvider::ProviderProperty property, const QVariant &defaultValue ) const
38 {
39  return mProviderProperties.value( property, defaultValue );
40 }
41 
42 QVariant QgsDataProvider::providerProperty( int property, const QVariant &defaultValue = QVariant() ) const
43 {
44  return mProviderProperties.value( property, defaultValue );
45 }
46 
47 void QgsDataProvider::setListening( bool isListening )
48 {
49  Q_UNUSED( isListening )
50 }
51 
53 {
54  return context.lastRenderingTimeMs <= context.maxRenderingTimeMs;
55 }
56 
58 {
59  QMutexLocker locker( &mOptionsMutex );
60  return mOptions.transformContext;
61 }
62 
64 {
65  QMutexLocker locker( &mOptionsMutex );
66  mOptions.transformContext = value;
67 }
QVariant providerProperty(ProviderProperty property, const QVariant &defaultValue=QVariant()) const
Gets the current value of a certain provider property.
static QString SUBLAYER_SEPARATOR
String sequence used for separating components of sublayers strings.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions())
Create a new dataprovider with the specified in the uri.
double maxRenderingTimeMs
Default maximum allowable render time, in ms.
virtual void setListening(bool isListening)
Set whether the provider will listen to datasource notifications If set, the provider will issue noti...
Contains information about the context in which a coordinate transform is executed.
void setProviderProperty(ProviderProperty property, const QVariant &value)
Allows setting arbitrary properties on the provider.
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
QgsCoordinateTransformContext transformContext
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
Setting options for creating vector data providers.
virtual void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets data coordinate transform context to transformContext.
double lastRenderingTimeMs
Previous rendering time for the layer, in ms.
Stores settings related to the context in which a preview job runs.
ProviderProperty
Properties are used to pass custom configuration options into data providers.