QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
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 Qgis::LayerType type() const { return mType; }
69
75 void setType( Qgis::LayerType 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
122 bool loadAllStoredStyle = false;
123 };
124
130 QgsMapLayer *toLayer( const LayerOptions &options ) const SIP_FACTORY;
131
137 QString name() const { return mName; }
138
144 void setName( const QString &name ) { mName = name; }
145
151 QString description() const { return mDescription; }
152
158 void setDescription( const QString &description ) { mDescription = description; }
159
165 Qgis::SublayerFlags flags() const { return mFlags; }
166
172 void setFlags( Qgis::SublayerFlags newFlags ) { mFlags = newFlags; }
173
181 QString driverName() const { return mDriverName; }
182
188 void setDriverName( const QString &driver ) { mDriverName = driver; }
189
198 QStringList path() const { return mPath; }
199
208 void setPath( const QStringList &path ) { mPath = path; }
209
217 long long featureCount() const { return mFeatureCount; }
218
226 void setFeatureCount( long long count ) { mFeatureCount = count; }
227
233 Qgis::WkbType wkbType() const { return mWkbType; }
234
242 void setWkbType( Qgis::WkbType type ) { mWkbType = type; }
243
249 QString geometryColumnName() const { return mGeometryColumnName; }
250
258 void setGeometryColumnName( const QString &name ) { mGeometryColumnName = name; }
259
260#ifdef SIP_RUN
261 SIP_PYOBJECT __repr__();
262 % MethodCode
263 QString str = QStringLiteral( "<QgsProviderSublayerDetails: %1 - %2>" ).arg( sipCpp->providerKey(), sipCpp->name() );
264 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
265 % End
266#endif
267
273 int layerNumber() const { return mLayerNumber; }
274
280 void setLayerNumber( int number ) { mLayerNumber = number; }
281
288 void setSkippedContainerScan( bool skipped ) { mSkippedContainerScan = skipped; }
289
296 bool skippedContainerScan() const { return mSkippedContainerScan; }
297
303 QgsMimeDataUtils::Uri toMimeUri() const;
304
305 // TODO c++20 - replace with = default
306 bool operator==( const QgsProviderSublayerDetails &other ) const;
307 bool operator!=( const QgsProviderSublayerDetails &other ) const;
308
309 private:
310
311 QString mProviderKey;
313 QString mUri;
314 int mLayerNumber = 0;
315 QString mName;
316 QString mDescription;
317 long long mFeatureCount = static_cast< long >( Qgis::FeatureCountState::UnknownCount );
318 QString mGeometryColumnName;
319 QStringList mPath;
321 QString mDriverName;
322 bool mSkippedContainerScan = false;
324
325};
326
327#endif //QGSPROVIDERSUBLAYERDETAILS_H
328
329
330
QFlags< SublayerFlag > SublayerFlags
Sublayer flags.
Definition qgis.h:1323
LayerType
Types of layers that can be added to a map.
Definition qgis.h:169
@ Vector
Vector layer.
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
@ Unknown
Unknown.
Contains information about the context in which a coordinate transform is executed.
Base class for all map layer types.
Definition qgsmaplayer.h:76
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.
long long featureCount() const
Returns the layer's feature count.
int layerNumber() const
Returns the associated layer number, for providers which order sublayers.
Qgis::LayerType type() const
Returns the layer type.
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.
void setType(Qgis::LayerType type)
Sets the layer type.
void setGeometryColumnName(const QString &name)
Sets the layer's geometry column name.
void setName(const QString &name)
Sets the layer's name.
Qgis::WkbType wkbType() const
Returns the layer's WKB type, or QgsWkbTypes::Unknown if the WKB type is not application or unknown.
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.
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.
QString providerKey() const
Returns the associated data provider key.
void setWkbType(Qgis::WkbType type)
Set the layer's WKB type.
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.
@ UnknownCount
Provider returned an unknown feature count.
#define str(x)
Definition qgis.cpp:38
#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.