Gazebo Gui

API Reference

3.12.0
Grid3D.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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_GUI_PLUGINS_GRID3D_HH_
19 #define GZ_GUI_PLUGINS_GRID3D_HH_
20 
21 #include <memory>
22 
23 #include "gz/gui/Plugin.hh"
24 
25 namespace ignition
26 {
27 namespace gui
28 {
29 namespace plugins
30 {
31  class Grid3DPrivate;
32 
33  // TODO(chapulina) Delete this plugin when forward porting to `ign-gui6` in
34  // favor of `GridConfig`
35 
52  class Grid3D : public Plugin
53  {
54  Q_OBJECT
55 
57  Q_PROPERTY(
59  READ NameList
60  WRITE SetNameList
61  NOTIFY NameListChanged
62  )
63 
64 
65  public: Grid3D();
66 
68  public: ~Grid3D() override;
69 
70  // Documentation inherited
71  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
72  override;
73 
74  // Documentation inherited
75  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
76 
78  public: void CreateGrids();
79 
81  public: void UpdateGrid();
82 
84  public: void ConnectToGrid();
85 
87  public: void RefreshList();
88 
90  public slots: void OnRefresh();
91 
94  public slots: void OnName(const QString &_name);
95 
98  public slots: QStringList NameList() const;
99 
102  public slots: void SetNameList(const QStringList &_nameList);
103 
105  signals: void NameListChanged();
106 
109  public slots: void UpdateVCellCount(int _cellCount);
110 
113  public slots: void UpdateHCellCount(int _cellCount);
114 
117  public slots: void UpdateCellLength(double _length);
118 
122  public slots: void SetPose(double _x, double _y, double _z,
123  double _roll, double _pitch, double _yaw);
124 
127  public slots: void SetColor(double _r, double _g, double _b, double _a);
128 
131  public slots: void OnShow(bool _checked);
132 
140  signals: void newParams(
141  int _hCellCount,
142  int _vCellCount,
143  double _cellLength,
144  QVector3D _pos,
145  QVector3D _rot,
146  QColor _color);
147 
150  private: std::unique_ptr<Grid3DPrivate> dataPtr;
151  };
152 }
153 }
154 }
155 
156 #endif
void NameListChanged()
Notify that name list has changed.
void newParams(int _hCellCount, int _vCellCount, double _cellLength, QVector3D _pos, QVector3D _rot, QColor _color)
Notify QML that grid values have changed.
void UpdateVCellCount(int _cellCount)
Callback to update vertical cell count.
QStringList NameList() const
Get the list of grid names.
void RefreshList()
Refresh list of grids. This is called in the rendering thread.
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
void SetNameList(const QStringList &_nameList)
Set the list of names.
void SetColor(double _r, double _g, double _b, double _a)
Callback to update grid color.
Manages grids in an Gazebo Rendering scene. This plugin can be used for:
Definition: Grid3D.hh:52
void SetPose(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
Callback to update grid pose.
void ConnectToGrid()
Callback to retrieve existing grid.
void UpdateGrid()
Update grid.
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
void UpdateHCellCount(int _cellCount)
Callback to update horizontal cell count.
void OnShow(bool _checked)
Callback when checkbox is clicked.
QStringList nameList
Name list.
Definition: Grid3D.hh:62
STL namespace.
Definition: gz/gui/Application.hh:35
bool eventFilter(QObject *_obj, QEvent *_event) override
void OnName(const QString &_name)
Callback when a new name is chosen on the combo box.
void OnRefresh()
Callback when refresh button is pressed.
void CreateGrids()
Create grids defined at startup.
void UpdateCellLength(double _length)
Callback to update cell length.