Cafu Engine
Carve.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_COMMAND_CARVE_HPP_INCLUDED
8 #define CAFU_COMMAND_CARVE_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 #include "Templates/Pointer.hpp"
12 
13 
14 namespace MapEditor { class CompMapEntityT; }
15 class CommandDeleteT;
16 class GroupT;
17 class MapDocumentT;
18 class MapBrushT;
19 class MapElementT;
20 
21 
22 class CommandCarveT : public CommandT
23 {
24  public:
25 
26  /// Constructor to carve an array of objects from the world.
27  CommandCarveT(MapDocumentT& MapDoc, const ArrayT<const MapBrushT*>& Carvers);
28 
29  ~CommandCarveT();
30 
31  // Implementation of the CommandT interface.
32  bool Do();
33  void Undo();
34  wxString GetName() const;
35 
36 
37  private:
38 
39  MapDocumentT& m_MapDoc;
40  const ArrayT<const MapBrushT*> m_Carvers;
41  CommandDeleteT* m_DeleteCommand; ///< Subcommand to delete the original brushes that are carved.
42  ArrayT<GroupT*> m_NewCarveGroups; ///< One new group for the carve pieces of each original brush, when the original brush was in no group before and carved into at least two pieces.
43 
44  ArrayT<MapElementT*> m_OriginalBrushes; ///< The affected brushes before they were carved.
45  ArrayT< IntrusivePtrT<MapEditor::CompMapEntityT> > m_Parents; ///< Parent entities of the original brushes.
46  ArrayT< ArrayT<MapBrushT*> > m_CarvedBrushes; ///< For each original brush, the brushes resulting from the carve operation.
47 };
48 
49 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
void Undo()
This method un-does the command.
Definition: Carve.cpp:188
This class represents groups.
Definition: Group.hpp:20
wxString GetName() const
Returns the name (a description) of the command.
Definition: Carve.cpp:226
Definition: MapBrush.hpp:15
CommandCarveT(MapDocumentT &MapDoc, const ArrayT< const MapBrushT * > &Carvers)
Constructor to carve an array of objects from the world.
Definition: Carve.cpp:19
Definition: Delete.hpp:22
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
Definition: Carve.hpp:22
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57
bool Do()
This method executes the command.
Definition: Carve.cpp:48