QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
18 #ifndef QGSPOINTCLOUDRENDERER_H
19 #define QGSPOINTCLOUDRENDERER_H
23 #include "qgis_core.h"
58 double zValueScale,
double zValueFixedOffset,
QgsFeedback *feedback =
nullptr );
102 long pointsRendered()
const;
110 void incrementPointsRendered(
long count );
182 template <
typename T>
189 value = *( data + offset );
193 value = *
reinterpret_cast< const quint32 *
>( data + offset );
196 value = *
reinterpret_cast< const qint32 *
>( data + offset );
200 value = *
reinterpret_cast< const quint64 *
>( data + offset );
203 value = *
reinterpret_cast< const qint64 *
>( data + offset );
207 value = *
reinterpret_cast< const short *
>( data + offset );
211 value = *
reinterpret_cast< const unsigned short *
>( data + offset );
215 value = *
reinterpret_cast< const float *
>( data + offset );
219 value = *
reinterpret_cast< const double *
>( data + offset );
233 long mPointsRendered = 0;
235 int mPointRecordSize = 0;
239 double mZValueScale = 1.0;
240 double mZValueFixedOffset = 0;
265 virtual QSet< QString > usedAttributes()
const = 0;
302 const QString type = sipCpp->type();
304 if ( type == QLatin1String(
"rgb" ) )
305 sipType = sipType_QgsPointCloudRgbRenderer;
306 else if ( type == QLatin1String(
"ramp" ) )
307 sipType = sipType_QgsPointCloudAttributeByRampRenderer;
308 else if ( type == QLatin1String(
"classified" ) )
309 sipType = sipType_QgsPointCloudClassifiedRenderer;
310 else if ( type == QLatin1String(
"extent" ) )
311 sipType = sipType_QgsPointCloudExtentRenderer;
329 virtual QString type()
const = 0;
366 Q_UNUSED( pointAttributes );
383 virtual QDomElement save( QDomDocument &doc,
const QgsReadWriteContext &context )
const = 0;
400 virtual std::unique_ptr< QgsPreparedPointCloudRendererData > prepare()
SIP_SKIP;
430 virtual
bool legendItemChecked( const QString &key );
437 virtual
void checkLegendItem( const QString &key,
bool state = true );
445 void setPointSize(
double size ) { mPointSize = size; }
531 double maximumScreenError()
const;
543 void setMaximumScreenError(
double error );
569 virtual QStringList legendRuleKeys()
const;
580 const qint32 ix = *
reinterpret_cast< const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
xOffset() );
581 const qint32 iy = *
reinterpret_cast< const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
yOffset() );
593 const qint32 iz = *
reinterpret_cast<const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
zOffset() );
602 const QPointF originalXY( x, y );
605 switch ( mPointSymbol )
608 painter->fillRect( QRectF( x - mPainterPenWidth * 0.5,
609 y - mPainterPenWidth * 0.5,
610 mPainterPenWidth, mPainterPenWidth ), color );
614 painter->setBrush( QBrush( color ) );
615 painter->setPen( Qt::NoPen );
616 painter->drawEllipse( QRectF( x - mPainterPenWidth * 0.5,
617 y - mPainterPenWidth * 0.5,
618 mPainterPenWidth, mPainterPenWidth ) );
634 void restoreCommonProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
642 void saveCommonProperties( QDomElement &element,
const QgsReadWriteContext &context )
const;
650 QThread *mThread =
nullptr;
654 double mMaximumScreenError = 0.3;
657 double mPointSize = 1;
662 int mPainterPenWidth = 1;
666 #endif // QGSPOINTCLOUDRENDERER_H
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
RenderUnit
Rendering size units.
DataType
Systems of unit measurement.
The class is used as a container of context for various read/write operations on other objects.
double y() const
Returns Y coordinate.
Represents a map layer supporting display of point clouds.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Base class for 2d point cloud renderer prepared data containers.
void setScale(const QgsVector3D &scale)
Sets the scale of the layer's int32 coordinates compared to CRS coords.
Contains information about the context of a rendering operation.
@ RenderMillimeters
Millimeters.
@ UInt32
Unsigned int32 4 bytes.
Base class for storing raw data from point cloud nodes.
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...
@ Short
Short int 2 bytes.
int xOffset() const
Returns the offset for the x value in a point record.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
@ UInt64
Unsigned int64 8 bytes.
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).
Encapsulates the render context for a 2D point cloud rendering operation.
@ UShort
Unsigned short int 2 bytes.
double z() const
Returns Z coordinate.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
double zValueFixedOffset() const
Returns any constant offset which must be applied to z values taken from the point cloud index.
Layer tree node points to a map layer.
Collection of point cloud attributes.
@ Square
Renders points as squares.
int yOffset() const
Returns the offset for the y value in a point record.
PointCloudSymbol
Rendering symbols for point cloud points.
QgsVector3D offset() const
Returns the offset of the layer's int32 coordinates compared to CRS coords.
int zOffset() const
Returns the offset for the y value in a point record.
void setPointSizeUnit(const QgsUnitTypes::RenderUnit units)
Sets the units used for the point size.
PointCloudDrawOrder
Pointcloud rendering order for 2d views.
void setPointSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the point size.
Struct for storing maximum and minimum scales for measurements in map units.
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.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the rendered block.
QgsFeedback * feedback() const
Returns the feedback object used to cancel rendering.
@ Circle
Renders points as circles.
virtual bool willRenderPoint(const QMap< QString, QVariant > &pointAttributes)
Checks whether the point holding pointAttributes attributes will be rendered By default if not overri...
double pointSize() const
Returns the point size.
const QgsRenderContext & renderContext() const
Returns a reference to the context's render context.
double zValueScale() const
Returns any constant scaling factor which must be applied to z values taken from the point cloud inde...
void transformInPlace(double &x, double &y) const
Transforms device coordinates to map coordinates.
A geometry is the spatial representation of a feature.
@ Default
Draw points in the order they are stored.
QgsVector3D scale() const
Returns the scale of the layer's int32 coordinates compared to CRS coords.
int pointRecordSize() const
Returns the size of a single point record.
Abstract base class for 2d point cloud renderers.
void setOffset(const QgsVector3D &offset)
Sets the offset of the layer's int32 coordinates compared to CRS coords.
QgsUnitTypes::RenderUnit pointSizeUnit() const
Returns the units used for the point size.
QPainter * painter()
Returns the destination QPainter for the render operation.
@ UChar
Unsigned char 1 byte.
const QgsMapUnitScale & pointSizeMapUnitScale() const
Returns the map unit scale used for the point size.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
static double pointZ(QgsPointCloudRenderContext &context, const char *ptr, int i)
Retrieves the z value for the point at index i.
double x() const
Returns X coordinate.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...