QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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 {
36 u.layerType = QStringLiteral( "vector" );
37 u.wkbType = mWkbType;
38 break;
40 u.layerType = QStringLiteral( "raster" );
41 break;
43 u.layerType = QStringLiteral( "mesh" );
44 break;
46 u.layerType = QStringLiteral( "vector-tile" );
47 break;
49 u.layerType = QStringLiteral( "pointcloud" );
50 break;
52 u.layerType = QStringLiteral( "plugin" );
53 break;
55 u.layerType = QStringLiteral( "group" );
56 break;
58 u.layerType = QStringLiteral( "annotation" );
59 break;
61 u.layerType = QStringLiteral( "tiled-scene" );
62 break;
63 }
64
65 u.providerKey = mProviderKey;
66 u.name = mName;
67 u.uri = mUri;
68 return u;
69}
70
72{
73 return mProviderKey == other.mProviderKey
74 && mType == other.mType
75 && mFlags == other.mFlags
76 && mUri == other.mUri
77 && mLayerNumber == other.mLayerNumber
78 && mName == other.mName
79 && mDescription == other.mDescription
80 && mFeatureCount == other.mFeatureCount
81 && mGeometryColumnName == other.mGeometryColumnName
82 && mPath == other.mPath
83 && mWkbType == other.mWkbType
84 && mSkippedContainerScan == other.mSkippedContainerScan
85 && mDriverName == other.mDriverName;
86}
87
89{
90 return !( *this == other );
91}
@ Group
Composite group layer. Added in QGIS 3.24.
@ Plugin
Plugin based layer.
@ TiledScene
Tiled scene layer. Added in QGIS 3.34.
@ Annotation
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
@ Vector
Vector layer.
@ VectorTile
Vector tile layer. Added in QGIS 3.14.
@ Mesh
Mesh layer. Added in QGIS 3.2.
@ Raster
Raster layer.
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
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:74
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.