##

CollisionConfig.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_COLLISIONCONFIG_HH_
#define GAZEBO_GUI_MODEL_COLLISIONCONFIG_HH_
#include <map>
#include <string>
#include "gazebo/gui/qt.h"
#include "gazebo/gui/model/ModelData.hh"
namespace gazebo
{
namespace gui
{
class ConfigWidget;
class CollisionConfigData : public QWidget
{
Q_OBJECT
public slots: void RestoreOriginalData();
private slots: void OnToggleItem(bool _checked);
private slots: void OnGeometryChanged();
Q_SIGNALS: void CollisionChanged(const std::string &_name,
const std::string &_type);
public: int id;
public: std::string name;
public: ConfigWidget *configWidget;
public: QWidget *widget;
public: msgs::Collision originalDataMsg;
};
class GZ_GUI_VISIBLE CollisionConfig : public QWidget
{
Q_OBJECT
public: CollisionConfig();
public: ~CollisionConfig();
public: void Init();
public slots: void RestoreOriginalData();
public: void AddCollision(const std::string &_name,
const msgs::Collision *_collisionMsg = NULL);
public: void UpdateCollision(const std::string &_name,
ConstCollisionPtr _collisionMsg);
public: void Reset();
public: unsigned int GetCollisionCount() const;
public: msgs::Collision *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) const;
public: void SetShowCollision(const bool _show, const std::string &_name);
public: const std::map<int, CollisionConfigData *> &ConfigData() const;
Q_SIGNALS: void CollisionRemoved(const std::string &_name);
Q_SIGNALS: void CollisionAdded(const std::string &_name);
Q_SIGNALS: void ShowCollision(const bool _show, const std::string &_name);
Q_SIGNALS: void Applied();
private slots: void OnAddCollision();
private slots: void OnRemoveCollision(int _id);
private slots: void OnShowCollision(const int _id);
private slots: void OnPoseChanged(const QString &_name,
const ignition::math::Pose3d &_value);
private slots: void OnCollisionChanged(
const std::string &_name, const std::string &_type);
Q_SIGNALS: void CollisionChanged(
const std::string &_name, const std::string &_type);
private slots: void OnGeometryChanged(const std::string &_name,
const std::string &_value,
const ignition::math::Vector3d &_dimensions,
const std::string &_uri);
private: std::map<int, CollisionConfigData *> configs;
private: std::map<int, CollisionConfigData *> deletedConfigs;
private: std::map<int, CollisionConfigData *> addedConfigs;
private: int counter;
private: QSignalMapper *mapperRemove;
private: QSignalMapper *mapperShow;
private: std::map<int, QTreeWidgetItem *> collisionItems;
private: QVBoxLayout *listLayout;
};
}
}
#endif
gazebo::gui::CollisionConfigData::RestoreOriginalData
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
gazebo::gui::CollisionConfig::SetGeometry
void SetGeometry(const std::string &_name, const ignition::math::Vector3d &_size, const std::string &_uri="")
Set the geometry data of a collision.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::CollisionConfig::ShowCollision
void ShowCollision(const bool _show, const std::string &_name)
Qt signal emitted requesting to show/hide a collision.
ModelData.hh
gazebo::gui::CollisionConfig::ConfigData
const std::map< int, CollisionConfigData * > & ConfigData() const
Get collision config data.
NULL
#define NULL
Definition: CommonTypes.hh:31
gazebo::gui::CollisionConfig::UpdateCollision
void UpdateCollision(const std::string &_name, ConstCollisionPtr _collisionMsg)
Update a collision widget from a collision msg.
gazebo::gui::CollisionConfig::CollisionChanged
void CollisionChanged(const std::string &_name, const std::string &_type)
Signal to indicate a collision change.
gazebo::gui::CollisionConfig::~CollisionConfig
~CollisionConfig()
Destructor.
gazebo::gui::CollisionConfig::Reset
void Reset()
Reset the collision tab.
gazebo::gui::CollisionConfigData::widget
QWidget * widget
Widget associated with this data.
Definition: CollisionConfig.hh:68
gazebo::gui::CollisionConfigData::id
int id
Unique ID of this collision config.
Definition: CollisionConfig.hh:59
gazebo::gui::CollisionConfig::Applied
void Applied()
Qt signal emitted to indicate that changes should be applied.
gazebo::gui::CollisionConfig::RestoreOriginalData
void RestoreOriginalData()
Restore the widget's data to how it was when first opened.
gazebo::gui::CollisionConfigData::CollisionChanged
void CollisionChanged(const std::string &_name, const std::string &_type)
Signal to indicate a collision change.
gazebo::gui::CollisionConfig::GetCollisionCount
unsigned int GetCollisionCount() const
Get the number of collisions.
gazebo::gui::CollisionConfigData::configWidget
ConfigWidget * configWidget
Config widget for configuring collision properties.
Definition: CollisionConfig.hh:65
gazebo::gui::CollisionConfig::SetShowCollision
void SetShowCollision(const bool _show, const std::string &_name)
Set the state of a show collision button.
gazebo::gui::CollisionConfig::AddCollision
void AddCollision(const std::string &_name, const msgs::Collision *_collisionMsg=NULL)
Add a collision widget to the tab.
gazebo::gui::CollisionConfig::Geometry
void Geometry(const std::string &_name, ignition::math::Vector3d &_size, std::string &_uri) const
Get the geometry data of a collision.
gazebo::gui::CollisionConfig::GetData
msgs::Collision * GetData(const std::string &_name) const
Get the msg containing all collision data.
gazebo::gui::CollisionConfigData
A class of widgets used for configuring collision properties.
Definition: CollisionConfig.hh:38
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::CollisionConfig
A tab for configuring collision properties of a link.
Definition: CollisionConfig.hh:77
gazebo::gui::CollisionConfig::Init
void Init()
Initialize widget.
gazebo::gui::CollisionConfig::CollisionConfig
CollisionConfig()
Constructor.
gazebo::gui::ConfigWidget
A widget generated from a google protobuf message.
Definition: ConfigWidget.hh:193
gazebo::gui::CollisionConfigData::name
std::string name
Name of the collision.
Definition: CollisionConfig.hh:62
gazebo::gui::CollisionConfig::CollisionRemoved
void CollisionRemoved(const std::string &_name)
Qt signal emitted when a collision is removed.
gazebo::gui::CollisionConfig::CollisionAdded
void CollisionAdded(const std::string &_name)
Qt signal emitted when a collision is added.
gazebo::gui::CollisionConfigData::originalDataMsg
msgs::Collision originalDataMsg
Message containing the data which was in the widget when first open.
Definition: CollisionConfig.hh:72