Gazebo Gazebo

API Reference

3.15.1
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_GAZEBO_GUI_ALIGNTOOL_HH_
19 #define GZ_GAZEBO_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 ignition
28 {
29 namespace gazebo
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  class AlignToolPrivate;
58 
63  class AlignTool :
65  {
66  Q_OBJECT
67 
69  public: AlignTool();
70 
72  public: ~AlignTool() override;
73 
74  // Documentation inherited
75  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
76 
77  // Documentation inherited
78  public: void Update(const UpdateInfo &_info,
79  EntityComponentManager &_ecm) override;
80 
83  public slots: void OnAlignAxis(const QString &_mode);
84 
87  public slots: void OnAlignTarget(const QString &_target);
88 
90  public slots: void OnHoveredEntered();
91 
93  public slots: void OnHoveredExited();
94 
96  public slots: void OnAlign();
97 
100  public: void AddState(const AlignState &_state);
101 
104  public: void MakeTransparent(const rendering::NodePtr &_node);
105 
109  public: void MakeSolid(const rendering::NodePtr &_node);
110 
114  public: void Align();
115 
120  public: rendering::VisualPtr TopLevelVisual(rendering::ScenePtr &_scene,
121  rendering::VisualPtr &_visual) const;
122 
127  public: rendering::NodePtr TopLevelNode(rendering::ScenePtr &_scene,
128  rendering::NodePtr &_node) const;
129 
130  // Documentation inherited
131  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
132 
135  private: std::unique_ptr<AlignToolPrivate> dataPtr;
136  };
137 }
138 }
139 
140 #endif
Base class for a GUI System.
Definition: gz/sim/gui/GuiSystem.hh:44
@ ALIGN_Z
Indicates an alignment relative to the z axis.
This library is part of the Ignition Robotics project.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:65
void MakeTransparent(const rendering::NodePtr &_node)
Makes the node transparent.
void Align()
The function call to execute a state from the queue. This function makes rendering calls and should o...
Provides buttons for the align tool.
Definition: AlignTool.hh:63
@ ALIGN
Indicates the user has clicked the align button.
void OnHoveredExited()
Callback to make whenever a hover state is exited on a button.
@ RESET
Indicates a reset of the currently placed nodes, only occurs on a hover exit if the align button has ...
void MakeSolid(const rendering::NodePtr &_node)
Reset the node to its solid form, intended to be called after MakeTransparent.
@ ALIGN_X
Indicates an alignment relative to the x axis.
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:37
void OnHoveredEntered()
Callback to make whenever a hover state is entered on a button.
@ HOVER
Indicates the user is currently hovering the mouse over an align button.
AlignAxis
Enumeration of the axes to be aligned relative to.
Definition: AlignTool.hh:47
void OnAlign()
Callback to the align state the execution queue.
void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
rendering::VisualPtr TopLevelVisual(rendering::ScenePtr &_scene, rendering::VisualPtr &_visual) const
Returns the top level visual of the passed in visual within a given scene.
void AddState(const AlignState &_state)
Callback to add a state to the execution queue.
AlignState
Enumeration of the states within the Align Tool.
Definition: AlignTool.hh:32
@ ALIGN_Y
Indicates an alignment relative to the y axis.
bool eventFilter(QObject *_obj, QEvent *_event) override
void OnAlignTarget(const QString &_target)
Callback to update the target type.
@ NONE
Indicates the user is currently not utilizing the align tool.
void Update(const UpdateInfo &_info, EntityComponentManager &_ecm) override
Update callback called every time the system is stepped. This is called at an Ignition transport thre...
~AlignTool() override
Destructor.
rendering::NodePtr TopLevelNode(rendering::ScenePtr &_scene, rendering::NodePtr &_node) const
Returns the top level node of the passed in node within a given scene.
void OnAlignAxis(const QString &_mode)
Callback to update the axis type.