QGIS API Documentation 3.39.0-Master (d85f3c2a281)
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
21#include <Qt3DRender/QMaterial>
22
23#include "qgsabstract3dsymbol.h"
24#include "qgscolorrampshader.h"
25#include "qgspointcloudlayer.h"
28
39{
40 public:
41
46 {
47 // Do not render anything
48 NoRendering = 0,
56 Classification
57 };
58
60 ~QgsPointCloud3DSymbol() override;
61
62 QString type() const override { return "pointcloud"; }
63
67 virtual QString symbolType() const = 0;
68
73 float pointSize() const { return mPointSize; }
74
79 void setPointSize( float size );
80
82 virtual unsigned int byteStride() = 0;
84 virtual void fillMaterial( Qt3DRender::QMaterial *material ) = 0 SIP_SKIP;
85
91 bool renderAsTriangles() const;
92
98 void setRenderAsTriangles( bool asTriangles );
99
106 bool horizontalTriangleFilter() const;
107
114 void setHorizontalTriangleFilter( bool horizontalTriangleFilter );
115
122 float horizontalFilterThreshold() const;
123
130 void setHorizontalFilterThreshold( float horizontalFilterThreshold );
131
138 bool verticalTriangleFilter() const;
139
146 void setVerticalTriangleFilter( bool verticalTriangleFilter );
147
154 float verticalFilterThreshold() const;
155
162 void setVerticalFilterThreshold( float verticalFilterThreshold );
163
164 void copyBaseSettings( QgsAbstract3DSymbol *destination ) const override;
165
166 protected:
167 float mPointSize = 3.0;
168 bool mRenderAsTriangles = false;
169 bool mHorizontalTriangleFilter = false;
170 float mHorizontalFilterThreshold = 10.0;
171 bool mVerticalTriangleFilter = false;
172 float mVerticalFilterThreshold = 10.0;
173
179 void writeBaseXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
180
186 void readBaseXml( const QDomElement &elem, const QgsReadWriteContext &context );
187};
188
199{
200 public:
202
203 QString symbolType() const override;
204 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
205
206 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
207 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
208
213 QColor singleColor() const { return mSingleColor; }
214
219 void setSingleColor( QColor color );
220
221 unsigned int byteStride() override { return 3 * sizeof( float ); }
222 void fillMaterial( Qt3DRender::QMaterial *material ) override SIP_SKIP;
223
224
225 private:
226 QColor mSingleColor = QColor( 0, 0, 255 );
227};
228
239{
240 public:
242
243 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
244 QString symbolType() const override;
245
246 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
247 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
248
253 QString attribute() const;
254
259 void setAttribute( const QString &attribute );
260
265 QgsColorRampShader colorRampShader() const;
266
271 void setColorRampShader( const QgsColorRampShader &colorRampShader );
272
277 double colorRampShaderMin() const { return mColorRampShaderMin; }
278
283 double colorRampShaderMax() const { return mColorRampShaderMax; }
284
290 void setColorRampShaderMinMax( double min, double max );
291
292 unsigned int byteStride() override { return 4 * sizeof( float ); }
293 void fillMaterial( Qt3DRender::QMaterial *material ) override SIP_SKIP;
294
295 private:
296 QString mRenderingParameter;
297 QgsColorRampShader mColorRampShader;
298 double mColorRampShaderMin = 0.0;
299 double mColorRampShaderMax = 1.0;
300};
301
312{
313 public:
315
318
321
322 QString symbolType() const override;
323 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
324
325 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
326 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
327
328 unsigned int byteStride() override { return 6 * sizeof( float ); }
329 void fillMaterial( Qt3DRender::QMaterial *material ) override SIP_SKIP;
330
338 QString redAttribute() const;
339
347 void setRedAttribute( const QString &attribute );
348
356 QString greenAttribute() const;
357
365 void setGreenAttribute( const QString &attribute );
366
374 QString blueAttribute() const;
375
383 void setBlueAttribute( const QString &attribute );
384
392 QgsContrastEnhancement *redContrastEnhancement();
393
403 void setRedContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
404
412 QgsContrastEnhancement *greenContrastEnhancement();
413
423 void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
424
432 QgsContrastEnhancement *blueContrastEnhancement();
433
443 void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
444
445 private:
446
447#ifdef SIP_RUN
449#endif
450
451 QString mRedAttribute = QStringLiteral( "Red" );
452 QString mGreenAttribute = QStringLiteral( "Green" );
453 QString mBlueAttribute = QStringLiteral( "Blue" );
454
455 std::unique_ptr< QgsContrastEnhancement > mRedContrastEnhancement;
456 std::unique_ptr< QgsContrastEnhancement > mGreenContrastEnhancement;
457 std::unique_ptr< QgsContrastEnhancement > mBlueContrastEnhancement;
458
459};
460
471{
472 public:
474
475 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
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( Qt3DRender::QMaterial *material ) override SIP_SKIP;
514
515 private:
516 QString mRenderingParameter;
517 QgsPointCloudCategoryList mCategoriesList;
518
519 QgsColorRampShader colorRampShader() const;
520};
521
522#endif // QGSPOINTCLOUD3DSYMBOL_H
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.
double colorRampShaderMin() const
Returns the minimum value used when classifying colors in the color ramp shader.
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.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
virtual unsigned int byteStride()=0
Returns the byte stride for the geometries used to for the vertex buffer.
virtual QString symbolType() const =0
Returns a unique string identifier of the symbol type.
virtual void fillMaterial(Qt3DRender::QMaterial *material)=0SIP_SKIP
Used to fill material object with necessary QParameters (and consequently opengl uniforms)
float pointSize() const
Returns the point size of the point cloud.
RenderingStyle
How to render the point cloud.
@ 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.
QString type() const override
The class is used as a container of context for various read/write operations on other objects.
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.
QColor singleColor() const
Returns the color used by the renderer when using SingleColor rendering mode.
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_ABSTRACT
Definition qgis_sip.h:213
#define SIP_FACTORY
Definition qgis_sip.h:76
QList< QgsPointCloudCategory > QgsPointCloudCategoryList