SDFormat Editor
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CommandFactory Class Reference

Implementation of CommandFactoryI. More...

#include <command_factory.h>

Inheritance diagram for CommandFactory:
Inheritance graph
Collaboration diagram for CommandFactory:
Collaboration graph

Public Member Functions

 CommandFactory (std::shared_ptr< GUII > gui, std::shared_ptr< SDFormatParserI > sdformatParser, std::shared_ptr< ModelViewerI > model_viewer)
 Constructor that wraps the Initialize method.
 
std::unique_ptr< CommandIMakeOpenModelViewerCommand () override
 Create a open model viewer model command.
 
std::unique_ptr< CommandIMakeCloseModelViewerCommand () override
 Create a close model viewer model command.
 

Private Member Functions

void Initialize (std::shared_ptr< GUII > gui, std::shared_ptr< SDFormatParserI > sdformatParser, std::shared_ptr< ModelViewerI > model_viewer)
 Implementation of interface method, wrapped by constructor.
 
std::unique_ptr< CommandIMakeOpenFileCommand (std::string file_path) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeDeleteElementCommand (sdf::ElementPtr element_to_delete) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeAddElementCommand (sdf::ElementPtr parent_element, sdf::ElementPtr new_element) override
 Create an add element command.
 
std::unique_ptr< CommandIMakeSaveFileCommand () override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeRenderModelCommand (bool render_collisions_in_model_viewer) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeCreateFileCommand () override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeUndoCommand () override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeRedoCommand () override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeModifyAttributeCommand (sdf::ParamPtr attribute_to_modify, std::string new_value) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeModifyAttributeCommand (sdf::ParamPtr attribute_to_modify, bool new_value) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeModifyElementCommand (sdf::ElementPtr element_to_modify, std::string new_value) override
 Implementation of interface method.
 
std::unique_ptr< CommandIMakeModifyElementCommand (sdf::ElementPtr element_to_modify, bool new_value) override
 Implementation of interface method.
 
void ClearStack (std::stack< std::unique_ptr< CommandI > > &stack)
 Clears the undo stack.
 
void ClearUndoRedoStacks () override
 Implementation of interface method.
 
void PushToUndoCommandsStack (std::unique_ptr< CommandI > command, const bool new_change=true) override
 Pushes to the undo commands stack.
 
void PushToRedoCommandsStack (std::unique_ptr< CommandI > command) override
 Pushes to the redo commands stack.
 
void PopFromUndoCommandsStack ()
 Pops from the undo commands stack and executes the popped command.
 
void PopFromRedoCommandsStack ()
 Pops from the redo commands stack and executes the popped command.
 

Private Attributes

std::shared_ptr< GUIIgui
 Pointer to the GUI obejct.
 
std::shared_ptr< SDFormatParserIsdformatParser
 Pointer to the sdformat parser object.
 
std::shared_ptr< ModelViewerImodel_viewer
 Pointer to the model viewer object.
 
std::stack< std::unique_ptr< CommandI > > undo_commands_stack
 Stack for undo functionality.
 
std::stack< std::unique_ptr< CommandI > > redo_commands_stack
 Stack for redo functionality.
 

Detailed Description

Implementation of CommandFactoryI.

Constructor & Destructor Documentation

◆ CommandFactory()

CommandFactory::CommandFactory ( std::shared_ptr< GUII gui,
std::shared_ptr< SDFormatParserI sdformatParser,
std::shared_ptr< ModelViewerI model_viewer 
)

Constructor that wraps the Initialize method.

Parameters
[in]guiA pointer to the GUI object
[in]sdformat_parserA pointer to the sdformat parser object
[in]model_viewerA pointer to the model viewer object

Member Function Documentation

◆ ClearUndoRedoStacks()

void CommandFactory::ClearUndoRedoStacks ( )
overrideprivatevirtual

Implementation of interface method.

Implements CommandFactoryI.

◆ Initialize()

void CommandFactory::Initialize ( std::shared_ptr< GUII gui,
std::shared_ptr< SDFormatParserI sdformatParser,
std::shared_ptr< ModelViewerI model_viewer 
)
privatevirtual

Implementation of interface method, wrapped by constructor.

Parameters
[in]guiA pointer to the GUI object
[in]sdformat_parserA pointer to the sdformat parser object
[in]model_viewerA pointer to the model viewer object

Implements CommandFactoryI.

◆ MakeAddElementCommand()

std::unique_ptr< CommandI > CommandFactory::MakeAddElementCommand ( sdf::ElementPtr  parent_element,
sdf::ElementPtr  new_element 
)
overrideprivatevirtual

Create an add element command.

Parameters
[in]parent_elementThe parent of the new SDF element
[in]new_elementThe new SDF element
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeCloseModelViewerCommand()

std::unique_ptr< CommandI > CommandFactory::MakeCloseModelViewerCommand ( )
overridevirtual

Create a close model viewer model command.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeCreateFileCommand()

std::unique_ptr< CommandI > CommandFactory::MakeCreateFileCommand ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeDeleteElementCommand()

std::unique_ptr< CommandI > CommandFactory::MakeDeleteElementCommand ( sdf::ElementPtr  element_to_delete)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]element_to_deleteThe SDF element to delete
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeModifyAttributeCommand() [1/2]

std::unique_ptr< CommandI > CommandFactory::MakeModifyAttributeCommand ( sdf::ParamPtr  attribute_to_modify,
bool  new_value 
)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]attribute_to_modifyA pointer to the attribute that will be modified
[in]new_valueThe new value as a bool
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeModifyAttributeCommand() [2/2]

std::unique_ptr< CommandI > CommandFactory::MakeModifyAttributeCommand ( sdf::ParamPtr  attribute_to_modify,
std::string  new_value 
)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]attribute_to_modifyA pointer to the attribute that will be modified
[in]new_valueThe new value as a string
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeModifyElementCommand() [1/2]

std::unique_ptr< CommandI > CommandFactory::MakeModifyElementCommand ( sdf::ElementPtr  element_to_modify,
bool  new_value 
)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]element_to_modifyA pointer to the element that will be modified
[in]new_valueThe new value as a bool
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeModifyElementCommand() [2/2]

std::unique_ptr< CommandI > CommandFactory::MakeModifyElementCommand ( sdf::ElementPtr  element_to_modify,
std::string  new_value 
)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]element_to_modifyA pointer to the element that will be modified
[in]new_valueThe new value as a string
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeOpenFileCommand()

std::unique_ptr< CommandI > CommandFactory::MakeOpenFileCommand ( std::string  file_path)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]file_pathFilepath of the model
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeOpenModelViewerCommand()

std::unique_ptr< CommandI > CommandFactory::MakeOpenModelViewerCommand ( )
overridevirtual

Create a open model viewer model command.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeRedoCommand()

std::unique_ptr< CommandI > CommandFactory::MakeRedoCommand ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeRenderModelCommand()

std::unique_ptr< CommandI > CommandFactory::MakeRenderModelCommand ( bool  render_collisions_in_model_viewer)
overrideprivatevirtual

Implementation of interface method.

Parameters
[in]render_collisions_in_model_viewerindicates if collision boxes should be rendered in the model viewer
Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeSaveFileCommand()

std::unique_ptr< CommandI > CommandFactory::MakeSaveFileCommand ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ MakeUndoCommand()

std::unique_ptr< CommandI > CommandFactory::MakeUndoCommand ( )
overrideprivatevirtual

Implementation of interface method.

Returns
Unique pointer to a command interface

Implements CommandFactoryI.

◆ PushToRedoCommandsStack()

void CommandFactory::PushToRedoCommandsStack ( std::unique_ptr< CommandI command)
overrideprivatevirtual

Pushes to the redo commands stack.

Parameters
[in]commandcommandI object to push

Implements CommandFactoryI.

◆ PushToUndoCommandsStack()

void CommandFactory::PushToUndoCommandsStack ( std::unique_ptr< CommandI command,
const bool  new_change = true 
)
overrideprivatevirtual

Pushes to the undo commands stack.

Parameters
[in]commandcommandI object to push
[in]new_changeindicates if we are pushing a new change, and thus should clear the redo stack

Implements CommandFactoryI.


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