00001
00002
00014 #ifndef _ViewBase_H_
00015 #define _ViewBase_H_
00016
00017 #include "LineStyle.h"
00018 #include "Rectangle.h"
00019 #include "SymbolType.h"
00020
00021 #include "axes/AxesType.h"
00022 #include "pattern/Observer.h"
00023
00024 class Color;
00025 class FontBase;
00026 class PlotterBase;
00027 class Range;
00028
00059 class MDL_HIPPOPLOT_API ViewBase : public hippodraw::Observer
00060 {
00061 protected:
00062
00066 PlotterBase * m_plotter;
00067
00068 public:
00069
00071 ViewBase();
00072
00075 ViewBase ( PlotterBase * plotter );
00076
00078 ViewBase ( const ViewBase & );
00079
00081 virtual ~ViewBase();
00082
00087 virtual void setPlotter ( PlotterBase * plotter );
00088
00090 PlotterBase * getPlotter () const;
00091
00093 PlotterBase * getPlotter ();
00094
00099 virtual void update ( const Observable * ) = 0;
00100
00102 virtual void drawSelf();
00103
00108 virtual void initPlot ( double aspect ) = 0;
00109
00111 virtual void endPlot () = 0;
00112
00122 virtual void drawLines ( const std::vector< double > & x,
00123 const std::vector< double > & y,
00124 hippodraw::Line::Style style,
00125 const Color & color,
00126 float size ) = 0;
00127
00148 virtual void drawColorLines ( const std::vector< double > & x,
00149 const std::vector< double > & y,
00150 hippodraw::Line::Style style,
00151 const std::vector < Color > & color,
00152 float size ) = 0;
00153
00163 virtual void drawViewLines ( const std::vector< double > & x,
00164 const std::vector< double > & y,
00165 hippodraw::Line::Style style,
00166 bool color,
00167 float size ) = 0;
00168
00177 virtual void drawViewLines ( const std::vector< double > & x,
00178 const std::vector< double > & y,
00179 hippodraw::Line::Style style,
00180 const Color & color,
00181 float size ) = 0;
00188 virtual void drawPolyLine ( const std::vector< double > & xpoints,
00189 const std::vector< double > & ypoints,
00190 hippodraw::Line::Style style,
00191 const Color & color,
00192 float size ) = 0;
00193
00223 virtual void drawText ( const std::string &s, float x, float y,
00224 float fontsize, float angle = 0.0,
00225 char xp = 'l', char yp = 't',
00226 bool resize = false,
00227 const FontBase * font = 0 ) = 0;
00228
00234 virtual void drawUserText ( const std::string &s, float x, float y,
00235 float fontsize, float angle,
00236 char xp, char yp ) = 0;
00237
00246 virtual void drawMag ( float x, float y, int mag, float fontsize ) = 0;
00247
00251 virtual void drawPoints ( const std::vector<double> & x,
00252 const std::vector<double> & y,
00253 hippodraw::Symbol::Type type,
00254 float sym_size,
00255 const Color & color ) = 0;
00256
00262 virtual void drawPoints ( const std::vector< double > & x,
00263 const std::vector< double > & y,
00264 const std::vector< Color > & colors,
00265 hippodraw::Symbol::Type type,
00266 float sym_size ) = 0;
00267
00270 virtual void drawSquare ( double x1, double y1, double x2, double y2,
00271 int red, int green, int blue ) = 0;
00272
00275 virtual void drawViewSquare ( float x1, float y1, float x2, float y2,
00276 int red, int green, int blue ) = 0;
00277
00280 const Range & getRange ( hippodraw::Axes::Type axis ) const;
00281
00285 const HippoRectangle & getUserRect () const;
00286
00289 virtual HippoRectangle getDrawRect() const = 0;
00290
00292 virtual void setDrawRect ( float x, float y, float w, float h ) = 0;
00293
00301 virtual HippoRectangle getMarginRect() const;
00302
00305 virtual float userToDrawX ( double x ) const = 0;
00306
00309 virtual float userToDrawY ( double y ) const = 0;
00310
00313 virtual float userToDrawColor ( double c ) const = 0;
00314
00316 virtual double getAspectRatio () const;
00317
00318 };
00319
00320 #endif // _ViewBase_H_