QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
55 QString providerKey() const { return mProviderKey; }
56
62 void setProviderKey( const QString &key ) { mProviderKey = key; }
63
69 Qgis::LayerType type() const { return mType; }
70
76 void setType( Qgis::LayerType type ) { mType = type; }
77
83 QString uri() const { return mUri; }
84
90 void setUri( const QString &uri ) { mUri = uri; }
91
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 // clang-format off
262 SIP_PYOBJECT __repr__();
263 % MethodCode
264 QString str = u"<QgsProviderSublayerDetails: %1 - %2>"_s.arg( sipCpp->providerKey(), sipCpp->name() );
265 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
266 % End
267// clang-format on
268#endif
269
275 int layerNumber() const
276 {
277 return mLayerNumber;
278 }
279
285 void setLayerNumber( int number ) { mLayerNumber = number; }
286
293 void setSkippedContainerScan( bool skipped ) { mSkippedContainerScan = skipped; }
294
301 bool skippedContainerScan() const { return mSkippedContainerScan; }
302
308 QgsMimeDataUtils::Uri toMimeUri() const;
309
310 // TODO c++20 - replace with = default
311 bool operator==( const QgsProviderSublayerDetails &other ) const;
312 bool operator!=( const QgsProviderSublayerDetails &other ) const;
313
314 private:
315 QString mProviderKey;
317 QString mUri;
318 int mLayerNumber = 0;
319 QString mName;
320 QString mDescription;
321 long long mFeatureCount = static_cast< long >( Qgis::FeatureCountState::UnknownCount );
322 QString mGeometryColumnName;
323 QStringList mPath;
325 QString mDriverName;
326 bool mSkippedContainerScan = false;
328};
329
330#endif //QGSPROVIDERSUBLAYERDETAILS_H
QFlags< SublayerFlag > SublayerFlags
Sublayer flags.
Definition qgis.h:1491
LayerType
Types of layers that can be added to a map.
Definition qgis.h:206
@ Vector
Vector layer.
Definition qgis.h:207
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:294
@ Unknown
Unknown.
Definition qgis.h:295
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:573
#define SIP_FACTORY
Definition qgis_sip.h:83
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.