Ignition Gui

API Reference

6.4.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 IGNITION_GAZEBO_GUI_GRIDCONFIG_HH_
19 #define IGNITION_GAZEBO_GUI_GRIDCONFIG_HH_
20 
21 #include <memory>
22 
23 #include <ignition/gui/Plugin.hh>
24 #include <ignition/rendering.hh>
25 
26 namespace ignition
27 {
28 namespace gui
29 {
30  class GridConfigPrivate;
31 
48  class GridConfig : public ignition::gui::Plugin
49  {
50  Q_OBJECT
51 
53  Q_PROPERTY(
55  READ NameList
56  WRITE SetNameList
57  NOTIFY NameListChanged
58  )
59 
60 
61  public: GridConfig();
62 
64  public: ~GridConfig() override;
65 
66  // Documentation inherited
67  public: void LoadConfig(const tinyxml2::XMLElement *) override;
68 
69  // Documentation inherited
70  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
71 
73  public: void CreateGrids();
74 
76  public: void UpdateGrid();
77 
79  public: void ConnectToGrid();
80 
82  public: void RefreshList();
83 
85  public slots: void OnRefresh();
86 
89  public slots: void OnName(const QString &_name);
90 
93  public slots: QStringList NameList() const;
94 
97  public slots: void SetNameList(const QStringList &_nameList);
98 
100  signals: void NameListChanged();
101 
104  public slots: void UpdateVCellCount(int _cellCount);
105 
108  public slots: void UpdateHCellCount(int _cellCount);
109 
112  public slots: void UpdateCellLength(double _length);
113 
117  public slots: void SetPose(double _x, double _y, double _z,
118  double _roll, double _pitch, double _yaw);
119 
122  public slots: void SetColor(double _r, double _g, double _b, double _a);
123 
126  public slots: void OnShow(bool _checked);
127 
135  signals: void newParams(
136  int _hCellCount,
137  int _vCellCount,
138  double _cellLength,
139  QVector3D _pos,
140  QVector3D _rot,
141  QColor _color);
142 
145  private: std::unique_ptr<GridConfigPrivate> dataPtr;
146  };
147 }
148 }
149 
150 #endif
void OnName(const QString &_name)
Callback when a new name is chosen on the combo box.
void LoadConfig(const tinyxml2::XMLElement *) 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 SetPose(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
Callback to update grid pose.
void UpdateCellLength(double _length)
Callback to update cell length.
bool eventFilter(QObject *_obj, QEvent *_event) override
void UpdateVCellCount(int _cellCount)
Callback to update vertical cell count.
STL namespace.
void newParams(int _hCellCount, int _vCellCount, double _cellLength, QVector3D _pos, QVector3D _rot, QColor _color)
Notify QML that grid values have changed.
Definition: Application.hh:35
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
void UpdateHCellCount(int _cellCount)
Callback to update horizontal cell count.
void OnShow(bool _checked)
Callback when checkbox is clicked.
QStringList NameList() const
Get the list of grid names.
QStringList nameList
Name list.
Definition: GridConfig.hh:58
void SetColor(double _r, double _g, double _b, double _a)
Callback to update grid color.