Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

visualization/SDAGViewEl.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003            Scheduling Simulator
00004         Lehrstuhl f"ur Effiziente Algorithmen
00005            Technische Universit"at M"unchen
00006 
00007  File    : $Id: SDAGViewEl.h,v 1.4 2003/01/08 18:57:14 meierb Exp $
00008 
00009  Purpose : This view element paints a dag. It uses the SDAGNodeViewEl and 
00010            the SDAGEdgeViewEl classes for painting nodes and edges.
00011 
00012  RCS-Log:
00013  $Log: SDAGViewEl.h,v $
00014  Revision 1.4  2003/01/08 18:57:14  meierb
00015  added randomized release times
00016 
00017  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00018  my_schedule
00019 
00020  Revision 1.2  2002/11/11 16:19:36  taeubig
00021  changes in header inclusion
00022 
00023  Revision 1.1  2002/08/29 12:59:59  taeubig
00024  Added the sources
00025 
00026  Revision 1.18  2001/05/16 13:20:04  taeubig
00027  QT headers are included last because of "slots" conflict
00028 
00029  Revision 1.17  2000/08/21 23:04:18  hall
00030  more "intelligent" repaint (moved to SViewEl.cpp),
00031  fixes/workarounds for crazy bugs
00032 
00033  Revision 1.16  2000/05/24 13:02:44  taeubig
00034  New compiler (gcc-2.95) and new Qt (2.1)
00035  Replaced "list" by "leda_list" etc.
00036 
00037  Revision 1.15  2000/05/04 16:52:11  kern
00038  dragging edge bug removed
00039 
00040  Revision 1.13  2000/01/24 10:55:06  kern
00041  added isAffectedBy method
00042 
00043  Revision 1.14  2000/05/04  16:08:42  schickin
00044  added layout for trees
00045 
00046  Revision 1.13  2000/01/24 10:55:06  kern
00047  added isAffectedBy method
00048 
00049  Revision 1.12  2000/01/18 08:44:30  kern
00050  moved visLayout from SDAGLayouter to load routine in SDAGViewEl
00051 
00052  Revision 1.11  2000/01/16 18:42:56  kern
00053  java docs
00054 
00055  Revision 1.10  2000/01/14 09:06:57  kern
00056  added DAG-layouting class
00057 
00058  Revision 1.9  2000/01/12 09:27:39  kern
00059  added javadocs
00060 
00061  Revision 1.8  1999/12/21 10:24:16  kern
00062  you can add shop jobs now
00063 
00064  Revision 1.7  1999/12/15 10:19:58  kern
00065  added shop job support
00066 
00067  Revision 1.6  1999/12/10 10:31:20  kern
00068  fixed some crash bugs
00069 
00070  Revision 1.5  1999/12/06 14:11:56  kern
00071  added some more preferences
00072 
00073  Revision 1.4  1999/11/29 11:46:06  kern
00074  added design structure
00075 
00076  Revision 1.3  1999/11/16 10:06:19  kern
00077  added visualization
00078 
00079  Revision 1.2  1999/01/29 10:04:08  schickin
00080  Project-Headers added.
00081 
00082 
00083  * #end# ************************************************************* */
00084 
00085 #ifndef SDAGVIEWEL_H
00086 #define SDAGVIEWEL_H
00087 
00088 // system header files
00089 
00090 // project header files
00091 #include "SDAGLayouter.h"
00092 #include "SViewEl.h"
00093 
00094 // QT header files
00095 #include <qlist.h>
00096 #include <qpopupmenu.h>
00097 
00098 class SDAGNodeViewEl;
00099 class SDAGEdgeViewEl;
00100 
00105 class SDAGViewEl : public SViewEl 
00106 {
00107   friend class SDAGEdgeViewEl;
00108   Q_OBJECT
00109 
00110 public: 
00113   enum MenuIDs {
00114     COLOR_MENU_ID_WHITE,
00115     COLOR_MENU_ID_RED, COLOR_MENU_ID_BLUE, 
00116     COLOR_MENU_ID_GREEN, COLOR_MENU_ID_YELLOW, COLOR_MENU_ID_USER,
00117     SHAPE_MENU_ID_ELLIPSE, SHAPE_MENU_ID_RECTANGLE,
00118     WIDTH_MENU_ID_1, WIDTH_MENU_ID_2, WIDTH_MENU_ID_3,
00119     WIDTH_MENU_ID_4, WIDTH_MENU_ID_5
00120   };
00123   enum GraphType { 
00124     DIRECTED, UNDIRECTED 
00125   };
00128   enum HitTestInfo  { 
00129     GetHit = 0, OnContext = 1, OnNode = 2, OnEdge = 3 
00130   };
00134   enum DAGViewState { 
00135     Idle = 0,
00136     InsertNode = 1, DragNode = 2,
00137     SelectEdgeStart = 3, SelectEdgeEnd = 4, DragEdge = 5
00138   };
00141   SDAGViewEl( STaskSystem *ts );
00142   ~SDAGViewEl();
00145   virtual void paint( QPaintDevice *pd, QRect rect );
00148   virtual void setView( SView &view );
00153   virtual void setPos( QPoint p );
00158   bool isDirected();
00163   virtual bool mouseEvent( QMouseEvent* e );
00168   virtual bool isAffectedBy( QMouseEvent* );
00171   QRegion getRegion();
00174   const QRect &getBoundBox() const;
00175 
00178   virtual void update( const class SEvent & );
00179 
00180 signals: 
00184   void numberOfNodes( int );
00188   void numberOfEdges( int );
00189 
00190 public slots:
00194   bool load();
00195 
00196 protected:
00201   void removeEdge( SDAGEdgeViewEl *edge );
00202 
00203 private:
00206   SDAGLayouter *_pDAGLayouter;
00207   // some context menus for the dagview
00208   QPopupMenu *_pContextMenu;
00209   QPopupMenu *_pNodeMenu;
00210   QPopupMenu *_pEdgeMenu;
00211   QPopupMenu *_pColorMenu;
00212   QPopupMenu *_pShapeMenu;
00213   QPopupMenu *_pWidthMenu;
00214   QPopupMenu *_pLayoutMenu;
00215   // ids for the menu entries
00216   int _contextNewNodeID, _contextNewEdgeID, _contextPlaceHereID; 
00217   int _contextLayoutID;
00218   int _userColorID;
00219   // is the graph directed or not ?
00220   GraphType _dagtype;
00225   DAGViewState _state;
00229   SDAGNodeViewEl *_pSelectedNode;
00233   SDAGEdgeViewEl *_pSelectedEdge;
00239   QList<SDAGNodeViewEl> *_pNodeList; 
00243   QList<SDAGEdgeViewEl> *_pEdgeList; 
00254   bool hitTest( QPoint p, HitTestInfo &info );
00258   void clear();
00261   void selectEdgeBegin();
00264   void setIdle();
00269   void notifyNodes();
00277   SDAGNodeViewEl* getSDAGNode( leda_node ledanode );
00280   bool mousePress( QMouseEvent* );
00283   bool mouseRelease( QMouseEvent* );
00286   bool mouseMove( QMouseEvent* );
00287 
00288 private slots:
00292   void newEdge();
00295   void insertEdge();
00299   void removeEdge();
00302   void insertNode();
00305   void removeNode(); 
00308   void pos();
00312   void colorMenu( int );
00316   void shapeMenu( int );
00320   void widthMenu( int ); 
00324   void layoutMenu( int ); 
00327   void jobProperties();
00328 };
00329 
00330 #endif //SDAGVIEWEL_H

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18