QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgspluginlayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspluginlayer.h
3  ---------------------
4  begin : January 2010
5  copyright : (C) 2010 by Martin Dobias
6  email : wonder dot sk at gmail dot com
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 #ifndef QGSPLUGINLAYER_H
16 #define QGSPLUGINLAYER_H
17 
18 #include "qgis_core.h"
19 #include "qgsmaplayer.h"
20 #include "qgsdataprovider.h"
21 
31 class CORE_EXPORT QgsPluginLayer : public QgsMapLayer
32 {
33  Q_OBJECT
34 
35  public:
36  QgsPluginLayer( const QString &layerType, const QString &layerName = QString() );
37  ~QgsPluginLayer() override;
38 
44  QgsPluginLayer *clone() const override = 0;
45 
47  QString pluginLayerType();
48 
50  void setExtent( const QgsRectangle &extent ) override;
51 
56  void setSource( const QString &source );
57 
58  QgsDataProvider *dataProvider() override;
59  const QgsDataProvider *dataProvider() const override SIP_SKIP;
60 
61  protected:
62  QString mPluginLayerType;
63  QgsDataProvider *mDataProvider;
64 };
65 
66 #ifndef SIP_RUN
67 
72 class QgsPluginLayerDataProvider : public QgsDataProvider
73 {
74  Q_OBJECT
75 
76  public:
77  QgsPluginLayerDataProvider( const QString &layerType,
78  const QgsDataProvider::ProviderOptions &providerOptions,
79  QgsDataProvider::ReadFlags flags );
80  void setExtent( const QgsRectangle &extent ) { mExtent = extent; }
81  QgsCoordinateReferenceSystem crs() const override;
82  QString name() const override;
83  QString description() const override;
84  QgsRectangle extent() const override;
85  bool isValid() const override;
86 
87  private:
88  QString mName;
89  QgsRectangle mExtent;
90 };
92 #endif
93 
94 #endif // QGSPLUGINLAYER_H
QgsDataProvider::ProviderOptions
Setting options for creating vector data providers.
Definition: qgsdataprovider.h:105
QgsDataProvider
Abstract base class for spatial data provider implementations.
Definition: qgsdataprovider.h:42
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:51
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsMapLayer::setExtent
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
Definition: qgsmaplayer.cpp:1858
qgsmaplayer.h
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsPluginLayer
Base class for plugin layers.
Definition: qgspluginlayer.h:32
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
qgsdataprovider.h
QgsPluginLayer::clone
QgsPluginLayer * clone() const override=0
Returns a new instance equivalent to this one.
QgsMapLayer::dataProvider
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
Definition: qgsmaplayer.cpp:169