QGIS API Documentation
4.3.0-Master (4ecdf0f3f59)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
providers
qgsprovidersublayerdetails.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsprovidersublayerdetails.cpp
3
----------------------------
4
begin : May 2021
5
copyright : (C) 2021 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
17
#include "
qgsprovidersublayerdetails.h
"
18
19
#include "
qgsmaplayerfactory.h
"
20
#include "
qgsmimedatautils.h
"
21
22
QgsMapLayer
*
QgsProviderSublayerDetails::toLayer
(
const
LayerOptions
&options )
const
23
{
24
QgsMapLayerFactory::LayerOptions
layerOptions( options.
transformContext
);
25
layerOptions.
loadDefaultStyle
= options.
loadDefaultStyle
;
26
layerOptions.
loadAllStoredStyles
= options.
loadAllStoredStyle
;
27
return
QgsMapLayerFactory::createLayer
( mUri, mName, mType, layerOptions, mProviderKey );
28
}
29
30
QgsMimeDataUtils::Uri
QgsProviderSublayerDetails::toMimeUri
()
const
31
{
32
QgsMimeDataUtils::Uri
u;
33
u.
layerType
=
QgsMapLayerFactory::typeToString
( mType );
34
switch
( mType )
35
{
36
case
Qgis::LayerType::Vector
:
37
u.
wkbType
= mWkbType;
38
break
;
39
case
Qgis::LayerType::Raster
:
40
case
Qgis::LayerType::Mesh
:
41
case
Qgis::LayerType::VectorTile
:
42
case
Qgis::LayerType::PointCloud
:
43
case
Qgis::LayerType::Plugin
:
44
case
Qgis::LayerType::Group
:
45
case
Qgis::LayerType::Annotation
:
46
case
Qgis::LayerType::TiledScene
:
47
break
;
48
}
49
50
u.
providerKey
= mProviderKey;
51
u.
name
= mName;
52
u.
uri
= mUri;
53
return
u;
54
}
55
56
bool
QgsProviderSublayerDetails::operator==
(
const
QgsProviderSublayerDetails
&other )
const
57
{
58
return
mProviderKey == other.mProviderKey
59
&& mType == other.mType
60
&& mFlags == other.mFlags
61
&& mUri == other.mUri
62
&& mLayerNumber == other.mLayerNumber
63
&& mName == other.mName
64
&& mDescription == other.mDescription
65
&& mFeatureCount == other.mFeatureCount
66
&& mGeometryColumnName == other.mGeometryColumnName
67
&& mPath == other.mPath
68
&& mWkbType == other.mWkbType
69
&& mSkippedContainerScan == other.mSkippedContainerScan
70
&& mDriverName == other.mDriverName;
71
}
72
73
bool
QgsProviderSublayerDetails::operator!=
(
const
QgsProviderSublayerDetails
&other )
const
74
{
75
return
!( *
this
== other );
76
}
Qgis::LayerType::Group
@ Group
Composite group layer. Added in QGIS 3.24.
Definition
qgis.h:214
Qgis::LayerType::Plugin
@ Plugin
Plugin based layer.
Definition
qgis.h:209
Qgis::LayerType::TiledScene
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
Definition
qgis.h:215
Qgis::LayerType::Annotation
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
Definition
qgis.h:212
Qgis::LayerType::Vector
@ Vector
Vector layer.
Definition
qgis.h:207
Qgis::LayerType::VectorTile
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
Definition
qgis.h:211
Qgis::LayerType::Mesh
@ Mesh
Mesh layer. Added in QGIS 3.2.
Definition
qgis.h:210
Qgis::LayerType::Raster
@ Raster
Raster layer.
Definition
qgis.h:208
Qgis::LayerType::PointCloud
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
Definition
qgis.h:213
QgsMapLayerFactory::typeToString
static QString typeToString(Qgis::LayerType type)
Converts a map layer type to a string value.
Definition
qgsmaplayerfactory.cpp:63
QgsMapLayerFactory::createLayer
static QgsMapLayer * createLayer(const QString &uri, const QString &name, Qgis::LayerType type, const LayerOptions &options, const QString &provider=QString())
Creates a map layer, given a uri, name, layer type and provider name.
Definition
qgsmaplayerfactory.cpp:89
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
QgsProviderSublayerDetails
Contains details about a sub layer available from a dataset.
Definition
qgsprovidersublayerdetails.h:48
QgsProviderSublayerDetails::operator!=
bool operator!=(const QgsProviderSublayerDetails &other) const
Definition
qgsprovidersublayerdetails.cpp:73
QgsProviderSublayerDetails::toMimeUri
QgsMimeDataUtils::Uri toMimeUri() const
Converts the sublayer details to a QgsMimeDataUtils::Uri representing the sublayer.
Definition
qgsprovidersublayerdetails.cpp:30
QgsProviderSublayerDetails::toLayer
QgsMapLayer * toLayer(const LayerOptions &options) const
Creates a new QgsMapLayer object associated with the sublayer.
Definition
qgsprovidersublayerdetails.cpp:22
QgsProviderSublayerDetails::operator==
bool operator==(const QgsProviderSublayerDetails &other) const
Definition
qgsprovidersublayerdetails.cpp:56
qgsmaplayerfactory.h
qgsmimedatautils.h
qgsprovidersublayerdetails.h
QgsMapLayerFactory::LayerOptions
Setting options for loading layers.
Definition
qgsmaplayerfactory.h:64
QgsMapLayerFactory::LayerOptions::loadAllStoredStyles
bool loadAllStoredStyles
Controls whether the stored styles will be all loaded.
Definition
qgsmaplayerfactory.h:90
QgsMapLayerFactory::LayerOptions::loadDefaultStyle
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
Definition
qgsmaplayerfactory.h:76
QgsMimeDataUtils::Uri
Definition
qgsmimedatautils.h:45
QgsMimeDataUtils::Uri::wkbType
Qgis::WkbType wkbType
WKB type, if associated with a vector layer, or QgsWkbTypes::Unknown if not yet known.
Definition
qgsmimedatautils.h:228
QgsMimeDataUtils::Uri::uri
QString uri
Identifier of the data source recognized by its providerKey.
Definition
qgsmimedatautils.h:205
QgsMimeDataUtils::Uri::name
QString name
Human readable name to be used e.g. in layer tree.
Definition
qgsmimedatautils.h:203
QgsMimeDataUtils::Uri::providerKey
QString providerKey
For "vector" / "raster" type: provider id.
Definition
qgsmimedatautils.h:200
QgsMimeDataUtils::Uri::layerType
QString layerType
Type of URI.
Definition
qgsmimedatautils.h:192
QgsProviderSublayerDetails::LayerOptions
Setting options for loading layers.
Definition
qgsprovidersublayerdetails.h:96
QgsProviderSublayerDetails::LayerOptions::transformContext
QgsCoordinateTransformContext transformContext
Coordinate transform context.
Definition
qgsprovidersublayerdetails.h:105
QgsProviderSublayerDetails::LayerOptions::loadDefaultStyle
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
Definition
qgsprovidersublayerdetails.h:108
QgsProviderSublayerDetails::LayerOptions::loadAllStoredStyle
bool loadAllStoredStyle
Controls whether the stored styles will be all loaded.
Definition
qgsprovidersublayerdetails.h:122
Generated on
for QGIS API Documentation by
1.17.0