QGIS API Documentation
3.2.0-Bonn (bc43194)
|
3 Object that controls camera movement based on user input More...
#include <qgscameracontroller.h>
Signals | |
void | cameraChanged () |
Emitted when camera has been updated. 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... | |
void | addTerrainPicker (Qt3DRender::QObjectPicker *picker) |
Connects to object picker attached to terrain entity. More... | |
Qt3DRender::QCamera * | camera () const |
Returns camera that is being controlled. 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 | 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 | setCamera (Qt3DRender::QCamera *camera) |
Assigns camera that should be controlled by this class. Called internally from 3D scene. More... | |
void | setLookingAtPoint (const QgsVector3D &point) |
Sets the point toward which the camera is looking - this is used when world origin changes (e.g. after terrain generator changes) 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 (const QRect &viewport) |
Sets viewport rectangle. Called internally from 3D canvas. Allows conversion of mouse coordinates. More... | |
QRect | viewport () const |
Returns viewport rectangle. More... | |
QDomElement | writeXml (QDomDocument &doc) const |
Writes camera configuration to the given DOM element. More... | |
Properties | |
Qt3DRender::QCamera | camera |
QRect | viewport |
3 Object that controls camera movement based on user input
Definition at line 35 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 26 of file qgscameracontroller.cpp.
void QgsCameraController::addTerrainPicker | ( | Qt3DRender::QObjectPicker * | picker | ) |
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
Definition at line 132 of file qgscameracontroller.cpp.
|
inline |
Returns camera that is being controlled.
Definition at line 45 of file qgscameracontroller.h.
|
signal |
Emitted when camera has been updated.
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 221 of file qgscameracontroller.cpp.
QgsVector3D QgsCameraController::lookingAtPoint | ( | ) | const |
Returns the point in the world coordinates towards which the camera is looking.
Definition at line 316 of file qgscameracontroller.cpp.
void QgsCameraController::readXml | ( | const QDomElement & | elem | ) |
Reads camera configuration from the given DOM element.
Definition at line 338 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 301 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 138 of file qgscameracontroller.cpp.
void QgsCameraController::setLookingAtPoint | ( | const QgsVector3D & | point | ) |
Sets the point toward which the camera is looking - this is used when world origin changes (e.g. after terrain generator changes)
Definition at line 321 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 306 of file qgscameracontroller.cpp.
void QgsCameraController::setViewport | ( | const QRect & | viewport | ) |
Sets viewport rectangle. Called internally from 3D canvas. Allows conversion of mouse coordinates.
Definition at line 151 of file qgscameracontroller.cpp.
|
inline |
Returns viewport rectangle.
Definition at line 47 of file qgscameracontroller.h.
|
signal |
Emitted when viewport rectangle has been updated.
QDomElement QgsCameraController::writeXml | ( | QDomDocument & | doc | ) | const |
Writes camera configuration to the given DOM element.
Definition at line 327 of file qgscameracontroller.cpp.
|
readwrite |
Definition at line 38 of file qgscameracontroller.h.
|
readwrite |
Definition at line 39 of file qgscameracontroller.h.