Class: QgsPointCloudRenderer

Abstract base class for 2d point cloud renderers.

Added in version 3.18.

Class Hierarchy

Inheritance diagram of qgis.core.QgsPointCloudRenderer

Subclasses

QgsPointCloudAttributeByRampRenderer

An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.

QgsPointCloudClassifiedRenderer

Renders point clouds by a classification attribute.

QgsPointCloudExtentRenderer

A renderer for 2d visualisation of point clouds which shows the dataset’s extents using a fill symbol.

QgsPointCloudRgbRenderer

An RGB renderer for 2d visualisation of point clouds using embedded red, green and blue attributes.

Enums

DrawOrder

alias of PointCloudDrawOrder

PointSymbol

alias of PointCloudSymbol

Methods

addPointToTriangulation

Adds a point to the list of points to be triangulated (only used when renderAsTriangles() is enabled)

checkLegendItem

Called when the check state of the legend item with the specified key is changed.

clone

Create a deep copy of this renderer.

copyCommonProperties

Copies common point cloud properties (such as point size and screen error) to the destination renderer.

createLegendNodes

Creates a set of legend nodes representing the renderer.

drawOrder2d

Returns the drawing order used by the renderer for drawing points.

drawPoint

Draws a point using a color at the specified x and y (in map coordinates).

horizontalTriangleFilter

Returns whether large triangles will get rendered.

horizontalTriangleFilterThreshold

Returns threshold for filtering of triangles.

horizontalTriangleFilterUnit

Returns units of the threshold for filtering of triangles.

legendItemChecked

Returns True if the legend item with the specified key is checked.

legendRuleKeys

Returns a list of all rule keys for legend nodes created by the renderer.

maximumScreenError

Returns the maximum screen error allowed when rendering the point cloud.

maximumScreenErrorUnit

Returns the unit for the maximum screen error allowed when rendering the point cloud.

pointSize

Returns the point size.

pointSizeMapUnitScale

Returns the map unit scale used for the point size.

pointSizeUnit

Returns the units used for the point size.

pointSymbol

Returns the symbol used by the renderer for drawing points.

renderAsTriangles

Returns whether points are triangulated to render solid surface

renderBlock

Renders a block of point cloud data using the specified render context.

restoreCommonProperties

Restores common renderer properties (such as point size and screen error) from the specified DOM element.

save

Saves the renderer configuration to an XML element.

saveCommonProperties

Saves common renderer properties (such as point size and screen error) to the specified DOM element.

setDrawOrder2d

Sets the drawing order used by the renderer for drawing points.

setHorizontalTriangleFilter

Sets whether large triangles will get rendered.

setHorizontalTriangleFilterThreshold

Sets threshold for filtering of triangles.

setHorizontalTriangleFilterUnit

Sets units of the threshold for filtering of triangles.

setMaximumScreenError

Sets the maximum screen error allowed when rendering the point cloud.

setMaximumScreenErrorUnit

Sets the unit for the maximum screen error allowed when rendering the point cloud.

setPointSize

Sets the point size.

setPointSizeMapUnitScale

Sets the map unit scale used for the point size.

setPointSizeUnit

Sets the units used for the point size.

setPointSymbol

Sets the symbol used by the renderer for drawing points.

setRenderAsTriangles

Sets whether points are triangulated to render solid surface

startRender

Must be called when a new render cycle is started.

stopRender

Must be called when a render cycle has finished, to allow the renderer to clean up.

type

Returns the identifier of the renderer type.

usedAttributes

Returns a list of attributes required by this renderer.

willRenderPoint

Checks whether the point holding pointAttributes attributes will be rendered By default if not overridden in the subclass renderer will return true ( the renderer is responsible for the filtering behavior )

Static Methods

load

Creates a renderer from an XML element.

pointXY

Retrieves the x and y coordinate for the point at index i.

pointZ

Retrieves the z value for the point at index i.

class qgis.core.QgsPointCloudRenderer[source]

Bases: object

DrawOrder

alias of PointCloudDrawOrder

PointSymbol

alias of PointCloudSymbol

addPointToTriangulation(self, x: float, y: float, z: float, color: QColor | Qt.GlobalColor, context: QgsPointCloudRenderContext)[source]

Adds a point to the list of points to be triangulated (only used when renderAsTriangles() is enabled)

Added in version 3.36.

Parameters:
checkLegendItem(self, key: str | None, state: bool = True)[source]

Called when the check state of the legend item with the specified key is changed.

Parameters:
  • key (Optional[str])

  • state (bool = True)

clone(self) QgsPointCloudRenderer | None[source]

Create a deep copy of this renderer. Should be implemented by all subclasses and generate a proper subclass.

Return type:

Optional[QgsPointCloudRenderer]

copyCommonProperties(self, destination: QgsPointCloudRenderer | None)[source]

Copies common point cloud properties (such as point size and screen error) to the destination renderer.

Parameters:

destination (Optional[QgsPointCloudRenderer])

createLegendNodes(self, nodeLayer: QgsLayerTreeLayer | None) List[QgsLayerTreeModelLegendNode]

Creates a set of legend nodes representing the renderer.

Parameters:

nodeLayer (Optional[QgsLayerTreeLayer])

Return type:

List[QgsLayerTreeModelLegendNode]

drawOrder2d(self) Qgis.PointCloudDrawOrder[source]

Returns the drawing order used by the renderer for drawing points.

See also

setDrawOrder2d()

Added in version 3.24.

Return type:

Qgis.PointCloudDrawOrder

drawPoint(self, x: float, y: float, color: QColor | Qt.GlobalColor, context: QgsPointCloudRenderContext)[source]

Draws a point using a color at the specified x and y (in map coordinates).

Parameters:
drawPoint(self, x: float, y: float, color: QColor | Qt.GlobalColor, width: int, context: QgsPointCloudRenderContext)[source]

Draws a point using a color and painter width at the specified x and y (in map coordinates).

Added in version 3.36.

Parameters:
horizontalTriangleFilter(self) bool[source]

Returns whether large triangles will get rendered. This only applies when renderAsTriangles() is enabled. When the triangle filtering is enabled, triangles where at least one side is horizontally longer than the threshold in horizontalTriangleFilterThreshold() do not get rendered.

Added in version 3.36.

Return type:

bool

horizontalTriangleFilterThreshold(self) float[source]

Returns threshold for filtering of triangles. This only applies when renderAsTriangles() and horizontalTriangleFilter() are both enabled. If any edge of a triangle is horizontally longer than the threshold, such triangle will not get rendered. Units of the threshold value are given by horizontalTriangleFilterUnits().

Added in version 3.36.

Return type:

float

horizontalTriangleFilterUnit(self) Qgis.RenderUnit[source]

Returns units of the threshold for filtering of triangles. This only applies when renderAsTriangles() and horizontalTriangleFilter() are both enabled.

Added in version 3.36.

Return type:

Qgis.RenderUnit

legendItemChecked(self, key: str | None) bool[source]

Returns True if the legend item with the specified key is checked.

Parameters:

key (Optional[str])

Return type:

bool

legendRuleKeys(self) List[str][source]

Returns a list of all rule keys for legend nodes created by the renderer.

Return type:

List[str]

static load(element: QDomElement, context: QgsReadWriteContext) QgsPointCloudRenderer | None[source]

Creates a renderer from an XML element.

Caller takes ownership of the returned renderer.

See also

save()

Parameters:
Return type:

Optional[QgsPointCloudRenderer]

maximumScreenError(self) float[source]

Returns the maximum screen error allowed when rendering the point cloud.

Larger values result in a faster render with less points rendered.

Units are retrieved via maximumScreenErrorUnit().

Return type:

float

maximumScreenErrorUnit(self) Qgis.RenderUnit[source]

Returns the unit for the maximum screen error allowed when rendering the point cloud.

Return type:

Qgis.RenderUnit

pointSize(self) float[source]

Returns the point size.

The point size units are retrieved by calling pointSizeUnit().

See also

setPointSize()

See also

pointSizeUnit()

Return type:

float

pointSizeMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale used for the point size.

See also

pointSizeUnit()

See also

pointSize()

Return type:

QgsMapUnitScale

pointSizeUnit(self) Qgis.RenderUnit[source]

Returns the units used for the point size.

See also

pointSize()

Return type:

Qgis.RenderUnit

pointSymbol(self) Qgis.PointCloudSymbol[source]

Returns the symbol used by the renderer for drawing points.

See also

setPointSymbol()

Return type:

Qgis.PointCloudSymbol

static pointXY(context: QgsPointCloudRenderContext, ptr: str | None, i: int)[source]

Retrieves the x and y coordinate for the point at index i.

Parameters:
static pointZ(context: QgsPointCloudRenderContext, ptr: str | None, i: int) float[source]

Retrieves the z value for the point at index i.

Parameters:
Return type:

float

renderAsTriangles(self) bool[source]

Returns whether points are triangulated to render solid surface

Added in version 3.36.

Return type:

bool

renderBlock(self, block: QgsPointCloudBlock | None, context: QgsPointCloudRenderContext)[source]

Renders a block of point cloud data using the specified render context.

Parameters:
restoreCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)[source]

Restores common renderer properties (such as point size and screen error) from the specified DOM element.

Parameters:
save(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement[source]

Saves the renderer configuration to an XML element.

See also

load()

Parameters:
Return type:

QDomElement

saveCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)[source]

Saves common renderer properties (such as point size and screen error) to the specified DOM element.

Parameters:
setDrawOrder2d(self, order: Qgis.PointCloudDrawOrder)[source]

Sets the drawing order used by the renderer for drawing points.

See also

drawOrder2d()

Added in version 3.24.

Parameters:

order (Qgis.PointCloudDrawOrder)

setHorizontalTriangleFilter(self, enabled: bool)[source]

Sets whether large triangles will get rendered. This only applies when renderAsTriangles() is enabled. When the triangle filtering is enabled, triangles where at least one side is horizontally longer than the threshold in horizontalTriangleFilterThreshold() do not get rendered.

Added in version 3.36.

Parameters:

enabled (bool)

setHorizontalTriangleFilterThreshold(self, threshold: float)[source]

Sets threshold for filtering of triangles. This only applies when renderAsTriangles() and horizontalTriangleFilter() are both enabled. If any edge of a triangle is horizontally longer than the threshold, such triangle will not get rendered. Units of the threshold value are given by horizontalTriangleFilterUnits().

Added in version 3.36.

Parameters:

threshold (float)

setHorizontalTriangleFilterUnit(self, unit: Qgis.RenderUnit)[source]

Sets units of the threshold for filtering of triangles. This only applies when renderAsTriangles() and horizontalTriangleFilter() are both enabled.

Added in version 3.36.

Parameters:

unit (Qgis.RenderUnit)

setMaximumScreenError(self, error: float)[source]

Sets the maximum screen error allowed when rendering the point cloud.

Larger values result in a faster render with less points rendered.

Units are set via setMaximumScreenErrorUnit().

Parameters:

error (float)

setMaximumScreenErrorUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the maximum screen error allowed when rendering the point cloud.

Parameters:

unit (Qgis.RenderUnit)

setPointSize(self, size: float)[source]

Sets the point size. Point size units are specified via setPointSizeUnit().

See also

pointSize()

Parameters:

size (float)

setPointSizeMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale used for the point size.

See also

setPointSize()

Parameters:

scale (QgsMapUnitScale)

setPointSizeUnit(self, units: Qgis.RenderUnit)[source]

Sets the units used for the point size.

See also

setPointSize()

See also

pointSizeUnit()

Parameters:

units (Qgis.RenderUnit)

setPointSymbol(self, symbol: Qgis.PointCloudSymbol)[source]

Sets the symbol used by the renderer for drawing points.

See also

pointSymbol()

Parameters:

symbol (Qgis.PointCloudSymbol)

setRenderAsTriangles(self, asTriangles: bool)[source]

Sets whether points are triangulated to render solid surface

Added in version 3.36.

Parameters:

asTriangles (bool)

startRender(self, context: QgsPointCloudRenderContext)[source]

Must be called when a new render cycle is started. A call to startRender() must always be followed by a corresponding call to stopRender() after all features have been rendered.

See also

stopRender()

Warning

This method is not thread safe. Before calling startRender() in a non-main thread, the renderer should instead be cloned and startRender()/stopRender() called on the clone.

Parameters:

context (QgsPointCloudRenderContext)

stopRender(self, context: QgsPointCloudRenderContext)[source]

Must be called when a render cycle has finished, to allow the renderer to clean up.

Calls to stopRender() must always be preceded by a call to startRender().

Warning

This method is not thread safe. Before calling startRender() in a non-main thread, the renderer should instead be cloned and startRender()/stopRender() called on the clone.

See also

startRender()

Parameters:

context (QgsPointCloudRenderContext)

type(self) str[source]

Returns the identifier of the renderer type.

Return type:

str

usedAttributes(self, context: QgsPointCloudRenderContext) Set[str]

Returns a list of attributes required by this renderer. Attributes not listed in here may not be requested from the provider at rendering time.

Note

the “X” and “Y” attributes will always be fetched and do not need to be explicitly returned here.

Parameters:

context (QgsPointCloudRenderContext)

Return type:

Set[str]

willRenderPoint(self, pointAttributes: Dict[str | None, Any]) bool[source]

Checks whether the point holding pointAttributes attributes will be rendered By default if not overridden in the subclass renderer will return true ( the renderer is responsible for the filtering behavior )

Parameters:

pointAttributes (Dict[Optional[str], Any])

Return type:

bool