18 #ifndef QGSPOINTCLOUDRENDERER_H
19 #define QGSPOINTCLOUDRENDERER_H
23 #include "qgis_core.h"
58 double zValueScale,
double zValueFixedOffset );
90 long pointsRendered()
const;
98 void incrementPointsRendered(
long count );
163 template <
typename T>
169 value = *( data + offset );
173 value = *
reinterpret_cast< const qint32 *
>( data + offset );
177 value = *
reinterpret_cast< const short *
>( data + offset );
181 value = *
reinterpret_cast< const unsigned short *
>( data + offset );
185 value = *
reinterpret_cast< const float *
>( data + offset );
189 value = *
reinterpret_cast< const double *
>( data + offset );
203 long mPointsRendered = 0;
205 int mPointRecordSize = 0;
209 double mZValueScale = 1.0;
210 double mZValueFixedOffset = 0;
228 const QString type = sipCpp->type();
230 if ( type == QLatin1String(
"rgb" ) )
231 sipType = sipType_QgsPointCloudRgbRenderer;
232 else if ( type == QLatin1String(
"ramp" ) )
233 sipType = sipType_QgsPointCloudAttributeByRampRenderer;
234 else if ( type == QLatin1String(
"classified" ) )
235 sipType = sipType_QgsPointCloudClassifiedRenderer;
236 else if ( type == QLatin1String(
"extent" ) )
237 sipType = sipType_QgsPointCloudExtentRenderer;
264 virtual QString
type()
const = 0;
299 virtual
bool willRenderPoint( const QMap<QString, QVariant> &pointAttributes )
301 Q_UNUSED( pointAttributes );
357 virtual bool legendItemChecked(
const QString &key );
364 virtual void checkLegendItem(
const QString &key,
bool state =
true );
423 PointSymbol pointSymbol()
const;
430 void setPointSymbol( PointSymbol symbol );
442 double maximumScreenError()
const;
454 void setMaximumScreenError(
double error );
480 virtual QStringList legendRuleKeys()
const;
491 const qint32 ix = *
reinterpret_cast< const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
xOffset() );
492 const qint32 iy = *
reinterpret_cast< const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
yOffset() );
504 const qint32 iz = *
reinterpret_cast<const qint32 *
>( ptr + i * context.
pointRecordSize() + context.
zOffset() );
513 QPointF originalXY( x, y );
516 switch ( mPointSymbol )
519 painter->fillRect( QRectF( x - mPainterPenWidth * 0.5,
520 y - mPainterPenWidth * 0.5,
521 mPainterPenWidth, mPainterPenWidth ), color );
525 painter->setBrush( QBrush( color ) );
526 painter->setPen( Qt::NoPen );
527 painter->drawEllipse( QRectF( x - mPainterPenWidth * 0.5,
528 y - mPainterPenWidth * 0.5,
529 mPainterPenWidth, mPainterPenWidth ) );
545 void restoreCommonProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
553 void saveCommonProperties( QDomElement &element,
const QgsReadWriteContext &context )
const;
562 QThread *mThread =
nullptr;
565 double mMaximumScreenError = 0.3;
568 double mPointSize = 1;
572 PointSymbol mPointSymbol = Square;
573 int mPainterPenWidth = 1;
A geometry is the spatial representation of a feature.
Layer tree node points to a map layer.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
void transformInPlace(double &x, double &y) const
Transforms device coordinates to map coordinates.
Struct for storing maximum and minimum scales for measurements in map units.
Collection of point cloud attributes.
DataType
Systems of unit measurement.
@ UShort
Unsigned short int 2 bytes.
@ Short
Short int 2 bytes.
Base class for storing raw data from point cloud nodes.
Represents a map layer supporting display of point clouds.
Encapsulates the render context for a 2D point cloud rendering operation.
void getAttribute(const char *data, std::size_t offset, QgsPointCloudAttribute::DataType type, T &value) const
Retrieves the attribute value from data at the specified offset, where type indicates the original da...
const QgsRenderContext & renderContext() const
Returns a reference to the context's render context.
int yOffset() const
Returns the offset for the y value in a point record.
double zValueFixedOffset() const
Returns any constant offset which must be applied to z values taken from the point cloud index.
QgsVector3D offset() const
Returns the offset of the layer's int32 coordinates compared to CRS coords.
int pointRecordSize() const
Returns the size of a single point record.
int xOffset() const
Returns the offset for the x value in a point record.
QgsPointCloudRenderContext(const QgsPointCloudRenderContext &rh)=delete
QgsPointCloudRenderContext cannot be copied.
double zValueScale() const
Returns any constant scaling factor which must be applied to z values taken from the point cloud inde...
QgsVector3D scale() const
Returns the scale of the layer's int32 coordinates compared to CRS coords.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the rendered block.
int zOffset() const
Returns the offset for the y value in a point record.
QgsPointCloudRenderContext & operator=(const QgsPointCloudRenderContext &)=delete
QgsPointCloudRenderContext cannot be copied.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Abstract base class for 2d point cloud renderers.
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) const =0
Saves the renderer configuration to an XML element.
const QgsMapUnitScale & pointSizeMapUnitScale() const
Returns the map unit scale used for the point size.
virtual void renderBlock(const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context)=0
Renders a block of point cloud data using the specified render context.
QgsPointCloudRenderer & operator=(const QgsPointCloudRenderer &other)=delete
QgsPointCloudRenderer cannot be copied – use clone() instead.
void setPointSizeUnit(const QgsUnitTypes::RenderUnit units)
Sets the units used for the point size.
void setPointSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the point size.
QgsPointCloudRenderer()=default
Constructor for QgsPointCloudRenderer.
virtual QgsPointCloudRenderer * clone() const =0
Create a deep copy of this renderer.
void setPointSize(double size)
Sets the point size.
PointSymbol
Rendering symbols for points.
@ Square
Renders points as squares.
@ Circle
Renders points as circles.
virtual QString type() const =0
Returns the identifier of the renderer type.
QgsPointCloudRenderer(const QgsPointCloudRenderer &other)=delete
QgsPointCloudRenderer cannot be copied – use clone() instead.
QgsUnitTypes::RenderUnit pointSizeUnit() const
Returns the units used for the point size.
virtual ~QgsPointCloudRenderer()=default
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).
double pointSize() const
Returns the point size.
static double pointZ(QgsPointCloudRenderContext &context, const char *ptr, int i)
Retrieves the z value for the point at index i.
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.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
QPainter * painter()
Returns the destination QPainter for the render operation.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
RenderUnit
Rendering size units.
@ RenderMillimeters
Millimeters.
double y() const
Returns Y coordinate.
double z() const
Returns Z coordinate.
double x() const
Returns X coordinate.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)