AxisRepBase.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00002 
00014 #ifndef _AxisRepBase_H_
00015 #define _AxisRepBase_H_
00016 
00017 #include "axes/AxesType.h"
00018 #include "graphics/FontBase.h"
00019 
00020 #include <vector>
00021 
00022 namespace hippodraw {
00023 
00024 class AxisModelBase;
00025 class AxisTick;
00026 class BinToColor;
00027 class TransformBase;
00028 class ViewBase;
00029 class Range;
00030 
00049 class MDL_HIPPOPLOT_API AxisRepBase
00050 {
00051 
00052 protected:
00053 
00054   bool m_sci_note_x;
00055   bool m_sci_note_y;
00056 
00060   float m_axis_x_origin;
00061 
00065   float m_axis_y_origin;
00066 
00068   float m_axis_width;
00069 
00071   float m_axis_height;
00072   
00075   double m_font_size;
00076 
00079   double m_x_tick_font_size;
00080 
00083   double m_y_tick_font_size;
00084 
00087   double m_x_font_size;
00088 
00091   double m_y_font_size;
00092 
00095   double m_z_font_size;
00096   
00098   FontBase * m_xLabelFont;
00099       
00101   FontBase * m_yLabelFont;
00102 
00104   FontBase * m_zLabelFont;
00105 
00107   FontBase * m_titleFont;
00108   
00111   bool m_draw_titles;
00112 
00120   void initAxisRect ( ViewBase & view );
00121   
00123   void drawXTickLines ( const AxisModelBase & axisModelX,
00124                         const AxisModelBase & axisModelY,
00125                         const TransformBase & transform,
00126                         ViewBase & view );
00127 
00129   void drawYTickLines ( const AxisModelBase & axisModelX,
00130                         const AxisModelBase & axisModelY,
00131                         const TransformBase & transform,
00132                         ViewBase & view );
00133 
00134  public:
00135 
00138   AxisRepBase();
00139 
00141   AxisRepBase( const AxisRepBase & axis_rep );
00142 
00144   virtual ~AxisRepBase();
00145 
00148   virtual AxisRepBase * clone() = 0;
00149 
00154   void beginPlot ( ViewBase & view );
00155 
00156   
00159   void setXFontSize ( const AxisModelBase & axis_model,
00160                       ViewBase & view );
00161   
00163   void setXLabelFont( FontBase* font );
00164 
00167   FontBase* xLabelFont();
00168   
00171   void setYFontSize ( const AxisModelBase & axis_model, ViewBase & view );
00172   
00174   void setYLabelFont( FontBase* font );
00175 
00178   FontBase* yLabelFont();
00179 
00182   void setZFontSize ( const AxisModelBase & axis_model, ViewBase & view );
00183     
00185   void setZLabelFont( FontBase* font );
00186   
00189   FontBase* zLabelFont();
00190 
00192   void setTitleFont( FontBase* font );
00193   
00196   FontBase* titleFont();
00197   
00199   void setDrawTitles( bool set );
00200   
00202   void drawXLabels( const AxisModelBase & axis_model,
00203                     ViewBase & view, const std::string & x_label );
00205   void drawYLabels( const AxisModelBase & axis_model,
00206                     ViewBase & view, const std::string & y_label );
00207 
00211   virtual void setFontSize( const AxisModelBase * x_axis,
00212                             const AxisModelBase * y_axis,
00213                             const AxisModelBase * z_axis,
00214                             ViewBase & view );
00215   
00218   virtual void drawAxesLines ( TransformBase & transform, 
00219                                ViewBase & view, 
00220                                const Range & x_range,
00221                                const Range & y_range);
00222 
00224   virtual void drawCrossHairs ( double x, double y,
00225                                 TransformBase & transform,
00226                                 ViewBase & view );
00227 
00230   virtual void drawTitle( ViewBase & view, const std::string & title );
00231 
00232   virtual void drawZLabels ( const AxisModelBase & axis_model,
00233                              ViewBase & view, 
00234                              const std::string & z_label ) = 0;
00235 
00239   virtual void drawAllXTicks ( const AxisModelBase & axisModelX,
00240                                const AxisModelBase & axisModelY,
00241                                const TransformBase & transform,
00242                                ViewBase & view );
00243   
00247   virtual void drawAllYTicks ( const AxisModelBase & axisModelX,
00248                                const AxisModelBase & axisModelY,
00249                                const TransformBase & transform,
00250                                ViewBase & view );
00251   
00252 
00257   virtual void drawAllZTicks ( const AxisModelBase & axis_model,
00258                                const TransformBase & transform,
00259                                ViewBase & view ) = 0;
00260 
00266   void drawReferencePoint( const AxisModelBase & axisModel, 
00267                            ViewBase & base,
00268                            const std::string & ref);
00269 
00270 
00272   void drawXMag ( const AxisModelBase & axisModel,
00273                   ViewBase & view, const std::string & mag="");
00274 
00276   void drawYMag ( const AxisModelBase & axisModel,
00277                   ViewBase & view, const std::string & mag="");
00278 
00281   virtual void drawGridLines( const AxisModelBase & axisModelX,
00282                               const AxisModelBase & axisModelY,
00283                               TransformBase & transform,
00284                               ViewBase & view );
00285 
00289   virtual void drawColorScale ( const BinToColor &, ViewBase & );
00290 
00291 protected:
00292 
00294   void drawXTickLabels ( const AxisModelBase & axisModelX,
00295                          const AxisModelBase & axisModelY,
00296                          const TransformBase & transform,
00297                          ViewBase & view );
00298 
00300   void drawYTickLabels ( const AxisModelBase & axisModelX,
00301                          const AxisModelBase & axisModelY,
00302                          const TransformBase & transform,
00303                          ViewBase & view );
00304 
00307   void drawXTickLabel ( const std::string & label, 
00308                         float x, float y,
00309                         ViewBase & view );
00310 
00314   void drawYTickLabels ( const std::vector < AxisTick > & ticks,
00315                          const std::vector < float > & xv,
00316                          const std::vector < float > & yv,
00317                          ViewBase & view );
00318 
00321   void drawYTickLabel ( const std::string & label,
00322                         float x, float y,
00323                         ViewBase & view );
00324 
00325 };
00326 
00327 } // namespace hippodraw
00328 
00329 #endif // _AxisRepBase_H_

Generated for HippoDraw Class Library by doxygen