18 #ifndef GZ_SIM_GUI_COMPONENTINSPECTOR_HH_
19 #define GZ_SIM_GUI_COMPONENTINSPECTOR_HH_
25 #include <sdf/Material.hh>
26 #include <sdf/Physics.hh>
28 #include <gz/math/SphericalCoordinates.hh>
29 #include <gz/math/Vector3.hh>
30 #include <gz/transport/Node.hh>
38 #include <gz/msgs/light.pb.h>
46 class ComponentInspectorPrivate;
51 template <
class DataType>
52 void setData(QStandardItem *_item,
const DataType &_data)
60 setData(_item, ss.
str());
64 gzwarn <<
"Attempting to set unsupported data type to item ["
65 << _item->text().toStdString() <<
"]" <<
std::endl;
73 void setData(QStandardItem *_item,
const std::string &_data);
79 void setData(QStandardItem *_item,
const msgs::Light &_data);
91 void setData(QStandardItem *_item,
const sdf::Physics &_data);
103 void setData(QStandardItem *_item,
const bool &_data);
109 void setData(QStandardItem *_item,
const int &_data);
115 void setData(QStandardItem *_item,
const double &_data);
121 void setData(QStandardItem *_item,
const std::ostream &_data);
127 void setData(QStandardItem *_item,
const sdf::Material &_data);
133 void setUnit(QStandardItem *_item,
const std::string &_unit);
137 class ComponentsModel :
public QStandardItemModel
142 public:
explicit ComponentsModel();
145 public: ~ComponentsModel()
override =
default;
148 public: QHash<int, QByteArray> roleNames()
const override;
152 public:
static QHash<int, QByteArray> RoleNames();
157 public slots: QStandardItem *AddComponentType(
162 public slots:
void RemoveComponentType(
173 class ComponentInspector :
public sim::GuiSystem
213 NOTIFY NestedModelChanged
218 QStringList systemNameList
220 WRITE SetSystemNameList
221 NOTIFY SystemNameListChanged
225 public: ComponentInspector();
228 public: ~ComponentInspector()
override;
231 public:
void LoadConfig(
const tinyxml2::XMLElement *_pluginElem)
override;
234 public:
void Update(
const UpdateInfo &, EntityComponentManager &)
override;
267 public: Q_INVOKABLE
void OnLight(
268 double _rSpecular,
double _gSpecular,
double _bSpecular,
269 double _aSpecular,
double _rDiffuse,
double _gDiffuse,
270 double _bDiffuse,
double _aDiffuse,
double _attRange,
271 double _attLinear,
double _attConstant,
double _attQuadratic,
272 bool _castShadows,
double _directionX,
double _directionY,
273 double _directionZ,
double _innerAngle,
double _outerAngle,
274 double _falloff,
double _intensity,
int _type,
bool _isLightOn,
275 bool _visualizeVisual);
280 public: Q_INVOKABLE
void OnPhysics(
double _stepSize,
281 double _realTimeFactor);
304 public: Q_INVOKABLE
void OnMaterialColor(
305 double _rAmbient,
double _gAmbient,
double _bAmbient,
306 double _aAmbient,
double _rDiffuse,
double _gDiffuse,
307 double _bDiffuse,
double _aDiffuse,
double _rSpecular,
308 double _gSpecular,
double _bSpecular,
double _aSpecular,
309 double _rEmissive,
double _gEmissive,
double _bEmissive,
310 double _aEmissive, QString _type, QColor _currColor);
318 public: Q_INVOKABLE
void OnSphericalCoordinates(QString _surface,
319 double _latitude,
double _longitude,
double _elevation,
324 public: Q_INVOKABLE
bool NestedModel()
const;
327 signals:
void NestedModelChanged();
330 protected:
bool eventFilter(QObject *_obj, QEvent *_event)
override;
334 public: Q_INVOKABLE
Entity GetEntity()
const;
338 public: Q_INVOKABLE
void SetEntity(
const Entity &_entity);
341 signals:
void EntityChanged();
345 public: Q_INVOKABLE QString Type()
const;
349 public: Q_INVOKABLE
void SetType(
const QString &_entity);
352 signals:
void TypeChanged();
356 public: Q_INVOKABLE
bool Locked()
const;
360 public: Q_INVOKABLE
void SetLocked(
bool _locked);
363 signals:
void LockedChanged();
367 public: Q_INVOKABLE
bool Paused()
const;
371 public: Q_INVOKABLE
void SetPaused(
bool _paused);
374 signals:
void PausedChanged();
382 public: transport::Node &TransportNode();
385 public: Q_INVOKABLE
void QuerySystems();
389 public: Q_INVOKABLE QStringList SystemNameList()
const;
393 public: Q_INVOKABLE
void SetSystemNameList(
394 const QStringList &_systemNameList);
397 signals:
void SystemNameListChanged();
403 public: Q_INVOKABLE
void OnAddSystem(
const QString &_name,
404 const QString &_filename,
const QString &_innerxml);