00001
00002
00014 #ifndef _EpsView_H_
00015 #define _EpsView_H_
00016
00017 #include "DataView.h"
00018
00019 #include <fstream>
00020
00021 namespace hippodraw {
00022
00027 class MDL_HIPPOPLOT_API EpsView : public DataView
00028 {
00029
00030 private:
00031
00032 std::ofstream m_outfile;
00033
00034 Rect m_boundingRect;
00035
00036 Rect m_draw_rect;
00037
00038 EpsView ( const EpsView & );
00039
00044 void initPlot ( const std::string & filename,
00045 double x, double y, double w, double h );
00046
00049 void lineTo ( double x, double y );
00050
00053 void moveTo ( double x, double y );
00054
00057 void setDash ( hippodraw::Line::Style style );
00058
00061 void setLineWidth ( double size );
00062
00067 void setRgbColor ( const Color & color );
00068
00073 void setRgbColor ( int red, int green, int blue );
00074
00078 void drawSymbol ( hippodraw::Symbol::Type type,
00079 double x, double y,
00080 float size );
00081
00082 virtual void draw_Text ( const std::string &s, float x, float y,
00083 float fontsize, float angle,
00084 char xp, char yp, const FontBase * );
00085
00086 public:
00087
00091 EpsView ( const std::string file, double x, double y, double w, double h );
00092
00093 virtual ~EpsView ();
00094
00097 virtual void closeFile ();
00098
00099 virtual void drawLines ( const std::vector< double > & x,
00100 const std::vector< double > & y,
00101 hippodraw::Line::Style style,
00102 const Color & color,
00103 float size );
00104
00105 virtual void drawColorLines ( const std::vector< double > & x,
00106 const std::vector< double > & y,
00107 hippodraw::Line::Style style,
00108 const std::vector < Color > & color,
00109 float size );
00110
00111 virtual void drawViewLines ( const std::vector< double > & x,
00112 const std::vector< double > & y,
00113 hippodraw::Line::Style style,
00114 bool color,
00115 float size );
00116
00117 virtual void drawViewLines ( const std::vector< double > & x,
00118 const std::vector< double > & y,
00119 hippodraw::Line::Style style,
00120 const Color & color,
00121 float size );
00122
00123 virtual void drawPolyLine ( const std::vector< double > & xpoints,
00124 const std::vector< double > & ypoints,
00125 hippodraw::Line::Style style,
00126 const Color & color,
00127 float size );
00128
00129 virtual void drawSquare ( double x1, double y1, double x2, double y2,
00130 int red, int green, int blue );
00131
00132 virtual void drawViewSquare ( float x1, float y1, float x2, float y2,
00133 int red, int green, int blue );
00134
00135 virtual void drawPoints ( const std::vector<double> & x,
00136 const std::vector<double> & y,
00137 hippodraw::Symbol::Type type,
00138 float sym_size,
00139 const Color & color );
00140
00141 virtual void drawPoints ( const std::vector< double > & x,
00142 const std::vector< double > & y,
00143 const std::vector< Color > & colors,
00144 hippodraw::Symbol::Type type,
00145 float sym_size );
00146
00147 virtual void drawText ( const std::string &s, float x, float y,
00148 float fontsize, float angle,
00149 char xp, char yp, bool resize,
00150 const FontBase * font,
00151 const Color * color );
00152
00153 virtual void update ( const Observable * );
00154 virtual Rect getDrawRect () const;
00155 virtual void setDrawRect ( float x, float y, float w, float h );
00156
00157 float userToDrawX ( double x ) const;
00158 float userToDrawXAutoInv ( double x ) const;
00159 float userToDrawY ( double x ) const;
00160 float userToDrawColor ( double c ) const;
00161 float toViewX ( double datX ) const;
00162 float toViewY ( double datY ) const;
00163 float toX ( double x ) const;
00164 float toY ( double y ) const;
00165
00166 };
00167
00168 }
00169
00170 #endif // _EpsView_H_