Tulip  4.4.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  GlMainWidget *glMainWidget;
53  DoubleProperty *_rotation;
54 
55  void initProxies(GlMainWidget *glMainWidget);
56  void initEdition();
57  void undoEdition();
58  void stopEdition();
59 
60  Coord ffdCenter;
61 
62  GlLayer *layer;
63  GlComposite *composite;
64  GlCircle _controls[8];
65  GlComplexPolygon _advControls[6];
66  GlRect centerRect;
67  GlRect advRect;
68  Coord _layoutCenter;
69 
70  bool computeFFD(GlMainWidget*);
71  void getOperation(GlEntity *select);
72 
73 protected:
74 
75  EditOperation operation;
76  OperationTarget mode;
77 
78  Coord editCenter;
79  Coord editPosition;
80  Graph *_graph;
81  LayoutProperty *_layout;
82  BooleanProperty *_selection;
83  SizeProperty *_sizes;
84  Coord editLayoutCenter;
85 
86  virtual void mMouseTranslate(double, double, GlMainWidget*);
87  virtual void mMouseRotate(double, double, GlMainWidget*);
88  virtual void mMouseStretchAxis(double, double, GlMainWidget*);
89  virtual void mAlign(EditOperation operation,GlMainWidget*);
90 
91 
92 };
93 
94 }
95 
96 
97 #endif
98 ///@endcond