00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GFX_GRAPHICS_HPP
00022 #define GFX_GRAPHICS_HPP
00023
00024
00025 #include <estar/util.hpp>
00026 #include <estar/FacadeReadInterface.hpp>
00027
00028
00029 namespace estar {
00030
00031 class GridCSpace;
00032 class Algorithm;
00033 class RiskMap;
00034 class Kernel;
00035 class Region;
00036
00037 }
00038
00039
00040 namespace gfx {
00041
00042
00043 typedef enum {
00044 GREEN_PINK_BLUE,
00045 GREY_WITH_SPECIAL,
00046 BLUE_GREEN_RED,
00047 INVERTED_GREY,
00048 RED
00049 } colorscheme_enum_t;
00050
00051
00053 class ColorScheme
00054 {
00055 public:
00056 virtual ~ColorScheme() { }
00057 virtual void Set(double value) const = 0;
00058 static const ColorScheme * Get(colorscheme_enum_t number);
00059 };
00060
00061
00067 class ColorCycle
00068 : public ColorScheme
00069 {
00070 public:
00071 ColorCycle(const ColorScheme * scheme,
00074 double period,
00077 double width);
00078
00081 virtual void Set(double value) const;
00082
00083 double ComputeMapping(double value) const;
00084
00085 protected:
00086 const ColorScheme * m_scheme;
00087 double m_period, m_width, m_half_period, m_scaled_width, m_scale;
00088 };
00089
00090
00091 void draw_grid_value(const estar::GridCSpace & cspace,
00092 const estar::Algorithm & algo,
00093 const ColorScheme * colorscheme,
00094 bool auto_scale_value);
00095
00096 void draw_grid_value(const estar::FacadeReadInterface & facade,
00097 const ColorScheme * colorscheme,
00098 bool auto_scale_value);
00099
00100 void draw_grid_rhs(const estar::GridCSpace & cspace,
00101 const estar::Algorithm & algo,
00102 const ColorScheme * colorscheme);
00103
00104 void draw_grid_rhs(const estar::FacadeReadInterface & facade,
00105 const ColorScheme * colorscheme);
00106
00107 void draw_grid_risk(const estar::GridCSpace & cspace,
00108 const estar::Algorithm & algo,
00109 const estar::RiskMap & riskmap,
00110 const ColorScheme * colorscheme);
00111
00112 void draw_grid_meta(const estar::GridCSpace & cspace,
00113 const estar::Algorithm & algo,
00114 const estar::Kernel & kernel,
00115 const ColorScheme * colorscheme);
00116
00117 void draw_grid_meta(const estar::FacadeReadInterface & facade,
00118 const ColorScheme * colorscheme);
00119
00120 void draw_grid_obstacles(const estar::FacadeReadInterface & facade,
00121 double red, double green, double blue,
00122 bool fill_cells = true);
00123
00124 void draw_array(const estar::array<double> & grid,
00125 ssize_t x0, ssize_t y0, ssize_t x1, ssize_t y1,
00126 double lower, double upper,
00127 const ColorScheme * colorscheme);
00128
00129 void draw_trace(estar::carrot_trace const & trace,
00130 ColorScheme const * colorscheme,
00131 double fail_r, double fail_g, double fail_b);
00132
00133 void draw_trace(const estar::FacadeReadInterface & facade,
00134 double robot_x, double robot_y,
00135 const ColorScheme * colorscheme,
00136 double fail_r, double fail_g, double fail_b);
00137
00138 void draw_grid_queue(const estar::GridCSpace & cspace,
00139 const estar::Algorithm & algo);
00140
00141 void draw_grid_queue(const estar::FacadeReadInterface & facade);
00142
00143 void draw_grid_upwind(const estar::GridCSpace & cspace,
00144 const estar::Algorithm & algo,
00145 double red, double green, double blue,
00146 double linewidth);
00147
00148 void draw_grid_upwind(const estar::FacadeReadInterface & facade,
00149 double red, double green, double blue,
00150 double linewidth);
00151
00152 void draw_grid_connect(const estar::GridCSpace & cspace,
00153 const estar::Algorithm & algo,
00154 double red, double green, double blue,
00155 double linewidth);
00156
00157 void draw_grid_status(const estar::FacadeReadInterface & facade);
00158
00159 void get_grid_bbox(const estar::GridCSpace & cspace,
00160 double & x0, double & y0, double & x1, double & y1);
00161
00162 void get_grid_bbox(const estar::FacadeReadInterface & facade,
00163 double & x0, double & y0, double & x1, double & y1);
00164
00165 void draw_region(const estar::Region & region,
00166 double red, double green, double blue);
00167
00168 }
00169
00170 #endif // GFX_GRAPHICS_HPP