QGIS API Documentation 3.27.0-Master (0a97e3138f)
qgspointcloudclassifiedrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudclassifiedrenderer.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 QGSPOINTCLOUDCLASSIFIEDRENDERER_H
19#define QGSPOINTCLOUDCLASSIFIEDRENDERER_H
20
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgscolorrampshader.h"
25
26
32class CORE_EXPORT QgsPointCloudCategory
33{
34 public:
35
40
48 QgsPointCloudCategory( int value, const QColor &color, const QString &label, bool render = true );
49
54 bool operator==( const QgsPointCloudCategory &other ) const;
55
61 int value() const { return mValue; }
62
67 QColor color() const { return mColor; }
68
74 QString label() const { return mLabel; }
75
81 void setValue( int value ) { mValue = value; }
82
88 void setColor( const QColor &color ) { mColor = color; }
89
95 void setLabel( const QString &label ) { mLabel = label; }
96
101 bool renderState() const { return mRender; }
102
107 void setRenderState( bool render ) { mRender = render; }
108
109 protected:
110 int mValue = 0;
111 QColor mColor;
112 QString mLabel;
113 bool mRender = true;
114};
115
116typedef QList<QgsPointCloudCategory> QgsPointCloudCategoryList;
117
118#ifndef SIP_RUN
119
129{
130 public:
131
132 QSet< QString > usedAttributes() const override;
133 bool prepareBlock( const QgsPointCloudBlock *block ) override;
134 QColor pointColor( const QgsPointCloudBlock *block, int i, double z ) override SIP_SKIP;
135
137 QHash< int, QColor > colors;
139 int attributeOffset = 0;
140};
141#endif
142
150{
151 public:
152
156 QgsPointCloudClassifiedRenderer( const QString &attributeName = QString(), const QgsPointCloudCategoryList &categories = QgsPointCloudCategoryList() );
157
158 QString type() const override;
159 QgsPointCloudRenderer *clone() const override;
160 void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
161 bool willRenderPoint( const QVariantMap &pointAttributes ) override;
162 QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
163 QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
164 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) override SIP_FACTORY;
165 QStringList legendRuleKeys() const override;
166 bool legendItemChecked( const QString &key ) override;
167 void checkLegendItem( const QString &key, bool state = true ) override;
168 std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override SIP_SKIP;
169
173 static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
174
178 static QgsPointCloudCategoryList defaultCategories();
179
185 QString attribute() const;
186
192 void setAttribute( const QString &attribute );
193
199 QgsPointCloudCategoryList categories() const;
200
206 void setCategories( const QgsPointCloudCategoryList &categories );
207
213 void addCategory( const QgsPointCloudCategory &category );
214
215 private:
216
217 QString mAttribute = QStringLiteral( "Classification" );
218
219 QgsPointCloudCategoryList mCategories;
220};
221
222#endif // QGSPOINTCLOUDCLASSIFIEDRENDERER_H
Layer tree node points to a map layer.
DataType
Systems of unit measurement.
Base class for storing raw data from point cloud nodes.
Represents an individual category (class) from a QgsPointCloudClassifiedRenderer.
QgsPointCloudCategory()=default
Constructor for QgsPointCloudCategory.
int value() const
Returns the value corresponding to this category.
void setValue(int value)
Sets the value corresponding to this category.
bool renderState() const
Returns true if the category is currently enabled and should be rendered.
void setRenderState(bool render)
Sets whether the category is currently enabled and should be rendered.
QColor color() const
Returns the color which will be used to render this category.
void setColor(const QColor &color)
Sets the color which will be used to render this category.
QString label() const
Returns the label for this category, which is used to represent the category within legends and the l...
void setLabel(const QString &label)
Sets the label for this category, which is used to represent the category within legends and the laye...
Prepared data container for QgsPointCloudClassifiedRenderer.
Renders point clouds by a classification attribute.
Encapsulates the render context for a 2D point cloud rendering operation.
Abstract base class for 2d point cloud renderers.
Base class for 2d point cloud renderer prepared data containers.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QList< QgsPointCloudCategory > QgsPointCloudCategoryList