PeriDyno 1.2.1
Loading...
Searching...
No Matches
WtConnectionGraphicsObject.h
Go to the documentation of this file.
1#pragma once
2
3#include <Wt/WPainter.h>
4#include <Wt/WPainterPath.h>
5#include <Wt/WRectF.h>
6
7#include "guid.hpp"
8
9#include "WtConnection.h"
10
11class WtNode;
12class WtFlowScene;
13class WtConnection;
16
18{
19public:
20
21 static void paint(Wt::WPainter* painter, WtConnection const& connection);
22
23 static Wt::WPainterPath getPainterStroke(WtConnectionGeometry const& geom);
24};
25
28{
29public:
30
31 WtConnectionGraphicsObject(WtFlowScene& scene, WtConnection& connection, Wt::WPainter* painter);
32
34
35 enum { Type = 65538 };
36 int type() const { return Type; }
37
38public:
39
41
42 Wt::WRectF boundingRect() const;
43
44 Wt::WPainterPath shape() const;
45
46 void setGeometryChanged();
47
49 void move();
50
51 void lock(bool locked);
52
53 void setPos(int x, int y)
54 {
55 _origin.setX(x);
56 _origin.setY(y);
57 _painter->translate(_origin);
59 _origin.setX(-x);
60 _origin.setY(-y);
61 _painter->translate(_origin);
62 }
63
64 void setPos(Wt::WPointF pos)
65 {
66 _origin = pos;
67 _painter->translate(_origin);
69 _origin.setX(-pos.x());
70 _origin.setY(-pos.y());
71 _painter->translate(_origin);
72 }
73
74 bool isSelected() const
75 {
76 return false;
77 }
78protected:
79
80 void paint(Wt::WPainter* painter);
81 //
82 // void
83 // mousePressEvent(QGraphicsSceneMouseEvent* event) override;
84 //
85 // void
86 // mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
87 //
88 // void
89 // mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
90 //
91 // void
92 // hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
93 //
94 // void
95 // hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
96
97private:
98
99 void addGraphicsEffect();
100
101private:
102
104
106
107 // use for move
108 Wt::WPointF _origin = Wt::WPointF(0, 0);
109
110 Wt::WPainter* _painter;
111};
WtConnectionGraphicsObject(WtFlowScene &scene, WtConnection &connection, Wt::WPainter *painter)
void move()
Updates the position of both ends.
Wt::WPainterPath shape() const
static void paint(Wt::WPainter *painter, WtConnection const &connection)
static Wt::WPainterPath getPainterStroke(WtConnectionGeometry const &geom)