QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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 return QgsMapLayerFactory::createLayer( mUri, mName, mType, layerOptions, mProviderKey );
27}
28
30{
32 switch ( mType )
33 {
35 u.layerType = QStringLiteral( "vector" );
36 u.wkbType = mWkbType;
37 break;
39 u.layerType = QStringLiteral( "raster" );
40 break;
42 u.layerType = QStringLiteral( "mesh" );
43 break;
45 u.layerType = QStringLiteral( "vector-tile" );
46 break;
48 u.layerType = QStringLiteral( "pointcloud" );
49 break;
51 u.layerType = QStringLiteral( "plugin" );
52 break;
54 u.layerType = QStringLiteral( "group" );
55 break;
57 u.layerType = QStringLiteral( "annotation" );
58 break;
59 }
60
61 u.providerKey = mProviderKey;
62 u.name = mName;
63 u.uri = mUri;
64 return u;
65}
66
68{
69 return mProviderKey == other.mProviderKey
70 && mType == other.mType
71 && mFlags == other.mFlags
72 && mUri == other.mUri
73 && mLayerNumber == other.mLayerNumber
74 && mName == other.mName
75 && mDescription == other.mDescription
76 && mFeatureCount == other.mFeatureCount
77 && mGeometryColumnName == other.mGeometryColumnName
78 && mPath == other.mPath
79 && mWkbType == other.mWkbType
80 && mSkippedContainerScan == other.mSkippedContainerScan
81 && mDriverName == other.mDriverName;
82}
83
85{
86 return !( *this == other );
87}
static QgsMapLayer * createLayer(const QString &uri, const QString &name, QgsMapLayerType 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
@ PointCloudLayer
Point cloud layer. Added in QGIS 3.18.
@ MeshLayer
Mesh layer. Added in QGIS 3.2.
@ VectorLayer
Vector layer.
@ RasterLayer
Raster layer.
@ GroupLayer
Composite group layer. Added in QGIS 3.24.
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
@ PluginLayer
Plugin based layer.
Setting options for loading layers.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
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.
QgsWkbTypes::Type wkbType
WKB type, if associated with a vector layer, or QgsWkbTypes::Unknown if not yet known.
QString layerType
Type of URI.
QgsCoordinateTransformContext transformContext
Coordinate transform context.
bool loadDefaultStyle
Set to true if the default layer style should be loaded.