Gazebo Sim

API Reference

8.7.0
ViewAngle.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_SIM_GUI_VIEWANGLE_HH_
19 #define GZ_SIM_GUI_VIEWANGLE_HH_
20 
21 #include <gz/msgs/pose.pb.h>
22 #include <gz/msgs/boolean.pb.h>
23 #include <gz/msgs/gui_camera.pb.h>
24 
25 #include <memory>
26 
27 #include <gz/gui/Plugin.hh>
28 
29 namespace gz
30 {
31 namespace sim
32 {
33  class ViewAnglePrivate;
34 
40  class ViewAngle : public gz::gui::Plugin
41  {
42  Q_OBJECT
43 
45  Q_PROPERTY(
46  QList<double> camPose
47  READ CamPose
48  NOTIFY CamPoseChanged
49  )
50 
51 
52  Q_PROPERTY(
53  QList<double> camClipDist
54  READ CamClipDist
55  NOTIFY CamClipDistChanged
56  )
57 
58 
59  Q_PROPERTY(
61  READ ViewControlIndex
63  )
64 
65 
66  Q_PROPERTY(
67  double horizontalFOV
68  READ HorizontalFOV
70  )
71 
72 
73  public: ViewAngle();
74 
76  public: ~ViewAngle() override;
77 
78  // Documentation inherited
79  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
80 
81  // Documentation inherited
82  private: bool eventFilter(QObject *_obj, QEvent *_event) override;
83 
91  public slots: void OnAngleMode(int _x, int _y, int _z);
92 
95  public slots: void OnViewControl(const QString &_controller);
96 
101  public slots: void OnViewControlReferenceVisual(bool _enable);
102 
105  public slots: void OnViewControlSensitivity(double _sensitivity);
106 
109  public slots: void SetHorizontalFOV(double _horizontalFOV);
110 
112  public: Q_INVOKABLE double HorizontalFOV() const;
113 
115  signals: void CamHorizontalFOVChanged();
116 
118  public: Q_INVOKABLE QList<double> CamPose() const;
119 
121  signals: void CamPoseChanged();
122 
126  public slots: void SetCamPose(double _x, double _y, double _z,
127  double _roll, double _pitch, double _yaw);
128 
131  public: void CamPoseCb(const msgs::Pose &_msg);
132 
136  public: bool OnMoveToModelService(const gz::msgs::GUICamera &_msg,
137  gz::msgs::Boolean &_res);
138 
140  public: Q_INVOKABLE QList<double> CamClipDist() const;
141 
143  signals: void CamClipDistChanged();
144 
148  public slots: void SetCamClipDist(double _near, double _far);
149 
151  public: int ViewControlIndex() const;
152 
154  signals: void ViewControlIndexChanged();
155 
158  private: std::unique_ptr<ViewAnglePrivate> dataPtr;
159  };
160 }
161 }
162 
163 #endif