QGIS API Documentation 3.37.0-Master (49cede7946b)
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
40
50 QgsPointCloudCategory( int value, const QColor &color, const QString &label, bool render = true, double pointSize = 0 );
51
56 bool operator==( const QgsPointCloudCategory &other ) const;
57
63 int value() const { return mValue; }
64
69 QColor color() const { return mColor; }
70
76 double pointSize() const { return mPointSize; }
77
83 QString label() const { return mLabel; }
84
90 void setValue( int value ) { mValue = value; }
91
97 void setColor( const QColor &color ) { mColor = color; }
98
105 void setPointSize( double size ) { mPointSize = size; }
106
112 void setLabel( const QString &label ) { mLabel = label; }
113
118 bool renderState() const { return mRender; }
119
124 void setRenderState( bool render ) { mRender = render; }
125
126 protected:
127 int mValue = 0;
128 QColor mColor;
129 double mPointSize = 0; // Values <= 0 means "use default layer point size"
130 QString mLabel;
131 bool mRender = true;
132};
133
134typedef QList<QgsPointCloudCategory> QgsPointCloudCategoryList;
135
136#ifndef SIP_RUN
137
147{
148 public:
149
150 QSet< QString > usedAttributes() const override;
151 bool prepareBlock( const QgsPointCloudBlock *block ) override;
152 QColor pointColor( const QgsPointCloudBlock *block, int i, double z ) override SIP_SKIP;
153
155 QHash< int, QColor > colors;
157 int attributeOffset = 0;
158};
159#endif
160
168{
169 public:
170
174 QgsPointCloudClassifiedRenderer( const QString &attributeName = QString(), const QgsPointCloudCategoryList &categories = QgsPointCloudCategoryList() );
175
176 QString type() const override;
177 QgsPointCloudRenderer *clone() const override;
178 void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) override;
179 bool willRenderPoint( const QVariantMap &pointAttributes ) override;
180 QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
181 QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const override;
182 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) override SIP_FACTORY;
183 QStringList legendRuleKeys() const override;
184 bool legendItemChecked( const QString &key ) override;
185 void checkLegendItem( const QString &key, bool state = true ) override;
186 std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override SIP_SKIP;
187
191 static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
192
196 static QgsPointCloudCategoryList defaultCategories();
197
203 QString attribute() const;
204
210 void setAttribute( const QString &attribute );
211
217 QgsPointCloudCategoryList categories() const;
218
224 void setCategories( const QgsPointCloudCategoryList &categories );
225
231 void addCategory( const QgsPointCloudCategory &category );
232
233 private:
234
235 QString mAttribute = QStringLiteral( "Classification" );
236
237 QgsPointCloudCategoryList mCategories;
238};
239
240#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
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.
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