Class: QgsRayCastResult

Contains the results of ray casting operations in a 3D map canvas.

Added in version 4.0.

Methods

addLayerHits

Adds all hits from layer to the result

addTerrainHits

Adds all terrain hits to the result

allHits

Returns all the hits from both layer and terrain intersections

hasLayerHits

Returns True is ray hit at least one entity from a layer

hasTerrainHits

Returns True is the ray intersected the terrain

isEmpty

Returns True is ray did not intersect any layer or terrain entity

layerHits

Returns all hits from entities of the specific layer

layers

Returns pointers to the map layers of entities that were intersected by the ray

terrainHits

Returns all terrain intersection hits

class qgis._3d.QgsRayCastResult[source]

Bases: object

__init__()

Ctor

__init__(a0: QgsRayCastResult)
Parameters:

a0 (QgsRayCastResult)

addLayerHits(self, layer: QgsMapLayer | None, hits: Iterable[QgsRayCastHit])[source]

Adds all hits from layer to the result

Parameters:
addTerrainHits(self, hits: Iterable[QgsRayCastHit])[source]

Adds all terrain hits to the result

Parameters:

hits (Iterable[QgsRayCastHit])

allHits(self) List[QgsRayCastHit]

Returns all the hits from both layer and terrain intersections

Return type:

List[QgsRayCastHit]

hasLayerHits(self) bool[source]

Returns True is ray hit at least one entity from a layer

Return type:

bool

hasTerrainHits(self) bool[source]

Returns True is the ray intersected the terrain

Return type:

bool

isEmpty(self) bool[source]

Returns True is ray did not intersect any layer or terrain entity

Return type:

bool

layerHits(self, layer: QgsMapLayer | None) List[QgsRayCastHit]

Returns all hits from entities of the specific layer

Parameters:

layer (Optional[QgsMapLayer])

Return type:

List[QgsRayCastHit]

layers(self) List[QgsMapLayer]

Returns pointers to the map layers of entities that were intersected by the ray

Return type:

List[QgsMapLayer]

terrainHits(self) List[QgsRayCastHit]

Returns all terrain intersection hits

Return type:

List[QgsRayCastHit]