ViewBase.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
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 namespace hippodraw {
00025 
00026 class Color;
00027 class FontBase;
00028 class PlotterBase;
00029 class Range;
00030 
00062 class MDL_HIPPOPLOT_API ViewBase : public Observer
00063 {
00064 protected:
00065 
00069   PlotterBase * m_plotter;
00070 
00071 public:
00072 
00074   ViewBase();
00075 
00078   ViewBase ( PlotterBase * plotter );
00079 
00081   ViewBase ( const ViewBase & );
00082 
00084   virtual ~ViewBase();
00085 
00090   virtual void setPlotter ( PlotterBase * plotter );
00091 
00093   PlotterBase * getPlotter () const;
00094 
00096   PlotterBase * getPlotter ();
00097 
00102   virtual void update ( const Observable * ) = 0;
00103 
00105   virtual void drawSelf();
00106 
00116   virtual void drawLines ( const std::vector< double > & x,
00117                            const std::vector< double > & y,
00118                            Line::Style style,
00119                            const Color & color,
00120                            float size ) = 0;
00121 
00140   virtual void drawColorLines ( const std::vector< double > & x,
00141                                 const std::vector< double > & y,
00142                                 Line::Style style,
00143                                 const std::vector < Color > & color,
00144                                 float size ) = 0;
00145 
00155   virtual void drawViewLines ( const std::vector< double > & x,
00156                                const std::vector< double > & y,
00157                                Line::Style style,
00158                                bool color,
00159                                float size ) = 0;
00160 
00169   virtual void drawViewLines ( const std::vector< double > & x,
00170                                const std::vector< double > & y,
00171                                Line::Style style,
00172                                const Color & color,
00173                                float size ) = 0;
00180   virtual void drawPolyLine ( const std::vector< double > & xpoints,
00181                               const std::vector< double > & ypoints, 
00182                               Line::Style style,
00183                               const Color & color,
00184                               float size ) = 0;
00185 
00191   virtual void drawPolygon ( const std::vector <double > & xpoints,
00192                              const std::vector <double > & ypoints,
00193                              const Color & color,
00194                              const Color & edge );
00195 
00196 
00229   virtual void drawText ( const std::string &s, float x, float y,
00230                           float fontsize, float angle = 0.0,
00231                           char xp = 'l', char yp = 't',
00232                           bool resize = false,
00233                           const FontBase * font = 0,
00234                           const Color * color = 0 ) = 0;
00235 
00236 
00241   virtual void drawImage ( const std::string &filename, int position = 0);
00242 
00246   virtual void drawLatex ( const std::string &eq, int position = 0);
00247 
00251   virtual void drawPoints ( const std::vector<double> & x,
00252                             const std::vector<double> & y,
00253                             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                             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 ( Axes::Type axis ) const;
00281 
00285   const Rect & getUserRect () const;
00286 
00289   const Rect & getRawRect () const;
00290 
00293   virtual Rect getDrawRect() const = 0;
00294 
00296   virtual void updateDrawRect();
00297 
00299   virtual void setDrawRect ( float x, float y, float w, float h ) = 0;
00300 
00303   virtual float userToDrawX ( double x ) const = 0;
00304   virtual float userToDrawXAutoInv ( double x )  const = 0;
00305 
00308   virtual float userToDrawY ( double y ) const = 0;
00309 
00312   virtual float userToDrawColor ( double c ) const = 0;
00313 
00315   virtual double getAspectRatio () const;
00316 
00319   virtual void willDelete ( const Observable * plotter );
00320 
00321 };
00322 
00323 } // namespace hippodraw
00324 
00325 #endif // _ViewBase_H_

Generated for HippoDraw Class Library by doxygen