![]() |
Tulip
4.6.0
Better Visualization Through Research
|
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 MOUSEADDEDGE_H 00022 #define MOUSEADDEDGE_H 00023 00024 #include <vector> 00025 #include <tulip/Coord.h> 00026 #include <tulip/GLInteractor.h> 00027 #include <tulip/Observable.h> 00028 00029 namespace tlp { 00030 class Graph; 00031 class LayoutProperty; 00032 00033 class TLP_QT_SCOPE MouseEdgeBuilder:public GLInteractorComponent, public Observable { 00034 private: 00035 node _source; 00036 bool _started; 00037 Coord _startPos,_curPos; 00038 std::vector<Coord> _bends; 00039 Graph *_graph; 00040 LayoutProperty *_layoutProperty; 00041 00042 protected: 00043 /** 00044 * @brief addLink Adds a link between a source and destination nodes. Adds an edge by default 00045 * @param source 00046 * @param dest 00047 */ 00048 virtual void addLink(QObject *, const node source, const node dest); 00049 /** 00050 * @brief source gets the source node. 00051 * @return 00052 */ 00053 node source()const { 00054 return _source; 00055 } 00056 /** 00057 * @brief bends returns the bends list. 00058 * @return 00059 */ 00060 const std::vector<Coord>& bends()const { 00061 return _bends; 00062 } 00063 /** 00064 * @brief setBends updates the bends list. 00065 * @param bends 00066 */ 00067 void setBends(const std::vector<Coord>& bends) { 00068 _bends = bends; 00069 } 00070 00071 public: 00072 MouseEdgeBuilder(); 00073 bool draw(GlMainWidget *); 00074 bool eventFilter(QObject *, QEvent *); 00075 void initObserver(Graph *); 00076 void clearObserver(); 00077 00078 void treatEvent(const Event&); 00079 00080 void clear(); 00081 }; 00082 00083 00084 } 00085 #endif 00086 ///@endcond