21 #ifndef MOUSEEDGEBENDEDITION_H
22 #define MOUSEEDGEBENDEDITION_H
24 #include <tulip/GlCircle.h>
25 #include <tulip/GlTriangle.h>
26 #include <tulip/GLInteractor.h>
27 #include <tulip/GlScene.h>
28 #include <tulip/GlLines.h>
33 class BooleanProperty;
36 class CoordVectorProperty;
37 class IntegerProperty;
39 class EdgeEntity :
public GlSimpleEntity {
43 std::vector<Coord> bends;
46 void setCoordinates(
const Coord &startPos,
const Coord &endPos,
47 const std::vector<Coord> &bendsPos) {
51 boundingBox.init(start);
52 boundingBox.expand(end,
true);
54 for (
auto &coord : bends) {
55 boundingBox.expand(coord,
true);
59 void draw(
float, Camera *)
override {
60 GlLines::glDrawCurve(start, bends, end, 10, 0, Color(127, 127, 127, 255),
61 Color(127, 127, 127, 255));
64 void getXML(std::string &)
override {}
65 void setWithXML(
const std::string &,
unsigned int &)
override {}
69 class TLP_QT_SCOPE MouseEdgeBendEditor :
public GLInteractorComponent {
72 MouseEdgeBendEditor();
73 ~MouseEdgeBendEditor()
override;
74 bool compute(GlMainWidget *glMainWidget)
override;
75 bool draw(GlMainWidget *)
override;
76 void clear()
override;
77 bool eventFilter(QObject *, QEvent *)
override;
80 enum EditOperation { NONE_OP = 0, TRANSLATE_OP, NEW_OP, DELETE_OP };
82 EditOperation operation()
const {
93 enum OperationTarget { COORD = 0, SIZE, COORD_AND_SIZE };
96 GlMainWidget *glMainWidget;
97 LayoutProperty *_layout;
98 BooleanProperty *_selection;
99 DoubleProperty *_rotation;
100 SizeProperty *_sizes;
101 IntegerProperty *_shape;
102 CoordVectorProperty *_coordsVectorProperty;
104 void initProxies(GlMainWidget *glMainWidget);
106 EditOperation _operation;
107 OperationTarget mode;
112 std::vector<tlp::GlCircle> circles;
113 EdgeEntity *edgeEntity;
114 std::vector<Coord> coordinates;
115 GlCircle basicCircle;
116 GlTriangle targetTriangle;
117 GlCircle sourceCircle;
118 GlComposite *circleString;
123 std::string selectedEntity;
124 bool mouseButtonPressOnEdge;
125 bool belong(
const Coord &,
const Coord &,
const Coord &, GlMainWidget *);
126 bool haveSelection(GlMainWidget *);
127 void computeSrcTgtEntities(GlMainWidget *);
128 bool computeBendsCircles(GlMainWidget *);
129 void mMouseTranslate(
int,
int, GlMainWidget *);
131 void mMouseCreate(
int,
int, GlMainWidget *);
The edge struct represents an edge in a Graph object.