Gazebo Sim

API Reference

8.7.0
AlignTool.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_ALIGNTOOL_HH_
19 #define GZ_SIM_GUI_ALIGNTOOL_HH_
20 
21 #include <memory>
22 
23 #include <gz/sim/gui/GuiSystem.hh>
24 #include <gz/gui/Plugin.hh>
25 #include <gz/rendering/Node.hh>
26 
27 namespace gz
28 {
29 namespace sim
30 {
32  enum class AlignState
33  {
36  HOVER = 0,
39  RESET = 1,
41  ALIGN = 2,
43  NONE = 3
44  };
45 
47  enum class AlignAxis
48  {
50  ALIGN_X = 0,
52  ALIGN_Y = 1,
54  ALIGN_Z = 2
55  };
56 
57  enum class AlignConfig
58  {
59  ALIGN_MIN,
60  ALIGN_MID,
61  ALIGN_MAX
62  };
63 
64  class AlignToolPrivate;
65 
70  class AlignTool :
71  public gz::sim::GuiSystem
72  {
73  Q_OBJECT
74 
76  public: AlignTool();
77 
79  public: ~AlignTool() override;
80 
81  // Documentation inherited
82  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
83 
84  // Documentation inherited
85  public: void Update(const UpdateInfo &_info,
86  EntityComponentManager &_ecm) override;
87 
90  public slots: void OnAlignAxis(const QString &_mode);
91 
94  public slots: void OnAlignTarget(const QString &_target);
95 
98  public slots: void OnAlignConfig(const QString &_mode);
99 
102  public slots: void OnReverse(bool _reverse);
103 
105  public slots: void OnHoveredEntered();
106 
108  public slots: void OnHoveredExited();
109 
111  public slots: void OnAlign();
112 
115  public: void AddState(const AlignState &_state);
116 
123  public: void UpdateTransparency(const rendering::NodePtr &_node,
124  bool _makeTransparent);
125 
129  public: void Align();
130 
135  public: rendering::VisualPtr TopLevelVisual(rendering::ScenePtr &_scene,
136  rendering::VisualPtr &_visual) const;
137 
142  public: rendering::NodePtr TopLevelNode(rendering::ScenePtr &_scene,
143  rendering::NodePtr &_node) const;
144 
145  // Documentation inherited
146  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
147 
150  private: std::unique_ptr<AlignToolPrivate> dataPtr;
151  };
152 }
153 }
154 
155 #endif