QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
3 More...
#include <qgscameracontroller.h>
Public Types | |
enum | NavigationMode { TerrainBasedNavigation , WalkNavigation } |
The navigation mode used by the camera. More... | |
enum | VerticalAxisInversion { Never , WhenDragging , Always } |
Vertical axis inversion options. More... | |
Public Slots | |
void | depthBufferCaptured (const QImage &depthImage) |
Sets the depth buffer image used by the camera controller to calculate world position from a pixel's coordinates and depth. More... | |
void | setCameraNavigationMode (QgsCameraController::NavigationMode navigationMode) |
Sets the navigation mode used by the camera controller. More... | |
Signals | |
void | cameraChanged () |
Emitted when camera has been updated. More... | |
void | cameraMovementSpeedChanged (double speed) |
Emitted whenever the camera movement speed is changed by the controller. More... | |
void | cameraRotationCenterChanged (QVector3D position) |
Emitted when the camera rotation center changes. More... | |
void | navigationModeChanged (QgsCameraController::NavigationMode mode) |
Emitted when the navigation mode is changed using the hotkey ctrl + ~. More... | |
void | requestDepthBufferCapture () |
Emitted to ask for the depth buffer image. More... | |
void | setCursorPosition (QPoint point) |
Emitted when the mouse cursor position should be moved to the specified point on the map viewport. More... | |
void | viewportChanged () |
Emitted when viewport rectangle has been updated. More... | |
Public Member Functions | |
QgsCameraController (Qt3DCore::QNode *parent=nullptr) | |
Constructs the camera controller with optional parent node that will take ownership. More... | |
Qt3DRender::QCamera * | camera () const |
Returns camera that is being controlled. More... | |
double | cameraMovementSpeed () const |
Returns the camera movement speed. More... | |
QgsCameraController::NavigationMode | cameraNavigationMode () const |
Returns the navigation mode used by the camera controller. More... | |
QgsCameraPose | cameraPose () const |
Returns camera pose. More... | |
float | distance () const |
Returns distance of the camera from the point it is looking at. More... | |
void | frameTriggered (float dt) |
Called internally from 3D scene when a new frame is generated. Updates camera according to keyboard/mouse input. More... | |
QgsVector3D | lookingAtPoint () const |
Returns the point in the world coordinates towards which the camera is looking. More... | |
void | moveView (float tx, float ty) |
Move the map by tx and ty. More... | |
float | pitch () const |
Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side). More... | |
void | readXml (const QDomElement &elem) |
Reads camera configuration from the given DOM element. More... | |
void | resetView (float distance) |
Move camera back to the initial position (looking down towards origin of world's coordinates) More... | |
void | rotateAroundViewCenter (float deltaYaw) |
Rotate clockwise the view by deltaYaw around the view center (camera moves) More... | |
void | setCamera (Qt3DRender::QCamera *camera) |
Assigns camera that should be controlled by this class. Called internally from 3D scene. More... | |
void | setCameraHeadingAngle (float angle) |
Set camera heading to angle (used for rotating the view) More... | |
void | setCameraMovementSpeed (double movementSpeed) |
Sets the camera movement speed. More... | |
void | setCameraPose (const QgsCameraPose &camPose) |
Sets camera pose. More... | |
void | setLookingAtPoint (const QgsVector3D &point, float distance, float pitch, float yaw) |
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. More... | |
void | setTerrainEntity (QgsTerrainEntity *te) |
Connects to object picker attached to terrain entity. More... | |
void | setVerticalAxisInversion (QgsCameraController::VerticalAxisInversion inversion) |
Sets the vertical axis inversion behavior. More... | |
void | setViewFromTop (float worldX, float worldY, float distance, float yaw=0) |
Sets camera to look down towards given point in world coordinate, in given distance from plane with zero elevation. More... | |
void | setViewport (QRect viewport) |
Sets viewport rectangle. Called internally from 3D canvas. Allows conversion of mouse coordinates. More... | |
void | tiltUpAroundViewCenter (float deltaPitch) |
Tilt up the view by deltaPitch around the view center (camera moves) More... | |
QgsCameraController::VerticalAxisInversion | verticalAxisInversion () const |
Returns the vertical axis inversion behavior. More... | |
QRect | viewport () const |
Returns viewport rectangle. More... | |
bool | willHandleKeyEvent (QKeyEvent *event) |
Returns true if the camera controller will handle the specified key event, preventing it from being instead handled by parents of the 3D window before the controller ever receives it. More... | |
QDomElement | writeXml (QDomDocument &doc) const |
Writes camera configuration to the given DOM element. More... | |
float | yaw () const |
Returns yaw angle in degrees. More... | |
void | zoom (float factor) |
Zoom the map by factor. More... | |
Properties | |
Qt3DRender::QCamera * | camera |
QRect | viewport |
3
Object that controls camera movement based on user input
Definition at line 61 of file qgscameracontroller.h.
The navigation mode used by the camera.
Enumerator | |
---|---|
TerrainBasedNavigation | The default navigation based on the terrain. |
WalkNavigation | Uses WASD keys or arrows to navigate in walking (first person) manner. |
Definition at line 69 of file qgscameracontroller.h.
Vertical axis inversion options.
Enumerator | |
---|---|
Never | Never invert vertical axis movements. |
WhenDragging | Invert vertical axis movements when dragging in first person modes. |
Always | Always invert vertical axis movements. |
Definition at line 77 of file qgscameracontroller.h.
QgsCameraController::QgsCameraController | ( | Qt3DCore::QNode * | parent = nullptr | ) |
Constructs the camera controller with optional parent node that will take ownership.
Definition at line 33 of file qgscameracontroller.cpp.
|
inline |
Returns camera that is being controlled.
Definition at line 90 of file qgscameracontroller.h.
|
signal |
Emitted when camera has been updated.
|
inline |
Returns the camera movement speed.
Definition at line 104 of file qgscameracontroller.h.
|
signal |
Emitted whenever the camera movement speed is changed by the controller.
|
inline |
Returns the navigation mode used by the camera controller.
Definition at line 98 of file qgscameracontroller.h.
|
inline |
|
signal |
Emitted when the camera rotation center changes.
|
slot |
Sets the depth buffer image used by the camera controller to calculate world position from a pixel's coordinates and depth.
Definition at line 1075 of file qgscameracontroller.cpp.
|
inline |
Returns distance of the camera from the point it is looking at.
The value should not be smaller than 10.
Definition at line 172 of file qgscameracontroller.h.
void QgsCameraController::frameTriggered | ( | float | dt | ) |
Called internally from 3D scene when a new frame is generated. Updates camera according to keyboard/mouse input.
Definition at line 159 of file qgscameracontroller.cpp.
QgsVector3D QgsCameraController::lookingAtPoint | ( | ) | const |
Returns the point in the world coordinates towards which the camera is looking.
Definition at line 186 of file qgscameracontroller.cpp.
void QgsCameraController::moveView | ( | float | tx, |
float | ty | ||
) |
Move the map by tx and ty.
Definition at line 1001 of file qgscameracontroller.cpp.
|
signal |
Emitted when the navigation mode is changed using the hotkey ctrl + ~.
|
inline |
Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side).
The angle should range from 0 to 180.
Definition at line 179 of file qgscameracontroller.h.
void QgsCameraController::readXml | ( | const QDomElement & | elem | ) |
Reads camera configuration from the given DOM element.
Definition at line 226 of file qgscameracontroller.cpp.
|
signal |
Emitted to ask for the depth buffer image.
void QgsCameraController::resetView | ( | float | distance | ) |
Move camera back to the initial position (looking down towards origin of world's coordinates)
Definition at line 164 of file qgscameracontroller.cpp.
void QgsCameraController::rotateAroundViewCenter | ( | float | deltaYaw | ) |
Rotate clockwise the view by deltaYaw around the view center (camera moves)
Definition at line 986 of file qgscameracontroller.cpp.
void QgsCameraController::setCamera | ( | Qt3DRender::QCamera * | camera | ) |
Assigns camera that should be controlled by this class. Called internally from 3D scene.
Definition at line 105 of file qgscameracontroller.cpp.
void QgsCameraController::setCameraHeadingAngle | ( | float | angle | ) |
Set camera heading to angle (used for rotating the view)
Definition at line 995 of file qgscameracontroller.cpp.
void QgsCameraController::setCameraMovementSpeed | ( | double | movementSpeed | ) |
Sets the camera movement speed.
Definition at line 83 of file qgscameracontroller.cpp.
|
slot |
Sets the navigation mode used by the camera controller.
Definition at line 73 of file qgscameracontroller.cpp.
void QgsCameraController::setCameraPose | ( | const QgsCameraPose & | camPose | ) |
|
signal |
Emitted when the mouse cursor position should be moved to the specified point on the map viewport.
void QgsCameraController::setLookingAtPoint | ( | const QgsVector3D & | point, |
float | distance, | ||
float | pitch, | ||
float | yaw | ||
) |
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.
Definition at line 191 of file qgscameracontroller.cpp.
void QgsCameraController::setTerrainEntity | ( | QgsTerrainEntity * | te | ) |
Connects to object picker attached to terrain entity.
Called internally from 3D scene. This allows camera controller understand how far from the camera is the terrain under mouse cursor. Also it allows adjustment of camera's view center to a point on terrain.
Definition at line 97 of file qgscameracontroller.cpp.
void QgsCameraController::setVerticalAxisInversion | ( | QgsCameraController::VerticalAxisInversion | inversion | ) |
Sets the vertical axis inversion behavior.
Definition at line 92 of file qgscameracontroller.cpp.
void QgsCameraController::setViewFromTop | ( | float | worldX, |
float | worldY, | ||
float | distance, | ||
float | yaw = 0 |
||
) |
Sets camera to look down towards given point in world coordinate, in given distance from plane with zero elevation.
Definition at line 169 of file qgscameracontroller.cpp.
void QgsCameraController::setViewport | ( | QRect | viewport | ) |
Sets viewport rectangle. Called internally from 3D canvas. Allows conversion of mouse coordinates.
Definition at line 118 of file qgscameracontroller.cpp.
void QgsCameraController::tiltUpAroundViewCenter | ( | float | deltaPitch | ) |
Tilt up the view by deltaPitch around the view center (camera moves)
Definition at line 977 of file qgscameracontroller.cpp.
|
inline |
Returns the vertical axis inversion behavior.
Definition at line 116 of file qgscameracontroller.h.
|
inline |
Returns viewport rectangle.
Definition at line 92 of file qgscameracontroller.h.
|
signal |
Emitted when viewport rectangle has been updated.
bool QgsCameraController::willHandleKeyEvent | ( | QKeyEvent * | event | ) |
Returns true
if the camera controller will handle the specified key event, preventing it from being instead handled by parents of the 3D window before the controller ever receives it.
Definition at line 1020 of file qgscameracontroller.cpp.
QDomElement QgsCameraController::writeXml | ( | QDomDocument & | doc | ) | const |
Writes camera configuration to the given DOM element.
Definition at line 214 of file qgscameracontroller.cpp.
|
inline |
Returns yaw angle in degrees.
Yaw value of zero means the camera is pointing towards north. The angle should range from 0 to 360.
Definition at line 186 of file qgscameracontroller.h.
void QgsCameraController::zoom | ( | float | factor | ) |
Zoom the map by factor.
Definition at line 527 of file qgscameracontroller.cpp.
|
readwrite |
Definition at line 61 of file qgscameracontroller.h.
|
readwrite |
Definition at line 61 of file qgscameracontroller.h.