QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
22#include "qgsabstract3dsymbol.h"
23#include "qgscolorrampshader.h"
24#include "qgsmaterial.h"
25#include "qgspointcloudlayer.h"
28
39{
40 public:
45 {
46 // Do not render anything
47 NoRendering = 0,
55 Classification
56 };
57
59 ~QgsPointCloud3DSymbol() override;
60
61 QString type() const override { return "pointcloud"; }
62
66 virtual QString symbolType() const = 0;
67
72 float pointSize() const { return mPointSize; }
73
78 void setPointSize( float size );
79
81 virtual unsigned int byteStride() = 0;
83 virtual void fillMaterial( QgsMaterial *material ) = 0 SIP_SKIP;
84
90 bool renderAsTriangles() const;
91
97 void setRenderAsTriangles( bool asTriangles );
98
105 bool horizontalTriangleFilter() const;
106
113 void setHorizontalTriangleFilter( bool horizontalTriangleFilter );
114
121 float horizontalFilterThreshold() const;
122
129 void setHorizontalFilterThreshold( float horizontalFilterThreshold );
130
137 bool verticalTriangleFilter() const;
138
145 void setVerticalTriangleFilter( bool verticalTriangleFilter );
146
153 float verticalFilterThreshold() const;
154
161 void setVerticalFilterThreshold( float verticalFilterThreshold );
162
163 void copyBaseSettings( QgsAbstract3DSymbol *destination ) const override;
164
165 protected:
166 float mPointSize = 3.0;
167 bool mRenderAsTriangles = false;
168 bool mHorizontalTriangleFilter = false;
169 float mHorizontalFilterThreshold = 10.0;
170 bool mVerticalTriangleFilter = false;
171 float mVerticalFilterThreshold = 10.0;
172
178 void writeBaseXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
179
185 void readBaseXml( const QDomElement &elem, const QgsReadWriteContext &context );
186};
187
198{
199 public:
201
202 QString symbolType() const override;
203 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
204
205 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
206 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
207
212 QColor singleColor() const { return mSingleColor; }
213
218 void setSingleColor( QColor color );
219
220 unsigned int byteStride() override { return 3 * sizeof( float ); }
221 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
222
223
224 private:
225 QColor mSingleColor = QColor( 0, 0, 255 );
226};
227
238{
239 public:
241
242 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
243 QString symbolType() const override;
244
245 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
246 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
247
252 QString attribute() const;
253
258 void setAttribute( const QString &attribute );
259
264 QgsColorRampShader colorRampShader() const;
265
270 void setColorRampShader( const QgsColorRampShader &colorRampShader );
271
276 double colorRampShaderMin() const { return mColorRampShaderMin; }
277
282 double colorRampShaderMax() const { return mColorRampShaderMax; }
283
289 void setColorRampShaderMinMax( double min, double max );
290
291 unsigned int byteStride() override { return 4 * sizeof( float ); }
292 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
293
294 private:
295 QString mRenderingParameter;
296 QgsColorRampShader mColorRampShader;
297 double mColorRampShaderMin = 0.0;
298 double mColorRampShaderMax = 1.0;
299};
300
311{
312 public:
314
317
320
321 QString symbolType() const override;
322 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
323
324 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
325 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
326
327 unsigned int byteStride() override { return 6 * sizeof( float ); }
328 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
329
337 QString redAttribute() const;
338
346 void setRedAttribute( const QString &attribute );
347
355 QString greenAttribute() const;
356
364 void setGreenAttribute( const QString &attribute );
365
373 QString blueAttribute() const;
374
382 void setBlueAttribute( const QString &attribute );
383
391 QgsContrastEnhancement *redContrastEnhancement();
392
402 void setRedContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
403
411 QgsContrastEnhancement *greenContrastEnhancement();
412
422 void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
423
431 QgsContrastEnhancement *blueContrastEnhancement();
432
442 void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement SIP_TRANSFER );
443
444 private:
445#ifdef SIP_RUN
447#endif
448
449 QString mRedAttribute = QStringLiteral( "Red" );
450 QString mGreenAttribute = QStringLiteral( "Green" );
451 QString mBlueAttribute = QStringLiteral( "Blue" );
452
453 std::unique_ptr<QgsContrastEnhancement> mRedContrastEnhancement;
454 std::unique_ptr<QgsContrastEnhancement> mGreenContrastEnhancement;
455 std::unique_ptr<QgsContrastEnhancement> mBlueContrastEnhancement;
456};
457
468{
469 public:
471
472 QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
473 QString symbolType() const override;
474
475 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
476 void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
477
482 QString attribute() const;
483
488 void setAttribute( const QString &attribute );
489
494 QgsPointCloudCategoryList categoriesList() const { return mCategoriesList; }
495
500 void setCategoriesList( const QgsPointCloudCategoryList &categories );
501
507 QgsPointCloudCategoryList getFilteredOutCategories() const;
508
509 unsigned int byteStride() override { return 5 * sizeof( float ); }
510 void fillMaterial( QgsMaterial *material ) override SIP_SKIP;
511
512 private:
513 QString mRenderingParameter;
514 QgsPointCloudCategoryList mCategoriesList;
515
516 QgsColorRampShader colorRampShader() const;
517};
518
519#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 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.
virtual QString symbolType() const =0
Returns a unique string identifier of the symbol type.
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