QGIS API Documentation 3.41.0-Master (d2aaa9c6e02)
Loading...
Searching...
No Matches
qgspointcloudlayer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudlayer.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 QGSPOINTCLOUDLAYER_H
19#define QGSPOINTCLOUDLAYER_H
20
22
24#include "qgsmaplayer.h"
25#include "qgis_core.h"
28
29#include <QString>
30#include <memory>
31
35
46{
47 Q_OBJECT
48 public:
49
54 {
55
60 : transformContext( transformContext )
61 {}
62
67
69 bool loadDefaultStyle = true;
70
82 bool skipCrsValidation = false;
83
87 bool skipIndexGeneration = false;
88
93 bool skipStatisticsCalculation = false;
94 };
95
96
102 {
103 NotStarted = 0,
104 Calculating = 1 << 0,
105 Calculated = 1 << 1
106 };
107 Q_ENUM( PointCloudStatisticsCalculationState )
108
109
112 explicit QgsPointCloudLayer( const QString &uri = QString(),
113 const QString &baseName = QString(),
114 const QString &providerLib = QStringLiteral( "pointcloud" ),
116
117 ~QgsPointCloudLayer() override;
118
121
122#ifdef SIP_RUN
123 SIP_PYOBJECT __repr__();
124 % MethodCode
125 QString str = QStringLiteral( "<QgsPointCloudLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
126 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
127 % End
128#endif
129
130 QgsPointCloudLayer *clone() const override SIP_FACTORY;
131 QgsRectangle extent() const override;
132 QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
133 QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY;
134
135 QgsPointCloudDataProvider *dataProvider() override;
136 const QgsPointCloudDataProvider *dataProvider() const override SIP_SKIP;
137
138 bool supportsEditing() const override;
139 bool isEditable() const override;
140 bool isModified() const override;
141
142 bool readXml( const QDomNode &layerNode, QgsReadWriteContext &context ) override;
143
144 bool writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
145
146 bool readSymbology( const QDomNode &node, QString &errorMessage,
147 QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) override;
148 bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) FINAL;
149
150 bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
151 StyleCategories categories = AllStyleCategories ) const override;
152 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) const FINAL;
153
154 void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;
155
156 QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const override;
157 QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const override;
158 QString loadDefaultStyle( bool &resultFlag SIP_OUT ) FINAL;
159 QString htmlMetadata() const override;
160 QgsMapLayerElevationProperties *elevationProperties() override;
161
165 QgsPointCloudAttributeCollection attributes() const;
166
170 qint64 pointCount() const;
171
177 QgsPointCloudRenderer *renderer();
178
185 const QgsPointCloudRenderer *renderer() const SIP_SKIP;
186
194 void setRenderer( QgsPointCloudRenderer *renderer SIP_TRANSFER );
195
203 bool setSubsetString( const QString &subset );
204
211 QString subsetString() const;
212
219 void setSync3DRendererTo2DRenderer( bool sync );
220
227 bool sync3DRendererTo2DRenderer() const;
228
235 bool convertRenderer3DFromRenderer2D();
236
241 const QgsPointCloudStatistics statistics() const { return mStatistics; }
242
248 PointCloudStatisticsCalculationState statisticsCalculationState() const { return mStatisticsCalculationState; }
249
265 bool startEditing();
266
286 bool commitChanges( bool stopEditing = true );
287
294 QString commitError() const;
295
303 bool rollBack();
304
319 bool changeAttributeValue( const QgsPointCloudNodeId &n, const QVector<int> &points, const QgsPointCloudAttribute &attribute, double value ) SIP_SKIP;
320
328 QgsPointCloudIndex index() const;
329
330
331 signals:
332
339
345 void raiseError( const QString &msg );
346
353
354 private slots:
355 void onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state );
356 void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags ) override;
357
358 private:
359
360 bool isReadOnly() const override {return true;}
361
362 void calculateStatistics();
363
364 void resetRenderer();
365
366 void loadIndexesForRenderContext( QgsRenderContext &rendererContext ) const;
367
368#ifdef SIP_RUN
370#endif
371
372 std::unique_ptr<QgsPointCloudDataProvider> mDataProvider;
373
374 std::unique_ptr<QgsPointCloudRenderer> mRenderer;
375
376 QgsPointCloudLayerElevationProperties *mElevationProperties = nullptr;
377
378 LayerOptions mLayerOptions;
379
380 bool mSync3DRendererTo2DRenderer = true;
381 QgsPointCloudStatistics mStatistics;
382 PointCloudStatisticsCalculationState mStatisticsCalculationState = PointCloudStatisticsCalculationState::NotStarted;
383 long mStatsCalculationTask = 0;
384
385 QgsPointCloudIndex mEditIndex;
386 QString mCommitError;
387
388 friend class TestQgsVirtualPointCloudProvider;
389};
390
391
392#endif // QGSPOINTCLOUDLAYER_H
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
Definition qgis.h:450
Base class for point cloud 3D renderers.
Abstract base class for objects which generate elevation profiles.
Interface for classes which can generate elevation profiles.
Contains information about the context in which a coordinate transform is executed.
Base class for storage of map layer elevation properties.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Base class for all map layer types.
Definition qgsmaplayer.h:76
QFlags< StyleCategory > StyleCategories
virtual QgsMapLayer * clone() const =0
Returns a new instance equivalent to this one except for the id which is still unique.
Collection of point cloud attributes.
Attribute for point cloud data pair of name and size in bytes.
Base class for providing data for QgsPointCloudLayer.
PointCloudIndexGenerationState
Point cloud index state.
Smart pointer for QgsAbstractPointCloudIndex.
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
Implementation of threaded rendering for point cloud layers.
Represents a map layer supporting display of point clouds.
PointCloudStatisticsCalculationState
Point cloud statistics calculation task.
void raiseError(const QString &msg)
Signals an error related to this point cloud layer.
PointCloudStatisticsCalculationState statisticsCalculationState() const
Returns the status of point cloud statistics calculation.
QgsPointCloudLayer(const QgsPointCloudLayer &rhs)=delete
void statisticsCalculationStateChanged(QgsPointCloudLayer::PointCloudStatisticsCalculationState state)
Emitted when statistics calculation state has changed.
void subsetStringChanged()
Emitted when the layer's subset string has changed.
QgsPointCloudLayer & operator=(QgsPointCloudLayer const &rhs)=delete
Represents a indexed point cloud node's position in octree.
Abstract base class for 2d point cloud renderers.
Class used to store statistics of a point cloud dataset.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_SKIP
Definition qgis_sip.h:126
#define FINAL
Definition qgis_sip.h:242
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:76
Setting options for creating vector data providers.
Setting options for loading point cloud layers.
LayerOptions(const QgsCoordinateTransformContext &transformContext=QgsCoordinateTransformContext())
Constructor for LayerOptions with optional transformContext.
QgsCoordinateTransformContext transformContext
Coordinate transform context.