20#ifndef COMMAND_FACTORY_HH_
21#define COMMAND_FACTORY_HH_
25#include "interfaces/command_factory_interface.h"
28#include "commands/DeleteElementCommand.h"
29#include "commands/OpenFileCommand.h"
30#include "commands/SaveFileCommand.h"
31#include "commands/DeleteElementCommand.h"
32#include "commands/GenericCommand.h"
33#include "commands/OpenFileCommand.h"
34#include "commands/CreateFileCommand.h"
35#include "commands/ModifyAttributeCommand.h"
36#include "commands/ModifyElementCommand.h"
37#include "commands/AddElementCommand.h"
38#include "commands/RenderModelCommand.h"
39#include "commands/OpenModelViewerCommand.h"
40#include "commands/CloseModelViewerCommand.h"
75 sdf::ElementPtr parent_element, sdf::ElementPtr new_element)
override;
84 private: std::unique_ptr<CommandI>
MakeRenderModelCommand(
bool render_collisions_in_model_viewer)
override;
110 private: std::unique_ptr<CommandI>
MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, std::string new_value)
override;
122 private: std::unique_ptr<CommandI>
MakeModifyElementCommand(sdf::ElementPtr element_to_modify, std::string new_value)
override;
128 private: std::unique_ptr<CommandI>
MakeModifyElementCommand(sdf::ElementPtr element_to_modify,
bool new_value)
override;
131 private:
void ClearStack(std::stack<std::unique_ptr<CommandI>>& stack);
139 private:
void PushToUndoCommandsStack(std::unique_ptr<CommandI> command,
const bool new_change =
true)
override;
152 private: std::shared_ptr<GUII>
gui;
Interface for the SDFormat Editor's Command Factory.
Definition command_factory_interface.h:37
Implementation of CommandFactoryI.
Definition command_factory.h:44
std::unique_ptr< CommandI > MakeOpenModelViewerCommand() override
Create a open model viewer model command.
Definition command_factory.cpp:46
std::unique_ptr< CommandI > MakeDeleteElementCommand(sdf::ElementPtr element_to_delete) override
Implementation of interface method.
Definition command_factory.cpp:66
std::shared_ptr< GUII > gui
Pointer to the GUI obejct.
Definition command_factory.h:152
std::unique_ptr< CommandI > MakeModifyElementCommand(sdf::ElementPtr element_to_modify, std::string new_value) override
Implementation of interface method.
Definition command_factory.cpp:79
void PushToUndoCommandsStack(std::unique_ptr< CommandI > command, const bool new_change=true) override
Pushes to the undo commands stack.
Definition command_factory.cpp:98
std::unique_ptr< CommandI > MakeRedoCommand() override
Implementation of interface method.
Definition command_factory.cpp:61
std::unique_ptr< CommandI > MakeSaveFileCommand() override
Implementation of interface method.
Definition command_factory.cpp:153
std::unique_ptr< CommandI > MakeUndoCommand() override
Implementation of interface method.
Definition command_factory.cpp:56
std::unique_ptr< CommandI > MakeCloseModelViewerCommand() override
Create a close model viewer model command.
Definition command_factory.cpp:93
std::shared_ptr< ModelViewerI > model_viewer
Pointer to the model viewer object.
Definition command_factory.h:158
void PopFromUndoCommandsStack()
Pops from the undo commands stack and executes the popped command.
Definition command_factory.cpp:112
std::stack< std::unique_ptr< CommandI > > redo_commands_stack
Stack for redo functionality.
Definition command_factory.h:164
std::stack< std::unique_ptr< CommandI > > undo_commands_stack
Stack for undo functionality.
Definition command_factory.h:161
std::unique_ptr< CommandI > MakeRenderModelCommand(bool render_collisions_in_model_viewer) override
Implementation of interface method.
Definition command_factory.cpp:41
void ClearUndoRedoStacks() override
Implementation of interface method.
Definition command_factory.cpp:139
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.
Definition command_factory.cpp:28
void PushToRedoCommandsStack(std::unique_ptr< CommandI > command) override
Pushes to the redo commands stack.
Definition command_factory.cpp:107
void PopFromRedoCommandsStack()
Pops from the redo commands stack and executes the popped command.
Definition command_factory.cpp:125
std::shared_ptr< SDFormatParserI > sdformatParser
Pointer to the sdformat parser object.
Definition command_factory.h:155
std::unique_ptr< CommandI > MakeAddElementCommand(sdf::ElementPtr parent_element, sdf::ElementPtr new_element) override
Create an add element command.
Definition command_factory.cpp:87
std::unique_ptr< CommandI > MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, std::string new_value) override
Implementation of interface method.
Definition command_factory.cpp:71
void ClearStack(std::stack< std::unique_ptr< CommandI > > &stack)
Clears the undo stack.
Definition command_factory.cpp:145
std::unique_ptr< CommandI > MakeCreateFileCommand() override
Implementation of interface method.
Definition command_factory.cpp:51
std::unique_ptr< CommandI > MakeOpenFileCommand(std::string file_path) override
Implementation of interface method.
Definition command_factory.cpp:36