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