QGIS API Documentation 3.27.0-Master (f261cc1f8b)
qgsprovidersublayerdetails.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprovidersublayerdetails.h
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#ifndef QGSPROVIDERSUBLAYERDETAILS_H
17#define QGSPROVIDERSUBLAYERDETAILS_H
18
19#include "qgis_core.h"
20#include "qgis.h"
21#include "qgswkbtypes.h"
23#include "qgsmimedatautils.h"
24
25#include <QString>
26#include <QStringList>
27
46{
47 public:
48
54 QString providerKey() const { return mProviderKey; }
55
61 void setProviderKey( const QString &key ) { mProviderKey = key; }
62
68 QgsMapLayerType type() const { return mType; }
69
75 void setType( QgsMapLayerType type ) { mType = type; }
76
82 QString uri() const { return mUri; }
83
89 void setUri( const QString &uri ) { mUri = uri; }
90
95 {
96
100 explicit LayerOptions( const QgsCoordinateTransformContext &transformContext )
101 : transformContext( transformContext )
102 {}
103
106
108 bool loadDefaultStyle = true;
109 };
110
116 QgsMapLayer *toLayer( const LayerOptions &options ) const SIP_FACTORY;
117
123 QString name() const { return mName; }
124
130 void setName( const QString &name ) { mName = name; }
131
137 QString description() const { return mDescription; }
138
144 void setDescription( const QString &description ) { mDescription = description; }
145
151 Qgis::SublayerFlags flags() const { return mFlags; }
152
158 void setFlags( Qgis::SublayerFlags newFlags ) { mFlags = newFlags; }
159
167 QString driverName() const { return mDriverName; }
168
174 void setDriverName( const QString &driver ) { mDriverName = driver; }
175
184 QStringList path() const { return mPath; }
185
194 void setPath( const QStringList &path ) { mPath = path; }
195
203 long long featureCount() const { return mFeatureCount; }
204
212 void setFeatureCount( long long count ) { mFeatureCount = count; }
213
219 QgsWkbTypes::Type wkbType() const { return mWkbType; }
220
228 void setWkbType( QgsWkbTypes::Type type ) { mWkbType = type; }
229
235 QString geometryColumnName() const { return mGeometryColumnName; }
236
244 void setGeometryColumnName( const QString &name ) { mGeometryColumnName = name; }
245
246#ifdef SIP_RUN
247 SIP_PYOBJECT __repr__();
248 % MethodCode
249 QString str = QStringLiteral( "<QgsProviderSublayerDetails: %1 - %2>" ).arg( sipCpp->providerKey(), sipCpp->name() );
250 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
251 % End
252#endif
253
259 int layerNumber() const { return mLayerNumber; }
260
266 void setLayerNumber( int number ) { mLayerNumber = number; }
267
274 void setSkippedContainerScan( bool skipped ) { mSkippedContainerScan = skipped; }
275
282 bool skippedContainerScan() const { return mSkippedContainerScan; }
283
289 QgsMimeDataUtils::Uri toMimeUri() const;
290
291 // TODO c++20 - replace with = default
292 bool operator==( const QgsProviderSublayerDetails &other ) const;
293 bool operator!=( const QgsProviderSublayerDetails &other ) const;
294
295 private:
296
297 QString mProviderKey;
299 QString mUri;
300 int mLayerNumber = 0;
301 QString mName;
302 QString mDescription;
303 long long mFeatureCount = static_cast< long >( Qgis::FeatureCountState::UnknownCount );
304 QString mGeometryColumnName;
305 QStringList mPath;
307 QString mDriverName;
308 bool mSkippedContainerScan = false;
309 Qgis::SublayerFlags mFlags = Qgis::SublayerFlags();
310
311};
312
313#endif //QGSPROVIDERSUBLAYERDETAILS_H
314
315
316
Contains information about the context in which a coordinate transform is executed.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Contains details about a sub layer available from a dataset.
QString description() const
Returns the layer's description.
QStringList path() const
Returns the path to the sublayer.
void setWkbType(QgsWkbTypes::Type type)
Set the layer's WKB type.
long long featureCount() const
Returns the layer's feature count.
int layerNumber() const
Returns the associated layer number, for providers which order sublayers.
void setUri(const QString &uri)
Sets the layer's uri.
void setLayerNumber(int number)
Sets the associated layer number, for providers which order sublayers.
void setDescription(const QString &description)
Sets the layer's description.
QgsWkbTypes::Type wkbType() const
Returns the layer's WKB type, or QgsWkbTypes::Unknown if the WKB type is not application or unknown.
void setGeometryColumnName(const QString &name)
Sets the layer's geometry column name.
void setName(const QString &name)
Sets the layer's name.
void setFeatureCount(long long count)
Sets the layer's feature count.
QString uri() const
Returns the layer's URI.
void setProviderKey(const QString &key)
Sets the associated data provider key.
void setDriverName(const QString &driver)
Sets the layer's driver name.
QgsMapLayerType type() const
Returns the layer type.
void setPath(const QStringList &path)
Sets the path to the sublayer.
void setSkippedContainerScan(bool skipped)
Set to true if the layer is a potential dataset container and an in-depth scan of its contents was sk...
QString driverName() const
Returns the layer's driver name.
void setType(QgsMapLayerType type)
Sets the layer type.
QString providerKey() const
Returns the associated data provider key.
bool skippedContainerScan() const
Returns true if the layer is a potential dataset container and an in-depth scan of its contents was s...
QString geometryColumnName() const
Returns the layer's geometry column name, or an empty string if not applicable.
Qgis::SublayerFlags flags() const
Returns the layer's flags, which indicate properties of the layer.
void setFlags(Qgis::SublayerFlags newFlags)
Sets the layer's flags, which indicate properties of the layer.
QString name() const
Returns the layer's name.
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:47
@ UnknownCount
Provider returned an unknown feature count.
@ VectorLayer
Vector layer.
#define str(x)
Definition: qgis.cpp:37
#define SIP_FACTORY
Definition: qgis_sip.h:76
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QgsCoordinateTransformContext transformContext
Coordinate transform context.
LayerOptions(const QgsCoordinateTransformContext &transformContext)
Constructor for LayerOptions with transformContext.