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