Class: QgsCameraController¶
Class Hierarchy¶
Base classes¶
Methods
Returns the camera movement speed |
|
Returns the navigation mode used by the camera controller. |
|
Returns camera pose |
|
Sets the depth buffer image used by the camera controller to calculate world position from a pixel's coordinates and depth |
|
Returns distance of the camera from the point it is looking at. |
|
Called internally from 3D scene when a new frame is generated. |
|
Returns the point in the world coordinates towards which the camera is looking |
|
Move the map by tx and ty |
|
Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side). |
|
Reads camera configuration from the given DOM element |
|
Move camera back to the initial position (looking down towards origin of world's coordinates) |
|
Rotate clockwise the view by deltaYaw around the view center (camera moves) |
|
Rotates the camera on itself. |
|
Set camera heading to angle (used for rotating the view) |
|
Sets the camera movement speed |
|
Sets the navigation mode used by the camera controller. |
|
Sets camera pose |
|
Sets the complete camera configuration: the point towards it is looking (in 3D world coordinates), the distance of the camera from the point, pitch angle in degrees (0 = looking from the top, 90 = looking from the side) and yaw angle in degrees. |
|
Sets the vertical axis inversion behavior. |
|
Sets camera to look down towards given point in world coordinate, in given distance from plane with zero elevation |
|
Tilt up the view by deltaPitch around the view center (camera moves) |
|
Returns the vertical axis inversion behavior. |
|
Walks into the map by tx, ty, and tz |
|
Returns |
|
Writes camera configuration to the given DOM element |
|
Returns yaw angle in degrees. |
|
Zoom the map by factor |
Signals
Emitted when camera has been updated |
|
Emitted whenever the camera movement speed is changed by the controller. |
|
Emitted when the camera rotation center changes |
|
Emitted when the navigation mode is changed using the hotkey ctrl + ~ |
|
Emitted to ask for the depth buffer image |
|
Emitted when the mouse cursor position should be moved to the specified point on the map viewport. |
- class qgis._3d.QgsCameraController[source]¶
Bases:
QObject
- cameraMovementSpeed(self) float [source]¶
Returns the camera movement speed
Added in version 3.18.
- Return type:
float
- signal cameraMovementSpeedChanged(speed: float)[source]¶
Emitted whenever the camera movement speed is changed by the controller.
- Parameters:
speed (float)
Returns the navigation mode used by the camera controller.
Added in version 3.18.
- Return type:
- cameraPose(self) QgsCameraPose [source]¶
Returns camera pose
Added in version 3.4.
- Return type:
- signal cameraRotationCenterChanged(position: QVector3D)[source]¶
Emitted when the camera rotation center changes
Added in version 3.24.
- Parameters:
position (QVector3D)
- depthBufferCaptured(self, depthImage: QImage)[source]¶
Sets the depth buffer image used by the camera controller to calculate world position from a pixel’s coordinates and depth
Added in version 3.24.
- Parameters:
depthImage (QImage)
- distance(self) float [source]¶
Returns distance of the camera from the point it is looking at. The value should not be smaller than 10.
Added in version 3.4.
- Return type:
float
- frameTriggered(self, dt: float)[source]¶
Called internally from 3D scene when a new frame is generated. Updates camera according to keyboard/mouse input
- Parameters:
dt (float)
- lookingAtPoint(self) QgsVector3D [source]¶
Returns the point in the world coordinates towards which the camera is looking
- Return type:
- moveView(self, tx: float, ty: float)[source]¶
Move the map by
tx
andty
- Parameters:
tx (float)
ty (float)
Emitted when the navigation mode is changed using the hotkey ctrl + ~
- Parameters:
mode (Qgis.NavigationMode)
- pitch(self) float [source]¶
Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side). The angle should range from 0 to 180.
Added in version 3.4.
- Return type:
float
- readXml(self, elem: QDomElement)[source]¶
Reads camera configuration from the given DOM element
- Parameters:
elem (QDomElement)
- signal requestDepthBufferCapture[source]¶
Emitted to ask for the depth buffer image
Added in version 3.24.
- resetView(self, distance: float)[source]¶
Move camera back to the initial position (looking down towards origin of world’s coordinates)
- Parameters:
distance (float)
- rotateAroundViewCenter(self, deltaYaw: float)[source]¶
Rotate clockwise the view by
deltaYaw
around the view center (camera moves)- Parameters:
deltaYaw (float)
- rotateCamera(self, diffPitch: float, diffYaw: float)[source]¶
Rotates the camera on itself.
- Parameters:
diffPitch (float) – the pitch difference
diffYaw (float) – the yaw difference
Added in version 3.30.
- setCameraHeadingAngle(self, angle: float)[source]¶
Set camera heading to
angle
(used for rotating the view)- Parameters:
angle (float)
- setCameraMovementSpeed(self, movementSpeed: float)[source]¶
Sets the camera movement speed
Added in version 3.18.
- Parameters:
movementSpeed (float)
Sets the navigation mode used by the camera controller.
Added in version 3.18.
- Parameters:
navigationMode (Qgis.NavigationMode)
- setCameraPose(self, camPose: QgsCameraPose)[source]¶
Sets camera pose
Added in version 3.4.
- Parameters:
camPose (QgsCameraPose)
- signal setCursorPosition(point: QPoint)[source]¶
Emitted when the mouse cursor position should be moved to the specified
point
on the map viewport.- Parameters:
point (QPoint)
- setLookingAtPoint(self, point: QgsVector3D, distance: float, pitch: float, yaw: float)[source]¶
Sets the complete camera configuration: the point towards it is looking (in 3D world coordinates), the distance of the camera from the point, pitch angle in degrees (0 = looking from the top, 90 = looking from the side) and yaw angle in degrees.
Added in version 3.4.
- Parameters:
point (QgsVector3D)
distance (float)
pitch (float)
yaw (float)
- setVerticalAxisInversion(self, inversion: Qgis.VerticalAxisInversion)[source]¶
Sets the vertical axis
inversion
behavior.Added in version 3.18.
- Parameters:
inversion (Qgis.VerticalAxisInversion)
- setViewFromTop(self, worldX: float, worldY: float, distance: float, yaw: float = 0)[source]¶
Sets camera to look down towards given point in world coordinate, in given distance from plane with zero elevation
- Parameters:
worldX (float)
worldY (float)
distance (float)
yaw (float = 0)
- tiltUpAroundViewCenter(self, deltaPitch: float)[source]¶
Tilt up the view by
deltaPitch
around the view center (camera moves)- Parameters:
deltaPitch (float)
- verticalAxisInversion(self) Qgis.VerticalAxisInversion [source]¶
Returns the vertical axis inversion behavior.
Added in version 3.18.
- Return type:
- walkView(self, tx: float, ty: float, tz: float)[source]¶
Walks into the map by
tx
,ty
, andtz
Added in version 3.30.
- Parameters:
tx (float)
ty (float)
tz (float)
- willHandleKeyEvent(self, event: QKeyEvent | None) bool [source]¶
Returns
True
if the camera controller will handle the specified keyevent
, preventing it from being instead handled by parents of the 3D window before the controller ever receives it.- Parameters:
event (Optional[QKeyEvent])
- Return type:
bool
- writeXml(self, doc: QDomDocument) QDomElement [source]¶
Writes camera configuration to the given DOM element
- Parameters:
doc (QDomDocument)
- Return type:
QDomElement