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) {
48 boundingBox = BoundingBox();
52 boundingBox.expand(start);
53 boundingBox.expand(end);
55 for (std::vector<Coord>::iterator it = bends.begin(); it != bends.end(); ++it) {
56 boundingBox.expand(*it);
60 void draw(
float, Camera *)
override {
61 GlLines::glDrawCurve(start, bends, end, 10, 0, Color(127, 127, 127, 255),
62 Color(127, 127, 127, 255));
65 void getXML(std::string &)
override {}
66 void setWithXML(
const std::string &,
unsigned int &)
override {}
70 class TLP_QT_SCOPE MouseEdgeBendEditor :
public GLInteractorComponent {
73 MouseEdgeBendEditor();
74 ~MouseEdgeBendEditor()
override;
75 bool compute(GlMainWidget *glMainWidget)
override;
76 bool draw(GlMainWidget *)
override;
77 void clear()
override;
78 bool eventFilter(QObject *, QEvent *)
override;
81 enum EditOperation { NONE_OP = 0, TRANSLATE_OP, NEW_OP, DELETE_OP };
83 EditOperation operation()
const {
94 enum OperationTarget { COORD = 0, SIZE, COORD_AND_SIZE };
97 GlMainWidget *glMainWidget;
98 LayoutProperty *_layout;
99 BooleanProperty *_selection;
100 DoubleProperty *_rotation;
101 SizeProperty *_sizes;
102 IntegerProperty *_shape;
103 CoordVectorProperty *_coordsVectorProperty;
105 void initProxies(GlMainWidget *glMainWidget);
107 EditOperation _operation;
108 OperationTarget mode;
113 std::vector<tlp::GlCircle> circles;
114 EdgeEntity *edgeEntity;
115 std::vector<Coord> coordinates;
116 GlCircle basicCircle;
117 GlTriangle targetTriangle;
118 GlCircle sourceCircle;
119 GlComposite *circleString;
120 std::vector<SelectedEntity> select;
125 std::string selectedEntity;
126 bool mouseButtonPressOnEdge;
127 bool belong(Coord, Coord, Coord, GlMainWidget *);
128 bool haveSelection(GlMainWidget *);
129 void computeSrcTgtEntities(GlMainWidget *);
130 bool computeBendsCircles(GlMainWidget *);
131 void mMouseTranslate(
int,
int, GlMainWidget *);
133 void mMouseCreate(
int,
int, GlMainWidget *);
The edge struct represents an edge in a Graph object.