##

VisualConfig.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_GUI_MODEL_VISUALCONFIG_HH_
#define GAZEBO_GUI_MODEL_VISUALCONFIG_HH_
#include <map>
#include <string>
#include <ignition/math/Pose3.hh>
#include <ignition/math/Vector3.hh>
#include "gazebo/gui/qt.h"
#include "gazebo/gui/model/ModelData.hh"
namespace gazebo
{
namespace gui
{
class ConfigWidget;
class VisualConfigData : public QWidget
{
Q_OBJECT
public slots: void RestoreOriginalData();
private slots: void OnToggleItem(bool _checked);
public: int id;
public: std::string name;
public: ConfigWidget *configWidget;
public: QWidget *widget;
public: msgs::Visual originalDataMsg;
};
class GZ_GUI_VISIBLE VisualConfig : public QWidget
{
Q_OBJECT
public: VisualConfig();
public: ~VisualConfig();
public: void Init();
public slots: void RestoreOriginalData();
public: void AddVisual(const std::string &_name,
const msgs::Visual *_visualMsg = NULL);
public: void UpdateVisual(const std::string &_name,
ConstVisualPtr _visualMsg);
public: void Reset();
public: unsigned int GetVisualCount() const;
public: void SetShowVisual(const bool _show, const std::string &_name);
public: msgs::Visual *GetData(const std::string &_name) const;
public: void SetGeometry(const std::string &_name,
const ignition::math::Vector3d &_size, const std::string &_uri = "");
public: void Geometry(const std::string &_name,
ignition::math::Vector3d &_size, std::string &_uri);
public: void SetMaterial(const std::string &_name,
const std::string &_materialName,
const ignition::math::Color &_ambient,
const ignition::math::Color &_diffuse,
const ignition::math::Color &_specular,
const ignition::math::Color &_emissive);
public: const std::map<int, VisualConfigData *> &ConfigData() const;
Q_SIGNALS: void VisualRemoved(const std::string &_name);
Q_SIGNALS: void VisualAdded(const std::string &_name);
Q_SIGNALS: void ShowVisual(const bool _show, const std::string &_name);
Q_SIGNALS: void Applied();
private slots: void OnAddVisual();
private slots: void OnRemoveVisual(int _id);
private slots: void OnShowVisual(const int _id);
private slots: void OnPoseChanged(const QString &_name,
const ignition::math::Pose3d &_value);
private slots: void OnGeometryChanged(const std::string &_name,
const std::string &_value,
const ignition::math::Vector3d &_dimensions,
const std::string &_uri);
private slots: void OnColorChanged(const QString &_name,
const ignition::math::Color &_value);
private slots: void OnDoubleChanged(const QString &_name,
const double _value);
private slots: void OnStringChanged(const QString &_name,
const std::string &_value);
private: std::map<int, VisualConfigData *> configs;
private: std::map<int, VisualConfigData *> deletedConfigs;
private: std::map<int, VisualConfigData *> addedConfigs;
private: int counter;
private: QSignalMapper *mapperRemove;
private: QSignalMapper *mapperShow;
private: QVBoxLayout *listLayout;
};
}
}
#endif
gazebo::gui::VisualConfig::VisualRemoved
void VisualRemoved(const std::string &_name)
Qt signal emitted when a visual is removed.
gazebo::gui::VisualConfigData::RestoreOriginalData
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
gazebo::gui::VisualConfig::SetMaterial
void SetMaterial(const std::string &_name, const std::string &_materialName, const ignition::math::Color &_ambient, const ignition::math::Color &_diffuse, const ignition::math::Color &_specular, const ignition::math::Color &_emissive)
Set the material of a visual.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::VisualConfigData::name
std::string name
Name of the visual.
Definition: VisualConfig.hh:56
ModelData.hh
NULL
#define NULL
Definition: CommonTypes.hh:31
gazebo::gui::VisualConfig::Reset
void Reset()
Reset the visual tab.
gazebo::gui::VisualConfigData::widget
QWidget * widget
Widget associated with this data.
Definition: VisualConfig.hh:62
gazebo::gui::VisualConfig::ShowVisual
void ShowVisual(const bool _show, const std::string &_name)
Qt signal emitted requesting to show/hide a collision.
gazebo::gui::VisualConfigData
A class of widgets used for configuring visual properties.
Definition: VisualConfig.hh:41
gazebo::gui::VisualConfig::UpdateVisual
void UpdateVisual(const std::string &_name, ConstVisualPtr _visualMsg)
Update a visual widget from a visual msg.
gazebo::gui::VisualConfig::VisualConfig
VisualConfig()
Constructor.
gazebo::gui::VisualConfigData::configWidget
ConfigWidget * configWidget
Config widget for configuring visual properties.
Definition: VisualConfig.hh:59
gazebo::gui::VisualConfigData::id
int id
Unique ID of this visual config.
Definition: VisualConfig.hh:53
gazebo::gui::VisualConfig::~VisualConfig
~VisualConfig()
Destructor.
gazebo::gui::VisualConfig::SetGeometry
void SetGeometry(const std::string &_name, const ignition::math::Vector3d &_size, const std::string &_uri="")
Set the geometry data of a visual.
gazebo::gui::VisualConfig::AddVisual
void AddVisual(const std::string &_name, const msgs::Visual *_visualMsg=NULL)
Add a visual widget to the tab.
gazebo::gui::VisualConfig::ConfigData
const std::map< int, VisualConfigData * > & ConfigData() const
Get visual config data.
gazebo::gui::VisualConfig::GetVisualCount
unsigned int GetVisualCount() const
Get the number of visuals.
gazebo::gui::VisualConfig::Init
void Init()
Initialize widget.
gazebo::gui::VisualConfigData::originalDataMsg
msgs::Visual originalDataMsg
Message containing the data which was in the widget when first open.
Definition: VisualConfig.hh:66
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::VisualConfig::GetData
msgs::Visual * GetData(const std::string &_name) const
Get the msg containing all visual data.
gazebo::gui::VisualConfig::SetShowVisual
void SetShowVisual(const bool _show, const std::string &_name)
Set the state of a show collision button.
gazebo::gui::ConfigWidget
A widget generated from a google protobuf message.
Definition: ConfigWidget.hh:193
gazebo::gui::VisualConfig::RestoreOriginalData
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
gazebo::gui::VisualConfig::Geometry
void Geometry(const std::string &_name, ignition::math::Vector3d &_size, std::string &_uri)
Get the geometry data of a visual.
gazebo::gui::VisualConfig::Applied
void Applied()
Qt signal emitted to indicate that changes should be applied.
gazebo::gui::VisualConfig::VisualAdded
void VisualAdded(const std::string &_name)
Qt signal emitted when a visual is added.
gazebo::gui::VisualConfig
A tab for configuring visual properties of a link.
Definition: VisualConfig.hh:71