Class: QgsPointCloudRenderer

class qgis.core.QgsPointCloudRenderer

Bases: sip.wrapper

Constructor for QgsPointCloudRenderer.

Abstract base class for 2d point cloud renderers.

Methods

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.

drawPoint

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

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.

load

Creates a renderer from an XML element.

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.

pointXY

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

pointZ

Retrieves the z value for the point at index i.

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.

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.

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 )

Attributes

Circle

Square

Circle = 1
class PointSymbol

Bases: int

Square = 0
checkLegendItem(self, key: str, state: bool = True)

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

Parameters
  • key (str) –

  • state (bool = True) –

clone(self)QgsPointCloudRenderer

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

Return type

QgsPointCloudRenderer

copyCommonProperties(self, destination: QgsPointCloudRenderer)

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

Parameters

destination (QgsPointCloudRenderer) –

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

Creates a set of legend nodes representing the renderer.

Parameters

nodeLayer (QgsLayerTreeLayer) –

Return type

List[QgsLayerTreeModelLegendNode]

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

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

Parameters
legendItemChecked(self, key: str)bool

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

Parameters

key (str) –

Return type

bool

legendRuleKeys(self)List[str]

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

Return type

List[str]

load(element: QDomElement, context: QgsReadWriteContext)QgsPointCloudRenderer

Creates a renderer from an XML element.

Caller takes ownership of the returned renderer.

See also

save()

Parameters
Return type

QgsPointCloudRenderer

maximumScreenError(self)float

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)QgsUnitTypes.RenderUnit

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

Return type

QgsUnitTypes.RenderUnit

pointSize(self)float

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)QgsUnitTypes.RenderUnit

Returns the units used for the point size.

See also

pointSize()

Return type

QgsUnitTypes.RenderUnit

pointSymbol(self)QgsPointCloudRenderer.PointSymbol

Returns the symbol used by the renderer for drawing points.

See also

setPointSymbol()

Return type

QgsPointCloudRenderer.PointSymbol

pointXY(context: QgsPointCloudRenderContext, ptr: str, i: int)Tuple[float, float]

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

Parameters
Return type

Tuple[float, float]

pointZ(context: QgsPointCloudRenderContext, ptr: str, i: int)float

Retrieves the z value for the point at index i.

Parameters
Return type

float

renderBlock(self, block: QgsPointCloudBlock, context: QgsPointCloudRenderContext)

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

Parameters
restoreCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)

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

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

Saves the renderer configuration to an XML element.

See also

load()

Parameters
Return type

QDomElement

saveCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)

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

Parameters
setMaximumScreenError(self, error: float)

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: QgsUnitTypes.RenderUnit)

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

Parameters

unit (QgsUnitTypes.RenderUnit) –

setPointSize(self, size: float)

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

See also

pointSize()

Parameters

size (float) –

setPointSizeMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale used for the point size.

See also

setPointSize()

Parameters

scale (QgsMapUnitScale) –

setPointSizeUnit(self, units: QgsUnitTypes.RenderUnit)

Sets the units used for the point size.

See also

setPointSize()

See also

pointSizeUnit()

Parameters

units (QgsUnitTypes.RenderUnit) –

setPointSymbol(self, symbol: QgsPointCloudRenderer.PointSymbol)

Sets the symbol used by the renderer for drawing points.

See also

pointSymbol()

Parameters

symbol (QgsPointCloudRenderer.PointSymbol) –

startRender(self, context: QgsPointCloudRenderContext)

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)

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

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, Any])bool

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[str) –

Return type

bool