SDFormat Editor
Loading...
Searching...
No Matches
command_factory_interface.h
1/*
2* sdformat-editor
3* Copyright 2025 sdformat-editor
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17* Developer: Zaid Duraid, Ean Wheeler, Evan Vokey
18*/
19
20#ifndef COMMAND_FACTORY_INTERFACE_HH_
21#define COMMAND_FACTORY_INTERFACE_HH_
22
23// SDFormat dependencies
24#include <sdf/sdf.hh>
25#include <memory>
26#include "interfaces/command_interface.h"
27#include "interfaces/gui_interface.h"
28#include "interfaces/sdformat_parser_interface.h"
29#include "interfaces/model_viewer_interface.h"
30#include <stack>
31
32// Predeclare GUII to avoid circular dependencies
33class GUII;
34
37{
43 private: virtual void Initialize(std::shared_ptr<GUII> gui, std::shared_ptr<SDFormatParserI> sdformatParser,
44 std::shared_ptr<ModelViewerI> model_viewer) = 0;
45
49 public: virtual std::unique_ptr<CommandI> MakeOpenFileCommand(std::string file_path) = 0;
50
53 public: virtual std::unique_ptr<CommandI> MakeCreateFileCommand() = 0;
54
58 public: virtual std::unique_ptr<CommandI> MakeDeleteElementCommand(
59 sdf::ElementPtr element_to_delete) = 0;
60
65 public: virtual std::unique_ptr<CommandI> MakeAddElementCommand(
66 sdf::ElementPtr parent_element, sdf::ElementPtr new_element) = 0;
67
70 public: virtual std::unique_ptr<CommandI> MakeUndoCommand() = 0;
71
74 public: virtual std::unique_ptr<CommandI> MakeRedoCommand() = 0;
75
78 public: virtual std::unique_ptr<CommandI> MakeSaveFileCommand() = 0;
79
84 public: virtual std::unique_ptr<CommandI> MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, std::string new_value) = 0;
85
86
91 public: virtual std::unique_ptr<CommandI> MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, bool new_value) = 0;
92
97 public: virtual std::unique_ptr<CommandI> MakeModifyElementCommand(sdf::ElementPtr element_to_modify, std::string new_value) = 0;
98
103 public: virtual std::unique_ptr<CommandI> MakeModifyElementCommand(sdf::ElementPtr element_to_modify, bool new_value) = 0;
104
108 public: virtual std::unique_ptr<CommandI> MakeRenderModelCommand(bool render_collisions_in_model_viewer) = 0;
109
112 public: virtual std::unique_ptr<CommandI> MakeOpenModelViewerCommand() = 0;
113
116 public: virtual std::unique_ptr<CommandI> MakeCloseModelViewerCommand() = 0;
117
121 public: virtual void PushToUndoCommandsStack(std::unique_ptr<CommandI> command, const bool new_change = true) = 0;
122
125 public: virtual void PushToRedoCommandsStack(std::unique_ptr<CommandI> command) = 0;
126
128 public: virtual void ClearUndoRedoStacks() = 0;
129};
130
131#endif // COMMAND_FACTORY_INTERFACE_HH_
Interface for the SDFormat Editor's Command Factory.
Definition command_factory_interface.h:37
virtual void PushToUndoCommandsStack(std::unique_ptr< CommandI > command, const bool new_change=true)=0
Pushes to the undo commands stack.
virtual std::unique_ptr< CommandI > MakeUndoCommand()=0
Create an undo command.
virtual std::unique_ptr< CommandI > MakeAddElementCommand(sdf::ElementPtr parent_element, sdf::ElementPtr new_element)=0
Create an add element command.
virtual void Initialize(std::shared_ptr< GUII > gui, std::shared_ptr< SDFormatParserI > sdformatParser, std::shared_ptr< ModelViewerI > model_viewer)=0
Initialization of the Command Factory. Should be wrapped in the constructor of the implementation.
virtual std::unique_ptr< CommandI > MakeCloseModelViewerCommand()=0
Create a close model viewer model command.
virtual std::unique_ptr< CommandI > MakeSaveFileCommand()=0
Create a save file command.
virtual std::unique_ptr< CommandI > MakeModifyElementCommand(sdf::ElementPtr element_to_modify, std::string new_value)=0
create a modify element command
virtual std::unique_ptr< CommandI > MakeOpenFileCommand(std::string file_path)=0
Create an open file command.
virtual std::unique_ptr< CommandI > MakeRedoCommand()=0
Create a redo command.
virtual std::unique_ptr< CommandI > MakeModifyElementCommand(sdf::ElementPtr element_to_modify, bool new_value)=0
create a modify element command
virtual std::unique_ptr< CommandI > MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, bool new_value)=0
create a modify attribute command
virtual void ClearUndoRedoStacks()=0
Clears both the undo and redo stacks.
virtual std::unique_ptr< CommandI > MakeDeleteElementCommand(sdf::ElementPtr element_to_delete)=0
Create a delete element command.
virtual std::unique_ptr< CommandI > MakeCreateFileCommand()=0
Create a create file command.
virtual std::unique_ptr< CommandI > MakeModifyAttributeCommand(sdf::ParamPtr attribute_to_modify, std::string new_value)=0
create a modify attribute command
virtual void PushToRedoCommandsStack(std::unique_ptr< CommandI > command)=0
Pushes to the redo commands stack.
virtual std::unique_ptr< CommandI > MakeOpenModelViewerCommand()=0
Create a open model viewer model command.
virtual std::unique_ptr< CommandI > MakeRenderModelCommand(bool render_collisions_in_model_viewer)=0
Create a render model command.
Interface for the SDFormat Editor's Graphical User Interface Note that this class also inherits from ...
Definition gui_interface.h:39