Go to the documentation of this file.
18 #ifndef GAZEBO_GUI_MODEL_MEUSERCMDMANAGER_HH_
19 #define GAZEBO_GUI_MODEL_MEUSERCMDMANAGER_HH_
41 class MEUserCmdPrivate;
42 class MEUserCmdManagerPrivate;
59 INSERTING_NESTED_MODEL = 2,
62 DELETING_NESTED_MODEL = 3,
74 MOVING_NESTED_MODEL = 7,
80 INSERTING_MODEL_PLUGIN = 9,
83 DELETING_MODEL_PLUGIN = 10
91 public:
MEUserCmd(
const unsigned int _id,
const std::string &_description,
98 public:
virtual void Undo();
101 public:
virtual void Redo();
105 public:
unsigned int Id()
const;
109 public: std::string Description()
const;
113 public:
void SetSDF(sdf::ElementPtr _sdf);
117 public:
void SetScopedName(
const std::string &_name);
121 public:
void SetJointId(
const std::string &_id);
127 public:
void SetPoseChange(
const ignition::math::Pose3d &_before,
128 const ignition::math::Pose3d &_after);
133 public:
void SetScaleChange(
134 const std::map<std::string, ignition::math::Vector3d> &_before,
135 const std::map<std::string, ignition::math::Vector3d> &_after);
139 protected: std::unique_ptr<MEUserCmdPrivate>
dataPtr;
155 public:
void Reset();
162 public:
MEUserCmdPtr NewCmd(
const std::string &_description,
167 private slots:
void OnUndoCommand(QAction *_action);
171 private slots:
void OnRedoCommand(QAction *_action);
175 private:
virtual bool HasUndo()
const;
179 private:
virtual bool HasRedo()
const;
183 private:
virtual std::vector<std::pair<unsigned int, std::string>>
184 Cmds(
const bool _undo)
const;
188 private: std::unique_ptr<MEUserCmdManagerPrivate> dataPtr;
Class which manages user commands in the model editor.
Definition: MEUserCmdManager.hh:144
unsigned int Id() const
Return this command's unique ID.
@ DELETING_JOINT
Delete a joint.
Definition: MEUserCmdManager.hh:68
MEUserCmdManager()
Constructor.
virtual ~MEUserCmdManager()
Destructor.
Class which manages user commands in the client side.
Definition: UserCmdHistory.hh:36
virtual void Undo()
Undo this command.
Forward declarations for the common classes.
Definition: Animation.hh:26
@ DELETING_MODEL_PLUGIN
Delete a model plugin.
Definition: MEUserCmdManager.hh:83
virtual void Redo()
Redo this command.
@ INSERTING_NESTED_MODEL
Insert a nested model.
Definition: MEUserCmdManager.hh:59
Class which represents a user command, which can be "undone" and "redone".
Definition: MEUserCmdManager.hh:46
MEUserCmd(const unsigned int _id, const std::string &_description, MEUserCmd::CmdType _type)
Constructor.
@ DELETING_NESTED_MODEL
Delete a nested model.
Definition: MEUserCmdManager.hh:62
@ SCALING_LINK
Scale a link.
Definition: MEUserCmdManager.hh:77
void SetPoseChange(const ignition::math::Pose3d &_before, const ignition::math::Pose3d &_after)
Set the pose before and after the command.
std::unique_ptr< MEUserCmdPrivate > dataPtr
Definition: MEUserCmdManager.hh:139
MEUserCmdPtr NewCmd(const std::string &_description, const MEUserCmd::CmdType _type)
Register that a new command has been executed by the user.
void SetJointId(const std::string &_id)
Set the unique id of the joint related to this command.
virtual ~MEUserCmd()
Destructor.
@ INSERTING_MODEL_PLUGIN
Insert a model plugin.
Definition: MEUserCmdManager.hh:80
std::string Description() const
Return this command's description.
void Reset()
Reset commands.
@ MOVING_NESTED_MODEL
Move a nested model.
Definition: MEUserCmdManager.hh:74
std::shared_ptr< MEUserCmd > MEUserCmdPtr
Definition: ModelEditorTypes.hh:37
void SetSDF(sdf::ElementPtr _sdf)
Set the SDF element relevant to this command.
gui
Definition: KeyEventHandler.hh:29
CmdType
Types of user commands.
Definition: MEUserCmdManager.hh:50
void SetScopedName(const std::string &_name)
Set the scoped name of the entity related to this command.
@ DELETING_LINK
Delete a link.
Definition: MEUserCmdManager.hh:56
@ INSERTING_JOINT
Insert a joint.
Definition: MEUserCmdManager.hh:65
@ MOVING_LINK
Move a link.
Definition: MEUserCmdManager.hh:71
@ INSERTING_LINK
Insert a link.
Definition: MEUserCmdManager.hh:53
void SetScaleChange(const std::map< std::string, ignition::math::Vector3d > &_before, const std::map< std::string, ignition::math::Vector3d > &_after)
Set the scale factors before and after the command.