/
TextureToolSelectionSystem.h
100 lines (73 loc) · 3.94 KB
/
TextureToolSelectionSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once
#include <functional>
#include "itexturetoolmodel.h"
#include "icommandsystem.h"
#include "TextureToolManipulationPivot.h"
#include "messages/UnselectSelectionRequest.h"
namespace textool
{
class TextureToolSelectionSystem :
public ITextureToolSelectionSystem
{
private:
SelectionMode _selectionMode;
std::map<std::size_t, selection::ITextureToolManipulator::Ptr> _manipulators;
// The currently active manipulator
selection::ITextureToolManipulator::Ptr _activeManipulator;
selection::IManipulator::Type _defaultManipulatorType;
sigc::signal<void, selection::IManipulator::Type> _sigActiveManipulatorChanged;
sigc::signal<void, SelectionMode> _sigSelectionModeChanged;
sigc::signal<void> _sigSelectionChanged;
TextureToolManipulationPivot _manipulationPivot;
std::size_t _unselectListener;
public:
const std::string& getName() const override;
const StringSet& getDependencies() const override;
void initialiseModule(const IApplicationContext& ctx) override;
void shutdownModule() override;
SelectionMode getSelectionMode() const override;
void setSelectionMode(SelectionMode mode) override;
void toggleSelectionMode(SelectionMode mode) override;
sigc::signal<void, SelectionMode>& signal_selectionModeChanged() override;
void foreachSelectedNode(const std::function<bool(const INode::Ptr&)>& functor) override;
void foreachSelectedComponentNode(const std::function<bool(const INode::Ptr&)>& functor) override;
std::size_t countSelected() override;
std::size_t countSelectedComponentNodes() override;
sigc::signal<void>& signal_selectionChanged() override;
void clearSelection() override;
void clearComponentSelection() override;
void selectPoint(SelectionTest& test, selection::SelectionSystem::EModifier modifier) override;
void selectArea(SelectionTest& test, selection::SelectionSystem::EModifier modifier) override;
// Returns the ID of the registered manipulator
std::size_t registerManipulator(const selection::ITextureToolManipulator::Ptr& manipulator) override;
void unregisterManipulator(const selection::ITextureToolManipulator::Ptr& manipulator) override;
selection::IManipulator::Type getActiveManipulatorType() override;
const selection::ITextureToolManipulator::Ptr& getActiveManipulator() override;
void setActiveManipulator(std::size_t manipulatorId) override;
void setActiveManipulator(selection::IManipulator::Type manipulatorType) override;
void toggleManipulatorMode(selection::IManipulator::Type manipulatorType) override;
sigc::signal<void, selection::IManipulator::Type>& signal_activeManipulatorChanged() override;
Matrix4 getPivot2World() override;
void onManipulationStart() override;
void onManipulationChanged() override;
void onManipulationFinished() override;
void onManipulationCancelled() override;
void onNodeSelectionChanged(ISelectable& selectable) override;
void onComponentSelectionChanged(ISelectable& selectable) override;
private:
void handleUnselectRequest(selection::UnselectSelectionRequest& request);
// Internally switches between the selection modes and iterates over the corresponding collection
void foreachSelectedNodeOfAnyType(const std::function<bool(const INode::Ptr&)>& functor);
void toggleManipulatorModeCmd(const cmd::ArgumentList& args);
void toggleManipulatorModeById(std::size_t manipId);
std::size_t getManipulatorIdForType(selection::IManipulator::Type type);
void toggleSelectionModeCmd(const cmd::ArgumentList& args);
void selectRelatedCmd(const cmd::ArgumentList& args);
void snapSelectionToGridCmd(const cmd::ArgumentList& args);
void mergeSelectionCmd(const cmd::ArgumentList& args);
void flipHorizontallyCmd(const cmd::ArgumentList& args);
void flipVerticallyCmd(const cmd::ArgumentList& args);
void flipSelected(int axis);
void performSelectionTest(Selector& selector, SelectionTest& test);
};
}