QGIS API Documentation  3.21.0-Master (564c892cfd)
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"
26 
27 #include <QString>
28 #include <memory>
29 
32 
42 class CORE_EXPORT QgsPointCloudLayer : public QgsMapLayer
43 {
44  Q_OBJECT
45  public:
46 
50  struct LayerOptions
51  {
52 
57  : transformContext( transformContext )
58  {}
59 
64 
66  bool loadDefaultStyle = true;
67 
79  bool skipCrsValidation = false;
80 
84  bool skipIndexGeneration = false;
85  };
86 
87 
91  explicit QgsPointCloudLayer( const QString &uri = QString(),
92  const QString &baseName = QString(),
93  const QString &providerLib = QStringLiteral( "pointcloud" ),
95 
96  ~QgsPointCloudLayer() override;
97 
99  QgsPointCloudLayer( const QgsPointCloudLayer &rhs ) = delete;
102 
103 #ifdef SIP_RUN
104  SIP_PYOBJECT __repr__();
105  % MethodCode
106  QString str = QStringLiteral( "<QgsPointCloudLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
107  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
108  % End
109 #endif
110 
111  QgsPointCloudLayer *clone() const override SIP_FACTORY;
112  QgsRectangle extent() const override;
113  QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
114 
115  QgsPointCloudDataProvider *dataProvider() override;
116  const QgsPointCloudDataProvider *dataProvider() const override SIP_SKIP;
117 
118  bool readXml( const QDomNode &layerNode, QgsReadWriteContext &context ) override;
119 
120  bool writeXml( QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
121 
122  bool readSymbology( const QDomNode &node, QString &errorMessage,
123  QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) override;
124  bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) FINAL;
125 
126  bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context,
127  StyleCategories categories = AllStyleCategories ) const override;
128  bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) const FINAL;
129 
130  void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;
131 
132  QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const override;
133  QString decodedSource( const QString &source, const QString &dataProvider, const QgsReadWriteContext &context ) const override;
134  QString loadDefaultStyle( bool &resultFlag SIP_OUT ) FINAL;
135  QString htmlMetadata() const override;
136  QgsMapLayerElevationProperties *elevationProperties() override;
137 
141  QgsPointCloudAttributeCollection attributes() const;
142 
146  qint64 pointCount() const;
147 
153  QgsPointCloudRenderer *renderer();
154 
161  const QgsPointCloudRenderer *renderer() const SIP_SKIP;
162 
170  void setRenderer( QgsPointCloudRenderer *renderer SIP_TRANSFER );
171 
172  private slots:
173  void onPointCloudIndexGenerationStateChanged( QgsPointCloudDataProvider::PointCloudIndexGenerationState state );
174  void setDataSourcePrivate( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags ) override;
175 
176  private:
177 
178  bool isReadOnly() const override {return true;}
179 
180 #ifdef SIP_RUN
182 #endif
183 
184  std::unique_ptr<QgsPointCloudDataProvider> mDataProvider;
185 
186  std::unique_ptr<QgsPointCloudRenderer> mRenderer;
187 
188  QgsPointCloudLayerElevationProperties *mElevationProperties = nullptr;
189 };
190 
191 
192 #endif // QGSPOINTCLOUDPLAYER_H
Contains information about the context in which a coordinate transform is executed.
Abstract base class for spatial data provider implementations.
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:70
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.
Base class for providing data for QgsPointCloudLayer.
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
Implementation of threaded rendering for point cloud layers.
Represents a map layer supporting display of point clouds.
QgsPointCloudLayer(const QgsPointCloudLayer &rhs)=delete
QgsPointCloudLayer cannot be copied.
~QgsPointCloudLayer() override
QgsPointCloudLayer & operator=(QgsPointCloudLayer const &rhs)=delete
QgsPointCloudLayer cannot be copied.
Abstract base class for 2d point cloud renderers.
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Contains information about the context of a rendering operation.
#define str(x)
Definition: qgis.cpp:37
#define SIP_SKIP
Definition: qgis_sip.h:126
#define FINAL
Definition: qgis_sip.h:228
#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 loading point cloud layers.
LayerOptions(const QgsCoordinateTransformContext &transformContext=QgsCoordinateTransformContext())
Constructor for LayerOptions with optional transformContext.
QgsCoordinateTransformContext transformContext
Coordinate transform context.