Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
MouseSelectionEditor.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef MOUSEMOVESELECTION_H
22 #define MOUSEMOVESELECTION_H
23 
24 #include <tulip/GlCircle.h>
25 #include <tulip/GLInteractor.h>
26 #include <tulip/GlComplexPolygon.h>
27 #include <tulip/GlRect.h>
28 
29 namespace tlp {
30 
31 class LayoutProperty;
32 class BooleanProperty;
33 class DoubleProperty;
34 class SizeProperty;
35 
36 /// This interactor allows to move/rotate/stretch the current selection layout
37 class TLP_QT_SCOPE MouseSelectionEditor:public GLInteractorComponent {
38 
39 public:
40 
41  MouseSelectionEditor();
42  ~MouseSelectionEditor();
43  void clear();
44  bool compute(GlMainWidget *glMainWidget);
45  bool draw(GlMainWidget *);
46  bool eventFilter(QObject *, QEvent *);
47 
48 private:
49  enum EditOperation { NONE=0, ROTATE_Z, ROTATE_XY, STRETCH_X, STRETCH_Y, STRETCH_XY, TRANSLATE, ALIGN_TOP, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_VERTICALLY, ALIGN_HORIZONTALLY};
50  enum OperationTarget { COORD = 0, SIZE, COORD_AND_SIZE};
51 
52  Graph *_graph;
53  GlMainWidget *glMainWidget;
54  LayoutProperty *_layout;
55  BooleanProperty *_selection;
56  DoubleProperty *_rotation;
57  SizeProperty *_sizes;
58 
59  void initProxies(GlMainWidget *glMainWidget);
60  void initEdition();
61  void undoEdition();
62  void stopEdition();
63 
64  EditOperation operation;
65  OperationTarget mode;
66 
67  Coord editCenter;
68  Coord editPosition;
69  Coord editLayoutCenter;
70 
71  Coord ffdCenter;
72 
73  GlLayer *layer;
74  GlComposite *composite;
75  GlCircle _controls[8];
76  GlComplexPolygon _advControls[6];
77  GlRect centerRect;
78  GlRect advRect;
79  Coord _layoutCenter;
80 
81  bool computeFFD(GlMainWidget*);
82  void getOperation(GlEntity *select);
83  void mMouseTranslate(double, double, GlMainWidget*);
84  void mMouseRotate(double, double, GlMainWidget*);
85  void mMouseStretchAxis(double, double, GlMainWidget*);
86  void mAlign(EditOperation operation,GlMainWidget*);
87 
88 
89 };
90 
91 }
92 
93 
94 #endif
95 ///@endcond