QGIS API Documentation 3.41.0-Master (3440c17df1d)
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#include "moc_qgspluginlayer.cpp"
17
18QgsPluginLayer::QgsPluginLayer( const QString &layerType, const QString &layerName )
19 : QgsMapLayer( Qgis::LayerType::Plugin, layerName )
20 , mPluginLayerType( layerType )
21{
22 mDataProvider = new QgsPluginLayerDataProvider( layerType, QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags() );
23}
24
26{
27 // TODO: shall we move the responsibility of emitting the signal to plugin
28 // layer implementations before they start doing their part of cleanup...?
29 emit willBeDeleted();
30 delete mDataProvider;
31}
32
37
39{
41 static_cast<QgsPluginLayerDataProvider *>( mDataProvider )->setExtent( extent );
42}
43
44void QgsPluginLayer::setSource( const QString &source )
45{
47}
48
53
58
59//
60// QgsPluginLayerDataProvider
61//
63QgsPluginLayerDataProvider::QgsPluginLayerDataProvider( const QString &layerType,
64 const ProviderOptions &options,
66 : QgsDataProvider( QString(), options, flags )
67 , mName( layerType )
68{}
69
70QgsCoordinateReferenceSystem QgsPluginLayerDataProvider::crs() const
71{
73}
74
75QString QgsPluginLayerDataProvider::name() const
76{
77 return mName;
78}
79
80QString QgsPluginLayerDataProvider::description() const
81{
82 return QString();
83}
84
85QgsRectangle QgsPluginLayerDataProvider::extent() const
86{
87 return mExtent;
88}
89
90bool QgsPluginLayerDataProvider::isValid() const
91{
92 return true;
93}
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
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 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.