Cafu Engine
Clip.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_CLIP_HPP_INCLUDED
8 #define CAFU_COMMAND_CLIP_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 #include "../MapBrush.hpp"
12 
13 
14 /// This struct describes and holds the result of clipping a brush.
16 {
17  ClipResultT()
18  {
19  Workpiece=NULL;
20  Front =NULL;
21  Back =NULL;
22  }
23 
24  ~ClipResultT()
25  {
26  delete Front;
27  delete Back;
28  }
29 
30  MapBrushT* Workpiece;
31  MapBrushT* Front;
32  MapBrushT* Back;
33 };
34 
35 
36 class MapDocumentT;
37 class CommandSelectT;
38 class CommandDeleteT;
39 
40 
41 class CommandClipT : public CommandT
42 {
43  public:
44 
45  /// The constructor.
46  CommandClipT(MapDocumentT& MapDoc_, const ArrayT<ClipResultT*>& ClipResults_);
47 
48  /// The destructor.
49  ~CommandClipT();
50 
51  // Implementation of the CommandT interface.
52  bool Do();
53  void Undo();
54  wxString GetName() const;
55 
56 
57  private:
58 
59  MapDocumentT& MapDoc;
60  const ArrayT<ClipResultT*> ClipResults;
61  CommandSelectT* CommandSelect; ///< Subcommand used by this command to change the selection.
62  CommandDeleteT* CommandDelete; ///< Subcommand used by this command to delete the original brushes.
63 };
64 
65 #endif
CommandClipT(MapDocumentT &MapDoc_, const ArrayT< ClipResultT * > &ClipResults_)
The constructor.
Definition: Clip.cpp:15
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
This struct describes and holds the result of clipping a brush.
Definition: Clip.hpp:15
Definition: Select.hpp:18
Definition: MapBrush.hpp:15
bool Do()
This method executes the command.
Definition: Clip.cpp:45
void Undo()
This method un-does the command.
Definition: Clip.cpp:97
wxString GetName() const
Returns the name (a description) of the command.
Definition: Clip.cpp:129
Definition: Clip.hpp:41
Definition: Delete.hpp:22
~CommandClipT()
The destructor.
Definition: Clip.cpp:24
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30