Gazebo Gui

API Reference

6.8.0
GridConfig.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_GUI_GRIDCONFIG_HH_
19 #define GZ_GUI_GRIDCONFIG_HH_
20 
21 #include <memory>
22 
23 #include <gz/gui/Plugin.hh>
24 
25 namespace ignition
26 {
27 namespace gui
28 {
29  class GridConfigPrivate;
30 
47  class GridConfig : public gz::gui::Plugin
48  {
49  Q_OBJECT
50 
52  Q_PROPERTY(
54  READ NameList
55  WRITE SetNameList
56  NOTIFY NameListChanged
57  )
58 
59 
60  public: GridConfig();
61 
63  public: ~GridConfig() override;
64 
65  // Documentation inherited
66  public: void LoadConfig(const tinyxml2::XMLElement *) override;
67 
68  // Documentation inherited
69  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
70 
72  public: void CreateGrids();
73 
75  public: void UpdateGrid();
76 
78  public: void ConnectToGrid();
79 
81  public: void RefreshList();
82 
84  public slots: void OnRefresh();
85 
88  public slots: void OnName(const QString &_name);
89 
92  public slots: QStringList NameList() const;
93 
96  public slots: void SetNameList(const QStringList &_nameList);
97 
99  signals: void NameListChanged();
100 
103  public slots: void UpdateVCellCount(int _cellCount);
104 
107  public slots: void UpdateHCellCount(int _cellCount);
108 
111  public slots: void UpdateCellLength(double _length);
112 
116  public slots: void SetPose(double _x, double _y, double _z,
117  double _roll, double _pitch, double _yaw);
118 
121  public slots: void SetColor(double _r, double _g, double _b, double _a);
122 
125  public slots: void OnShow(bool _checked);
126 
134  signals: void newParams(
135  int _hCellCount,
136  int _vCellCount,
137  double _cellLength,
138  QVector3D _pos,
139  QVector3D _rot,
140  QColor _color);
141 
144  private: std::unique_ptr<GridConfigPrivate> dataPtr;
145  };
146 }
147 }
148 
149 #endif
void SetNameList(const QStringList &_nameList)
Set the list of names.
void SetPose(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
Callback to update grid pose.
void OnName(const QString &_name)
Callback when a new name is chosen on the combo box.
void UpdateCellLength(double _length)
Callback to update cell length.
bool eventFilter(QObject *_obj, QEvent *_event) override
void LoadConfig(const tinyxml2::XMLElement *) override
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
void UpdateVCellCount(int _cellCount)
Callback to update vertical cell count.
void newParams(int _hCellCount, int _vCellCount, double _cellLength, QVector3D _pos, QVector3D _rot, QColor _color)
Notify QML that grid values have changed.
void RefreshList()
Refresh list of grids. This is called in the rendering thread.
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
void UpdateHCellCount(int _cellCount)
Callback to update horizontal cell count.
void UpdateGrid()
Update grid.
void OnShow(bool _checked)
Callback when checkbox is clicked.
void OnRefresh()
Callback when refresh button is pressed.
Manages grids in a Gazebo Rendering scene. This plugin can be used for:
Definition: GridConfig.hh:47
STL namespace.
void ConnectToGrid()
Callback to retrieve existing grid.
Definition: gz/gui/Application.hh:35
QStringList NameList() const
Get the list of grid names.
void SetColor(double _r, double _g, double _b, double _a)
Callback to update grid color.
QStringList nameList
Name list.
Definition: GridConfig.hh:57
void CreateGrids()
Create grids defined at startup.
void NameListChanged()
Notify that name list has changed.