QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Go to the documentation of this file.
2 qgssensorthingsprovider.h
3 ----------------
4 begin : November 2023
5 copyright : (C) 2013 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
23#include "qgsprovidermetadata.h"
25#define SIP_NO_FILE
33class CORE_EXPORT QgsSensorThingsProvider final : public QgsVectorDataProvider
37 public:
39 static const inline QString SENSORTHINGS_PROVIDER_KEY = QStringLiteral( "sensorthings" );
40 static const inline QString SENSORTHINGS_PROVIDER_DESCRIPTION = QStringLiteral( "OGC SensorThings API data provider" );
42 QgsSensorThingsProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() );
45 QString storageType() const final;
46 QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const final;
47 Qgis::WkbType wkbType() const final;
48 long long featureCount() const final;
49 QgsFields fields() const final;
50 QgsLayerMetadata layerMetadata() const final;
51 QString htmlMetadata() const final;
53 Qgis::DataProviderFlags flags() const final;
55 bool supportsSubsetString() const final;
56 QString subsetString() const final;
57 bool setSubsetString( const QString &subset, bool updateFeatureCount = true ) final;
59 void setDataSourceUri( const QString &uri ) final;
60 QgsRectangle extent() const final;
61 bool isValid() const final { return mValid; }
63 QString name() const final;
64 QString description() const final;
65 bool renderInPreview( const QgsDataProvider::PreviewContext &context ) final;
67 static QString providerKey();
71 private:
72 bool mValid = false;
73 std::shared_ptr<QgsSensorThingsSharedData> mSharedData;
75 QgsLayerMetadata mLayerMetadata;
77 void reloadProviderData() final;
80class QgsSensorThingsProviderMetadata final: public QgsProviderMetadata
84 public:
85 QgsSensorThingsProviderMetadata();
86 QIcon icon() const final;
87 QList<QgsDataItemProvider *> dataItemProviders() const final;
88 QVariantMap decodeUri( const QString &uri ) const final;
89 QString encodeUri( const QVariantMap &parts ) const final;
90 QgsSensorThingsProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) final;
91 QList< Qgis::LayerType > supportedLayerTypes() const final;
93 // handling of stored connections
95 QMap<QString, QgsAbstractProviderConnection *> connections( bool cached ) final;
96 QgsAbstractProviderConnection *createConnection( const QString &name ) final;
97 void deleteConnection( const QString &name ) final;
98 void saveConnection( const QgsAbstractProviderConnection *connection, const QString &name ) final;
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:54
QFlags< DataProviderFlag > DataProviderFlags
Data provider flags.
Definition: qgis.h:1853
The WKB type describes the number of dimensions a geometry has.
Definition: qgis.h:182
Base class that can be used for any class that is capable of returning features.
The QgsAbstractProviderConnection provides an interface for data provider connections.
This class represents a coordinate reference system (CRS).
This is the interface for those who want to add custom data items to the browser tree.
Abstract base class for spatial data provider implementations.
virtual QString name() const =0
Returns a provider name.
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
QFlags< ReadFlag > ReadFlags
virtual QString subsetString() const
Returns the subset definition string (typically sql) currently in use by the layer and used by the pr...
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.
virtual void setDataSourceUri(const QString &uri)
Set the data source specification.
virtual bool supportsSubsetString() const
Returns true if the provider supports setting of subset strings.
virtual QString description() const =0
Returns description.
virtual QString htmlMetadata() const
Obtain a formatted HTML string containing assorted metadata for this data provider.
virtual bool setSubsetString(const QString &subset, bool updateFeatureCount=true)
Set the subset string used to create a subset of features in the layer.
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
virtual QgsRectangle extent() const =0
Returns the extent of the layer.
Wrapper for iterator of features from vector data provider or vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
Container of fields for a vector layer.
Definition: qgsfields.h:45
A structured metadata store for a map layer.
Holds data provider key, description, and associated shared library file or function pointer informat...
virtual QIcon icon() const
Returns an icon representing the provider.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
This is the base class for vector data providers.
long long featureCount() const override=0
Number of features in the layer.
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
virtual void handlePostCloneOperations(QgsVectorDataProvider *source)
Handles any post-clone operations required after this vector data provider was cloned from the source...
QFlags< Capability > Capabilities
virtual QgsAbstractFeatureSource * featureSource() const =0
Returns feature source object that can be used for querying provider's data.
QgsFields fields() const override=0
Returns the fields associated with this data provider.
Qgis::WkbType wkbType() const override=0
Returns the geometry type which is returned by this layer.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override=0
Query the provider for features specified in request.
virtual Q_INVOKABLE QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
Stores settings related to the context in which a preview job runs.
Setting options for creating vector data providers.