-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqtconceptmapcommandmovenode.h
58 lines (41 loc) · 1.41 KB
/
qtconceptmapcommandmovenode.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
#ifndef CONCEPTMAPCOMMANDMOVENODE_H
#define CONCEPTMAPCOMMANDMOVENODE_H
#include "qtconceptmapcommand.h"
namespace ribi {
namespace cmap {
///MoveNode a QGraphicsItems that is moveable, in this case QtEdges and non-center QtNodes
class CommandMoveNode final : public Command
{
public:
///@param predicate function to find the first QtNode (not on Edge)
/// in the QtConceptMap
CommandMoveNode(
QtConceptMap& qtconceptmap,
QtNode * const qtnode,
const double dx,
const double dy
);
CommandMoveNode(const CommandMoveNode&) = delete;
CommandMoveNode& operator=(const CommandMoveNode&) = delete;
~CommandMoveNode() noexcept;
auto GetDx() const noexcept { return m_dx; }
auto GetDy() const noexcept { return m_dy; }
/// Get the (first) QtNode in the QtConceptMap that satisfied the predicate
const QtNode * GetMovedQtNode() const noexcept { return m_qtnode; }
///Will throw if nothing is moved
void Redo() override;
void Undo() override;
private:
///The QtNode (not on Edge)
QtNode * const m_qtnode;
///The horizontal relative movement of the node or edge
const double m_dx;
///The vertical relative movement of the node or edge
const double m_dy;
};
/// Works on, for example 'create_new_node(0, 0, from)'
CommandMoveNode * ParseCommandMoveNode(
QtConceptMap& qtconceptmap, std::string s);
} //~namespace cmap
} //~namespace ribi
#endif // CONCEPTMAPCOMMANDMOVENODE_H