mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Previously the point was saved in origin-relative coordinates. Now since we pick the origin automatically, it can be changed by various initialisation routines, so the coordinates will be interpreted relative to the wrong origin. This commit changes the format to use map coordinates instead, and saves the "original" origin from the XML for interpreting older projects.
395 lines
9.6 KiB
Plaintext
395 lines
9.6 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/3d/qgscameracontroller.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsCameraController : QObject
|
|
{
|
|
%Docstring(signature="appended")
|
|
Object that controls camera movement based on user input.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscameracontroller.h"
|
|
%End
|
|
public:
|
|
~QgsCameraController();
|
|
|
|
|
|
Qgis::NavigationMode cameraNavigationMode() const;
|
|
%Docstring
|
|
Returns the navigation mode used by the camera controller.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
double cameraMovementSpeed() const;
|
|
%Docstring
|
|
Returns the camera movement speed
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
void setCameraMovementSpeed( double movementSpeed );
|
|
%Docstring
|
|
Sets the camera movement speed
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
Qgis::VerticalAxisInversion verticalAxisInversion() const;
|
|
%Docstring
|
|
Returns the vertical axis inversion behavior.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
void setVerticalAxisInversion( Qgis::VerticalAxisInversion inversion );
|
|
%Docstring
|
|
Sets the vertical axis ``inversion`` behavior.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
void frameTriggered( float dt );
|
|
%Docstring
|
|
Called internally from 3D scene when a new frame is generated. Updates
|
|
camera according to keyboard/mouse input
|
|
%End
|
|
|
|
void resetView( float distance );
|
|
%Docstring
|
|
Move camera back to the initial position (looking down towards origin of
|
|
world's coordinates)
|
|
%End
|
|
|
|
void setViewFromTop( float worldX, float worldY, float distance, float yaw = 0 );
|
|
%Docstring
|
|
Sets camera to look down towards given point in world coordinate, in
|
|
given distance from plane with zero elevation
|
|
%End
|
|
|
|
QgsVector3D lookingAtPoint() const;
|
|
%Docstring
|
|
Returns the point in the world coordinates towards which the camera is
|
|
looking
|
|
%End
|
|
|
|
void setLookingAtPoint( const QgsVector3D &point, float distance, float pitch, float yaw );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
QgsVector3D lookingAtMapPoint() const;
|
|
%Docstring
|
|
Returns the point in the map coordinates towards which the camera is
|
|
looking
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void setLookingAtMapPoint( const QgsVector3D &point, float distance, float pitch, float yaw );
|
|
%Docstring
|
|
Sets camera configuration like
|
|
:py:func:`~QgsCameraController.setLookingAtPoint`, but the point is
|
|
given in map coordinates
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void setCameraPose( const QgsCameraPose &camPose, bool force = false );
|
|
%Docstring
|
|
Sets camera pose
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
QgsCameraPose cameraPose() const;
|
|
%Docstring
|
|
Returns camera pose
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
float distance() const;
|
|
%Docstring
|
|
Returns distance of the camera from the point it is looking at. The
|
|
value should not be smaller than 10.
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
float pitch() const;
|
|
%Docstring
|
|
Returns pitch angle in degrees (0 = looking from the top, 90 = looking
|
|
from the side). The angle should range from 0 to 180.
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
float yaw() const;
|
|
%Docstring
|
|
Returns yaw angle in degrees. Yaw value of zero means the camera is
|
|
pointing towards north. The angle should range from 0 to 360.
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
QDomElement writeXml( QDomDocument &doc ) const;
|
|
%Docstring
|
|
Writes camera configuration to the given DOM element
|
|
%End
|
|
void readXml( const QDomElement &elem, QgsVector3D savedOrigin );
|
|
%Docstring
|
|
Reads camera configuration from the given DOM element
|
|
%End
|
|
|
|
void zoom( float factor );
|
|
%Docstring
|
|
Zoom the map by ``factor``
|
|
%End
|
|
void tiltUpAroundViewCenter( float deltaPitch );
|
|
%Docstring
|
|
Tilt up the view by ``deltaPitch`` around the view center (camera moves)
|
|
%End
|
|
void rotateAroundViewCenter( float deltaYaw );
|
|
%Docstring
|
|
Rotate clockwise the view by ``deltaYaw`` around the view center (camera
|
|
moves)
|
|
%End
|
|
void setCameraHeadingAngle( float angle );
|
|
%Docstring
|
|
Set camera heading to ``angle`` (used for rotating the view)
|
|
%End
|
|
void moveView( float tx, float ty );
|
|
%Docstring
|
|
Move the map by ``tx`` and ``ty``
|
|
%End
|
|
|
|
void walkView( double tx, double ty, double tz );
|
|
%Docstring
|
|
Walks into the map by ``tx``, ``ty``, and ``tz``
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
void rotateCamera( float diffPitch, float diffYaw );
|
|
%Docstring
|
|
Rotates the camera on itself.
|
|
|
|
:param diffPitch: the pitch difference
|
|
:param diffYaw: the yaw difference
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
void rotateCameraAroundPivot( float newPitch, float newHeading, const QVector3D &pivotPoint );
|
|
%Docstring
|
|
Rotates the camera around the pivot point (in world coordinates) to the
|
|
given new pitch and heading angle.
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
void zoomCameraAroundPivot( const QVector3D &oldCameraPosition, double zoomFactor, const QVector3D &pivotPoint );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
bool keyboardEventFilter( QKeyEvent *event );
|
|
%Docstring
|
|
If the event is relevant, handles the event and returns ``True``,
|
|
otherwise ``False``.
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void setOrigin( const QgsVector3D &origin );
|
|
%Docstring
|
|
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.
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
void setInputHandlersEnabled( bool enable );
|
|
%Docstring
|
|
Sets whether the camera controller responds to mouse and keyboard events
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
bool hasInputHandlersEnabled() const;
|
|
%Docstring
|
|
Returns whether the camera controller responds to mouse and keyboard
|
|
events
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void globeMoveCenterPoint( double latDiff, double lonDiff );
|
|
%Docstring
|
|
Orbits camera around the globe by the specified amount given as the
|
|
difference in latitude/longitude angles (in degrees)
|
|
|
|
.. note::
|
|
|
|
the final latitude gets clamped to 0-90 degrees, while the longitude does not get clamped
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void globeZoom( float factor );
|
|
%Docstring
|
|
Moves camera closer or further away from the globe. Use factor greater
|
|
than one to zoom in, or less than one to zoom out.
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void globeUpdatePitchAngle( float angleDiff );
|
|
%Docstring
|
|
Updates pitch angle by the specified amount given as the angular
|
|
difference in degrees
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void globeUpdateHeadingAngle( float angleDiff );
|
|
%Docstring
|
|
Updates heading angle by the specified amount given as the angular
|
|
difference in degrees
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void resetGlobe( float distance, double lat = 0, double lon = 0 );
|
|
%Docstring
|
|
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
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
const QgsVector3D origin() const;
|
|
%Docstring
|
|
Returns the origin of the scene in map coordinates
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void rotateCameraToHome();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToTop();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToNorth();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToEast();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToSouth();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToWest();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
void rotateCameraToBottom();
|
|
%Docstring
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
public slots:
|
|
|
|
void setCameraNavigationMode( Qgis::NavigationMode navigationMode );
|
|
%Docstring
|
|
Sets the navigation mode used by the camera controller.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
void depthBufferCaptured( const QImage &depthImage );
|
|
%Docstring
|
|
Sets the depth buffer image used by the camera controller to calculate
|
|
world position from a pixel's coordinates and depth
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
private:
|
|
QgsCameraController();
|
|
QgsCameraController( const QgsCameraController &other );
|
|
signals:
|
|
void cameraChanged();
|
|
%Docstring
|
|
Emitted when camera has been updated
|
|
%End
|
|
|
|
void navigationModeChanged( Qgis::NavigationMode mode );
|
|
%Docstring
|
|
Emitted when the navigation mode is changed using the hotkey ctrl + ~
|
|
%End
|
|
|
|
void cameraMovementSpeedChanged( double speed );
|
|
%Docstring
|
|
Emitted whenever the camera movement speed is changed by the controller.
|
|
%End
|
|
|
|
void setCursorPosition( QPoint point );
|
|
%Docstring
|
|
Emitted when the mouse cursor position should be moved to the specified
|
|
``point`` on the map viewport.
|
|
%End
|
|
|
|
void requestDepthBufferCapture();
|
|
%Docstring
|
|
Emitted to ask for the depth buffer image
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
void cameraRotationCenterChanged( QVector3D position );
|
|
%Docstring
|
|
Emitted when the camera rotation center changes
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/3d/qgscameracontroller.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|