QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
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
37
47 QgsPointCloudCategory( int value, const QColor &color, const QString &label, bool render = true, double pointSize = 0 );
48
53 bool operator==( const QgsPointCloudCategory &other ) const;
54
60 int value() const { return mValue; }
61
66 QColor color() const { return mColor; }
67
73 double pointSize() const { return mPointSize; }
74
80 QString label() const { return mLabel; }
81
87 void setValue( int value ) { mValue = value; }
88
94 void setColor( const QColor &color ) { mColor = color; }
95
102 void setPointSize( double size ) { mPointSize = size; }
103
109 void setLabel( const QString &label ) { mLabel = label; }
110
115 bool renderState() const { return mRender; }
116
121 void setRenderState( bool render ) { mRender = render; }
122
123 protected:
124 int mValue = 0;
125 QColor mColor;
126 double mPointSize = 0; // Values <= 0 means "use default layer point size"
127 QString mLabel;
128 bool mRender = true;
129};
130
131typedef QList<QgsPointCloudCategory> QgsPointCloudCategoryList;
132
133#ifndef SIP_RUN
134
144{
145 public:
146
147 QSet< QString > usedAttributes() const override;
148 bool prepareBlock( const QgsPointCloudBlock *block ) override;
149 QColor pointColor( const QgsPointCloudBlock *block, int i, double z ) override SIP_SKIP;
150
152 QHash< int, QColor > colors;
154 int attributeOffset = 0;
155};
156#endif
157
165{
166 public:
167
171 QgsPointCloudClassifiedRenderer( const QString &attributeName = QString(), const QgsPointCloudCategoryList &categories = QgsPointCloudCategoryList() );
172
173 QString type() const override;
174 QgsPointCloudRenderer *clone() const override;
175 void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
176 bool willRenderPoint( const QVariantMap &pointAttributes ) override;
177 QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
178 QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
179 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) override SIP_FACTORY;
180 QStringList legendRuleKeys() const override;
181 bool legendItemChecked( const QString &key ) override;
182 void checkLegendItem( const QString &key, bool state = true ) override;
183 std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override SIP_SKIP;
184
188 static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
189
193 static QgsPointCloudCategoryList defaultCategories();
194
200 QString attribute() const;
201
207 void setAttribute( const QString &attribute );
208
214 QgsPointCloudCategoryList categories() const;
215
221 void setCategories( const QgsPointCloudCategoryList &categories );
222
228 void addCategory( const QgsPointCloudCategory &category );
229
230 private:
231
232 QString mAttribute = QStringLiteral( "Classification" );
233
234 QgsPointCloudCategoryList mCategories;
235};
236
237#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.
void setPointSize(double size)
Sets the point size for this category.
QgsPointCloudCategory()=default
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.
double pointSize() const
Returns the point size for 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