00001
00002
00014 #ifndef _AxisModelBase_H_
00015 #define _AxisModelBase_H_
00016
00017 #include "AxisLoc.h"
00018 #include "Range.h"
00019
00020 class AxisTick;
00021
00031 class MDL_HIPPOPLOT_API AxisModelBase
00032 {
00033 protected:
00034
00036 Range m_range;
00037
00039 mutable Range m_scaled_range;
00040
00044 Range m_start_range;
00045
00047 bool m_is_dragging;
00048
00051 bool m_auto_range;
00052
00054 bool m_empty;
00055
00060 double m_scale_factor;
00061
00063 bool m_scaling_on;
00064
00068 double m_first_tick;
00069
00072 double m_tick_step;
00073
00075 const int m_max_ticks;
00076
00077
00078
00079 int m_num_minor_ticks;
00080
00081 AxisLoc m_label_location;
00082 AxisLoc m_scale_location;
00083
00086 double m_pmag;
00087
00091 bool m_use_pmag;
00092
00095 double m_rmag;
00096
00098 std::vector<AxisTick> m_ticks;
00099
00103 bool m_auto_ticks;
00104
00107 void startDragging ( bool dragging );
00108
00109 public:
00110
00113 AxisModelBase ( AxisLoc label, AxisLoc scale );
00114
00116 AxisModelBase( const AxisModelBase & axis_model );
00117
00119 virtual ~AxisModelBase();
00120
00122 virtual AxisModelBase * clone () const = 0;
00123
00124
00126 void setTickStep( const double & t_step );
00127
00130 double getTickStep() const;
00131
00133 void setFirstTick( const double & first_tick );
00134
00136 double getFirstTick() const;
00137
00139 double getMaxTicks() const;
00140
00142 void setRMag ( const double & rmag );
00143
00145 double getRMag() const;
00146
00148 void setPMag( const double & pmag );
00149
00151 double getPMag() const;
00152
00153
00155 void setRange ( double low, double high, double pos );
00156
00160 void setRange ( const Range &, bool scaled = false );
00161
00163 void setIntersectRange ( const Range &, const Range & );
00164
00166 void setRangePos ( double );
00167
00171 void setUnionRange ( const Range & range );
00172
00174 void setEmpty ();
00175
00182 const Range & getRange ( bool scaled ) const;
00183
00185 void setAutoRanging ( bool flag );
00186
00189 bool isAutoRanging ( ) const;
00190
00192 void setScaleFactor ( double );
00193
00196 double getScaleFactor () const;
00197
00201 bool isScaling () const;
00202
00204 void setScaling ( bool on = true );
00205
00215 virtual bool needPMag () const;
00216
00218 virtual void setUsePMag( const bool & use_p_mag );
00219
00223 virtual bool isLog() const = 0;
00224
00225 AxisLoc getLabelLocation() const;
00226 AxisLoc getScaleLocation() const;
00227
00229 void setTicks( const std::vector<AxisTick> & ticks);
00230
00232 const std::vector<AxisTick> & getTicks() const;
00233
00237 void setAutoTicks ( bool yes );
00238
00242 bool isAutoTicks () const;
00243
00246 virtual const Range & adjustValues ( const Range & limit ) = 0;
00247
00249 virtual const Range & adjustLogValues() = 0;
00250
00257 virtual Range calcLow ( int parm, bool dragging = false ) = 0;
00258
00265 virtual Range calcHigh ( int parm, bool dragging = false ) = 0;
00266
00267 };
00268
00269 #endif // _AxisModel_H_