QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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
18#include "qgsmaplayerfactory.h"
19#include "qgsmimedatautils.h"
20
21
23{
25 layerOptions.loadDefaultStyle = options.loadDefaultStyle;
26 layerOptions.loadAllStoredStyles = options.loadAllStoredStyle;
27 return QgsMapLayerFactory::createLayer( mUri, mName, mType, layerOptions, mProviderKey );
28}
29
31{
33 switch ( mType )
34 {
35 case Qgis::LayerType::Vector:
36 u.layerType = QStringLiteral( "vector" );
37 u.wkbType = mWkbType;
38 break;
39 case Qgis::LayerType::Raster:
40 u.layerType = QStringLiteral( "raster" );
41 break;
42 case Qgis::LayerType::Mesh:
43 u.layerType = QStringLiteral( "mesh" );
44 break;
45 case Qgis::LayerType::VectorTile:
46 u.layerType = QStringLiteral( "vector-tile" );
47 break;
48 case Qgis::LayerType::PointCloud:
49 u.layerType = QStringLiteral( "pointcloud" );
50 break;
51 case Qgis::LayerType::Plugin:
52 u.layerType = QStringLiteral( "plugin" );
53 break;
54 case Qgis::LayerType::Group:
55 u.layerType = QStringLiteral( "group" );
56 break;
57 case Qgis::LayerType::Annotation:
58 u.layerType = QStringLiteral( "annotation" );
59 break;
60 }
61
62 u.providerKey = mProviderKey;
63 u.name = mName;
64 u.uri = mUri;
65 return u;
66}
67
69{
70 return mProviderKey == other.mProviderKey
71 && mType == other.mType
72 && mFlags == other.mFlags
73 && mUri == other.mUri
74 && mLayerNumber == other.mLayerNumber
75 && mName == other.mName
76 && mDescription == other.mDescription
77 && mFeatureCount == other.mFeatureCount
78 && mGeometryColumnName == other.mGeometryColumnName
79 && mPath == other.mPath
80 && mWkbType == other.mWkbType
81 && mSkippedContainerScan == other.mSkippedContainerScan
82 && mDriverName == other.mDriverName;
83}
84
86{
87 return !( *this == other );
88}
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.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Contains details about a sub layer available from a dataset.
bool operator!=(const QgsProviderSublayerDetails &other) const
QgsMimeDataUtils::Uri toMimeUri() const
Converts the sublayer details to a QgsMimeDataUtils::Uri representing the sublayer.
QgsMapLayer * toLayer(const LayerOptions &options) const
Creates a new QgsMapLayer object associated with the sublayer.
bool operator==(const QgsProviderSublayerDetails &other) const
Setting options for loading layers.
bool loadAllStoredStyles
Controls whether the stored styles will be all loaded.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
Qgis::WkbType wkbType
WKB type, if associated with a vector layer, or QgsWkbTypes::Unknown if not yet known.
QString uri
Identifier of the data source recognized by its providerKey.
QString name
Human readable name to be used e.g. in layer tree.
QString providerKey
For "vector" / "raster" type: provider id.
QString layerType
Type of URI.
QgsCoordinateTransformContext transformContext
Coordinate transform context.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
bool loadAllStoredStyle
Controls whether the stored styles will be all loaded.