00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) University of Illinois and Steven M. LaValle. 00006 // All Rights Reserved. 00007 // 00008 // Permission to use, copy, and distribute this software and its 00009 // documentation is hereby granted free of charge, provided that 00010 // (1) it is not a component of a commercial product, and 00011 // (2) this notice appears in all copies of the software and 00012 // related documentation. 00013 // 00014 // The University of Illinois and the author make no representations 00015 // about the suitability or fitness of this software for any purpose. 00016 // It is provided "as is" without express or implied warranty. 00017 //---------------------------------------------------------------------- 00018 00019 #ifndef MSL_GUIPLANNER_H 00020 #define MSL_GUIPLANNER_H 00021 00022 #include <math.h> 00023 #include <stdio.h> 00024 //#include <fstream.h> 00025 #include <sys/stat.h> 00026 #include <signal.h> 00027 #include <fx.h> 00028 #include "gui.h" 00029 #include "defs.h" 00030 #include "planner.h" 00031 #include "rrt.h" 00032 #include "rcrrt.h" 00033 #include "prm.h" 00034 #include "fdp.h" 00035 #include "util.h" 00036 00038 00039 class GuiPlanner; 00040 class MSLPlotWindow; 00041 00042 class MSLPlannerWindow : public FXMainWindow { 00043 FXDECLARE(MSLPlannerWindow) 00044 protected: 00045 FXMenubar* menubar; 00046 FXMenubar* vcrbar; 00047 FXMenubar* buttonbar; 00048 FXMenuPane* loadmenu; 00049 FXMenuPane* savemenu; 00050 FXMenuPane* plotmenu; 00051 FXMenuPane* plannermenu; 00052 FXMatrix* matrix; 00053 00054 FXDataTarget plannerdeltat_target; 00055 FXDataTarget numnodes_target; 00056 FXDataTarget drawindexx_target; 00057 FXDataTarget drawindexy_target; 00058 FXDataTarget animationtimescale_target; 00059 FXDataTarget ambientlight_target; 00060 00061 GuiPlanner* GP; 00062 00063 public: 00064 MSLPlannerWindow() {} 00065 MSLPlannerWindow(GuiPlanner* gp); 00066 virtual ~MSLPlannerWindow(); 00067 00068 void create(); 00069 void Restart(); 00070 long onCmdTimer(FXObject*,FXSelector,void*); 00071 long GeneralHandler(FXObject*,FXSelector,void*); 00072 00073 friend class GuiPlanner; 00074 friend class MSLPlotWindow; 00075 00076 }; 00077 00078 00079 00080 class MSLPlotWindow : public FXDialogBox { 00081 00082 // Macro for class hierarchy declarations 00083 FXDECLARE(MSLPlotWindow) 00084 private: 00085 00086 FXHorizontalFrame *contents; // Content frame 00087 FXVerticalFrame *canvasFrame; // Canvas frame 00088 FXVerticalFrame *buttonFrame; // Button frame 00089 FXCanvas *canvas; // Canvas to draw into 00090 int indexx,indexy; 00091 00092 protected: 00093 MSLPlotWindow(){} 00094 00095 MSLPlannerWindow* Owner; 00096 GuiPlanner* GP; 00097 00098 public: 00099 00100 // Message handlers 00101 long onPaint(FXObject*,FXSelector,void*); 00102 long onCmdPrint(FXObject*,FXSelector,void*); 00103 00104 MSLPlotWindow(MSLPlannerWindow* owner); 00105 00106 void drawPage(FXDC& dc,FXint w,FXint h,FXint tx = 0,FXint ty = 0); 00107 00108 // Messages for our class 00109 enum{ 00110 ID_CANVAS=FXMainWindow::ID_LAST, 00111 ID_PRINT, 00112 ID_LAST 00113 }; 00114 }; 00115 00116 00117 00118 class GuiPlanner: public FXApp, public Gui { 00119 protected: 00120 virtual void Init(); 00121 virtual void CreateMenuWindow(); 00122 00123 MSLPlannerWindow* Window; 00124 public: 00125 virtual void HandleEvents(); 00126 virtual void ButtonHandle(int b); 00127 double LineWidth; 00128 double PSLineWidth; 00129 int DrawIndexX,DrawIndexY; 00130 Planner *Pl; 00131 GuiPlanner(Render *render, Planner *planner); 00132 virtual ~GuiPlanner(){}; 00133 void ResetPlanner(); 00134 void WriteGraphs(); 00135 void ReadGraphs(); 00136 // void DrawGraphs(); 00137 void ReadAnimationFrames(); 00138 void WriteAnimationFrames(); 00139 void ReadPath(); 00140 void WritePath(); 00141 void DrawGraphs(); 00142 00143 friend class MSLPlotWindow; 00144 }; 00145 00146 #endif