QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgspointcloudrenderer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudrenderer.cpp
3  --------------------
4  begin : October 2020
5  copyright : (C) 2020 by Peter Petrik
6  email : zilolv 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 #include "qgspointcloudrenderer.h"
20 #include "qgsapplication.h"
21 #include "qgssymbollayerutils.h"
22 #include "qgspointcloudlayer.h"
23 #include "qgspointcloudindex.h"
25 #include "qgslogger.h"
26 #include "qgscircle.h"
27 #include <QThread>
28 #include <QPointer>
29 
30 QgsPointCloudRenderContext::QgsPointCloudRenderContext( QgsRenderContext &context, const QgsVector3D &scale, const QgsVector3D &offset, double zValueScale, double zValueFixedOffset, QgsFeedback *feedback )
31  : mRenderContext( context )
32  , mScale( scale )
33  , mOffset( offset )
34  , mZValueScale( zValueScale )
35  , mZValueFixedOffset( zValueFixedOffset )
36  , mFeedback( feedback )
37 {
38 
39 }
40 
42 {
43  return mPointsRendered;
44 }
45 
47 {
48  mPointsRendered += count;
49 }
50 
52 {
53  mAttributes = attributes;
54  mPointRecordSize = mAttributes.pointRecordSize();
55 
56  // fetch offset for x/y/z attributes
57  attributes.find( QStringLiteral( "X" ), mXOffset );
58  attributes.find( QStringLiteral( "Y" ), mYOffset );
59  attributes.find( QStringLiteral( "Z" ), mZOffset );
60 }
61 
63 {
64  if ( element.isNull() )
65  return nullptr;
66 
67  // load renderer
68  const QString rendererType = element.attribute( QStringLiteral( "type" ) );
69 
71  if ( !m )
72  return nullptr;
73 
74  std::unique_ptr< QgsPointCloudRenderer > r( m->createRenderer( element, context ) );
75  return r.release();
76 }
77 
79 {
80  return QSet< QString >();
81 }
82 
83 std::unique_ptr<QgsPreparedPointCloudRendererData> QgsPointCloudRenderer::prepare()
84 {
85  return nullptr;
86 }
87 
89 {
90 #ifdef QGISDEBUG
91  if ( !mThread )
92  {
93  mThread = QThread::currentThread();
94  }
95  else
96  {
97  Q_ASSERT_X( mThread == QThread::currentThread(), "QgsPointCloudRenderer::startRender", "startRender called in a different thread - use a cloned renderer instead" );
98  }
99 #endif
100 
101  mPainterPenWidth = context.renderContext().convertToPainterUnits( pointSize(), pointSizeUnit(), pointSizeMapUnitScale() );
102 
103  switch ( mPointSymbol )
104  {
106  // for square point we always disable antialiasing -- it's not critical here and we benefit from the performance boost disabling it gives
107  context.renderContext().painter()->setRenderHint( QPainter::Antialiasing, false );
108  break;
109 
111  break;
112  }
113 }
114 
116 {
117 #ifdef QGISDEBUG
118  Q_ASSERT_X( mThread == QThread::currentThread(), "QgsPointCloudRenderer::stopRender", "stopRender called in a different thread - use a cloned renderer instead" );
119 #endif
120 }
121 
123 {
124  return false;
125 }
126 
127 void QgsPointCloudRenderer::checkLegendItem( const QString &, bool )
128 {
129 
130 }
131 
133 {
134  return mMaximumScreenError;
135 }
136 
138 {
139  mMaximumScreenError = error;
140 }
141 
143 {
144  return mMaximumScreenErrorUnit;
145 }
146 
148 {
149  mMaximumScreenErrorUnit = unit;
150 }
151 
152 QList<QgsLayerTreeModelLegendNode *> QgsPointCloudRenderer::createLegendNodes( QgsLayerTreeLayer * )
153 {
154  return QList<QgsLayerTreeModelLegendNode *>();
155 }
156 
158 {
159  return QStringList();
160 }
161 
163 {
164  destination->setPointSize( mPointSize );
165  destination->setPointSizeUnit( mPointSizeUnit );
166  destination->setPointSizeMapUnitScale( mPointSizeMapUnitScale );
167  destination->setMaximumScreenError( mMaximumScreenError );
168  destination->setMaximumScreenErrorUnit( mMaximumScreenErrorUnit );
169  destination->setPointSymbol( mPointSymbol );
170  destination->setDrawOrder2d( mDrawOrder2d );
171 }
172 
173 void QgsPointCloudRenderer::restoreCommonProperties( const QDomElement &element, const QgsReadWriteContext & )
174 {
175  mPointSize = element.attribute( QStringLiteral( "pointSize" ), QStringLiteral( "1" ) ).toDouble();
176  mPointSizeUnit = QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral( "pointSizeUnit" ), QStringLiteral( "MM" ) ) );
177  mPointSizeMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( element.attribute( QStringLiteral( "pointSizeMapUnitScale" ), QString() ) );
178 
179  mMaximumScreenError = element.attribute( QStringLiteral( "maximumScreenError" ), QStringLiteral( "0.3" ) ).toDouble();
180  mMaximumScreenErrorUnit = QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral( "maximumScreenErrorUnit" ), QStringLiteral( "MM" ) ) );
181  mPointSymbol = static_cast< Qgis::PointCloudSymbol >( element.attribute( QStringLiteral( "pointSymbol" ), QStringLiteral( "0" ) ).toInt() );
182  mDrawOrder2d = static_cast< Qgis::PointCloudDrawOrder >( element.attribute( QStringLiteral( "drawOrder2d" ), QStringLiteral( "0" ) ).toInt() );
183 }
184 
185 void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const QgsReadWriteContext & ) const
186 {
187  element.setAttribute( QStringLiteral( "pointSize" ), qgsDoubleToString( mPointSize ) );
188  element.setAttribute( QStringLiteral( "pointSizeUnit" ), QgsUnitTypes::encodeUnit( mPointSizeUnit ) );
189  element.setAttribute( QStringLiteral( "pointSizeMapUnitScale" ), QgsSymbolLayerUtils::encodeMapUnitScale( mPointSizeMapUnitScale ) );
190 
191  element.setAttribute( QStringLiteral( "maximumScreenError" ), qgsDoubleToString( mMaximumScreenError ) );
192  element.setAttribute( QStringLiteral( "maximumScreenErrorUnit" ), QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
193  element.setAttribute( QStringLiteral( "pointSymbol" ), QString::number( static_cast< int >( mPointSymbol ) ) );
194  element.setAttribute( QStringLiteral( "drawOrder2d" ), QString::number( static_cast< int >( mDrawOrder2d ) ) );
195 }
196 
198 {
199  return mPointSymbol;
200 }
201 
203 {
204  mPointSymbol = symbol;
205 }
206 
208 {
209  return mDrawOrder2d;
210 }
211 
213 {
214  mDrawOrder2d = order;
215 }
216 
217 QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, const QgsRenderContext &renderContext, const QgsGeometry &geometry, double toleranceForPointIdentification )
218 {
219  QVector<QVariantMap> selectedPoints;
220 
221  QgsPointCloudIndex *index = layer->dataProvider()->index();
222  const IndexedPointCloudNode root = index->root();
223 
224  const double maxErrorPixels = renderContext.convertToPainterUnits( maximumScreenError(), maximumScreenErrorUnit() );// in pixels
225 
226  const QgsRectangle rootNodeExtentLayerCoords = index->nodeMapExtent( root );
227  QgsRectangle rootNodeExtentMapCoords;
228  if ( !renderContext.coordinateTransform().isShortCircuited() )
229  {
230  try
231  {
232  QgsCoordinateTransform extentTransform = renderContext.coordinateTransform();
233  extentTransform.setBallparkTransformsAreAppropriate( true );
234  rootNodeExtentMapCoords = extentTransform.transformBoundingBox( rootNodeExtentLayerCoords );
235  }
236  catch ( QgsCsException & )
237  {
238  QgsDebugMsg( QStringLiteral( "Could not transform node extent to map CRS" ) );
239  rootNodeExtentMapCoords = rootNodeExtentLayerCoords;
240  }
241  }
242  else
243  {
244  rootNodeExtentMapCoords = rootNodeExtentLayerCoords;
245  }
246 
247  const double rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span();
248  const double rootErrorInLayerCoordinates = rootNodeExtentLayerCoords.width() / index->span();
249 
250  const double mapUnitsPerPixel = renderContext.mapToPixel().mapUnitsPerPixel();
251  if ( ( rootErrorInMapCoordinates < 0.0 ) || ( mapUnitsPerPixel < 0.0 ) || ( maxErrorPixels < 0.0 ) )
252  {
253  QgsDebugMsg( QStringLiteral( "invalid screen error" ) );
254  return selectedPoints;
255  }
256 
257  const double maxErrorInMapCoordinates = maxErrorPixels * mapUnitsPerPixel;
258  const double maxErrorInLayerCoordinates = maxErrorInMapCoordinates * rootErrorInLayerCoordinates / rootErrorInMapCoordinates;
259 
260  QgsGeometry selectionGeometry = geometry;
261  if ( geometry.type() == QgsWkbTypes::PointGeometry )
262  {
263  const double x = geometry.asPoint().x();
264  const double y = geometry.asPoint().y();
265  const double toleranceInPixels = toleranceForPointIdentification / renderContext.mapToPixel().mapUnitsPerPixel();
266  const double pointSizePixels = renderContext.convertToPainterUnits( mPointSize, mPointSizeUnit, mPointSizeMapUnitScale );
267  switch ( pointSymbol() )
268  {
270  {
271  const QgsPointXY deviceCoords = renderContext.mapToPixel().transform( QgsPointXY( x, y ) );
272  const QgsPointXY point1( deviceCoords.x() - std::max( toleranceInPixels, pointSizePixels / 2.0 ), deviceCoords.y() - std::max( toleranceInPixels, pointSizePixels / 2.0 ) );
273  const QgsPointXY point2( deviceCoords.x() + std::max( toleranceInPixels, pointSizePixels / 2.0 ), deviceCoords.y() + std::max( toleranceInPixels, pointSizePixels / 2.0 ) );
274  const QgsPointXY point1MapCoords = renderContext.mapToPixel().toMapCoordinates( point1.x(), point1.y() );
275  const QgsPointXY point2MapCoords = renderContext.mapToPixel().toMapCoordinates( point2.x(), point2.y() );
276  const QgsRectangle pointRect( point1MapCoords, point2MapCoords );
277  selectionGeometry = QgsGeometry::fromRect( pointRect );
278  break;
279  }
281  {
282  const QgsPoint centerMapCoords( x, y );
283  const QgsPointXY deviceCoords = renderContext.mapToPixel().transform( centerMapCoords );
284  const QgsPoint point1( deviceCoords.x(), deviceCoords.y() - std::max( toleranceInPixels, pointSizePixels / 2.0 ) );
285  const QgsPoint point2( deviceCoords.x(), deviceCoords.y() + std::max( toleranceInPixels, pointSizePixels / 2.0 ) );
286  const QgsPointXY point1MapCoords = renderContext.mapToPixel().toMapCoordinates( point1.x(), point1.y() );
287  const QgsPointXY point2MapCoords = renderContext.mapToPixel().toMapCoordinates( point2.x(), point2.y() );
288  const QgsCircle circle = QgsCircle::from2Points( QgsPoint( point1MapCoords ), QgsPoint( point2MapCoords ) );
289  std::unique_ptr<QgsPolygon> polygon( circle.toPolygon( 6 ) );
290  const QgsGeometry circleGeometry( std::move( polygon ) );
291  selectionGeometry = circleGeometry;
292  break;
293  }
294  }
295  }
296 
297  // selection geometry must be in layer CRS for QgsPointCloudDataProvider::identify
298  try
299  {
300  selectionGeometry.transform( renderContext.coordinateTransform(), Qgis::TransformDirection::Reverse );
301  }
302  catch ( QgsCsException & )
303  {
304  QgsDebugMsg( QStringLiteral( "Could not transform geometry to layer CRS" ) );
305  return selectedPoints;
306  }
307 
308  selectedPoints = layer->dataProvider()->identify( maxErrorInLayerCoordinates, selectionGeometry, renderContext.zRange() );
309 
310  selectedPoints.erase( std::remove_if( selectedPoints.begin(), selectedPoints.end(), [this]( const QMap<QString, QVariant> &point ) { return !this->willRenderPoint( point ); } ), selectedPoints.end() );
311 
312  return selectedPoints;
313 }
314 
315 //
316 // QgsPreparedPointCloudRendererData
317 //
QgsPointCloudIndex::nodeMapExtent
QgsRectangle nodeMapExtent(const IndexedPointCloudNode &node) const
Returns the extent of a node in map coordinates.
Definition: qgspointcloudindex.cpp:216
QgsPointCloudRenderer::maximumScreenErrorUnit
QgsUnitTypes::RenderUnit maximumScreenErrorUnit() const
Returns the unit for the maximum screen error allowed when rendering the point cloud.
Definition: qgspointcloudrenderer.cpp:142
QgsPointXY::y
double y
Definition: qgspointxy.h:63
QgsRenderContext::mapToPixel
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
Definition: qgsrendercontext.h:258
QgsPointCloudDataProvider::identify
QVector< QVariantMap > identify(double maxError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange=QgsDoubleRange(), int pointsLimit=1000)
Returns the list of points of the point cloud according to a zoom level defined by maxError (in layer...
Definition: qgspointclouddataprovider.cpp:275
QgsPointCloudRenderer::identify
QVector< QVariantMap > identify(QgsPointCloudLayer *layer, const QgsRenderContext &context, const QgsGeometry &geometry, double toleranceForPointIdentification=0)
Returns the list of visible points of the point cloud layer layer and an extent defined by a geometry...
Definition: qgspointcloudrenderer.cpp:217
QgsCircle
Circle geometry type.
Definition: qgscircle.h:43
QgsPointCloudRenderer::setPointSymbol
void setPointSymbol(Qgis::PointCloudSymbol symbol)
Sets the symbol used by the renderer for drawing points.
Definition: qgspointcloudrenderer.cpp:202
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:167
QgsMapToPixel::mapUnitsPerPixel
double mapUnitsPerPixel() const
Returns the current map units per pixel.
Definition: qgsmaptopixel.h:229
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
QgsPointCloudRenderer::pointSymbol
Qgis::PointCloudSymbol pointSymbol() const
Returns the symbol used by the renderer for drawing points.
Definition: qgspointcloudrenderer.cpp:197
QgsSymbolLayerUtils::encodeMapUnitScale
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
Definition: qgssymbollayerutils.cpp:666
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
QgsGeometry::transform
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
Definition: qgsgeometry.cpp:3128
QgsPointCloudRenderer::setPointSize
void setPointSize(double size)
Sets the point size.
Definition: qgspointcloudrenderer.h:445
QgsPointCloudLayer
Represents a map layer supporting display of point clouds.
Definition: qgspointcloudlayer.h:45
QgsVector3D
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition: qgsvector3d.h:31
QgsApplication::pointCloudRendererRegistry
static QgsPointCloudRendererRegistry * pointCloudRendererRegistry()
Returns the application's point cloud renderer registry, used for managing point cloud layer 2D rende...
Definition: qgsapplication.cpp:2330
qgssymbollayerutils.h
QgsPreparedPointCloudRendererData::~QgsPreparedPointCloudRendererData
virtual ~QgsPreparedPointCloudRendererData()
QgsCoordinateTransform::transformBoundingBox
QgsRectangle transformBoundingBox(const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool handle180Crossover=false) const SIP_THROW(QgsCsException)
Transforms a rectangle from the source CRS to the destination CRS.
Definition: qgscoordinatetransform.cpp:560
QgsPointCloudRenderer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsPointCloudRenderContext &context) const
Returns a list of attributes required by this renderer.
Definition: qgspointcloudrenderer.cpp:78
QgsPointCloudRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgspointcloudrenderer.cpp:152
QgsPointCloudRenderer::checkLegendItem
virtual void checkLegendItem(const QString &key, bool state=true)
Called when the check state of the legend item with the specified key is changed.
Definition: qgspointcloudrenderer.cpp:127
QgsPointCloudRenderer::prepare
virtual std::unique_ptr< QgsPreparedPointCloudRendererData > prepare()
Returns prepared data container for bulk point color retrieval.
Definition: qgspointcloudrenderer.cpp:83
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
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
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsMapToPixel::toMapCoordinates
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
Definition: qgsmaptopixel.h:173
QgsPointCloudRendererRegistry::rendererMetadata
QgsPointCloudRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
Definition: qgspointcloudrendererregistry.cpp:70
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsPointCloudRenderer::startRender
virtual void startRender(QgsPointCloudRenderContext &context)
Must be called when a new render cycle is started.
Definition: qgspointcloudrenderer.cpp:88
qgsDoubleToString
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition: qgis.h:2204
qgsapplication.h
QgsUnitTypes::decodeRenderUnit
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
Definition: qgsunittypes.cpp:2948
QgsCircle::from2Points
static QgsCircle from2Points(const QgsPoint &pt1, const QgsPoint &pt2) SIP_HOLDGIL
Constructs a circle by 2 points on the circle.
Definition: qgscircle.cpp:38
QgsRenderContext::coordinateTransform
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
Definition: qgsrendercontext.h:178
QgsPointCloudLayer::dataProvider
QgsPointCloudDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
Definition: qgspointcloudlayer.cpp:114
QgsPoint::y
double y
Definition: qgspoint.h:70
IndexedPointCloudNode
Represents a indexed point cloud node in octree.
Definition: qgspointcloudindex.h:57
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:65
QgsPointCloudRenderer::maximumScreenError
double maximumScreenError() const
Returns the maximum screen error allowed when rendering the point cloud.
Definition: qgspointcloudrenderer.cpp:132
QgsCoordinateTransform::isShortCircuited
bool isShortCircuited() const
Returns true if the transform short circuits because the source and destination are equivalent.
Definition: qgscoordinatetransform.cpp:905
QgsUnitTypes::encodeUnit
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
Definition: qgsunittypes.cpp:122
qgspointcloudlayer.h
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
QgsCoordinateTransform::setBallparkTransformsAreAppropriate
void setBallparkTransformsAreAppropriate(bool appropriate)
Sets whether approximate "ballpark" results are appropriate for this coordinate transform.
Definition: qgscoordinatetransform.cpp:939
QgsPointCloudRenderContext::incrementPointsRendered
void incrementPointsRendered(long count)
Increments the count of points rendered by the specified amount.
Definition: qgspointcloudrenderer.cpp:46
QgsPointCloudRenderContext::setAttributes
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Sets the attributes associated with the rendered block.
Definition: qgspointcloudrenderer.cpp:51
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
qgscircle.h
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition: qgslayertreelayer.h:43
QgsPointCloudAttributeCollection
Collection of point cloud attributes.
Definition: qgspointcloudattribute.h:141
Qgis::PointCloudSymbol::Square
@ Square
Renders points as squares.
QgsPointCloudRenderer::setMaximumScreenErrorUnit
void setMaximumScreenErrorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the maximum screen error allowed when rendering the point cloud.
Definition: qgspointcloudrenderer.cpp:147
qgspointcloudrendererregistry.h
Qgis::PointCloudSymbol
PointCloudSymbol
Rendering symbols for point cloud points.
Definition: qgis.h:1888
QgsPointCloudRenderer::setPointSizeUnit
void setPointSizeUnit(const QgsUnitTypes::RenderUnit units)
Sets the units used for the point size.
Definition: qgspointcloudrenderer.h:465
Qgis::PointCloudDrawOrder
PointCloudDrawOrder
Pointcloud rendering order for 2d views.
Definition: qgis.h:1900
QgsPointCloudIndex::root
IndexedPointCloudNode root()
Returns root node of the index.
Definition: qgspointcloudindex.h:227
QgsPointCloudRenderer::setPointSizeMapUnitScale
void setPointSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the point size.
Definition: qgspointcloudrenderer.h:481
QgsPointCloudRendererAbstractMetadata
Stores metadata about one point cloud renderer class.
Definition: qgspointcloudrendererregistry.h:46
QgsPointCloudRenderContext::attributes
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the rendered block.
Definition: qgspointcloudrenderer.h:117
QgsPointCloudRenderer::stopRender
virtual void stopRender(QgsPointCloudRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
Definition: qgspointcloudrenderer.cpp:115
Qgis::PointCloudSymbol::Circle
@ Circle
Renders points as circles.
QgsMapToPixel::transform
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
Definition: qgsmaptopixel.h:90
qgspointcloudindex.h
QgsRenderContext::zRange
QgsDoubleRange zRange() const
Returns the range of z-values which should be rendered.
Definition: qgsrendercontext.cpp:650
QgsPointCloudRenderer::setMaximumScreenError
void setMaximumScreenError(double error)
Sets the maximum screen error allowed when rendering the point cloud.
Definition: qgspointcloudrenderer.cpp:137
QgsPointCloudRenderer::pointSize
double pointSize() const
Returns the point size.
Definition: qgspointcloudrenderer.h:456
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsRenderContext::convertToPainterUnits
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
Definition: qgsrendercontext.cpp:367
QgsPointCloudRenderer::setDrawOrder2d
void setDrawOrder2d(Qgis::PointCloudDrawOrder order)
Sets the drawing order used by the renderer for drawing points.
Definition: qgspointcloudrenderer.cpp:212
QgsGeometry::asPoint
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
Definition: qgsgeometry.cpp:1662
QgsWkbTypes::PointGeometry
@ PointGeometry
Definition: qgswkbtypes.h:142
QgsPointCloudRenderer::load
static QgsPointCloudRenderer * load(QDomElement &element, const QgsReadWriteContext &context)
Creates a renderer from an XML element.
Definition: qgspointcloudrenderer.cpp:62
QgsGeometry
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
QgsRectangle::width
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
Definition: qgsrectangle.h:223
QgsPointXY::x
double x
Definition: qgspointxy.h:62
QgsPointCloudRendererAbstractMetadata::createRenderer
virtual QgsPointCloudRenderer * createRenderer(QDomElement &elem, const QgsReadWriteContext &context)=0
Returns new instance of the renderer given the DOM element.
QgsGeometry::fromRect
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
Definition: qgsgeometry.cpp:241
QgsPointCloudRenderer
Abstract base class for 2d point cloud renderers.
Definition: qgspointcloudrenderer.h:296
QgsPointCloudRenderer::restoreCommonProperties
void restoreCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Restores common renderer properties (such as point size and screen error) from the specified DOM elem...
Definition: qgspointcloudrenderer.cpp:173
QgsPointCloudIndex::span
int span() const
Returns the number of points in one direction in a single node.
Definition: qgspointcloudindex.cpp:247
QgsPointCloudRenderContext::pointsRendered
long pointsRendered() const
Returns the total number of points rendered.
Definition: qgspointcloudrenderer.cpp:41
QgsPointCloudRenderer::pointSizeUnit
QgsUnitTypes::RenderUnit pointSizeUnit() const
Returns the units used for the point size.
Definition: qgspointcloudrenderer.h:473
QgsEllipse::toPolygon
virtual QgsPolygon * toPolygon(unsigned int segments=36) const
Returns a segmented polygon.
Definition: qgsellipse.cpp:224
QgsPointCloudRenderContext::QgsPointCloudRenderContext
QgsPointCloudRenderContext(QgsRenderContext &context, const QgsVector3D &scale, const QgsVector3D &offset, double zValueScale, double zValueFixedOffset, QgsFeedback *feedback=nullptr)
Constructor for QgsPointCloudRenderContext.
Definition: qgspointcloudrenderer.cpp:30
qgspointcloudlayerelevationproperties.h
QgsPointCloudIndex
Represents a indexed point clouds data in octree.
Definition: qgspointcloudindex.h:163
QgsPointCloudRenderer::legendRuleKeys
virtual QStringList legendRuleKeys() const
Returns a list of all rule keys for legend nodes created by the renderer.
Definition: qgspointcloudrenderer.cpp:157
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
qgslogger.h
QgsPointCloudRenderer::drawOrder2d
Qgis::PointCloudDrawOrder drawOrder2d() const
Returns the drawing order used by the renderer for drawing points.
Definition: qgspointcloudrenderer.cpp:207
QgsRenderContext::painter
QPainter * painter()
Returns the destination QPainter for the render operation.
Definition: qgsrendercontext.h:112
QgsPointCloudRenderer::pointSizeMapUnitScale
const QgsMapUnitScale & pointSizeMapUnitScale() const
Returns the map unit scale used for the point size.
Definition: qgspointcloudrenderer.h:489
QgsPointCloudRenderContext::renderContext
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Definition: qgspointcloudrenderer.h:69
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:57
QgsGeometry::type
QgsWkbTypes::GeometryType type
Definition: qgsgeometry.h:128
QgsPointCloudRenderer::legendItemChecked
virtual bool legendItemChecked(const QString &key)
Returns true if the legend item with the specified key is checked.
Definition: qgspointcloudrenderer.cpp:122
qgspointcloudrenderer.h
QgsPoint::x
double x
Definition: qgspoint.h:69
QgsSymbolLayerUtils::decodeMapUnitScale
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
Definition: qgssymbollayerutils.cpp:676
QgsPointCloudDataProvider::index
virtual QgsPointCloudIndex * index() const
Returns the point cloud index associated with the provider.
Definition: qgspointclouddataprovider.h:164