Class: Qgs3DMapScene

Entity that encapsulates our 3D scene - contains all other entities

Class Hierarchy

Inheritance diagram of qgis._3d.Qgs3DMapScene

Base classes

QObject

class qgis._3d.Qgs3DMapScene[source]

Bases: QObject

Ready = 0
class SceneState

Bases: int

Updating = 1
cameraController(self) QgsCameraController | None[source]

Returns camera controller

Return type:

Optional[QgsCameraController]

disableClipping(self)[source]

Disables OpenGL clipping.

See also

enableClipping()

Added in version 3.40.

elevationRange(self) QgsDoubleRange[source]

Returns the scene’s elevation range

Note

Only some layer types are considered by this method (eg terrain, point cloud and mesh layers)

Added in version 3.30.

Return type:

QgsDoubleRange

enableClipping(self, clipPlaneEquations: Iterable[QVector4D])[source]

Enables OpenGL clipping based on the planes equations defined in clipPlaneEquations. The number of planes is equal to the size of clipPlaneEquations. A plane equation contains 4 elements. A simple way to define a clip plane equation is to define a normalized normal to the plane and its distance from the origin of the scene. In that case, the first 3 elements are the coordinates of the normal of the plane as (X, Y, Z). They need to be normalized. The last element is the distance of the plane from the origin of the scene. In mathematical terms, a 3d plane can be defined with the equation ax+by+cz+d=0 The normal is (a, b, c) with |a, b, c| = 1 The distance is -d.

By default, OpenGL supports up to 8 additional clipping planes. If clipPlaneEquations contains more than 8 planes, only the first 8 ones will be used. If clipPlaneEquations is empty, the clipping is disabled.

Added in version 3.40.

Parameters:

clipPlaneEquations (Iterable[QVector4D])

exportScene(self, exportSettings: Qgs3DMapExportSettings)[source]

Exports the scene according to the scene export settings

Parameters:

exportSettings (Qgs3DMapExportSettings)

signal fpsCountChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal fpsCounterEnabledChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal gpuMemoryLimitReached[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

hasSceneUpdatesEnabled(self) bool[source]

Returns whether updates of the 3D scene’s entities are allowed. Normally, scene updates are enabled. But for debugging purposes, it may be useful to temporarily disable scene updates.

Added in version 3.40.

Return type:

bool

mapSettings(self) Qgs3DMapSettings | None[source]

Returns the 3D map settings.

Added in version 3.30.

Return type:

Optional[Qgs3DMapSettings]

static openScenes() Any

Returns a map of 3D map scenes (by name) open in the QGIS application.

Note

Only available from the QGIS desktop application.

Deprecated since version 3.36: Use QgisAppInterface.mapCanvases3D() instead.

Added in version 3.30.

Return type:

Any

sceneExtent(self) QgsRectangle[source]

Returns the scene extent in the map’s CRS

Added in version 3.20.

Return type:

QgsRectangle

sceneState(self) Qgs3DMapScene.SceneState[source]

Returns the current state of the scene

Return type:

Qgs3DMapScene.SceneState

signal sceneStateChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

setSceneUpdatesEnabled(self, enabled: bool)[source]

Sets whether updates of the 3D scene’s entities are allowed. Normally, scene updates are enabled. But for debugging purposes, it may be useful to temporarily disable scene updates.

Added in version 3.40.

Parameters:

enabled (bool)

setViewFrom2DExtent(self, extent: QgsRectangle)[source]

Resets camera view to show the extent extent (top view)

Added in version 3.26.

Parameters:

extent (QgsRectangle)

signal terrainEntityChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

terrainPendingJobsCount(self) int[source]

Returns number of pending jobs of the terrain entity

Return type:

int

signal terrainPendingJobsCountChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

totalPendingJobsCount(self) int[source]

Returns number of pending jobs for all chunked entities

Added in version 3.12.

Return type:

int

signal totalPendingJobsCountChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

updateTemporal(self)[source]

Updates the temporale entities

viewFrustum2DExtent(self) List[QgsPointXY]

Calculates the 2D extent viewed by the 3D camera as the vertices of the viewed trapezoid

Added in version 3.26.

Return type:

List[QgsPointXY]

viewZoomFull(self)[source]

Resets camera view to show the whole scene (top view)

signal viewed2DExtentFrom3DChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

worldSpaceError(self, epsilon: float, distance: float) float[source]

Given screen error (in pixels) and distance from camera (in 3D world coordinates), this function estimates the error in world space. Takes into account camera’s field of view and the screen (3D view) size.

Parameters:
  • epsilon (float)

  • distance (float)

Return type:

float