MEUserCmd Class Reference

Class which represents a user command, which can be "undone" and "redone". More...

#include <MEUserCmdManager.hh>

Public Types

enum  CmdType {
  INSERTING_LINK = 0 , DELETING_LINK = 1 , INSERTING_NESTED_MODEL = 2 , DELETING_NESTED_MODEL = 3 ,
  INSERTING_JOINT = 4 , DELETING_JOINT = 5 , MOVING_LINK = 6 , MOVING_NESTED_MODEL = 7 ,
  SCALING_LINK = 8 , INSERTING_MODEL_PLUGIN = 9 , DELETING_MODEL_PLUGIN = 10
}
 Types of user commands. More...
 

Public Member Functions

 MEUserCmd (const unsigned int _id, const std::string &_description, MEUserCmd::CmdType _type)
 Constructor.
 
virtual ~MEUserCmd ()
 Destructor.
 
std::string Description () const
 Return this command's description.
 
unsigned int Id () const
 Return this command's unique ID.
 
virtual void Redo ()
 Redo this command.
 
void SetJointId (const std::string &_id)
 Set the unique id of the joint related to this command.
 
void SetPoseChange (const ignition::math::Pose3d &_before, const ignition::math::Pose3d &_after)
 Set the pose before and after the command.
 
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.
 
void SetScopedName (const std::string &_name)
 Set the scoped name of the entity related to this command.
 
void SetSDF (sdf::ElementPtr _sdf)
 Set the SDF element relevant to this command.
 
virtual void Undo ()
 Undo this command.
 

Protected Attributes

std::unique_ptr< MEUserCmdPrivate > dataPtr
 

Detailed Description

Class which represents a user command, which can be "undone" and "redone".

Member Enumeration Documentation

◆ CmdType

enum CmdType

Types of user commands.

Enumerator
INSERTING_LINK 

Insert a link.

DELETING_LINK 

Delete a link.

INSERTING_NESTED_MODEL 

Insert a nested model.

DELETING_NESTED_MODEL 

Delete a nested model.

INSERTING_JOINT 

Insert a joint.

DELETING_JOINT 

Delete a joint.

MOVING_LINK 

Move a link.

MOVING_NESTED_MODEL 

Move a nested model.

SCALING_LINK 

Scale a link.

INSERTING_MODEL_PLUGIN 

Insert a model plugin.

DELETING_MODEL_PLUGIN 

Delete a model plugin.

Constructor & Destructor Documentation

◆ MEUserCmd()

MEUserCmd ( const unsigned int _id,
const std::string & _description,
MEUserCmd::CmdType _type )

Constructor.

Parameters
[in]_idUnique ID for this command
[in]_descriptionDescription for the command, such as "Rotate box", "Delete sphere", etc.
[in]_typeType of command, such as MOVING, DELETING, etc.

◆ ~MEUserCmd()

virtual ~MEUserCmd ( )
virtual

Destructor.

Member Function Documentation

◆ Description()

std::string Description ( ) const

Return this command's description.

Returns
Description

◆ Id()

unsigned int Id ( ) const

Return this command's unique ID.

Returns
Unique ID

◆ Redo()

virtual void Redo ( )
virtual

Redo this command.

◆ SetJointId()

void SetJointId ( const std::string & _id)

Set the unique id of the joint related to this command.

Parameters
[in]_idUnique id of joint.

◆ SetPoseChange()

void SetPoseChange ( const ignition::math::Pose3d & _before,
const ignition::math::Pose3d & _after )

Set the pose before and after the command.

These are local poses with respect to the parent model.

Parameters
[in]_beforePose before the command, to be used by undo.
[in]_afterPose after the command, to be used by redo.

◆ SetScaleChange()

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.

Parameters
[in]_beforeScales before the command, to be used by undo.
[in]_afterScales after the command, to be used by redo.

◆ SetScopedName()

void SetScopedName ( const std::string & _name)

Set the scoped name of the entity related to this command.

Parameters
[in]_nameFully scoped entity name.

◆ SetSDF()

void SetSDF ( sdf::ElementPtr _sdf)

Set the SDF element relevant to this command.

Parameters
[in]_sdfSDF pointer.

◆ Undo()

virtual void Undo ( )
virtual

Undo this command.

Member Data Documentation

◆ dataPtr

std::unique_ptr<MEUserCmdPrivate> dataPtr
protected

The documentation for this class was generated from the following file: