QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgspointclouddataprovider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointclouddataprovider.h
3 ---------------------
4 begin : October 2020
5 copyright : (C) 2020 by Peter Petrik
6 email : zilolv at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPOINTCLOUDDATAPROVIDER_H
19#define QGSPOINTCLOUDDATAPROVIDER_H
20
21#include "qgis_core.h"
22#include "qgsdataprovider.h"
24#include "qgspointcloudindex.h"
26
30class QgsGeometry;
32
44{
45 Q_OBJECT
46 public:
47
52 {
53 NoCapabilities = 0,
54 ReadLayerMetadata = 1 << 0,
55 WriteLayerMetadata = 1 << 1,
56 CreateRenderer = 1 << 2,
57 ContainSubIndexes = 1 << 3,
58 };
59
60 Q_DECLARE_FLAGS( Capabilities, Capability )
61
62
66 {
67 NotIndexed = 0,
68 Indexing = 1 << 0,
69 Indexed = 1 << 1
70 };
71
73 QgsPointCloudDataProvider( const QString &uri,
74 const QgsDataProvider::ProviderOptions &providerOptions,
76
78
79#ifndef SIP_RUN
80
90 QVector<QVariantMap> identify( double maxError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
91#else
92
102 SIP_PYLIST identify( float maxErrorInMapCoords, QgsGeometry extentGeometry, const QgsDoubleRange extentZRange = QgsDoubleRange(), int pointsLimit = 1000 );
103 % MethodCode
104 {
105 QVector<QMap<QString, QVariant>> res = sipCpp->identify( a0, *a1, *a2, a3 );
106 sipRes = PyList_New( res.size() );
107 for ( int i = 0; i < res.size(); ++i )
108 {
109 PyObject *dict = PyDict_New();
110 for ( QString key : res[i].keys() )
111 {
112 PyObject *keyObj = sipConvertFromNewType( new QString( key ), sipType_QString, Py_None );
113 PyObject *valObj = sipConvertFromNewType( new QVariant( res[i][key] ), sipType_QVariant, Py_None );
114 PyDict_SetItem( dict, keyObj, valObj );
115 }
116 PyList_SET_ITEM( sipRes, i, dict );
117 }
118 }
119 % End
120#endif
121
125 virtual QgsPointCloudDataProvider::Capabilities capabilities() const;
126
132
138 virtual void loadIndex( ) = 0;
139
147 virtual void generateIndex( ) = 0;
148
149
154
162 virtual QgsPointCloudIndex *index() const SIP_SKIP {return nullptr;}
163
172 virtual QVector<QgsPointCloudSubIndex> subIndexes() SIP_SKIP { return QVector<QgsPointCloudSubIndex>(); }
173
182 virtual void loadSubIndex( int n ) SIP_SKIP { Q_UNUSED( n ) return; }
183
187 bool hasValidIndex() const;
188
192 virtual qint64 pointCount() const = 0;
193
205 virtual QgsGeometry polygonBounds() const;
206
213 virtual QVariantMap originalMetadata() const;
214
228 virtual QgsPointCloudRenderer *createRenderer( const QVariantMap &configuration = QVariantMap() ) const SIP_FACTORY;
229
235 virtual bool hasStatisticsMetadata() const;
236
237#ifndef SIP_RUN
238
249 virtual QVariant metadataStatistic( const QString &attribute, Qgis::Statistic statistic ) const;
250#else
251
262 SIP_PYOBJECT metadataStatistic( const QString &attribute, Qgis::Statistic statistic ) const;
263 % MethodCode
264 {
265 const QVariant res = sipCpp->metadataStatistic( *a0, a1 );
266 if ( !res.isValid() )
267 {
268 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Statistic is not available" ).toUtf8().constData() );
269 sipIsErr = 1;
270 }
271 else
272 {
273 QVariant *v = new QVariant( res );
274 sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
275 }
276 }
277 % End
278#endif
279
288 virtual QVariantList metadataClasses( const QString &attribute ) const;
289
290
291#ifndef SIP_RUN
292
303 virtual QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, Qgis::Statistic statistic ) const;
304
305#else
306
316 SIP_PYOBJECT metadataClassStatistic( const QString &attribute, const QVariant &value, Qgis::Statistic statistic ) const;
317 % MethodCode
318 {
319 const QVariant res = sipCpp->metadataClassStatistic( *a0, *a1, a2 );
320 if ( !res.isValid() )
321 {
322 PyErr_SetString( PyExc_ValueError, QStringLiteral( "Statistic is not available" ).toUtf8().constData() );
323 sipIsErr = 1;
324 }
325 else
326 {
327 QVariant *v = new QVariant( res );
328 sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
329 }
330 }
331 % End
332#endif
333
334
339 QgsPointCloudStatistics metadataStatistics();
340
341 bool supportsSubsetString() const override;
342 QString subsetStringDialect() const override;
343 QString subsetStringHelpUrl() const override;
344 QString subsetString() const override;
345 bool setSubsetString( const QString &subset, bool updateFeatureCount = false ) override;
346
353 static QMap< int, QString > lasClassificationCodes();
354
361 static QMap< int, QString > translatedLasClassificationCodes();
362
368 static QMap< int, QString > dataFormatIds();
369
375 static QMap< int, QString > translatedDataFormatIds();
376
377 signals:
378
383
384 protected:
387
389 QVector<QVariantMap> identify( QgsPointCloudIndex *index, double maxError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange, int pointsLimit ) SIP_SKIP ;
390
391 private:
392 QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange );
393
394};
395
396#endif // QGSMESHDATAPROVIDER_H
Represents a indexed point cloud node in octree.
Statistic
Available generic statistics.
Definition qgis.h:5432
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
Abstract base class for spatial data provider implementations.
virtual QString subsetString() const
Returns the subset definition string currently in use by the layer and used by the provider to limit ...
virtual bool supportsSubsetString() const
Returns true if the provider supports setting of subset strings.
virtual QString subsetStringHelpUrl() const
Returns a URL pointing to documentation describing the dialect which is supported for subset strings ...
virtual bool setSubsetString(const QString &subset, bool updateFeatureCount=true)
Set the subset string used to create a subset of features in the layer.
virtual QString subsetStringDialect() const
Returns a user-friendly string describing the dialect which is supported for subset strings by the pr...
QgsRange which stores a range of double values.
Definition qgsrange.h:231
A geometry is the spatial representation of a feature.
Collection of point cloud attributes.
Base class for providing data for QgsPointCloudLayer.
Capability
Capabilities that providers may implement.
~QgsPointCloudDataProvider() override
virtual QgsPointCloudAttributeCollection attributes() const =0
Returns the attributes available from this data provider.
virtual QVector< QgsPointCloudSubIndex > subIndexes()
Returns a list of sub indexes available if the provider supports multiple indexes,...
virtual void generateIndex()=0
Triggers generation of the point cloud index.
virtual void loadSubIndex(int n)
Triggers loading of the point cloud index for the n th sub index.
virtual void loadIndex()=0
Triggers loading of the point cloud index.
virtual qint64 pointCount() const =0
Returns the total number of points available in the dataset.
QString mSubsetString
String used to define a subset of the layer.
void indexGenerationStateChanged(QgsPointCloudDataProvider::PointCloudIndexGenerationState state)
Emitted when point cloud generation state is changed.
PointCloudIndexGenerationState
Point cloud index state.
virtual QgsPointCloudIndex * index() const
Returns the point cloud index associated with the provider.
virtual PointCloudIndexGenerationState indexingState()=0
Gets the current index generation state.
Represents a indexed point clouds data in octree.
Abstract base class for 2d point cloud renderers.
Class used to store statistics of a point cloud dataset.
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_FACTORY
Definition qgis_sip.h:76
Setting options for creating vector data providers.