##

ModelCreator Class Reference
GUI

Create and manage 3D visuals of a model with links, nested models and joints. More...

`#include <ModelCreator.hh>`

Inherits QObject.

## Public Types

enum | EntityType { ENTITY_NONE, ENTITY_BOX, ENTITY_SPHERE, ENTITY_CYLINDER, ENTITY_MESH, ENTITY_POLYLINE, ENTITY_MODEL }
enum | SaveState { NEVER_SAVED, ALL_SAVED, UNSAVED_CHANGES }
| Save states for the model editor. More...

## Public Slots

void | ShowCollisions (const bool _show)
| Show or hide collision visuals. More...
void | ShowLinkFrames (const bool _show)
| Show or hide link frame visuals. More...
void | ShowVisuals (const bool _show)
| Show or hide visual visuals. More...

## Signals

void | LinkAdded ()
| Qt signal when the a link has been added. More...

## Public Member Functions

| ModelCreator (QObject *_parent=NULL)
| Constructor. More...
virtual | ~ModelCreator ()
| Destructor. More...
void | AddCustomLink (const EntityType _type, const ignition::math::Vector3d &_size=ignition::math::Vector3d::One, const ignition::math::Pose3d &_pose=ignition::math::Pose3d::Zero, const std::string &_uri="", const unsigned int _samples=5)
| Begin the process of inserting a custom link using the mouse. More...
void | AddEntity (const sdf::ElementPtr &_sdf)
| Add an entity to the model. More...
void | AddJoint (const std::string &_type)
| Add a joint to the model. More...
void | AddLink (const EntityType _type)
| Add a link to the model. More...
NestedModelData * | AddModel (const sdf::ElementPtr &_sdf)
| Add a nested model to the model. More...
void | AddModelPlugin (const sdf::ElementPtr &_pluginElem)
| Add a model plugin to the model. More...
LinkData * | AddShape (const EntityType _type, const ignition::math::Vector3d &_size=ignition::math::Vector3d::One, const ignition::math::Pose3d &_pose=ignition::math::Pose3d::Zero, const std::string &_uri="", const unsigned int _samples=5)
| Add a link to the model. More...
enum SaveState | CurrentSaveState () const
| Get current save state. More...
void | DisableEventHandlers ()
| Disable the mouse and key event handlers. More...
void | EnableEventHandlers ()
| Enable the mouse and key event handlers. More...
void | FinishModel ()
| Finish the model and create the entity on the gzserver. More...
void | GenerateSDF ()
| Generate the SDF from model link and joint visuals. More...
gui::JointMaker * | JointMaker () const
| Get joint maker. More...
void | ModelChanged ()
| Set save state upon a change to the model. More...
std::string | ModelName () const
| Get the name of the model. More...
ModelPluginData * | ModelPlugin (const std::string &_name)
| Get a model plugin data by its name. More...
void | OnAddModelPlugin (const std::string &_name, const std::string &_filename, const std::string &_innerxml, const bool _newCmd=true)
| Add a model plugin to the model. More...
void | RemoveEntity (const std::string &_entityName)
| Remove an entity from the model. More...
void | RemoveModelPlugin (const std::string &_pluginName, const bool _newCmd=true)
| Remove a model plugin from the model. More...
void | Reset ()
| Reset the model creator and the SDF. More...
void | SaveModelFiles ()
| Helper function to manage writing files to disk. More...
void | SetAutoDisable (const bool _auto)
| Set the model to allow auto disable at rest. More...
void | SetModelName (const std::string &_modelName)
| Set the name of the model. More...
void | SetSelected (const rendering::VisualPtr &_entityVis, const bool selected)
| Set the select state of a entity visual. More...
void | SetSelected (const std::string &_name, const bool selected)
| Set the select state of an entity. More...
void | SetStatic (const bool _static)
| Set the model to be static. More...
void | Stop ()
| Stop the process of adding a link or joint to the model. More...
ignition::math::Pose3d | WorldToLocal (const ignition::math::Pose3d &_world) const
| Convert a given pose from the world frame to the local frame of the model being edited. More...

## Detailed Description

Create and manage 3D visuals of a model with links, nested models and joints.

## Member Enumeration Documentation

## EntityType

enum EntityType

Enumerator
ENTITY_NONE | none
ENTITY_BOX | Box.
ENTITY_SPHERE | Sphere.
ENTITY_CYLINDER | Cylinder.
ENTITY_MESH | Imported 3D mesh.
ENTITY_POLYLINE | Extruded polyline.
ENTITY_MODEL | Nested model.

## SaveState

enum SaveState

Save states for the model editor.

Enumerator
NEVER_SAVED | The model has never been saved.
ALL_SAVED | All changes have been saved.
UNSAVED_CHANGES | Has been saved before, but has unsaved changes.

## Constructor & Destructor Documentation

## ModelCreator()

ModelCreator | ( | QObject * | _parent = `NULL` | ) |

explicit

Constructor.

Parameters

  [in] | _parent | Parent Qt Object

## ~ModelCreator()

virtual ~ModelCreator | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## AddCustomLink()

void AddCustomLink | ( | const EntityType | _type,
|  | const ignition::math::Vector3d & | _size = `ignition::math::Vector3d::One`,
|  | const ignition::math::Pose3d & | _pose = `ignition::math::Pose3d::Zero`,
|  | const std::string & | _uri = `""`,
|  | const unsigned int | _samples = `5`
| ) |  |

Begin the process of inserting a custom link using the mouse.

Parameters

  [in] | _type | Type of link to add: ENTITY_BOX, ENTITY_CYLINDER, ENTITY_SPHERE, ENTITY_MESH or ENTITY_POLYLINE.
  [in] | _size | Size of the link.
  [in] | _pose | Pose of the link.
  [in] | _samples | Number of samples for polyline.

## AddEntity()

void AddEntity | ( | const sdf::ElementPtr & | _sdf | ) |

Add an entity to the model.

Parameters

  [in] | _sdf | SDF describing the entity.

## AddJoint()

void AddJoint | ( | const std::string & | _type | ) |

Add a joint to the model.

Parameters

  [in] | _type | Type of joint to add.

## AddLink()

void AddLink | ( | const EntityType | _type | ) |

Add a link to the model.

Parameters

  [in] | _type | Type of link to be added

## AddModel()

NestedModelData* AddModel | ( | const sdf::ElementPtr & | _sdf | ) |

Add a nested model to the model.

Parameters

  [in] | _sdf | SDF describing the model.

Returns
  Nested model data.

## AddModelPlugin()

void AddModelPlugin | ( | const sdf::ElementPtr & | _pluginElem | ) |

Add a model plugin to the model.

Parameters

  [in] | _pluginElem | Pointer to plugin SDF element

## AddShape()

LinkData* AddShape | ( | const EntityType | _type,
|  | const ignition::math::Vector3d & | _size = `ignition::math::Vector3d::One`,
|  | const ignition::math::Pose3d & | _pose = `ignition::math::Pose3d::Zero`,
|  | const std::string & | _uri = `""`,
|  | const unsigned int | _samples = `5`
| ) |  |

Add a link to the model.

Parameters

  [in] | _type | Type of link to add: ENTITY_BOX, ENTITY_CYLINDER, ENTITY_SPHERE, ENTITY_MESH or ENTITY_POLYLINE.
  [in] | _size | Size of the link.
  [in] | _pose | Pose of the link.
  [in] | _samples | Number of samples for polyline.

Returns
  Link data.

## CurrentSaveState()

enum SaveState CurrentSaveState | ( |  | ) | const

Get current save state.

Returns
  Current save state.

## DisableEventHandlers()

void DisableEventHandlers | ( |  | ) |

Disable the mouse and key event handlers.

## EnableEventHandlers()

void EnableEventHandlers | ( |  | ) |

Enable the mouse and key event handlers.

## FinishModel()

void FinishModel | ( |  | ) |

Finish the model and create the entity on the gzserver.

## GenerateSDF()

void GenerateSDF | ( |  | ) |

Generate the SDF from model link and joint visuals.

## JointMaker()

gui::JointMaker* JointMaker | ( |  | ) | const

Get joint maker.

Returns
  Joint maker

## LinkAdded

void LinkAdded | ( |  | ) |

signal

Qt signal when the a link has been added.

## ModelChanged()

void ModelChanged | ( |  | ) |

Set save state upon a change to the model.

## ModelName()

std::string ModelName | ( |  | ) | const

Get the name of the model.

Returns
  Name of model.

## ModelPlugin()

ModelPluginData* ModelPlugin | ( | const std::string & | _name | ) |

Get a model plugin data by its name.

Parameters

  [in] | _name | Name of model plugin

Returns
  Model plugin data.

## OnAddModelPlugin()

void OnAddModelPlugin | ( | const std::string & | _name,
|  | const std::string & | _filename,
|  | const std::string & | _innerxml,
|  | const bool | _newCmd = `true`
| ) |  |

Add a model plugin to the model.

Parameters

  [in] | _name | Name of plugin
  [in] | _filename | Plugin filename
  [in] | _innerxml | Plugin SDF elements in string
  [in] | _newCmd | Flag indicating whether a new command should be created.

## RemoveEntity()

void RemoveEntity | ( | const std::string & | _entityName | ) |

Remove an entity from the model.

Parameters

  [in] | _entityName | Name of the entity to remove

## RemoveModelPlugin()

void RemoveModelPlugin | ( | const std::string & | _pluginName,
|  | const bool | _newCmd = `true`
| ) |  |

Remove a model plugin from the model.

Parameters

  [in] | _pluginName | Name of the model plugin to remove.
  [in] | _newCmd | Flag indicating whether a new command should be created.

## Reset()

void Reset | ( |  | ) |

Reset the model creator and the SDF.

## SaveModelFiles()

void SaveModelFiles | ( |  | ) |

Helper function to manage writing files to disk.

## SetAutoDisable()

void SetAutoDisable | ( | const bool | _auto | ) |

Set the model to allow auto disable at rest.

Parameters

  [in] | _auto | True to allow the model to auto disable.

## SetModelName()

void SetModelName | ( | const std::string & | _modelName | ) |

Set the name of the model.

Parameters

  [in] | _modelName | Name of the model to set to.

## SetSelected() [1/2]

void SetSelected | ( | const rendering::VisualPtr & | _entityVis,
|  | const bool | selected
| ) |  |

Set the select state of a entity visual.

Parameters

  [in] | _linkVis | Pointer to the entity visual.
  [in] | _selected | True to select the entity.

## SetSelected() [2/2]

void SetSelected | ( | const std::string & | _name,
|  | const bool | selected
| ) |  |

Set the select state of an entity.

Parameters

  [in] | _name | Name of the link.
  [in] | _selected | True to select the entity.

## SetStatic()

void SetStatic | ( | const bool | _static | ) |

Set the model to be static.

Parameters

  [in] | _static | True to make the model static.

## ShowCollisions

void ShowCollisions | ( | const bool | _show | ) |

slot

Show or hide collision visuals.

Parameters

  [in] | _show | True to show, false to hide.

## ShowLinkFrames

void ShowLinkFrames | ( | const bool | _show | ) |

slot

Show or hide link frame visuals.

Parameters

  [in] | _show | True to show, false to hide.

## ShowVisuals

void ShowVisuals | ( | const bool | _show | ) |

slot

Show or hide visual visuals.

Parameters

  [in] | _show | True to show, false to hide.

## Stop()

void Stop | ( |  | ) |

Stop the process of adding a link or joint to the model.

## WorldToLocal()

ignition::math::Pose3d WorldToLocal | ( | const ignition::math::Pose3d & | _world | ) | const

Convert a given pose from the world frame to the local frame of the model being edited.

Parameters

  [in] | _world | Pose in world frame.

Returns
  Pose in model local frame.

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

- ModelCreator.hh