00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00032 #ifndef _PLPLOT_GRAPH_H_
00033 #define _PLPLOT_GRAPH_H_
00034
00035 #ifdef __GNUC__
00036 #define DEPRECATED(func) func __attribute__ ((deprecated))
00037 #elif defined(_MSC_VER)
00038 #define DEPRECATED(func) __declspec(deprecated) func
00039 #else
00040 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
00041 #define DEPRECATED(func) func
00042 #endif
00043
00044 #include <plplot.h>
00045 #include <iostream>
00046 #include <string>
00047
00048 #include <stdlib.h>
00049 #include <math.h>
00050
00051 #include "types_declaration.h"
00052
00053 using namespace std;
00054
00055 enum plcolors {PL_BLACK=14,PL_CYAN=11,PL_WHITE=15,PL_YELLOW=2,PL_RED=1,PL_BLUE=9};
00056 enum plshape {PL_SQUARE=1,PL_NOTRELEVANT=0};
00057
00058 class singlePlot
00059 {
00060 public:
00061 uint id;
00062 double*x;
00063 double*y;
00064 uint Lsize;
00065 uint allocated_size;
00066
00067 double xmin;
00068 double xmax;
00069 double ymin;
00070 double ymax;
00071 bool do_not_draw;
00072
00073 string title;
00074 string x_label;
00075 string y_label;
00076
00077 plshape shape;
00078
00079 plcolors color;
00080
00081 double ex_timestamp;
00082
00083 singlePlot(uint id_);
00084
00085 void SetColor(plcolors color_);
00086
00087 void SetXLinspace(double min,double max,uint size);
00088
00089 void SetEnv(double xmin_,double xmax_,double ymin_,double ymax_);
00090
00091 void DynamicScaleEnv(std::vector<t_posePtr>& path,plshape shape_);
00092
00093 void Env();
00094
00095 void SetLabel(string x_label_,string y_label_,string title_);
00096
00097 void Label();
00098
00099 void SetSize(uint size);
00100
00101 void Plot();
00102 };
00103
00104 typedef boost::shared_ptr<singlePlot> singlePlotPtr;
00105
00106 class plSpace
00107 {
00108 public:
00109
00110 bool draw;
00111
00112 vector<singlePlotPtr> plotVector;
00113 vector<singlePlotPtr> plotVector_2;
00114 vector<singlePlotPtr> plotVector_3;
00115 vector<singlePlotPtr> plotVector_4;
00116
00117 plSpace(uint width,uint height, bool draw_=true);
00118
00119 ~plSpace();
00120
00121 void Plot();
00122
00123 void SetThirdPlot(uint pos,vector<t_posePtr>& p,double (func)(t_pose&),plcolors color, double Dt);
00124
00125 void SetFourthPlot(uint pos,vector<t_posePtr>& p,double (func)(t_pose&),plcolors color, double Dt);
00126
00127 void SetSecondaryPlot(uint pos,vector<t_posePtr>& p,double (func)(t_pose&),plcolors color, double Dt);
00128
00129 void SetMember_UseTimestamp(uint pos,vector<t_posePtr>& p,double (func)(t_pose&),plcolors color,pair<double,double> limits,string Xlabel,string Ylabel,string title, double Dt);
00130
00131 void SetRunTime(uint pos,vector<double>& rt,plcolors color,string title,double tmax, double max);
00132
00133 void SetMember(uint pos,vector<t_posePtr>& pt,double(func)(s_pose&),plcolors color,double Vmax,double Vmin,string Xlabel,string Ylabel,string title, double max);
00134
00135 void SetLinearSpeed(uint pos,vector<t_posePtr>& pt,plcolors color,double tmax, double max);
00136
00137 void SetPath(uint pos,std::vector<t_posePtr>& path,string title);
00138
00139 void SetSecondaryPath(uint pos,std::vector<t_posePtr>& path,plcolors color);
00140 private:
00141
00142 };
00143
00144 #endif