00001
00002
00003
00004
00005
00006
00007 #ifndef Hippo_OpenGLView_h
00008 #define Hippo_OpenGLView_h
00009
00010
00011 #include "graphics/DataView.h"
00012
00013 namespace hippodraw {
00014 class TextTTF;
00015 }
00016
00025
00026 class OpenGLView : public hippodraw::DataView {
00027 public:
00028 virtual void update ( const hippodraw::Observable * );
00029 virtual void drawLines ( const std::vector< double > & x,
00030 const std::vector< double > & y,
00031 hippodraw::Line::Style style,
00032 const hippodraw::Color & color,float );
00033 virtual void drawColorLines ( const std::vector< double > & x,
00034 const std::vector< double > & y,
00035 hippodraw::Line::Style style,
00036 const std::vector <hippodraw::Color> & colors,
00037 float size );
00038
00039 virtual void drawViewLines ( const std::vector< double > & x,
00040 const std::vector< double > & y,
00041 hippodraw::Line::Style style,
00042 bool color, float);
00043 virtual void drawViewLines ( const std::vector< double > & x,
00044 const std::vector< double > & y,
00045 hippodraw::Line::Style style,
00046 const hippodraw::Color & color, float);
00047 virtual void drawPolyLine ( const std::vector< double > & xpoints,
00048 const std::vector< double > & ypoints,
00049 hippodraw::Line::Style style,
00050 const hippodraw::Color & color , float);
00051 virtual void drawSquare ( double x1, double y1, double x2, double y2,
00052 int red, int green, int blue );
00053 virtual void drawViewSquare ( float x1, float y1, float x2, float y2,
00054 int red, int green, int blue );
00055 virtual void drawPoints ( const std::vector<double> & x,
00056 const std::vector<double> & y,
00057 hippodraw::Symbol::Type type,
00058 float sym_size,
00059 const hippodraw::Color & color );
00060 virtual void drawPoints ( const std::vector< double > & x,
00061 const std::vector< double > & y,
00062 const std::vector< hippodraw::Color > & colors,
00063 hippodraw::Symbol::Type type,
00064 float sym_size );
00065 virtual void drawMag ( float x, float y, int mag, float fontsize );
00066
00067
00068
00069 virtual void drawText ( const std::string &s, float x, float y,
00070 float fontsize, float angle,
00071 char xp, char yp , bool resize = false );
00072 virtual void drawText ( const std::string &s, float x, float y,
00073 float fontsize, float angle,
00074 char xp, char yp , bool resize = false,
00075 const hippodraw::FontBase * font = 0,
00076 const hippodraw::Color * color = 0 );
00077
00078 virtual hippodraw::Rect getDrawRect () const;
00079 virtual void setDrawRect ( float x, float y, float w, float h );
00080 float userToDrawX ( double x ) const;
00081 float userToDrawXAutoInv ( double x ) const;
00082 float userToDrawY ( double x ) const;
00083 float userToDrawColor ( double c ) const;
00084 public:
00085 OpenGLView ();
00086 virtual ~OpenGLView ();
00087 void setRect( double x, double y, double w, double h);
00088 void setPlotter ( hippodraw::PlotterBase * );
00089 hippodraw::PlotterBase* getPlotter () const;
00090 private:
00091 float toViewX ( double datX ) const;
00092 float toViewY ( double datY ) const;
00093 float toCanvasX ( double datX ) const;
00094 float toCanvasY ( double datY ) const;
00095 float toX ( double x ) const;
00096 float toY ( double y ) const;
00097 void draw_Text ( const std::string &s, float x, float y,
00098 float fontsize, float angle,
00099 char xp, char yp,const hippodraw::FontBase* font = 0 );
00100 private:
00101 hippodraw::Rect m_draw_rect;
00102 hippodraw::TextTTF* m_TTF;
00103 };
00104
00105
00106 #endif // Hippo_OpenGLView_h