Cafu Engine
Group_Assign.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_ASSIGN_GROUP_HPP_INCLUDED
8 #define CAFU_COMMAND_ASSIGN_GROUP_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 
12 
13 class CommandSelectT;
14 class GroupT;
15 class MapDocumentT;
16 class MapElementT;
17 
18 
19 /// This class implements a command for putting a set of given map elements into a given group ("MapElems[i].Group=NewGroup").
20 /// If the given group is hidden, any selected map elements are automatically unselected.
22 {
23  public:
24 
25  /// The constructor.
26  /// @param MapDoc The relevant map document.
27  /// @param MapElems The map elements that are to be put into the given group.
28  /// @param Group The group that the MapElems are put into. Can be NULL for "no group".
29  CommandAssignGroupT(MapDocumentT& MapDoc, const ArrayT<MapElementT*>& MapElems, GroupT* Group);
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  ArrayT<MapElementT*> m_MapElems;
41  GroupT* m_Group;
42  ArrayT<GroupT*> m_PrevGroups; ///< The m_MapElems previous groups: In which group was m_MapElems[i] before our Do() put it into m_Group? Used for Undo().
43  ArrayT<MapElementT*> m_VisChanged; ///< The elements from m_MapElems whose visibility changed due to their being put into m_Group.
44  CommandSelectT* m_CommandReduceSel;
45 };
46 
47 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
wxString GetName() const
Returns the name (a description) of the command.
Definition: Group_Assign.cpp:126
This class represents groups.
Definition: Group.hpp:20
Definition: Select.hpp:18
bool Do()
This method executes the command.
Definition: Group_Assign.cpp:74
void Undo()
This method un-does the command.
Definition: Group_Assign.cpp:103
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
CommandAssignGroupT(MapDocumentT &MapDoc, const ArrayT< MapElementT * > &MapElems, GroupT *Group)
The constructor.
Definition: Group_Assign.cpp:14
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57
This class implements a command for putting a set of given map elements into a given group ("MapElems...
Definition: Group_Assign.hpp:21