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