QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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 
24 #include <QString>
25 #include <QStringList>
26 
44 class CORE_EXPORT QgsProviderSublayerDetails
45 {
46  public:
47 
53  QString providerKey() const { return mProviderKey; }
54 
60  void setProviderKey( const QString &key ) { mProviderKey = key; }
61 
67  QgsMapLayerType type() const { return mType; }
68 
74  void setType( QgsMapLayerType type ) { mType = type; }
75 
81  QString uri() const { return mUri; }
82 
88  void setUri( const QString &uri ) { mUri = uri; }
89 
93  struct LayerOptions
94  {
95 
99  explicit LayerOptions( const QgsCoordinateTransformContext &transformContext )
100  : transformContext( transformContext )
101  {}
102 
105 
107  bool loadDefaultStyle = true;
108  };
109 
115  QgsMapLayer *toLayer( const LayerOptions &options ) const SIP_FACTORY;
116 
122  QString name() const { return mName; }
123 
129  void setName( const QString &name ) { mName = name; }
130 
136  QString description() const { return mDescription; }
137 
143  void setDescription( const QString &description ) { mDescription = description; }
144 
150  Qgis::SublayerFlags flags() const { return mFlags; }
151 
157  void setFlags( Qgis::SublayerFlags newFlags ) { mFlags = newFlags; }
158 
166  QString driverName() const { return mDriverName; }
167 
173  void setDriverName( const QString &driver ) { mDriverName = driver; }
174 
183  QStringList path() const { return mPath; }
184 
193  void setPath( const QStringList &path ) { mPath = path; }
194 
202  long long featureCount() const { return mFeatureCount; }
203 
211  void setFeatureCount( long long count ) { mFeatureCount = count; }
212 
218  QgsWkbTypes::Type wkbType() const { return mWkbType; }
219 
227  void setWkbType( QgsWkbTypes::Type type ) { mWkbType = type; }
228 
234  QString geometryColumnName() const { return mGeometryColumnName; }
235 
243  void setGeometryColumnName( const QString &name ) { mGeometryColumnName = name; }
244 
245 #ifdef SIP_RUN
246  SIP_PYOBJECT __repr__();
247  % MethodCode
248  QString str = QStringLiteral( "<QgsProviderSublayerDetails: %1 - %2>" ).arg( sipCpp->providerKey(), sipCpp->name() );
249  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
250  % End
251 #endif
252 
258  int layerNumber() const { return mLayerNumber; }
259 
265  void setLayerNumber( int number ) { mLayerNumber = number; }
266 
273  void setSkippedContainerScan( bool skipped ) { mSkippedContainerScan = skipped; }
274 
281  bool skippedContainerScan() const { return mSkippedContainerScan; }
282 
283  // TODO c++20 - replace with = default
284  bool operator==( const QgsProviderSublayerDetails &other ) const;
285  bool operator!=( const QgsProviderSublayerDetails &other ) const;
286 
287  private:
288 
289  QString mProviderKey;
291  QString mUri;
292  int mLayerNumber = 0;
293  QString mName;
294  QString mDescription;
295  long long mFeatureCount = static_cast< long >( Qgis::FeatureCountState::UnknownCount );
296  QString mGeometryColumnName;
297  QStringList mPath;
299  QString mDriverName;
300  bool mSkippedContainerScan = false;
301  Qgis::SublayerFlags mFlags = Qgis::SublayerFlags();
302 
303 };
304 
305 #endif //QGSPROVIDERSUBLAYERDETAILS_H
306 
307 
308 
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.
#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.