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;
47 void setCoordinates(
const Coord &startPos,
const Coord &endPos,
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 *) {
61 GlLines::glDrawCurve(start,bends,end,10,0,Color(127,127,127,255),Color(127,127,127,255));
64 void getXML(std::string &) {}
65 void setWithXML(
const std::string &,
unsigned int &) {}
69 class TLP_QT_SCOPE MouseEdgeBendEditor:
public GLInteractorComponent {
73 MouseEdgeBendEditor();
74 ~MouseEdgeBendEditor();
75 bool compute(GlMainWidget *glMainWidget);
76 bool draw(GlMainWidget *);
78 bool eventFilter(QObject *, QEvent *);
79 InteractorComponent *clone() {
80 return new MouseEdgeBendEditor();
84 enum EditOperation { NONE_OP=0, TRANSLATE_OP, NEW_OP, DELETE_OP};
86 EditOperation operation()
const {
98 enum OperationTarget { COORD = 0, SIZE, COORD_AND_SIZE};
101 GlMainWidget* glMainWidget;
102 LayoutProperty *_layout;
103 BooleanProperty *_selection;
104 DoubleProperty *_rotation;
105 SizeProperty *_sizes;
106 IntegerProperty *_shape;
107 CoordVectorProperty *_coordsVectorProperty;
109 void initProxies(GlMainWidget *glMainWidget);
112 EditOperation _operation;
113 OperationTarget mode;
118 std::vector<tlp::GlCircle> circles;
119 EdgeEntity *edgeEntity;
120 std::vector<Coord> coordinates;
121 GlCircle basicCircle;
122 GlTriangle targetTriangle;
123 GlCircle sourceCircle;
124 GlComposite *circleString;
125 Graph *edgeBendsGraph;
126 std::vector <SelectedEntity> select;
131 std::string selectedEntity;
132 bool mouseButtonPressOnEdge;
133 bool belong(Coord, Coord, Coord, GlMainWidget*);
134 bool haveSelection(GlMainWidget *);
135 void computeSrcTgtEntities(GlMainWidget *);
136 bool computeBendsCircles(GlMainWidget*);
137 void mMouseTranslate(
double,
double, GlMainWidget*);
139 void mMouseCreate(
double,
double, GlMainWidget*);