QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 #ifndef SIP_RUN
24 namespace Qt3DRender
25 {
26  class QCamera;
27 }
28 #endif
29 
30 class QDomDocument;
31 class QDomElement;
32 
44 class _3D_EXPORT QgsCameraPose
45 {
46  public:
47 
49  QgsVector3D centerPoint() const { return mCenterPoint; }
51  void setCenterPoint( const QgsVector3D &point ) { mCenterPoint = point; }
52 
54  float distanceFromCenterPoint() const { return mDistanceFromCenterPoint; }
56  void setDistanceFromCenterPoint( float distance ) { mDistanceFromCenterPoint = distance; }
57 
59  float pitchAngle() const { return mPitchAngle; }
61  void setPitchAngle( float pitch ) { mPitchAngle = pitch; }
62 
64  float headingAngle() const { return mHeadingAngle; }
66  void setHeadingAngle( float heading ) { mHeadingAngle = heading; }
67 
69  void updateCamera( Qt3DRender::QCamera *camera ) SIP_SKIP;
70 
72  QDomElement writeXml( QDomDocument &doc ) const;
74  void readXml( const QDomElement &elem );
75 
76  bool operator==( const QgsCameraPose &other ) const
77  {
78  return mCenterPoint == other.mCenterPoint &&
79  mDistanceFromCenterPoint == other.mDistanceFromCenterPoint &&
80  mPitchAngle == other.mPitchAngle &&
81  mHeadingAngle == other.mHeadingAngle;
82  }
83  bool operator!=( const QgsCameraPose &other ) const
84  {
85  return !operator==( other );
86  }
87 
88  private:
90  QgsVector3D mCenterPoint;
92  float mDistanceFromCenterPoint = 1000;
94  float mPitchAngle = 0;
96  float mHeadingAngle = 0;
97 };
98 
99 
100 #endif // QGSCAMERAPOSE_H
QgsCameraPose::centerPoint
QgsVector3D centerPoint() const
Returns center point (towards which point the camera is looking)
Definition: qgscamerapose.h:49
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:399
QgsVector3D
Definition: qgsvector3d.h:31
QgsCameraPose::distanceFromCenterPoint
float distanceFromCenterPoint() const
Returns distance of the camera from the center point.
Definition: qgscamerapose.h:54
QgsCameraPose::setHeadingAngle
void setHeadingAngle(float heading)
Sets heading (yaw) angle in degrees.
Definition: qgscamerapose.h:66
QgsCameraPose::pitchAngle
float pitchAngle() const
Returns pitch angle in degrees.
Definition: qgscamerapose.h:59
QgsCameraPose::headingAngle
float headingAngle() const
Returns heading (yaw) angle in degrees.
Definition: qgscamerapose.h:64
QgsCameraPose::operator!=
bool operator!=(const QgsCameraPose &other) const
Definition: qgscamerapose.h:83
QgsCameraPose::operator==
bool operator==(const QgsCameraPose &other) const
Definition: qgscamerapose.h:76
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
Qt3DRender
Definition: qgs3dmapscene.h:25
QgsCameraPose
Definition: qgscamerapose.h:44
qgsvector3d.h
QgsCameraPose::setPitchAngle
void setPitchAngle(float pitch)
Sets pitch angle in degrees.
Definition: qgscamerapose.h:61
QgsCameraPose::setDistanceFromCenterPoint
void setDistanceFromCenterPoint(float distance)
Sets distance of the camera from the center point.
Definition: qgscamerapose.h:56
QgsCameraPose::setCenterPoint
void setCenterPoint(const QgsVector3D &point)
Sets center point (towards which point the camera is looking)
Definition: qgscamerapose.h:51