QGIS API Documentation  3.6.0-Noosa (5873452)
qgscamerapose.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscamerapose.h
3  --------------------------------------
4  Date : July 2018
5  Copyright : (C) 2018 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSCAMERAPOSE_H
17 #define QGSCAMERAPOSE_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsvector3d.h"
22 
23 namespace Qt3DRender
24 {
25  class QCamera;
26 }
27 
28 class QDomDocument;
29 class QDomElement;
30 
41 class _3D_EXPORT QgsCameraPose
42 {
43  public:
44 
46  QgsVector3D centerPoint() const { return mCenterPoint; }
48  void setCenterPoint( const QgsVector3D &point ) { mCenterPoint = point; }
49 
51  float distanceFromCenterPoint() const { return mDistanceFromCenterPoint; }
53  void setDistanceFromCenterPoint( float distance ) { mDistanceFromCenterPoint = distance; }
54 
56  float pitchAngle() const { return mPitchAngle; }
58  void setPitchAngle( float pitch ) { mPitchAngle = pitch; }
59 
61  float headingAngle() const { return mHeadingAngle; }
63  void setHeadingAngle( float heading ) { mHeadingAngle = heading; }
64 
66  void updateCamera( Qt3DRender::QCamera *camera );
67 
69  QDomElement writeXml( QDomDocument &doc ) const;
71  void readXml( const QDomElement &elem );
72 
73  bool operator==( const QgsCameraPose &other ) const
74  {
75  return mCenterPoint == other.mCenterPoint &&
76  mDistanceFromCenterPoint == other.mDistanceFromCenterPoint &&
77  mPitchAngle == other.mPitchAngle &&
78  mHeadingAngle == other.mHeadingAngle;
79  }
80  bool operator!=( const QgsCameraPose &other ) const
81  {
82  return !operator==( other );
83  }
84 
85  private:
87  QgsVector3D mCenterPoint;
89  float mDistanceFromCenterPoint = 1000;
91  float mPitchAngle = 0;
93  float mHeadingAngle = 0;
94 };
95 
96 
97 #endif // QGSCAMERAPOSE_H
3 Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double preci...
Definition: qgsvector3d.h:31
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator==(const QgsCameraPose &other) const
Definition: qgscamerapose.h:73
QgsVector3D centerPoint() const
Returns center point (towards which point the camera is looking)
Definition: qgscamerapose.h:46
3 Class that encapsulates camera pose in a 3D scene.
Definition: qgscamerapose.h:41
void setPitchAngle(float pitch)
Sets pitch angle in degrees.
Definition: qgscamerapose.h:58
float distanceFromCenterPoint() const
Returns distance of the camera from the center point.
Definition: qgscamerapose.h:51
float headingAngle() const
Returns heading (yaw) angle in degrees.
Definition: qgscamerapose.h:61
bool operator!=(const QgsCameraPose &other) const
Definition: qgscamerapose.h:80
void setHeadingAngle(float heading)
Sets heading (yaw) angle in degrees.
Definition: qgscamerapose.h:63
void setCenterPoint(const QgsVector3D &point)
Sets center point (towards which point the camera is looking)
Definition: qgscamerapose.h:48
float pitchAngle() const
Returns pitch angle in degrees.
Definition: qgscamerapose.h:56
void setDistanceFromCenterPoint(float distance)
Sets distance of the camera from the center point.
Definition: qgscamerapose.h:53