QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
Qgis::FeatureCountState::UnknownCount
@ UnknownCount
Provider returned an unknown feature count.
QgsProviderSublayerDetails::LayerOptions::LayerOptions
LayerOptions(const QgsCoordinateTransformContext &transformContext)
Constructor for LayerOptions with transformContext.
Definition: qgsprovidersublayerdetails.h:99
QgsProviderSublayerDetails::setFlags
void setFlags(Qgis::SublayerFlags newFlags)
Sets the layer's flags, which indicate properties of the layer.
Definition: qgsprovidersublayerdetails.h:157
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:57
QgsProviderSublayerDetails::setPath
void setPath(const QStringList &path)
Sets the path to the sublayer.
Definition: qgsprovidersublayerdetails.h:193
QgsProviderSublayerDetails::driverName
QString driverName() const
Returns the layer's driver name.
Definition: qgsprovidersublayerdetails.h:166
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:425
QgsMapLayerType::VectorLayer
@ VectorLayer
Vector layer.
QgsProviderSublayerDetails::uri
QString uri() const
Returns the layer's URI.
Definition: qgsprovidersublayerdetails.h:81
QgsProviderSublayerDetails::setWkbType
void setWkbType(QgsWkbTypes::Type type)
Set the layer's WKB type.
Definition: qgsprovidersublayerdetails.h:227
qgscoordinatetransformcontext.h
QgsProviderSublayerDetails::setDescription
void setDescription(const QString &description)
Sets the layer's description.
Definition: qgsprovidersublayerdetails.h:143
QgsMapLayerType
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:46
QgsProviderSublayerDetails::path
QStringList path() const
Returns the path to the sublayer.
Definition: qgsprovidersublayerdetails.h:183
QgsProviderSublayerDetails::skippedContainerScan
bool skippedContainerScan() const
Returns true if the layer is a potential dataset container and an in-depth scan of its contents was s...
Definition: qgsprovidersublayerdetails.h:281
qgis.h
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:69
QgsProviderSublayerDetails::setDriverName
void setDriverName(const QString &driver)
Sets the layer's driver name.
Definition: qgsprovidersublayerdetails.h:173
operator!=
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:430
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsProviderSublayerDetails::setName
void setName(const QString &name)
Sets the layer's name.
Definition: qgsprovidersublayerdetails.h:129
QgsProviderSublayerDetails::featureCount
long long featureCount() const
Returns the layer's feature count.
Definition: qgsprovidersublayerdetails.h:202
QgsProviderSublayerDetails::setLayerNumber
void setLayerNumber(int number)
Sets the associated layer number, for providers which order sublayers.
Definition: qgsprovidersublayerdetails.h:265
QgsWkbTypes::Unknown
@ Unknown
Definition: qgswkbtypes.h:71
QgsProviderSublayerDetails::setProviderKey
void setProviderKey(const QString &key)
Sets the associated data provider key.
Definition: qgsprovidersublayerdetails.h:60
QgsProviderSublayerDetails::setFeatureCount
void setFeatureCount(long long count)
Sets the layer's feature count.
Definition: qgsprovidersublayerdetails.h:211
QgsProviderSublayerDetails::providerKey
QString providerKey() const
Returns the associated data provider key.
Definition: qgsprovidersublayerdetails.h:53
QgsProviderSublayerDetails
Contains details about a sub layer available from a dataset.
Definition: qgsprovidersublayerdetails.h:44
QgsProviderSublayerDetails::setUri
void setUri(const QString &uri)
Sets the layer's uri.
Definition: qgsprovidersublayerdetails.h:88
QgsProviderSublayerDetails::name
QString name() const
Returns the layer's name.
Definition: qgsprovidersublayerdetails.h:122
QgsProviderSublayerDetails::LayerOptions
Setting options for loading layers.
Definition: qgsprovidersublayerdetails.h:93
QgsProviderSublayerDetails::geometryColumnName
QString geometryColumnName() const
Returns the layer's geometry column name, or an empty string if not applicable.
Definition: qgsprovidersublayerdetails.h:234
str
#define str(x)
Definition: qgis.cpp:37
QgsProviderSublayerDetails::layerNumber
int layerNumber() const
Returns the associated layer number, for providers which order sublayers.
Definition: qgsprovidersublayerdetails.h:258
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsProviderSublayerDetails::setSkippedContainerScan
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...
Definition: qgsprovidersublayerdetails.h:273
QgsProviderSublayerDetails::type
QgsMapLayerType type() const
Returns the layer type.
Definition: qgsprovidersublayerdetails.h:67
QgsProviderSublayerDetails::wkbType
QgsWkbTypes::Type wkbType() const
Returns the layer's WKB type, or QgsWkbTypes::Unknown if the WKB type is not application or unknown.
Definition: qgsprovidersublayerdetails.h:218
QgsProviderSublayerDetails::setType
void setType(QgsMapLayerType type)
Sets the layer type.
Definition: qgsprovidersublayerdetails.h:74
QgsProviderSublayerDetails::description
QString description() const
Returns the layer's description.
Definition: qgsprovidersublayerdetails.h:136
QgsProviderSublayerDetails::LayerOptions::transformContext
QgsCoordinateTransformContext transformContext
Coordinate transform context.
Definition: qgsprovidersublayerdetails.h:104
qgswkbtypes.h
QgsProviderSublayerDetails::flags
Qgis::SublayerFlags flags() const
Returns the layer's flags, which indicate properties of the layer.
Definition: qgsprovidersublayerdetails.h:150
QgsProviderSublayerDetails::setGeometryColumnName
void setGeometryColumnName(const QString &name)
Sets the layer's geometry column name.
Definition: qgsprovidersublayerdetails.h:243