QGIS API Documentation  3.6.0-Noosa (5873452)
Signals | Public Member Functions | Properties | List of all members
QgsCameraController Class Reference

3 Object that controls camera movement based on user input More...

#include <qgscameracontroller.h>

Inheritance diagram for QgsCameraController:
Inheritance graph
[legend]

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...
 
Qt3DRender::QCamera * camera () const
 Returns camera that is being controlled. 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...
 
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 setCamera (Qt3DRender::QCamera *camera)
 Assigns camera that should be controlled by this class. Called internally from 3D scene. 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 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...
 
QRect viewport () const
 Returns viewport rectangle. More...
 
QDomElement writeXml (QDomDocument &doc) const
 Writes camera configuration to the given DOM element. More...
 
float yaw () const
 Returns yaw angle in degrees. More...
 

Properties

Qt3DRender::QCamera camera
 
QRect viewport
 

Detailed Description

3 Object that controls camera movement based on user input

Since
QGIS 3.0

Definition at line 56 of file qgscameracontroller.h.

Constructor & Destructor Documentation

◆ QgsCameraController()

QgsCameraController::QgsCameraController ( Qt3DCore::QNode *  parent = nullptr)

Constructs the camera controller with optional parent node that will take ownership.

Definition at line 30 of file qgscameracontroller.cpp.

Member Function Documentation

◆ camera()

Qt3DRender::QCamera* QgsCameraController::camera ( ) const
inline

Returns camera that is being controlled.

Definition at line 66 of file qgscameracontroller.h.

◆ cameraChanged

void QgsCameraController::cameraChanged ( )
signal

Emitted when camera has been updated.

◆ cameraPose()

QgsCameraPose QgsCameraController::cameraPose ( ) const
inline

Returns camera pose.

Since
QGIS 3.4

Definition at line 111 of file qgscameracontroller.h.

◆ distance()

float QgsCameraController::distance ( ) const
inline

Returns distance of the camera from the point it is looking at.

Since
QGIS 3.4

Definition at line 117 of file qgscameracontroller.h.

◆ frameTriggered()

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 171 of file qgscameracontroller.cpp.

◆ lookingAtPoint()

QgsVector3D QgsCameraController::lookingAtPoint ( ) const

Returns the point in the world coordinates towards which the camera is looking.

Definition at line 195 of file qgscameracontroller.cpp.

◆ pitch()

float QgsCameraController::pitch ( ) const
inline

Returns pitch angle in degrees (0 = looking from the top, 90 = looking from the side).

The angle should range from 0 to 180.

Since
QGIS 3.4

Definition at line 124 of file qgscameracontroller.h.

◆ readXml()

void QgsCameraController::readXml ( const QDomElement &  elem)

Reads camera configuration from the given DOM element.

Definition at line 235 of file qgscameracontroller.cpp.

◆ resetView()

void QgsCameraController::resetView ( float  distance)

Move camera back to the initial position (looking down towards origin of world's coordinates)

Definition at line 176 of file qgscameracontroller.cpp.

◆ setCamera()

void QgsCameraController::setCamera ( Qt3DRender::QCamera *  camera)

Assigns camera that should be controlled by this class. Called internally from 3D scene.

Definition at line 71 of file qgscameracontroller.cpp.

◆ setCameraPose()

void QgsCameraController::setCameraPose ( const QgsCameraPose camPose)

Sets camera pose.

Since
QGIS 3.4

Definition at line 210 of file qgscameracontroller.cpp.

◆ setLookingAtPoint()

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.

Since
QGIS 3.4

Definition at line 200 of file qgscameracontroller.cpp.

◆ setTerrainEntity()

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 63 of file qgscameracontroller.cpp.

◆ setViewFromTop()

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 181 of file qgscameracontroller.cpp.

◆ setViewport()

void QgsCameraController::setViewport ( QRect  viewport)

Sets viewport rectangle. Called internally from 3D canvas. Allows conversion of mouse coordinates.

Definition at line 84 of file qgscameracontroller.cpp.

◆ viewport()

QRect QgsCameraController::viewport ( ) const
inline

Returns viewport rectangle.

Definition at line 68 of file qgscameracontroller.h.

◆ viewportChanged

void QgsCameraController::viewportChanged ( )
signal

Emitted when viewport rectangle has been updated.

◆ writeXml()

QDomElement QgsCameraController::writeXml ( QDomDocument &  doc) const

Writes camera configuration to the given DOM element.

Definition at line 223 of file qgscameracontroller.cpp.

◆ yaw()

float QgsCameraController::yaw ( ) const
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.

Since
QGIS 3.4

Definition at line 131 of file qgscameracontroller.h.

Property Documentation

◆ camera

Qt3DRender::QCamera QgsCameraController::camera
readwrite

Definition at line 59 of file qgscameracontroller.h.

◆ viewport

QRect QgsCameraController::viewport
readwrite

Definition at line 60 of file qgscameracontroller.h.


The documentation for this class was generated from the following files: