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 <cstdio> 00024 //#include <fstream.h> 00025 #include <sys/stat.h> 00026 #include <signal.h> 00027 00028 //#include <fx.h> 00029 #include "../../configs/configFOX.h" 00030 00031 00032 #include "gui.h" 00033 #include "defs.h" 00034 #include "planner.h" 00035 #include "rrt.h" 00036 #include "rcrrt.h" 00037 #include "prm.h" 00038 #include "fdp.h" 00039 #include "util.h" 00040 00041 00042 //A quick fix to solve some FOX version problems. Benjamin 00043 // typedef FXMenuBar FXMenubar; 00044 00046 00047 class GuiPlanner; 00048 class MSLPlotWindow; 00049 00050 class MSLPlannerWindow : public FXMainWindow { 00051 FXDECLARE(MSLPlannerWindow) 00052 protected: 00053 FXMenubar* menubar; 00054 FXMenubar* vcrbar; 00055 FXMenubar* buttonbar; 00056 FXMenuPane* loadmenu; 00057 FXMenuPane* savemenu; 00058 FXMenuPane* plotmenu; 00059 FXMenuPane* plannermenu; 00060 FXMatrix* matrix; 00061 00062 FXDataTarget plannerdeltat_target; 00063 FXDataTarget numnodes_target; 00064 FXDataTarget drawindexx_target; 00065 FXDataTarget drawindexy_target; 00066 FXDataTarget animationtimescale_target; 00067 FXDataTarget realAnimationtimescale_target; 00068 FXDataTarget ambientlight_target; 00069 00070 GuiPlanner* GP; 00071 00072 public: 00073 MSLPlannerWindow() {} 00074 MSLPlannerWindow(GuiPlanner* gp); 00075 virtual ~MSLPlannerWindow(); 00076 00077 void create(); 00078 void Restart(); 00079 long onCmdTimer(FXObject*,FXSelector,void*); 00080 long GeneralHandler(FXObject*,FXSelector,void*); 00081 00082 friend class GuiPlanner; 00083 friend class MSLPlotWindow; 00084 00085 }; 00086 00087 00088 00089 class MSLPlotWindow : public FXDialogBox { 00090 00091 // Macro for class hierarchy declarations 00092 FXDECLARE(MSLPlotWindow) 00093 private: 00094 00095 FXHorizontalFrame *contents; // Content frame 00096 FXVerticalFrame *canvasFrame; // Canvas frame 00097 FXVerticalFrame *buttonFrame; // Button frame 00098 FXCanvas *canvas; // Canvas to draw into 00099 int indexx,indexy; 00100 00101 protected: 00102 MSLPlotWindow(){} 00103 00104 MSLPlannerWindow* Owner; 00105 GuiPlanner* GP; 00106 00107 public: 00108 00109 // Message handlers 00110 long onPaint(FXObject*,FXSelector,void*); 00111 long onCmdPrint(FXObject*,FXSelector,void*); 00112 00113 MSLPlotWindow(MSLPlannerWindow* owner); 00114 00115 void drawPage(FXDC& dc,FXint w,FXint h,FXint tx = 0,FXint ty = 0); 00116 00117 // Messages for our class 00118 enum{ 00119 ID_CANVAS=FXMainWindow::ID_LAST, 00120 ID_PRINT, 00121 ID_LAST 00122 }; 00123 }; 00124 00125 00126 00127 class GuiPlanner: public FXApp, public Gui { 00128 protected: 00129 virtual void Init(); 00130 virtual void CreateMenuWindow(); 00131 00132 MSLPlannerWindow* Window; 00133 public: 00134 virtual void HandleEvents(); 00135 virtual void ButtonHandle(int b); 00136 double LineWidth; 00137 double PSLineWidth; 00138 int DrawIndexX,DrawIndexY; 00139 Planner *Pl; 00140 GuiPlanner(Render *render, Planner *planner); 00141 virtual ~GuiPlanner(){}; 00142 void ResetPlanner(); 00143 void WriteGraphs(); 00144 void ReadGraphs(); 00145 // void DrawGraphs(); 00146 void ReadAnimationFrames(); 00147 void WriteAnimationFrames(); 00148 void ReadPolicy(); 00149 void WritePolicy(); 00150 void DrawGraphs(); 00151 00152 friend class MSLPlotWindow; 00153 }; 00154 00155 #endif