Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/MouseSelectionEditor.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef MOUSEMOVESELECTION_H
00022 #define MOUSEMOVESELECTION_H
00023 
00024 #include <tulip/GlCircle.h>
00025 #include <tulip/GLInteractor.h>
00026 #include <tulip/GlComplexPolygon.h>
00027 #include <tulip/GlRect.h>
00028 
00029 namespace tlp {
00030 
00031 class LayoutProperty;
00032 class BooleanProperty;
00033 class DoubleProperty;
00034 class SizeProperty;
00035 
00036 /// This interactor allows to move/rotate/stretch the current selection layout
00037 class TLP_QT_SCOPE MouseSelectionEditor:public GLInteractorComponent {
00038 
00039 public:
00040 
00041   MouseSelectionEditor();
00042   ~MouseSelectionEditor();
00043   void clear();
00044   bool compute(GlMainWidget *glMainWidget);
00045   bool draw(GlMainWidget *);
00046   bool eventFilter(QObject *, QEvent *);
00047 
00048 private:
00049   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};
00050   enum OperationTarget { COORD = 0, SIZE, COORD_AND_SIZE};
00051 
00052   GlMainWidget *glMainWidget;
00053   DoubleProperty *_rotation;
00054 
00055   void initProxies(GlMainWidget *glMainWidget);
00056   void initEdition();
00057   void undoEdition();
00058   void stopEdition();
00059 
00060   Coord ffdCenter;
00061 
00062   GlLayer *layer;
00063   GlComposite *composite;
00064   GlCircle _controls[8];
00065   GlComplexPolygon _advControls[6];
00066   GlRect centerRect;
00067   GlRect advRect;
00068   Coord _layoutCenter;
00069 
00070   bool computeFFD(GlMainWidget*);
00071   void getOperation(GlEntity *select);
00072 
00073 protected:
00074 
00075   EditOperation operation;
00076   OperationTarget mode;
00077 
00078   Coord editCenter;
00079   Coord editPosition;
00080   Graph *_graph;
00081   LayoutProperty *_layout;
00082   BooleanProperty *_selection;
00083   SizeProperty *_sizes;
00084   Coord editLayoutCenter;
00085 
00086   virtual void mMouseTranslate(double, double, GlMainWidget*);
00087   virtual void mMouseRotate(double, double, GlMainWidget*);
00088   virtual void mMouseStretchAxis(double, double, GlMainWidget*);
00089   virtual void mAlign(EditOperation operation,GlMainWidget*);
00090 
00091 
00092 };
00093 
00094 }
00095 
00096 
00097 #endif
00098 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties