QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgspointcloudrgbrenderer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudrgbrenderer.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 
19 #include "qgspointcloudblock.h"
20 #include "qgscontrastenhancement.h"
21 
23 {
24 
25 }
26 
28 {
29  return QStringLiteral( "rgb" );
30 }
31 
33 {
34  std::unique_ptr< QgsPointCloudRgbRenderer > res = std::make_unique< QgsPointCloudRgbRenderer >();
35  res->mRedAttribute = mRedAttribute;
36  res->mGreenAttribute = mGreenAttribute;
37  res->mBlueAttribute = mBlueAttribute;
38 
39  if ( mRedContrastEnhancement )
40  {
41  res->setRedContrastEnhancement( new QgsContrastEnhancement( *mRedContrastEnhancement ) );
42  }
43  if ( mGreenContrastEnhancement )
44  {
45  res->setGreenContrastEnhancement( new QgsContrastEnhancement( *mGreenContrastEnhancement ) );
46  }
47  if ( mBlueContrastEnhancement )
48  {
49  res->setBlueContrastEnhancement( new QgsContrastEnhancement( *mBlueContrastEnhancement ) );
50  }
51 
52  copyCommonProperties( res.get() );
53 
54  return res.release();
55 }
56 
58 {
59  const QgsRectangle visibleExtent = context.renderContext().extent();
60 
61  const char *ptr = block->data();
62  const int count = block->pointCount();
63  const QgsPointCloudAttributeCollection request = block->attributes();
64 
65  const std::size_t recordSize = request.pointRecordSize();
66  int redOffset = 0;
67  const QgsPointCloudAttribute *attribute = request.find( mRedAttribute, redOffset );
68  if ( !attribute )
69  return;
70  const QgsPointCloudAttribute::DataType redType = attribute->type();
71 
72  int greenOffset = 0;
73  attribute = request.find( mGreenAttribute, greenOffset );
74  if ( !attribute )
75  return;
76  const QgsPointCloudAttribute::DataType greenType = attribute->type();
77 
78  int blueOffset = 0;
79  attribute = request.find( mBlueAttribute, blueOffset );
80  if ( !attribute )
81  return;
82  const QgsPointCloudAttribute::DataType blueType = attribute->type();
83 
84  const bool useRedContrastEnhancement = mRedContrastEnhancement && mRedContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
85  const bool useBlueContrastEnhancement = mBlueContrastEnhancement && mBlueContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
86  const bool useGreenContrastEnhancement = mGreenContrastEnhancement && mGreenContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
87 
88  const QgsDoubleRange zRange = context.renderContext().zRange();
89  const bool considerZ = !zRange.isInfinite();
90 
91  int rendered = 0;
92  double x = 0;
93  double y = 0;
94  double z = 0;
96  const bool reproject = ct.isValid();
97  for ( int i = 0; i < count; ++i )
98  {
99  if ( context.renderContext().renderingStopped() )
100  {
101  break;
102  }
103 
104  if ( considerZ )
105  {
106  // z value filtering is cheapest, if we're doing it...
107  z = pointZ( context, ptr, i );
108  if ( !zRange.contains( z ) )
109  continue;
110  }
111 
112  pointXY( context, ptr, i, x, y );
113  if ( visibleExtent.contains( x, y ) )
114  {
115  if ( reproject )
116  {
117  try
118  {
119  ct.transformInPlace( x, y, z );
120  }
121  catch ( QgsCsException & )
122  {
123  continue;
124  }
125  }
126 
127  int red = 0;
128  context.getAttribute( ptr, i * recordSize + redOffset, redType, red );
129  int green = 0;
130  context.getAttribute( ptr, i * recordSize + greenOffset, greenType, green );
131  int blue = 0;
132  context.getAttribute( ptr, i * recordSize + blueOffset, blueType, blue );
133 
134  //skip if red, green or blue not in displayable range
135  if ( ( useRedContrastEnhancement && !mRedContrastEnhancement->isValueInDisplayableRange( red ) )
136  || ( useGreenContrastEnhancement && !mGreenContrastEnhancement->isValueInDisplayableRange( green ) )
137  || ( useBlueContrastEnhancement && !mBlueContrastEnhancement->isValueInDisplayableRange( blue ) ) )
138  {
139  continue;
140  }
141 
142  //stretch color values
143  if ( useRedContrastEnhancement )
144  {
145  red = mRedContrastEnhancement->enhanceContrast( red );
146  }
147  if ( useGreenContrastEnhancement )
148  {
149  green = mGreenContrastEnhancement->enhanceContrast( green );
150  }
151  if ( useBlueContrastEnhancement )
152  {
153  blue = mBlueContrastEnhancement->enhanceContrast( blue );
154  }
155 
156  red = std::max( 0, std::min( 255, red ) );
157  green = std::max( 0, std::min( 255, green ) );
158  blue = std::max( 0, std::min( 255, blue ) );
159 
160  drawPoint( x, y, QColor( red, green, blue ), context );
161  rendered++;
162  }
163  }
164  context.incrementPointsRendered( rendered );
165 }
166 
167 
169 {
170  std::unique_ptr< QgsPointCloudRgbRenderer > r = std::make_unique< QgsPointCloudRgbRenderer >();
171 
172  r->setRedAttribute( element.attribute( QStringLiteral( "red" ), QStringLiteral( "Red" ) ) );
173  r->setGreenAttribute( element.attribute( QStringLiteral( "green" ), QStringLiteral( "Green" ) ) );
174  r->setBlueAttribute( element.attribute( QStringLiteral( "blue" ), QStringLiteral( "Blue" ) ) );
175 
176  r->restoreCommonProperties( element, context );
177 
178  //contrast enhancements
180  const QDomElement redContrastElem = element.firstChildElement( QStringLiteral( "redContrastEnhancement" ) );
181  if ( !redContrastElem.isNull() )
182  {
184  redContrastEnhancement->readXml( redContrastElem );
185  r->setRedContrastEnhancement( redContrastEnhancement );
186  }
187 
189  const QDomElement greenContrastElem = element.firstChildElement( QStringLiteral( "greenContrastEnhancement" ) );
190  if ( !greenContrastElem.isNull() )
191  {
193  greenContrastEnhancement->readXml( greenContrastElem );
194  r->setGreenContrastEnhancement( greenContrastEnhancement );
195  }
196 
198  const QDomElement blueContrastElem = element.firstChildElement( QStringLiteral( "blueContrastEnhancement" ) );
199  if ( !blueContrastElem.isNull() )
200  {
202  blueContrastEnhancement->readXml( blueContrastElem );
203  r->setBlueContrastEnhancement( blueContrastEnhancement );
204  }
205 
206  return r.release();
207 }
208 
209 QDomElement QgsPointCloudRgbRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context ) const
210 {
211  QDomElement rendererElem = doc.createElement( QStringLiteral( "renderer" ) );
212 
213  rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "rgb" ) );
214 
215  rendererElem.setAttribute( QStringLiteral( "red" ), mRedAttribute );
216  rendererElem.setAttribute( QStringLiteral( "green" ), mGreenAttribute );
217  rendererElem.setAttribute( QStringLiteral( "blue" ), mBlueAttribute );
218 
219  saveCommonProperties( rendererElem, context );
220 
221  //contrast enhancement
222  if ( mRedContrastEnhancement )
223  {
224  QDomElement redContrastElem = doc.createElement( QStringLiteral( "redContrastEnhancement" ) );
225  mRedContrastEnhancement->writeXml( doc, redContrastElem );
226  rendererElem.appendChild( redContrastElem );
227  }
228  if ( mGreenContrastEnhancement )
229  {
230  QDomElement greenContrastElem = doc.createElement( QStringLiteral( "greenContrastEnhancement" ) );
231  mGreenContrastEnhancement->writeXml( doc, greenContrastElem );
232  rendererElem.appendChild( greenContrastElem );
233  }
234  if ( mBlueContrastEnhancement )
235  {
236  QDomElement blueContrastElem = doc.createElement( QStringLiteral( "blueContrastEnhancement" ) );
237  mBlueContrastEnhancement->writeXml( doc, blueContrastElem );
238  rendererElem.appendChild( blueContrastElem );
239  }
240 
241  return rendererElem;
242 }
243 
245 {
246  QSet<QString> res;
247  res << mRedAttribute << mGreenAttribute << mBlueAttribute;
248  return res;
249 }
250 
251 std::unique_ptr<QgsPreparedPointCloudRendererData> QgsPointCloudRgbRenderer::prepare()
252 {
253  std::unique_ptr< QgsPointCloudRgbRendererPreparedData > data = std::make_unique< QgsPointCloudRgbRendererPreparedData >();
254  data->redAttribute = mRedAttribute;
255  if ( mRedContrastEnhancement )
256  data->redContrastEnhancement.reset( new QgsContrastEnhancement( *mRedContrastEnhancement ) );
257  data->greenAttribute = mGreenAttribute;
258  if ( mGreenContrastEnhancement )
259  data->greenContrastEnhancement.reset( new QgsContrastEnhancement( *mGreenContrastEnhancement ) );
260  data->blueAttribute = mBlueAttribute;
261  if ( mBlueContrastEnhancement )
262  data->blueContrastEnhancement.reset( new QgsContrastEnhancement( *mBlueContrastEnhancement ) );
263 
264  data->useRedContrastEnhancement = mRedContrastEnhancement && mRedContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
265  data->useBlueContrastEnhancement = mBlueContrastEnhancement && mBlueContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
266  data->useGreenContrastEnhancement = mGreenContrastEnhancement && mGreenContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement;
267 
268  return data;
269 }
270 
272 {
274 }
275 
277 {
278  const QgsPointCloudAttributeCollection request = block->attributes();
279  redOffset = 0;
280  const QgsPointCloudAttribute *attribute = request.find( redAttribute, redOffset );
281  if ( !attribute )
282  return false;
283  redType = attribute->type();
284 
285  greenOffset = 0;
286  attribute = request.find( greenAttribute, greenOffset );
287  if ( !attribute )
288  return false;
289  greenType = attribute->type();
290 
291  blueOffset = 0;
292  attribute = request.find( blueAttribute, blueOffset );
293  if ( !attribute )
294  return false;
295  blueType = attribute->type();
296  return true;
297 }
298 
300 {
301  const char *ptr = block->data();
302  const int pointRecordSize = block->pointRecordSize();
303 
304  int red = 0;
305  QgsPointCloudRenderContext::getAttribute( ptr, i * pointRecordSize + redOffset, redType, red );
306  int green = 0;
307  QgsPointCloudRenderContext::getAttribute( ptr, i * pointRecordSize + greenOffset, greenType, green );
308  int blue = 0;
309  QgsPointCloudRenderContext::getAttribute( ptr, i * pointRecordSize + blueOffset, blueType, blue );
310 
311  //skip if red, green or blue not in displayable range
312  if ( ( useRedContrastEnhancement && !redContrastEnhancement->isValueInDisplayableRange( red ) )
313  || ( useGreenContrastEnhancement && !greenContrastEnhancement->isValueInDisplayableRange( green ) )
314  || ( useBlueContrastEnhancement && !blueContrastEnhancement->isValueInDisplayableRange( blue ) ) )
315  {
316  return QColor();
317  }
318 
319  //stretch color values
321  {
322  red = redContrastEnhancement->enhanceContrast( red );
323  }
325  {
326  green = greenContrastEnhancement->enhanceContrast( green );
327  }
329  {
330  blue = blueContrastEnhancement->enhanceContrast( blue );
331  }
332 
333  red = std::max( 0, std::min( 255, red ) );
334  green = std::max( 0, std::min( 255, green ) );
335  blue = std::max( 0, std::min( 255, blue ) );
336 
337  return QColor( red, green, blue );
338 }
339 
341 {
342  return mRedAttribute;
343 }
344 
345 void QgsPointCloudRgbRenderer::setRedAttribute( const QString &redAttribute )
346 {
347  mRedAttribute = redAttribute;
348 }
349 
351 {
352  return mGreenAttribute;
353 }
354 
355 void QgsPointCloudRgbRenderer::setGreenAttribute( const QString &greenAttribute )
356 {
357  mGreenAttribute = greenAttribute;
358 }
359 
361 {
362  return mBlueAttribute;
363 }
364 
365 void QgsPointCloudRgbRenderer::setBlueAttribute( const QString &blueAttribute )
366 {
367  mBlueAttribute = blueAttribute;
368 }
369 
371 {
372  return mRedContrastEnhancement.get();
373 }
374 
376 {
377  mRedContrastEnhancement.reset( enhancement );
378 }
379 
381 {
382  return mGreenContrastEnhancement.get();
383 }
384 
386 {
387  mGreenContrastEnhancement.reset( enhancement );
388 }
389 
391 {
392  return mBlueContrastEnhancement.get();
393 }
394 
396 {
397  mBlueContrastEnhancement.reset( enhancement );
398 }
QgsPointCloudRgbRenderer::create
static QgsPointCloudRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Creates an RGB renderer from an XML element.
Definition: qgspointcloudrgbrenderer.cpp:168
QgsPointCloudRgbRendererPreparedData::redType
QgsPointCloudAttribute::DataType redType
Definition: qgspointcloudrgbrenderer.h:67
QgsPointCloudRgbRenderer::greenAttribute
QString greenAttribute() const
Returns the attribute to use for the green channel.
Definition: qgspointcloudrgbrenderer.cpp:350
QgsCoordinateTransform::transformInPlace
void transformInPlace(double &x, double &y, double &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const SIP_THROW(QgsCsException)
Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination...
Definition: qgscoordinatetransform.cpp:364
QgsPointCloudAttribute::DataType
DataType
Systems of unit measurement.
Definition: qgspointcloudattribute.h:44
QgsPointCloudRgbRendererPreparedData::greenOffset
int greenOffset
Definition: qgspointcloudrgbrenderer.h:69
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsPointCloudAttributeCollection::find
const QgsPointCloudAttribute * find(const QString &attributeName, int &offset) const
Finds the attribute with the name.
Definition: qgspointcloudattribute.cpp:168
QgsPointCloudRgbRenderer::setGreenAttribute
void setGreenAttribute(const QString &attribute)
Sets the attribute to use for the green channel.
Definition: qgspointcloudrgbrenderer.cpp:355
QgsPointCloudBlock::data
const char * data() const
Returns raw pointer to data.
Definition: qgspointcloudblock.cpp:37
qgscontrastenhancement.h
QgsPointCloudBlock::attributes
QgsPointCloudAttributeCollection attributes() const
Returns the attributes that are stored in the data block, along with their size.
Definition: qgspointcloudblock.cpp:47
QgsContrastEnhancement::readXml
void readXml(const QDomElement &elem)
Definition: qgscontrastenhancement.cpp:247
QgsPointCloudRgbRenderer::redContrastEnhancement
const QgsContrastEnhancement * redContrastEnhancement() const
Returns the contrast enhancement to use for the red channel.
Definition: qgspointcloudrgbrenderer.cpp:370
QgsPointCloudRgbRenderer::setRedAttribute
void setRedAttribute(const QString &attribute)
Sets the attribute to use for the red channel.
Definition: qgspointcloudrgbrenderer.cpp:345
QgsPointCloudRenderer::copyCommonProperties
void copyCommonProperties(QgsPointCloudRenderer *destination) const
Copies common point cloud properties (such as point size and screen error) to the destination rendere...
Definition: qgspointcloudrenderer.cpp:162
QgsPointCloudRgbRendererPreparedData::greenAttribute
QString greenAttribute
Definition: qgspointcloudrgbrenderer.h:60
QgsPointCloudBlock
Base class for storing raw data from point cloud nodes.
Definition: qgspointcloudblock.h:38
QgsCoordinateTransform::isValid
bool isValid() const
Returns true if the coordinate transform is valid, ie both the source and destination CRS have been s...
Definition: qgscoordinatetransform.cpp:900
QgsRenderContext::extent
const QgsRectangle & extent() const
When rendering a map layer, calling this method returns the "clipping" extent for the layer (in the l...
Definition: qgsrendercontext.h:239
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsPointCloudBlock::pointCount
int pointCount() const
Returns number of points that are stored in the block.
Definition: qgspointcloudblock.cpp:42
QgsPointCloudRgbRenderer::usedAttributes
QSet< QString > usedAttributes(const QgsPointCloudRenderContext &context) const override
Returns a list of attributes required by this renderer.
Definition: qgspointcloudrgbrenderer.cpp:244
QgsPointCloudRgbRendererPreparedData::redOffset
int redOffset
Definition: qgspointcloudrgbrenderer.h:66
QgsPointCloudRgbRendererPreparedData::useGreenContrastEnhancement
bool useGreenContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:71
QgsPointCloudRgbRenderer::type
QString type() const override
Returns the identifier of the renderer type.
Definition: qgspointcloudrgbrenderer.cpp:27
QgsPointCloudRenderContext::getAttribute
static void getAttribute(const char *data, std::size_t offset, QgsPointCloudAttribute::DataType type, T &value)
Retrieves the attribute value from data at the specified offset, where type indicates the original da...
Definition: qgspointcloudrenderer.h:183
QgsRenderContext::renderingStopped
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
Definition: qgsrendercontext.h:285
QgsRenderContext::coordinateTransform
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
Definition: qgsrendercontext.h:178
QgsPointCloudRgbRenderer::redAttribute
QString redAttribute() const
Returns the attribute to use for the red channel.
Definition: qgspointcloudrgbrenderer.cpp:340
QgsPointCloudRgbRendererPreparedData::useRedContrastEnhancement
bool useRedContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:68
QgsPointCloudRgbRenderer::blueAttribute
QString blueAttribute() const
Returns the attribute to use for the blue channel.
Definition: qgspointcloudrgbrenderer.cpp:360
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:65
QgsPointCloudRgbRendererPreparedData::greenContrastEnhancement
std::unique_ptr< QgsContrastEnhancement > greenContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:63
QgsPointCloudRenderer::drawPoint
void drawPoint(double x, double y, const QColor &color, QgsPointCloudRenderContext &context) const
Draws a point using a color at the specified x and y (in map coordinates).
Definition: qgspointcloudrenderer.h:600
QgsPointCloudRenderContext
Encapsulates the render context for a 2D point cloud rendering operation.
Definition: qgspointcloudrenderer.h:41
QgsPointCloudAttributeCollection::pointRecordSize
int pointRecordSize() const
Returns total size of record.
Definition: qgspointcloudattribute.h:187
QgsPointCloudRenderContext::incrementPointsRendered
void incrementPointsRendered(long count)
Increments the count of points rendered by the specified amount.
Definition: qgspointcloudrenderer.cpp:46
qgspointcloudrgbrenderer.h
QgsPointCloudRgbRenderer::clone
QgsPointCloudRenderer * clone() const override
Create a deep copy of this renderer.
Definition: qgspointcloudrgbrenderer.cpp:32
QgsPointCloudRgbRenderer::greenContrastEnhancement
const QgsContrastEnhancement * greenContrastEnhancement() const
Returns the contrast enhancement to use for the green channel.
Definition: qgspointcloudrgbrenderer.cpp:380
QgsContrastEnhancement::NoEnhancement
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
Definition: qgscontrastenhancement.h:50
QgsPointCloudRgbRendererPreparedData::blueType
QgsPointCloudAttribute::DataType blueType
Definition: qgspointcloudrgbrenderer.h:73
QgsPointCloudAttributeCollection
Collection of point cloud attributes.
Definition: qgspointcloudattribute.h:141
QgsPointCloudRgbRendererPreparedData::redAttribute
QString redAttribute
Definition: qgspointcloudrgbrenderer.h:59
QgsRectangle::contains
bool contains(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle contains other rectangle.
Definition: qgsrectangle.h:363
Qgis::DataType::UnknownDataType
@ UnknownDataType
Unknown or unspecified type.
QgsPointCloudAttribute
Attribute for point cloud data pair of name and size in bytes.
Definition: qgspointcloudattribute.h:40
QgsPointCloudRenderer::pointXY
static void pointXY(QgsPointCloudRenderContext &context, const char *ptr, int i, double &x, double &y)
Retrieves the x and y coordinate for the point at index i.
Definition: qgspointcloudrenderer.h:576
QgsPointCloudRgbRendererPreparedData::usedAttributes
QSet< QString > usedAttributes() const override
Returns the set of attributes used by the prepared point cloud renderer.
Definition: qgspointcloudrgbrenderer.cpp:271
QgsPointCloudRgbRendererPreparedData::prepareBlock
bool prepareBlock(const QgsPointCloudBlock *block) override
Prepares the renderer for using the specified block.
Definition: qgspointcloudrgbrenderer.cpp:276
QgsPointCloudRgbRenderer::blueContrastEnhancement
const QgsContrastEnhancement * blueContrastEnhancement() const
Returns the contrast enhancement to use for the blue channel.
Definition: qgspointcloudrgbrenderer.cpp:390
QgsPointCloudRgbRendererPreparedData::blueOffset
int blueOffset
Definition: qgspointcloudrgbrenderer.h:72
QgsContrastEnhancement
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
Definition: qgscontrastenhancement.h:42
QgsDoubleRange::isInfinite
bool isInfinite() const
Returns true if the range consists of all possible values.
Definition: qgsrange.h:247
QgsRenderContext::zRange
QgsDoubleRange zRange() const
Returns the range of z-values which should be rendered.
Definition: qgsrendercontext.cpp:650
QgsPointCloudBlock::pointRecordSize
int pointRecordSize() const
Returns the total size of each individual point record.
Definition: qgspointcloudblock.h:72
QgsDoubleRange
QgsRange which stores a range of double values.
Definition: qgsrange.h:202
QgsPointCloudRgbRendererPreparedData::useBlueContrastEnhancement
bool useBlueContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:74
QgsPointCloudRgbRenderer::setBlueAttribute
void setBlueAttribute(const QString &attribute)
Sets the attribute to use for the blue channel.
Definition: qgspointcloudrgbrenderer.cpp:365
QgsPointCloudRgbRenderer::save
QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) const override
Saves the renderer configuration to an XML element.
Definition: qgspointcloudrgbrenderer.cpp:209
QgsPointCloudRgbRendererPreparedData::blueContrastEnhancement
std::unique_ptr< QgsContrastEnhancement > blueContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:64
QgsPointCloudRgbRendererPreparedData::pointColor
QColor pointColor(const QgsPointCloudBlock *block, int i, double z) override
An optimised method of retrieving the color of a point from a point cloud block.
Definition: qgspointcloudrgbrenderer.cpp:299
QgsPointCloudRgbRenderer::setBlueContrastEnhancement
void setBlueContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the blue channel.
Definition: qgspointcloudrgbrenderer.cpp:395
QgsPointCloudRenderer
Abstract base class for 2d point cloud renderers.
Definition: qgspointcloudrenderer.h:296
qgspointcloudblock.h
QgsPointCloudRgbRenderer::renderBlock
void renderBlock(const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context) override
Renders a block of point cloud data using the specified render context.
Definition: qgspointcloudrgbrenderer.cpp:57
QgsPointCloudRgbRenderer::QgsPointCloudRgbRenderer
QgsPointCloudRgbRenderer()
Constructor for QgsPointCloudRgbRenderer.
Definition: qgspointcloudrgbrenderer.cpp:22
QgsRange::contains
bool contains(const QgsRange< T > &other) const
Returns true if this range contains another range.
Definition: qgsrange.h:108
QgsPointCloudRgbRendererPreparedData::greenType
QgsPointCloudAttribute::DataType greenType
Definition: qgspointcloudrgbrenderer.h:70
QgsPointCloudRenderer::saveCommonProperties
void saveCommonProperties(QDomElement &element, const QgsReadWriteContext &context) const
Saves common renderer properties (such as point size and screen error) to the specified DOM element.
Definition: qgspointcloudrenderer.cpp:185
QgsPointCloudRgbRendererPreparedData::redContrastEnhancement
std::unique_ptr< QgsContrastEnhancement > redContrastEnhancement
Definition: qgspointcloudrgbrenderer.h:62
QgsPointCloudRgbRenderer::setRedContrastEnhancement
void setRedContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the red channel.
Definition: qgspointcloudrgbrenderer.cpp:375
QgsPointCloudRenderContext::renderContext
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Definition: qgspointcloudrenderer.h:69
QgsPointCloudRenderer::pointZ
static double pointZ(QgsPointCloudRenderContext &context, const char *ptr, int i)
Retrieves the z value for the point at index i.
Definition: qgspointcloudrenderer.h:589
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:57
QgsPointCloudRgbRenderer::prepare
std::unique_ptr< QgsPreparedPointCloudRendererData > prepare() override
Returns prepared data container for bulk point color retrieval.
Definition: qgspointcloudrgbrenderer.cpp:251
QgsPointCloudRgbRendererPreparedData::blueAttribute
QString blueAttribute
Definition: qgspointcloudrgbrenderer.h:61
QgsPointCloudAttribute::type
DataType type() const
Returns the data type.
Definition: qgspointcloudattribute.h:74
QgsPointCloudRgbRenderer::setGreenContrastEnhancement
void setGreenContrastEnhancement(QgsContrastEnhancement *enhancement)
Sets the contrast enhancement to use for the green channel.
Definition: qgspointcloudrgbrenderer.cpp:385