00001
00002
00014 #ifndef _AxisRepBase_H_
00015 #define _AxisRepBase_H_
00016
00017 #include "pattern/libhippo.h"
00018 #include "graphics/FontBase.h"
00019
00020 #include <string>
00021
00022 class AxisModelBase;
00023 class BinToColor;
00024 class TransformBase;
00025 class ViewBase;
00026 class Range;
00027
00050 class MDL_HIPPOPLOT_API AxisRepBase
00051 {
00052
00053 protected:
00054
00058 float m_axis_x_origin;
00059
00063 float m_axis_y_origin;
00064
00066 float m_axis_width;
00067
00069 float m_axis_height;
00070
00073 double m_font_size;
00074
00077 double m_x_font_size;
00078
00081 double m_y_font_size;
00082
00085 double m_z_font_size;
00086
00088 FontBase * m_xLabelFont;
00089
00091 FontBase * m_yLabelFont;
00092
00094 FontBase * m_zLabelFont;
00095
00097 FontBase * m_titleFont;
00098
00101 bool m_draw_axes;
00102
00105 bool m_draw_titles;
00106
00114 void initAxisRect ( ViewBase & view );
00115
00117 void drawXTickLines ( const AxisModelBase & axisModelX,
00118 const AxisModelBase & axisModelY,
00119 const TransformBase & transform,
00120 ViewBase & view );
00121
00123 void drawYTickLines ( const AxisModelBase & axisModelX,
00124 const AxisModelBase & axisModelY,
00125 const TransformBase & transform,
00126 ViewBase & view );
00127
00128 public:
00129
00132 AxisRepBase();
00133
00135 AxisRepBase( const AxisRepBase & axis_rep );
00136
00138 virtual ~AxisRepBase();
00139
00142 virtual AxisRepBase * clone() = 0;
00143
00148 void beginPlot ( ViewBase & view );
00149
00150
00153 void setXFontSize ( const AxisModelBase & axis_model,
00154 ViewBase & view );
00155
00157 void setXLabelFont( FontBase* font );
00158
00161 FontBase* xLabelFont();
00162
00165 void setYFontSize ( const AxisModelBase & axis_model, ViewBase & view );
00166
00168 void setYLabelFont( FontBase* font );
00169
00172 FontBase* yLabelFont();
00173
00176 void setZFontSize ( const AxisModelBase & axis_model, ViewBase & view );
00177
00179 void setZLabelFont( FontBase* font );
00180
00183 FontBase* zLabelFont();
00184
00186 void setTitleFont( FontBase* font );
00187
00190 FontBase* titleFont();
00191
00193 void setDrawAxes( bool set );
00194
00196 void setDrawTitles( bool set );
00197
00199 void drawXLabels( const AxisModelBase & axis_model,
00200 ViewBase & view, const std::string & x_label );
00202 void drawYLabels( const AxisModelBase & axis_model,
00203 ViewBase & view, const std::string & y_label );
00204
00208 virtual void endPlot() = 0;
00209
00213 virtual void setFontSize( const AxisModelBase * x_axis,
00214 const AxisModelBase * y_axis,
00215 const AxisModelBase * z_axis,
00216 ViewBase & view );
00217
00220 virtual void drawAxesLines ( TransformBase & transform,
00221 ViewBase & view,
00222 const Range & x_range,
00223 const Range & y_range);
00224
00226 virtual void drawCrossHairs ( double x, double y,
00227 TransformBase & transform,
00228 ViewBase & view );
00229
00232 virtual void drawTitle( ViewBase & view, const std::string & title );
00233
00234 virtual void drawZLabels ( const AxisModelBase & axis_model,
00235 ViewBase & view,
00236 const std::string & z_label ) = 0;
00237
00241 virtual void drawAllXTicks ( const AxisModelBase & axisModelX,
00242 const AxisModelBase & axisModelY,
00243 const TransformBase & transform,
00244 ViewBase & view );
00245
00249 virtual void drawAllYTicks ( const AxisModelBase & axisModelX,
00250 const AxisModelBase & axisModelY,
00251 const TransformBase & transform,
00252 ViewBase & view );
00253
00254
00259 virtual void drawAllZTicks ( const AxisModelBase & axis_model,
00260 const TransformBase & transform,
00261 ViewBase & view ) = 0;
00262
00264 void drawYMag ( const AxisModelBase & axisModel,
00265 ViewBase & view );
00266
00269 virtual void drawGridLines( const AxisModelBase & axisModelX,
00270 const AxisModelBase & axisModelY,
00271 TransformBase & transform,
00272 ViewBase & view );
00273
00277 virtual void drawColorScale ( const BinToColor &, ViewBase & );
00278
00279 protected:
00280
00282 void drawXTickLabels ( const AxisModelBase & axisModelX,
00283 const AxisModelBase & axisModelY,
00284 const TransformBase & transform,
00285 ViewBase & view );
00286
00288 void drawYTickLabels ( const AxisModelBase & axisModelX,
00289 const AxisModelBase & axisModelY,
00290 const TransformBase & transform,
00291 ViewBase & view );
00292
00293 };
00294
00295 #endif // _AxisRepBase_H_