QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
qgspointcloud3dsymbol.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloud3dsymbol.h
3 ------------------------------
4 Date : November 2020
5 Copyright : (C) 2020 by Nedjima Belgacem
6 Email : belgacem dot nedjima at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSPOINTCLOUD3DSYMBOL_H
17#define QGSPOINTCLOUD3DSYMBOL_H
18
19#include "qgis_3d.h"
20#include "qgsabstract3dsymbol.h"
21#include "qgscolorrampshader.h"
23#include "qgsmaterial.h"
25#include "qgspointcloudlayer.h"
26
27#include <QString>
28
29using namespace Qt::StringLiterals;
30
41{
42 public:
47 {
48 // Do not render anything
58 };
59
61 ~QgsPointCloud3DSymbol() override;
62
63 QString type() const override { return "pointcloud"; }
65
69 virtual QString symbolType() const = 0;
70
75 float pointSize() const { return mPointSize; }
76
81 void setPointSize( float size );
82
84 virtual unsigned int byteStride() = 0;
86 virtual void fillMaterial( QgsMaterial *material ) = 0 SIP_SKIP;
87
93 bool renderAsTriangles() const;
94
100 void setRenderAsTriangles( bool asTriangles );
101
108 bool horizontalTriangleFilter() const;
109
117
124 float horizontalFilterThreshold() const;
125
133
140 bool verticalTriangleFilter() const;
141
149
156 float verticalFilterThreshold() const;
157
165
166 void copyBaseSettings( QgsAbstract3DSymbol *destination ) const override;
167
168 protected:
169 float mPointSize = 3.0;
170 bool mRenderAsTriangles = false;
175
181 void writeBaseXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
182
188 void readBaseXml( const QDomElement &elem, const QgsReadWriteContext &context );
189};
190
201{
202 public:
204
205 QString symbolType() const override;
207
208 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
209 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
210
215 QColor singleColor() const { return mSingleColor; }
216
221 void setSingleColor( QColor color );
222
223 unsigned int byteStride() override { return 3 * sizeof( float ); }
224 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
225
226
227 private:
228 QColor mSingleColor = QColor( 0, 0, 255 );
229};
230
241{
242 public:
244
246 QString symbolType() const override;
247
248 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
249 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
250
255 QString attribute() const;
256
261 void setAttribute( const QString &attribute );
262
268
274
279 double colorRampShaderMin() const { return mColorRampShaderMin; }
280
285 double colorRampShaderMax() const { return mColorRampShaderMax; }
286
292 void setColorRampShaderMinMax( double min, double max );
293
294 unsigned int byteStride() override { return 4 * sizeof( float ); }
295 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
296
297 private:
298 QString mRenderingParameter;
299 QgsColorRampShader mColorRampShader;
300 double mColorRampShaderMin = 0.0;
301 double mColorRampShaderMax = 1.0;
302};
303
314{
315 public:
317
320
323
324 QString symbolType() const override;
326
327 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
328 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
329
330 unsigned int byteStride() override { return 6 * sizeof( float ); }
331 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
332
340 QString redAttribute() const;
341
349 void setRedAttribute( const QString &attribute );
350
358 QString greenAttribute() const;
359
367 void setGreenAttribute( const QString &attribute );
368
376 QString blueAttribute() const;
377
385 void setBlueAttribute( const QString &attribute );
386
394 QgsContrastEnhancement *redContrastEnhancement();
395
405 void setRedContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
406
414 QgsContrastEnhancement *greenContrastEnhancement();
415
425 void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
426
434 QgsContrastEnhancement *blueContrastEnhancement();
435
445 void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
446
447 private:
448#ifdef SIP_RUN
450#endif
451
452 QString mRedAttribute = u"Red"_s;
453 QString mGreenAttribute = u"Green"_s;
454 QString mBlueAttribute = u"Blue"_s;
455
456 std::unique_ptr<QgsContrastEnhancement> mRedContrastEnhancement;
457 std::unique_ptr<QgsContrastEnhancement> mGreenContrastEnhancement;
458 std::unique_ptr<QgsContrastEnhancement> mBlueContrastEnhancement;
459};
460
471{
472 public:
474
476 QString symbolType() const override;
477
478 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
479 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
480
485 QString attribute() const;
486
491 void setAttribute( const QString &attribute );
492
497 QgsPointCloudCategoryList categoriesList() const { return mCategoriesList; }
498
503 void setCategoriesList( const QgsPointCloudCategoryList &categories );
504
510 QgsPointCloudCategoryList getFilteredOutCategories() const;
511
512 unsigned int byteStride() override { return 5 * sizeof( float ); }
513 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
514
515 private:
516 QString mRenderingParameter;
517 QgsPointCloudCategoryList mCategoriesList;
518
519 QgsColorRampShader colorRampShader() const;
520};
521
522#endif // QGSPOINTCLOUD3DSYMBOL_H
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
virtual void copyBaseSettings(QgsAbstract3DSymbol *destination) const
Copies base class settings from this object to a destination object.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes symbol configuration to the given DOM element.
QgsPointCloudCategoryList categoriesList() const
Returns the list of categories of the classification.
unsigned int byteStride() override
Returns the byte stride for the geometries used to for the vertex buffer.
QString attribute() const
Returns the attribute used to select the color of the point cloud.
void setAttribute(const QString &attribute)
Sets the attribute used to select the color of the point cloud.
QString symbolType() const override
Returns a unique string identifier of the symbol type.
double colorRampShaderMin() const
Returns the minimum value used when classifying colors in the color ramp shader.
void setAttribute(const QString &attribute)
Sets the attribute used to select the color of the point cloud.
QString attribute() const
Returns the attribute used to select the color of the point cloud.
QString symbolType() const override
Returns a unique string identifier of the symbol type.
QgsColorRampShader colorRampShader() const
Returns the color ramp shader used to render the color.
double colorRampShaderMax() const
Returns the maximum value used when classifying colors in the color ramp shader.
unsigned int byteStride() override
Returns the byte stride for the geometries used to for the vertex buffer.
void setColorRampShader(const QgsColorRampShader &colorRampShader)
Sets the color ramp shader used to render the point cloud.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Handles contrast enhancement and clipping.
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:39
3D symbol that draws point cloud geometries as 3D objects.
bool verticalTriangleFilter() const
Returns whether triangles are filtered by vertical height for rendering.
float verticalFilterThreshold() const
Returns the threshold vertical height value for filtering triangles.
void setVerticalTriangleFilter(bool verticalTriangleFilter)
Sets whether triangles are filtered by vertical height for rendering.
void setHorizontalFilterThreshold(float horizontalFilterThreshold)
Sets the threshold horizontal size value for filtering triangles.
void setRenderAsTriangles(bool asTriangles)
Sets whether points are triangulated to render solid surface.
virtual void fillMaterial(QgsMaterial *material)=0SIP_SKIP
Used to fill material object with necessary QParameters (and consequently opengl uniforms).
virtual unsigned int byteStride()=0
Returns the byte stride for the geometries used to for the vertex buffer.
float horizontalFilterThreshold() const
Returns the threshold horizontal size value for filtering triangles.
QgsPointCloud3DSymbol * clone() const override=0SIP_FACTORY
virtual QString symbolType() const =0
Returns a unique string identifier of the symbol type.
bool renderAsTriangles() const
Returns whether points are triangulated to render solid surface.
float pointSize() const
Returns the point size of the point cloud.
void writeBaseXml(QDomElement &elem, const QgsReadWriteContext &context) const
Writes symbol configuration of this class to the given DOM element.
RenderingStyle
How to render the point cloud.
@ Classification
Render the point cloud with classified colors.
@ SingleColor
Render the point cloud with a single color.
@ ColorRamp
Render the point cloud with a color ramp.
@ RgbRendering
Render the RGB colors of the point cloud.
void setHorizontalTriangleFilter(bool horizontalTriangleFilter)
Sets whether whether triangles are filtered by horizontal size for rendering.
bool horizontalTriangleFilter() const
Returns whether triangles are filtered by horizontal size for rendering.
QString type() const override
void readBaseXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads symbol configuration of this class from the given DOM element.
void setVerticalFilterThreshold(float verticalFilterThreshold)
Sets the threshold vertical height value for filtering triangles.
A container for the context for various read/write operations on objects.
3D symbol that draws point cloud geometries as 3D objects using RGB colors in the dataset.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
QgsRgbPointCloud3DSymbol(const QgsRgbPointCloud3DSymbol &other)=delete
QgsRgbPointCloud3DSymbol cannot be copied - use clone() instead.
QgsRgbPointCloud3DSymbol & operator=(const QgsRgbPointCloud3DSymbol &other)=delete
QgsRgbPointCloud3DSymbol cannot be copied - use clone() instead.
unsigned int byteStride() override
Returns the byte stride for the geometries used to for the vertex buffer.
QString symbolType() const override
Returns a unique string identifier of the symbol type.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
QString symbolType() const override
Returns a unique string identifier of the symbol type.
unsigned int byteStride() override
Returns the byte stride for the geometries used to for the vertex buffer.
QColor singleColor() const
Returns the color used by the renderer when using SingleColor rendering mode.
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_ABSTRACT
Definition qgis_sip.h:221
#define SIP_FACTORY
Definition qgis_sip.h:84
QList< QgsPointCloudCategory > QgsPointCloudCategoryList