Cafu Engine
Align.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_ALIGN_HPP_INCLUDED
8 #define CAFU_COMMAND_ALIGN_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 #include "../../AxesInfo.hpp"
12 #include "Math3D/BoundingBox.hpp"
13 
14 
15 class MapDocumentT;
16 class MapElementT;
17 class TrafoMementoT;
18 
19 
20 /// Command to align objects inside a specified box using an align mode.
21 class CommandAlignT : public CommandT
22 {
23  public:
24 
25  /// Constructor to align an array of map elements.
26  CommandAlignT(MapDocumentT& MapDoc, const ArrayT<MapElementT*>& Elems, const AxesInfoT& RefAxes, const BoundingBox3fT& Box, int Mode, bool LockTexCoords);
27 
28  /// Destructor.
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<MapElementT*> m_AlignElems;
41  ArrayT<TrafoMementoT*> m_OldStates;
42  const AxesInfoT m_RefAxes; ///< Axes of the 2D view in which the alignment is performed.
43  const BoundingBox3fT m_Box; ///< Box in which the objects are aligned.
44  const int m_Mode;
45  const bool m_LockTexCoords;
46 
47  /// Corrects the mode according to reference 2D view.
48  int CorrectMode(int Mode) const;
49 };
50 
51 #endif
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
wxString GetName() const
Returns the name (a description) of the command.
Definition: Align.cpp:97
bool Do()
This method executes the command.
Definition: Align.cpp:35
CommandAlignT(MapDocumentT &MapDoc, const ArrayT< MapElementT * > &Elems, const AxesInfoT &RefAxes, const BoundingBox3fT &Box, int Mode, bool LockTexCoords)
Constructor to align an array of map elements.
Definition: Align.cpp:13
An instance of this class encapsulates the transform-related state of a MapElementT.
Definition: MapElement.hpp:39
Command to align objects inside a specified box using an align mode.
Definition: Align.hpp:21
void Undo()
This method un-does the command.
Definition: Align.cpp:77
~CommandAlignT()
Destructor.
Definition: Align.cpp:26
This class describes how the three world-space axes are mapped to the two screen- or window-space axe...
Definition: AxesInfo.hpp:15
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
This class represents an axis-aligned bounding-box ("AABB") in 3-dimensional space.
Definition: BoundingBox.hpp:23
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57