QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgspluginlayer.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgspluginlayer.cpp
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#include "qgspluginlayer.h"
16
17QgsPluginLayer::QgsPluginLayer( const QString &layerType, const QString &layerName )
18 : QgsMapLayer( Qgis::LayerType::Plugin, layerName )
19 , mPluginLayerType( layerType )
20{
21 mDataProvider = new QgsPluginLayerDataProvider( layerType, QgsDataProvider::ProviderOptions(), QgsDataProvider::ReadFlags() );
22}
23
25{
26 // TODO: shall we move the responsibility of emitting the signal to plugin
27 // layer implementations before they start doing their part of cleanup...?
28 emit willBeDeleted();
29 delete mDataProvider;
30}
31
36
38{
40 static_cast<QgsPluginLayerDataProvider *>( mDataProvider )->setExtent( extent );
41}
42
43void QgsPluginLayer::setSource( const QString &source )
44{
46}
47
52
57
58//
59// QgsPluginLayerDataProvider
60//
62QgsPluginLayerDataProvider::QgsPluginLayerDataProvider( const QString &layerType,
63 const ProviderOptions &options,
64 QgsDataProvider::ReadFlags flags )
65 : QgsDataProvider( QString(), options, flags )
66 , mName( layerType )
67{}
68
69QgsCoordinateReferenceSystem QgsPluginLayerDataProvider::crs() const
70{
72}
73
74QString QgsPluginLayerDataProvider::name() const
75{
76 return mName;
77}
78
79QString QgsPluginLayerDataProvider::description() const
80{
81 return QString();
82}
83
84QgsRectangle QgsPluginLayerDataProvider::extent() const
85{
86 return mExtent;
87}
88
89bool QgsPluginLayerDataProvider::isValid() const
90{
91 return true;
92}
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
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:74
virtual QgsRectangle extent() const
Returns the extent of the layer.
QString source() const
Returns the source for the layer.
void willBeDeleted()
Emitted in the destructor when the layer is about to be deleted, but it is still in a perfectly valid...
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
QString mDataSource
Data source description string, varies by layer type.
QgsPluginLayer(const QString &layerType, const QString &layerName=QString())
void setSource(const QString &source)
Set source string.
~QgsPluginLayer() override
QString mPluginLayerType
QgsDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
void setExtent(const QgsRectangle &extent) override
Sets extent of the layer.
QString pluginLayerType()
Returns plugin layer type (the same as used in QgsPluginLayerRegistry)
QgsDataProvider * mDataProvider
A rectangle specified with double values.
Setting options for creating vector data providers.