QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgspointcloudattributebyramprenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudattributebyramprenderer.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 QGSPOINTCLOUDATTRIBUTEBYRAMPRENDERER_H
19 #define QGSPOINTCLOUDATTRIBUTEBYRAMPRENDERER_H
20 
21 #include "qgspointcloudrenderer.h"
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 #include "qgscolorrampshader.h"
25 
26 #ifndef SIP_RUN
27 
37 {
38  public:
39 
40  QSet< QString > usedAttributes() const override;
41  bool prepareBlock( const QgsPointCloudBlock *block ) override;
42  QColor pointColor( const QgsPointCloudBlock *block, int i, double z ) override SIP_SKIP;
43 
44  QString attributeName;
45  QgsColorRampShader colorRampShader;
46  int attributeOffset = 0;
47  bool attributeIsX = false;
48  bool attributeIsY = false;
49  bool attributeIsZ = false;
51 };
52 #endif
53 
54 
62 {
63  public:
64 
69 
70  QString type() const override;
71  QgsPointCloudRenderer *clone() const override;
72  void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
73  QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
74  QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
75  QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) override SIP_FACTORY;
76  std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override SIP_SKIP;
77 
81  static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
82 
88  QString attribute() const;
89 
95  void setAttribute( const QString &attribute );
96 
102  QgsColorRampShader colorRampShader() const;
103 
109  void setColorRampShader( const QgsColorRampShader &shader );
110 
117  double minimum() const;
118 
125  void setMinimum( double minimum );
126 
133  double maximum() const;
134 
141  void setMaximum( double maximum );
142 
143  private:
144 
145  double mMin = 0;
146  double mMax = 100;
147 
148  QString mAttribute = QStringLiteral( "Intensity" );
149  QgsColorRampShader mColorRampShader;
150 
151 };
152 
153 #endif // QGSPOINTCLOUDATTRIBUTEBYRAMPRENDERER_H
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
QgsPointCloudRenderer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsPointCloudRenderContext &context) const
Returns a list of attributes required by this renderer.
Definition: qgspointcloudrenderer.cpp:78
QgsPointCloudRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgspointcloudrenderer.cpp:152
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
qgscolorrampshader.h
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.
QgsColorRampShader
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Definition: qgscolorrampshader.h:42
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.
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
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition: qgslayertreelayer.h:43
qgis_sip.h
QgsPointCloudAttributeByRampRenderer
An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.
Definition: qgspointcloudattributebyramprenderer.h:61
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.
QgsPointCloudAttributeByRampRendererPreparedData
Prepared data container for QgsPointCloudAttributeByRampRenderer.
Definition: qgspointcloudattributebyramprenderer.h:36
QgsPointCloudRenderer
Abstract base class for 2d point cloud renderers.
Definition: qgspointcloudrenderer.h:296
qgspointcloudrenderer.h