1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_RotateObjectsToolController
21 #define TrenchBroom_RotateObjectsToolController
22 
23 #include "Model/Hit.h"
24 #include "View/RotateObjectsHandle.h"
25 #include "View/RotateObjectsHandle.h"
26 #include "View/ToolController.h"
27 #include "View/ViewTypes.h"
28 
29 namespace TrenchBroom {
30     namespace Model {
31         class PickResult;
32     }
33 
34     namespace View {
35         class MovementRestriction;
36         class RotateObjectsTool;
37 
38         class RotateObjectsToolController : public ToolControllerGroup {
39         protected:
40             class MoveCenterBase;
41             class RotateObjectsBase;
42         protected:
43             RotateObjectsTool* m_tool;
44         protected:
45             RotateObjectsToolController(RotateObjectsTool* tool);
46         public:
47             virtual ~RotateObjectsToolController();
48         private:
49             Tool* doGetTool();
50 
51             void doPick(const InputState& inputState, Model::PickResult& pickResult);
52 
53             void doSetRenderOptions(const InputState& inputState, Renderer::RenderContext& renderContext) const;
54             void doRender(const InputState& inputState, Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch);
55 
56             bool doCancel();
57         private: // subclassing interface
58             virtual Model::Hit doPick(const InputState& inputState) = 0;
59             virtual void doRenderHandle(Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch) = 0;
60         };
61 
62         class RotateObjectsToolController2D : public RotateObjectsToolController {
63         private:
64             class MoveCenterPart;
65             class RotateObjectsPart;
66         public:
67             RotateObjectsToolController2D(RotateObjectsTool* tool);
68         private:
69             Model::Hit doPick(const InputState& inputState);
70             void doRenderHandle(Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch);
71         };
72 
73         class RotateObjectsToolController3D : public RotateObjectsToolController {
74         private:
75             class MoveCenterPart;
76             class RotateObjectsPart;
77         public:
78             RotateObjectsToolController3D(RotateObjectsTool* tool);
79         private:
80             Model::Hit doPick(const InputState& inputState);
81             void doRenderHandle(Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch);
82         };
83     }
84 }
85 
86 #endif /* defined(TrenchBroom_RotateObjectsToolController) */
87