QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
31class 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
39#ifdef SIP_RUN
40 SIP_PYOBJECT __repr__();
41 % MethodCode
42 QString str = QStringLiteral( "<QgsPluginLayer: '%1'>" ).arg( sipCpp->name() );
43 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
44 % End
45#endif
46
51 QgsPluginLayer *clone() const override = 0;
52
54 QString pluginLayerType();
55
57 void setExtent( const QgsRectangle &extent ) override;
58
62 void setSource( const QString &source );
63
64 QgsDataProvider *dataProvider() override;
65 const QgsDataProvider *dataProvider() const override SIP_SKIP;
66
67 protected:
68 QString mPluginLayerType;
69 QgsDataProvider *mDataProvider;
70};
71
72#ifndef SIP_RUN
74
78class QgsPluginLayerDataProvider : public QgsDataProvider
79{
80 Q_OBJECT
81
82 public:
83 QgsPluginLayerDataProvider( const QString &layerType,
84 const QgsDataProvider::ProviderOptions &providerOptions,
86 void setExtent( const QgsRectangle &extent ) { mExtent = extent; }
87 QgsCoordinateReferenceSystem crs() const override;
88 QString name() const override;
89 QString description() const override;
90 QgsRectangle extent() const override;
91 bool isValid() const override;
92
93 private:
94 QString mName;
95 QgsRectangle mExtent;
96};
98#endif
99
100#endif // QGSPLUGINLAYER_H
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
This class represents a coordinate reference system (CRS).
Abstract base class for spatial data provider implementations.
Base class for all map layer types.
Definition qgsmaplayer.h:76
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
virtual Q_INVOKABLE QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
Base class for plugin layers.
QgsPluginLayer * clone() const override=0
Returns a new instance equivalent to this one.
A rectangle specified with double values.
#define str(x)
Definition qgis.cpp:39
#define SIP_SKIP
Definition qgis_sip.h:126
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.