QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgspointcloudrgbrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudrgbrenderer.h
3  --------------------
4  begin : October 2020
5  copyright : (C) 2020 by Nyall Dawson
6  email : nyall dot dawson 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 QGSPOINTCLOUDRGBRENDERER_H
19 #define QGSPOINTCLOUDRGBRENDERER_H
20 
21 #include "qgspointcloudrenderer.h"
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 
25 #include "qgscontrastenhancement.h"
26 
27 
28 #ifndef SIP_RUN
29 
39 {
40  public:
41 
42  QSet< QString > usedAttributes() const override;
43  bool prepareBlock( const QgsPointCloudBlock *block ) override;
44  QColor pointColor( const QgsPointCloudBlock *block, int i, double z ) override;
45 
46  QString redAttribute = QStringLiteral( "Red" );
47  QString greenAttribute = QStringLiteral( "Green" );
48  QString blueAttribute = QStringLiteral( "Blue" );
49  std::unique_ptr< QgsContrastEnhancement > redContrastEnhancement;
50  std::unique_ptr< QgsContrastEnhancement > greenContrastEnhancement;
51  std::unique_ptr< QgsContrastEnhancement > blueContrastEnhancement;
52 
53  int redOffset = 0;
55  bool useRedContrastEnhancement = false;
56  int greenOffset = 0;
58  bool useGreenContrastEnhancement = false;
59  int blueOffset = 0;
61  bool useBlueContrastEnhancement = false;
62 };
63 #endif
64 
72 {
73  public:
74 
79 
80  QString type() const override;
81  QgsPointCloudRenderer *clone() const override;
82  void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
83  QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
84  QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
85  std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override SIP_SKIP;
86 
90  static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
91 
99  QString redAttribute() const;
100 
108  void setRedAttribute( const QString &attribute );
109 
117  QString greenAttribute() const;
118 
126  void setGreenAttribute( const QString &attribute );
127 
135  QString blueAttribute() const;
136 
144  void setBlueAttribute( const QString &attribute );
145 
153  const QgsContrastEnhancement *redContrastEnhancement() const;
154 
164  void setRedContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
165 
173  const QgsContrastEnhancement *greenContrastEnhancement() const;
174 
184  void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
185 
193  const QgsContrastEnhancement *blueContrastEnhancement() const;
194 
204  void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
205 
206  private:
207 
208  QString mRedAttribute = QStringLiteral( "Red" );
209  QString mGreenAttribute = QStringLiteral( "Green" );
210  QString mBlueAttribute = QStringLiteral( "Blue" );
211 
212  std::unique_ptr< QgsContrastEnhancement > mRedContrastEnhancement;
213  std::unique_ptr< QgsContrastEnhancement > mGreenContrastEnhancement;
214  std::unique_ptr< QgsContrastEnhancement > mBlueContrastEnhancement;
215 
216 };
217 
218 #endif // QGSPOINTCLOUDRGBRENDERER_H
QgsPointCloudRgbRenderer
An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
Definition: qgspointcloudrgbrenderer.h:71
QgsPointCloudRgbRendererPreparedData
Prepared data container for QgsPointCloudRgbRenderer.
Definition: qgspointcloudrgbrenderer.h:38
QgsPointCloudAttribute::DataType
DataType
Systems of unit measurement.
Definition: qgspointcloudattribute.h:44
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
qgscontrastenhancement.h
QgsPointCloudRenderer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsPointCloudRenderContext &context) const
Returns a list of attributes required by this renderer.
Definition: qgspointcloudrenderer.cpp:78
QgsPointCloudRenderer::prepare
virtual std::unique_ptr< QgsPreparedPointCloudRendererData > prepare()
Returns prepared data container for bulk point color retrieval.
Definition: qgspointcloudrenderer.cpp:83
QgsPreparedPointCloudRendererData
Base class for 2d point cloud renderer prepared data containers.
Definition: qgspointcloudrenderer.h:256
QgsPointCloudRenderer::clone
virtual QgsPointCloudRenderer * clone() const =0
Create a deep copy of this renderer.
QgsPointCloudBlock
Base class for storing raw data from point cloud nodes.
Definition: qgspointcloudblock.h:38
QgsPreparedPointCloudRendererData::pointColor
virtual QColor pointColor(const QgsPointCloudBlock *block, int i, double z)=0
An optimised method of retrieving the color of a point from a point cloud block.
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPreparedPointCloudRendererData::prepareBlock
virtual bool prepareBlock(const QgsPointCloudBlock *block)=0
Prepares the renderer for using the specified block.
geos::unique_ptr
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
QgsPointCloudRenderer::save
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) const =0
Saves the renderer configuration to an XML element.
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsPointCloudRenderer::renderBlock
virtual void renderBlock(const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context)=0
Renders a block of point cloud data using the specified render context.
QgsPointCloudRenderContext
Encapsulates the render context for a 2D point cloud rendering operation.
Definition: qgspointcloudrenderer.h:41
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsContrastEnhancement
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
Definition: qgscontrastenhancement.h:42
QgsPreparedPointCloudRendererData::usedAttributes
virtual QSet< QString > usedAttributes() const =0
Returns the set of attributes used by the prepared point cloud renderer.
QgsPointCloudRenderer::type
virtual QString type() const =0
Returns the identifier of the renderer type.
QgsPointCloudRenderer
Abstract base class for 2d point cloud renderers.
Definition: qgspointcloudrenderer.h:296
qgspointcloudrenderer.h