QGIS API Documentation  3.2.0-Bonn (bc43194)
Classes | 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...
 
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
 

Detailed Description

3 Object that controls camera movement based on user input

Since
QGIS 3.0

Definition at line 35 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 26 of file qgscameracontroller.cpp.

Member Function Documentation

◆ addTerrainPicker()

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.

◆ camera()

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

Returns camera that is being controlled.

Definition at line 45 of file qgscameracontroller.h.

◆ cameraChanged

void QgsCameraController::cameraChanged ( )
signal

Emitted when camera has been updated.

◆ 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 221 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 316 of file qgscameracontroller.cpp.

◆ readXml()

void QgsCameraController::readXml ( const QDomElement &  elem)

Reads camera configuration from the given DOM element.

Definition at line 338 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 301 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 138 of file qgscameracontroller.cpp.

◆ setLookingAtPoint()

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.

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

◆ setViewport()

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.

◆ viewport()

QRect QgsCameraController::viewport ( ) const
inline

Returns viewport rectangle.

Definition at line 47 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 327 of file qgscameracontroller.cpp.

Property Documentation

◆ camera

Qt3DRender::QCamera QgsCameraController::camera
readwrite

Definition at line 38 of file qgscameracontroller.h.

◆ viewport

QRect QgsCameraController::viewport
readwrite

Definition at line 39 of file qgscameracontroller.h.


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