QGIS API Documentation 3.99.0-Master (d270888f95f)
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.h"
20#include "qgis_core.h"
22#include "qgsmimedatautils.h"
23#include "qgswkbtypes.h"
24
25#include <QString>
26#include <QStringList>
27
28using namespace Qt::StringLiterals;
29
48{
49 public:
50
56 QString providerKey() const { return mProviderKey; }
57
63 void setProviderKey( const QString &key ) { mProviderKey = key; }
64
70 Qgis::LayerType type() const { return mType; }
71
77 void setType( Qgis::LayerType type ) { mType = type; }
78
84 QString uri() const { return mUri; }
85
91 void setUri( const QString &uri ) { mUri = uri; }
92
126
132 QgsMapLayer *toLayer( const LayerOptions &options ) const SIP_FACTORY;
133
139 QString name() const { return mName; }
140
146 void setName( const QString &name ) { mName = name; }
147
153 QString description() const { return mDescription; }
154
160 void setDescription( const QString &description ) { mDescription = description; }
161
167 Qgis::SublayerFlags flags() const { return mFlags; }
168
174 void setFlags( Qgis::SublayerFlags newFlags ) { mFlags = newFlags; }
175
183 QString driverName() const { return mDriverName; }
184
190 void setDriverName( const QString &driver ) { mDriverName = driver; }
191
200 QStringList path() const { return mPath; }
201
210 void setPath( const QStringList &path ) { mPath = path; }
211
219 long long featureCount() const { return mFeatureCount; }
220
228 void setFeatureCount( long long count ) { mFeatureCount = count; }
229
235 Qgis::WkbType wkbType() const { return mWkbType; }
236
244 void setWkbType( Qgis::WkbType type ) { mWkbType = type; }
245
251 QString geometryColumnName() const { return mGeometryColumnName; }
252
260 void setGeometryColumnName( const QString &name ) { mGeometryColumnName = name; }
261
262#ifdef SIP_RUN
263 SIP_PYOBJECT __repr__();
264 % MethodCode
265 QString str = u"<QgsProviderSublayerDetails: %1 - %2>"_s.arg( sipCpp->providerKey(), sipCpp->name() );
266 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
267 % End
268#endif
269
275 int layerNumber() const { return mLayerNumber; }
276
282 void setLayerNumber( int number ) { mLayerNumber = number; }
283
290 void setSkippedContainerScan( bool skipped ) { mSkippedContainerScan = skipped; }
291
298 bool skippedContainerScan() const { return mSkippedContainerScan; }
299
305 QgsMimeDataUtils::Uri toMimeUri() const;
306
307 // TODO c++20 - replace with = default
308 bool operator==( const QgsProviderSublayerDetails &other ) const;
309 bool operator!=( const QgsProviderSublayerDetails &other ) const;
310
311 private:
312
313 QString mProviderKey;
315 QString mUri;
316 int mLayerNumber = 0;
317 QString mName;
318 QString mDescription;
319 long long mFeatureCount = static_cast< long >( Qgis::FeatureCountState::UnknownCount );
320 QString mGeometryColumnName;
321 QStringList mPath;
323 QString mDriverName;
324 bool mSkippedContainerScan = false;
326
327};
328
329#endif //QGSPROVIDERSUBLAYERDETAILS_H
330
331
332
QFlags< SublayerFlag > SublayerFlags
Sublayer flags.
Definition qgis.h:1471
LayerType
Types of layers that can be added to a map.
Definition qgis.h:193
@ Vector
Vector layer.
Definition qgis.h:194
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:280
@ Unknown
Unknown.
Definition qgis.h:281
Contains information about the context in which a coordinate transform is executed.
Base class for all map layer types.
Definition qgsmaplayer.h:83
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.
QgsMapLayer * toLayer(const LayerOptions &options) const
Creates a new QgsMapLayer object associated with the sublayer.
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.
Definition qgis.h:566
#define SIP_FACTORY
Definition qgis_sip.h:84
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
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.
LayerOptions(const QgsCoordinateTransformContext &transformContext)
Constructor for LayerOptions with transformContext.