|
QGIS API Documentation 3.99.0-Master (a8882ad4560)
|
Object that controls camera movement based on user input. More...
#include <qgscameracontroller.h>

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. | |
| void | moveCenterPoint (const QVector3D &posDiff) |
| Moves camera position by the given difference vector in world coordinates. | |
| void | setCameraNavigationMode (Qgis::NavigationMode navigationMode) |
| Sets the navigation mode used by the camera controller. | |
Signals | |
| void | cameraChanged () |
| Emitted when camera has been updated. | |
| void | cameraMovementSpeedChanged (double speed) |
| Emitted whenever the camera movement speed is changed by the controller. | |
| void | cameraRotationCenterChanged (QVector3D position) |
| Emitted when the camera rotation center changes. | |
| void | navigationModeChanged (Qgis::NavigationMode mode) |
| Emitted when the navigation mode is changed using the hotkey ctrl + ~. | |
| void | requestDepthBufferCapture () |
| Emitted to ask for the depth buffer image. | |
| void | setCursorPosition (QPoint point) |
| Emitted when the mouse cursor position should be moved to the specified point on the map viewport. | |
Public Member Functions | |
| QgsCameraController (Qgs3DMapScene *scene) | |
| Constructs the camera controller with optional parent node that will take ownership. | |
| ~QgsCameraController () override | |
| Qt3DRender::QCamera * | camera () const |
| Returns camera that is being controlled. | |
| double | cameraMovementSpeed () const |
| Returns the camera movement speed. | |
| Qgis::NavigationMode | cameraNavigationMode () const |
| Returns the navigation mode used by the camera controller. | |
| QgsCameraPose | cameraPose () const |
| Returns camera pose. | |
| float | distance () const |
| Returns distance of the camera from the point it is looking at. | |
| void | frameTriggered (float dt) |
| Called internally from 3D scene when a new frame is generated. Updates camera according to keyboard/mouse input. | |
| void | globeMoveCenterPoint (double latDiff, double lonDiff) |
| Orbits camera around the globe by the specified amount given as the difference in latitude/longitude angles (in degrees). | |
| void | globeUpdateHeadingAngle (float angleDiff) |
| Updates heading angle by the specified amount given as the angular difference in degrees. | |
| void | globeUpdatePitchAngle (float angleDiff) |
| Updates pitch angle by the specified amount given as the angular difference in degrees. | |
| void | globeZoom (float factor) |
| Moves camera closer or further away from the globe. | |
| bool | hasInputHandlersEnabled () const |
| Returns whether the camera controller responds to mouse and keyboard events. | |
| bool | keyboardEventFilter (QKeyEvent *event) |
If the event is relevant, handles the event and returns true, otherwise false. | |
| QgsVector3D | lookingAtMapPoint () const |
| Returns the point in the map coordinates towards which the camera is looking. | |
| QgsVector3D | lookingAtPoint () const |
| Returns the point in the world coordinates towards which the camera is looking. | |
| void | moveView (float tx, float ty) |
| Move the map by tx and ty. | |
| const QgsVector3D | origin () const |
| Returns the origin of the scene in map coordinates. | |
| float | pitch () const |
| Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side). | |
| void | readXml (const QDomElement &elem, QgsVector3D savedOrigin) |
| Reads camera configuration from the given DOM element. | |
| void | resetGlobe (float distance, double lat=0, double lon=0) |
| Resets view of the globe to look at a particular location given as latitude and longitude (in degrees) and distance from that point on ellipsoid. | |
| void | resetView (float distance) |
| Move camera back to the initial position (looking down towards origin of world's coordinates). | |
| void | rotateAroundViewCenter (float deltaYaw) |
| Rotate clockwise the view by deltaYaw around the view center (camera moves). | |
| void | rotateCamera (float diffPitch, float diffYaw) |
| Rotates the camera on itself. | |
| void | rotateCameraAroundPivot (float newPitch, float newHeading, const QVector3D &pivotPoint) |
| Rotates the camera around the pivot point (in world coordinates) to the given new pitch and heading angle. | |
| void | rotateCameraToBottom () |
| Rotate to bottom-up view. | |
| void | rotateCameraToEast () |
| Rotate to view from the east. | |
| void | rotateCameraToHome () |
| Rotate to diagonal view. | |
| void | rotateCameraToNorth () |
| Rotate to view from the north. | |
| void | rotateCameraToSouth () |
| Rotate to view from the south. | |
| void | rotateCameraToTop () |
| Rotate to top-down view. | |
| void | rotateCameraToWest () |
| Rotate to view from the west. | |
| void | setCameraHeadingAngle (float angle) |
| Set camera heading to angle (used for rotating the view). | |
| void | setCameraMovementSpeed (double movementSpeed) |
| Sets the camera movement speed. | |
| void | setCameraPose (const QgsCameraPose &camPose, bool force=false) |
| Sets camera pose. | |
| void | setCrossSectionSideView (const QgsCrossSection &crossSection) |
| Sets the cross section side view definition for the 3D map canvas. | |
| void | setInputHandlersEnabled (bool enable) |
| Sets whether the camera controller responds to mouse and keyboard events. | |
| void | setLookingAtMapPoint (const QgsVector3D &point, float distance, float pitch, float yaw) |
| Sets camera configuration like setLookingAtPoint(), but the point is given in map coordinates. | |
| 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. | |
| void | setOrigin (const QgsVector3D &origin) |
| Reacts to the shift of origin of the scene, updating camera pose and any other member variables so that the origin stays at the same position relative to other entities. | |
| void | setVerticalAxisInversion (Qgis::VerticalAxisInversion inversion) |
| Sets the vertical axis inversion behavior. | |
| 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. | |
| void | tiltUpAroundViewCenter (float deltaPitch) |
| Tilt up the view by deltaPitch around the view center (camera moves). | |
| Qgis::VerticalAxisInversion | verticalAxisInversion () const |
| Returns the vertical axis inversion behavior. | |
| void | walkView (double tx, double ty, double tz) |
| Walks into the map by tx, ty, and tz. | |
| QDomElement | writeXml (QDomDocument &doc) const |
| Writes camera configuration to the given DOM element. | |
| float | yaw () const |
| Returns yaw angle in degrees. | |
| void | zoom (float factor) |
| Zoom the map by factor. | |
| void | zoomCameraAroundPivot (const QVector3D &oldCameraPosition, double oldDistanceFromCenterPoint, double zoomFactor, const QVector3D &pivotPoint) |
| Zooms camera by given zoom factor (>1 one means zoom in) while keeping the pivot point (given in world coordinates) at the same screen coordinates after the zoom. | |
| Q_DECL_DEPRECATED void | zoomCameraAroundPivot (const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint) |
| Zooms camera by given zoom factor (>1 one means zoom in) while keeping the pivot point (given in world coordinates) at the same screen coordinates after the zoom. | |
Friends | |
| class | TestQgs3DCameraController |
| class | TestQgs3DRendering |
Object that controls camera movement based on user input.
Definition at line 58 of file qgscameracontroller.h.
| QgsCameraController::QgsCameraController | ( | Qgs3DMapScene * | scene | ) |
Constructs the camera controller with optional parent node that will take ownership.
Definition at line 41 of file qgscameracontroller.cpp.
|
overridedefault |
|
inline |
Returns camera that is being controlled.
Definition at line 77 of file qgscameracontroller.h.
|
signal |
Emitted when camera has been updated.
|
inline |
Returns the camera movement speed.
Definition at line 90 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 84 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 1420 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 159 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 211 of file qgscameracontroller.cpp.
| void QgsCameraController::globeMoveCenterPoint | ( | double | latDiff, |
| double | lonDiff ) |
Orbits camera around the globe by the specified amount given as the difference in latitude/longitude angles (in degrees).
Definition at line 410 of file qgscameracontroller.cpp.
| void QgsCameraController::globeUpdateHeadingAngle | ( | float | angleDiff | ) |
Updates heading angle by the specified amount given as the angular difference in degrees.
Definition at line 430 of file qgscameracontroller.cpp.
| void QgsCameraController::globeUpdatePitchAngle | ( | float | angleDiff | ) |
Updates pitch angle by the specified amount given as the angular difference in degrees.
Definition at line 424 of file qgscameracontroller.cpp.
| void QgsCameraController::globeZoom | ( | float | factor | ) |
Moves camera closer or further away from the globe.
Use factor greater than one to zoom in, or less than one to zoom out.
Definition at line 418 of file qgscameracontroller.cpp.
|
inline |
Returns whether the camera controller responds to mouse and keyboard events.
Definition at line 253 of file qgscameracontroller.h.
| bool QgsCameraController::keyboardEventFilter | ( | QKeyEvent * | event | ) |
If the event is relevant, handles the event and returns true, otherwise false.
Definition at line 1337 of file qgscameracontroller.cpp.
| QgsVector3D QgsCameraController::lookingAtMapPoint | ( | ) | const |
Returns the point in the map coordinates towards which the camera is looking.
Definition at line 266 of file qgscameracontroller.cpp.
| QgsVector3D QgsCameraController::lookingAtPoint | ( | ) | const |
Returns the point in the world coordinates towards which the camera is looking.
Definition at line 251 of file qgscameracontroller.cpp.
|
slot |
Moves camera position by the given difference vector in world coordinates.
Definition at line 484 of file qgscameracontroller.cpp.
| void QgsCameraController::moveView | ( | float | tx, |
| float | ty ) |
Move the map by tx and ty.
Definition at line 1318 of file qgscameracontroller.cpp.
|
signal |
Emitted when the navigation mode is changed using the hotkey ctrl + ~.
|
inline |
Returns the origin of the scene in map coordinates.
Definition at line 293 of file qgscameracontroller.h.
|
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 166 of file qgscameracontroller.h.
| void QgsCameraController::readXml | ( | const QDomElement & | elem, |
| QgsVector3D | savedOrigin ) |
Reads camera configuration from the given DOM element.
Definition at line 300 of file qgscameracontroller.cpp.
|
signal |
Emitted to ask for the depth buffer image.
| void QgsCameraController::resetGlobe | ( | float | distance, |
| double | lat = 0, | ||
| double | lon = 0 ) |
Resets view of the globe to look at a particular location given as latitude and longitude (in degrees) and distance from that point on ellipsoid.
Definition at line 436 of file qgscameracontroller.cpp.
| void QgsCameraController::resetView | ( | float | distance | ) |
Move camera back to the initial position (looking down towards origin of world's coordinates).
Definition at line 222 of file qgscameracontroller.cpp.
| void QgsCameraController::rotateAroundViewCenter | ( | float | deltaYaw | ) |
Rotate clockwise the view by deltaYaw around the view center (camera moves).
Definition at line 1303 of file qgscameracontroller.cpp.
| void QgsCameraController::rotateCamera | ( | float | diffPitch, |
| float | diffYaw ) |
Rotates the camera on itself.
| diffPitch | the pitch difference |
| diffYaw | the yaw difference |
Definition at line 107 of file qgscameracontroller.cpp.
| void QgsCameraController::rotateCameraAroundPivot | ( | float | newPitch, |
| float | newHeading, | ||
| const QVector3D & | pivotPoint ) |
Rotates the camera around the pivot point (in world coordinates) to the given new pitch and heading angle.
Definition at line 158 of file qgscameracontroller.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void QgsCameraController::setCameraHeadingAngle | ( | float | angle | ) |
Set camera heading to angle (used for rotating the view).
Definition at line 1312 of file qgscameracontroller.cpp.
| void QgsCameraController::setCameraMovementSpeed | ( | double | movementSpeed | ) |
Sets the camera movement speed.
Definition at line 91 of file qgscameracontroller.cpp.
|
slot |
Sets the navigation mode used by the camera controller.
Definition at line 81 of file qgscameracontroller.cpp.
| void QgsCameraController::setCameraPose | ( | const QgsCameraPose & | camPose, |
| bool | force = false ) |
| void QgsCameraController::setCrossSectionSideView | ( | const QgsCrossSection & | crossSection | ) |
Sets the cross section side view definition for the 3D map canvas.
The camera will be positioned to look at the cross section from the side.
Definition at line 1526 of file qgscameracontroller.cpp.
|
signal |
Emitted when the mouse cursor position should be moved to the specified point on the map viewport.
|
inline |
Sets whether the camera controller responds to mouse and keyboard events.
Definition at line 247 of file qgscameracontroller.h.
| void QgsCameraController::setLookingAtMapPoint | ( | const QgsVector3D & | point, |
| float | distance, | ||
| float | pitch, | ||
| float | yaw ) |
Sets camera configuration like setLookingAtPoint(), but the point is given in map coordinates.
Definition at line 271 of file qgscameracontroller.cpp.
| 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 256 of file qgscameracontroller.cpp.
| void QgsCameraController::setOrigin | ( | const QgsVector3D & | origin | ) |
Reacts to the shift of origin of the scene, updating camera pose and any other member variables so that the origin stays at the same position relative to other entities.
Definition at line 1481 of file qgscameracontroller.cpp.
| void QgsCameraController::setVerticalAxisInversion | ( | Qgis::VerticalAxisInversion | inversion | ) |
Sets the vertical axis inversion behavior.
Definition at line 102 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 229 of file qgscameracontroller.cpp.
| void QgsCameraController::tiltUpAroundViewCenter | ( | float | deltaPitch | ) |
Tilt up the view by deltaPitch around the view center (camera moves).
Definition at line 1294 of file qgscameracontroller.cpp.
|
inline |
Returns the vertical axis inversion behavior.
Definition at line 102 of file qgscameracontroller.h.
| void QgsCameraController::walkView | ( | double | tx, |
| double | ty, | ||
| double | tz ) |
Walks into the map by tx, ty, and tz.
Definition at line 1135 of file qgscameracontroller.cpp.
| QDomElement QgsCameraController::writeXml | ( | QDomDocument & | doc | ) | const |
Writes camera configuration to the given DOM element.
Definition at line 285 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 173 of file qgscameracontroller.h.
| void QgsCameraController::zoom | ( | float | factor | ) |
Zoom the map by factor.
Definition at line 828 of file qgscameracontroller.cpp.
| void QgsCameraController::zoomCameraAroundPivot | ( | const QVector3D & | oldCameraPosition, |
| double | oldDistanceFromCenterPoint, | ||
| double | zoomFactor, | ||
| const QVector3D & | pivotPoint ) |
Zooms camera by given zoom factor (>1 one means zoom in) while keeping the pivot point (given in world coordinates) at the same screen coordinates after the zoom.
Definition at line 195 of file qgscameracontroller.cpp.
| void QgsCameraController::zoomCameraAroundPivot | ( | const QVector3D & | oldCameraPosition, |
| double | zoomFactor, | ||
| const QVector3D & | pivotPoint ) |
Zooms camera by given zoom factor (>1 one means zoom in) while keeping the pivot point (given in world coordinates) at the same screen coordinates after the zoom.
Definition at line 179 of file qgscameracontroller.cpp.
|
friend |
Definition at line 514 of file qgscameracontroller.h.
|
friend |
Definition at line 513 of file qgscameracontroller.h.