Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 56

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>HippoDraw Class Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="hippoApp.ico">
</head><body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_d1aed8900ec9d9a2c165e57f18bd6f10.html">axes</a>
  </div>
</div>
<div class="contents">
<h1>AxisModelLinear.cxx</h1><a href="AxisModelLinear_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00016"></a>00016 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="comment">// Include max() and min() missing from MicroSoft Visual C++.</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#endif //_MSC_VER</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;<a class="code" href="AxisModelLinear_8h.html" title="hippodraw::AxisModelLinear class interface">AxisModelLinear.h</a>&quot;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="AxisTick_8h.html" title="AxisTick class interface.">AxisTick.h</a>&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">using</span> std::abs;
<a name="l00031"></a>00031 <span class="keyword">using</span> std::ceil;
<a name="l00032"></a>00032 <span class="keyword">using</span> std::floor;
<a name="l00033"></a>00033 <span class="keyword">using</span> std::log10;
<a name="l00034"></a>00034 <span class="keyword">using</span> std::max;
<a name="l00035"></a>00035 <span class="keyword">using</span> std::min;
<a name="l00036"></a>00036 <span class="keyword">using</span> std::pow;
<a name="l00037"></a>00037 <span class="keyword">using</span> std::string;
<a name="l00038"></a>00038 <span class="keyword">using</span> std::vector;
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keyword">namespace </span>hippodraw {
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#ae9881bcb7b4b2fd92f09b84c5455f9f4">00042</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#ae9881bcb7b4b2fd92f09b84c5455f9f4" title="The constructor sets the location of the ticks, labels, and scale.">AxisModelLinear::AxisModelLinear</a> ( <a class="code" href="AxisLoc_8h.html#a9b53735ee323795d625bf1a39a5c3407" title="The base class for the binner hierarchy.">AxisLoc</a> label_loc, 
<a name="l00043"></a>00043                                    <a class="code" href="AxisLoc_8h.html#a9b53735ee323795d625bf1a39a5c3407" title="The base class for the binner hierarchy.">AxisLoc</a> scale_loc )
<a name="l00044"></a>00044   : <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> ( label_loc, scale_loc )
<a name="l00045"></a>00045 {    
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 
<a name="l00048"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#aa6d4bcfb06e0a7bb93a3b3474dc44afa">00048</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#ae9881bcb7b4b2fd92f09b84c5455f9f4" title="The constructor sets the location of the ticks, labels, and scale.">AxisModelLinear::AxisModelLinear</a>( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis_model )
<a name="l00049"></a>00049   : <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a>( axis_model )
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a23ec8a7f63b1d4475e94396967241211">00053</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a23ec8a7f63b1d4475e94396967241211" title="The destructor.">AxisModelLinear::~AxisModelLinear</a>()
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="comment">/* virtual */</span>
<a name="l00058"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a41fb326349c28aa4a9dfde19710d63b1">00058</a> <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> * <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a41fb326349c28aa4a9dfde19710d63b1" title="The clone function returns an object of its own kind which is a copy of this object...">AxisModelLinear::clone</a>()<span class="keyword"> const</span>
<a name="l00059"></a>00059 <span class="keyword"></span>{
<a name="l00060"></a>00060   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#ae9881bcb7b4b2fd92f09b84c5455f9f4" title="The constructor sets the location of the ticks, labels, and scale.">AxisModelLinear</a>( *<span class="keyword">this</span> );
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="comment">// bool FLT_EQUAL( double x, double y )</span>
<a name="l00064"></a>00064 <span class="comment">// {</span>
<a name="l00065"></a>00065 <span class="comment">//   return ( abs( x - y ) &lt;= 100.0 *  DBL_EPSILON  );</span>
<a name="l00066"></a>00066 <span class="comment">// }</span>
<a name="l00067"></a>00067 
<a name="l00068"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#ac030832465ab51a9ccb670874b70bd4e">00068</a> <span class="keywordtype">bool</span> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#ac030832465ab51a9ccb670874b70bd4e" title="Returns false because this class represents a linear scale.">AxisModelLinear::isLog</a>()<span class="keyword"> const </span>
<a name="l00069"></a>00069 <span class="keyword"></span>{ 
<a name="l00070"></a>00070   <span class="keywordflow">return</span> <span class="keyword">false</span>; 
<a name="l00071"></a>00071 }
<a name="l00072"></a>00072 
<a name="l00073"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a2162425b32653426fe8637e351769968">00073</a> <span class="keywordtype">bool</span> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a2162425b32653426fe8637e351769968" title="The following functions are used by the AxisRepBase * object.">AxisModelLinear::needPMag</a> ()<span class="keyword"> const</span>
<a name="l00074"></a>00074 <span class="keyword"></span>{
<a name="l00075"></a>00075   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#a8274a754380fa31a3fc07466fd6a3240" title="A flag to indicate that one will using scientific notation.">m_use_pmag</a>;
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00079"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a4bb5f7b30f8aeca0bc6c6a4426ff4ebd">00079</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a4bb5f7b30f8aeca0bc6c6a4426ff4ebd" title="Sets the number of minor ticks that are between the major ones.">AxisModelLinear::adjustValues</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; limit )
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081   <span class="comment">//Because the low value, the high value, and the length value of the</span>
<a name="l00082"></a>00082   <span class="comment">//range were so frequently used, I added those three fields. There </span>
<a name="l00083"></a>00083   <span class="comment">//should be an improvement in performance.</span>
<a name="l00084"></a>00084   <span class="keywordtype">double</span> mylow, myhigh;
<a name="l00085"></a>00085   
<a name="l00086"></a>00086   <span class="comment">//The use of a step field and of a mag field will be explained when</span>
<a name="l00087"></a>00087   <span class="comment">//they are first initialized.</span>
<a name="l00088"></a>00088   <span class="keywordtype">double</span> step, magnitude;
<a name="l00089"></a>00089   
<a name="l00090"></a>00090   <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a756cd123abb9b5e712e793b0195376cc" title="Adjusts the range for nice logging.">adjustLogValues</a>();
<a name="l00091"></a>00091   <span class="keyword">const</span> <span class="keywordtype">int</span> N_NICE = 6;
<a name="l00092"></a>00092 <span class="preprocessor">#ifndef __STDC__</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span>  <span class="keyword">static</span>
<a name="l00094"></a>00094 <span class="preprocessor">#endif</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>    <span class="keywordtype">float</span> nice[N_NICE] = { 1.0, 2.0, 2.5,
<a name="l00096"></a>00096                            4.0, 5.0, 7.5 };
<a name="l00097"></a>00097 
<a name="l00098"></a>00098   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; init_range = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a47adba99d1bb0dd9eb9800f931feb672" title="Returns the range represented by this AxisModel.">getRange</a> ( <span class="keyword">false</span> );
<a name="l00099"></a>00099   <span class="keywordtype">double</span> low = init_range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00100"></a>00100   <span class="keywordtype">double</span> high = init_range.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00101"></a>00101   <span class="keywordflow">if</span> ( low == high ) {  <span class="comment">// all values in same bin</span>
<a name="l00102"></a>00102     <span class="keywordflow">if</span> ( low &gt; 0.0 ) low *= 0.95;
<a name="l00103"></a>00103     <span class="keywordflow">else</span>  low *= 1.05;
<a name="l00104"></a>00104 
<a name="l00105"></a>00105     <span class="keywordflow">if</span> ( high &gt; 0.0 ) high *= 1.05;
<a name="l00106"></a>00106     <span class="keywordflow">else</span> high *= 0.95;
<a name="l00107"></a>00107 
<a name="l00108"></a>00108     <a class="code" href="classhippodraw_1_1AxisModelBase.html#addffd7d4904f8f6261dae4e2cb51b734" title="Sets the Range to the low and high values.">setRange</a> ( low, high, low );
<a name="l00109"></a>00109   }  
<a name="l00110"></a>00110   <span class="comment">//setTickStep();</span>
<a name="l00111"></a>00111   <span class="keywordtype">double</span> range_length;
<a name="l00112"></a>00112   
<a name="l00113"></a>00113   <span class="keywordtype">int</span> i;
<a name="l00114"></a>00114   
<a name="l00115"></a>00115   <span class="comment">//double tick_step = getTickStep();</span>
<a name="l00116"></a>00116   <span class="comment">//tick_step /= m_scale_factor;</span>
<a name="l00117"></a>00117   <span class="comment">//myhigh = mylow = floor( low / tick_step ) * tick_step;</span>
<a name="l00118"></a>00118 
<a name="l00119"></a>00119   <span class="comment">// This increases myhigh so that &quot;myrange&quot; covers the whole range</span>
<a name="l00120"></a>00120   <span class="comment">// and then some.</span>
<a name="l00121"></a>00121   <span class="comment">//while( myhigh &lt;= high ) myhigh += tick_step;</span>
<a name="l00122"></a>00122   mylow  = low  - 0.05*(high-low);
<a name="l00123"></a>00123   myhigh = high + 0.05*(high-low);
<a name="l00124"></a>00124 
<a name="l00125"></a>00125   range_length = myhigh - mylow;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127   <span class="comment">// We have now decided on a range.  This tries to move low/high a</span>
<a name="l00128"></a>00128   <span class="comment">// little to end up on a nice number.</span>
<a name="l00129"></a>00129 
<a name="l00130"></a>00130   <span class="comment">// First checks if either end is near 0.0</span>
<a name="l00131"></a>00131   <span class="keywordflow">if</span>( low &gt;= 0.0 &amp;&amp; range_length &gt; ( 1.05 * high ) ) {
<a name="l00132"></a>00132     <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> range ( 0.0, range_length );
<a name="l00133"></a>00133     <a class="code" href="classhippodraw_1_1AxisModelBase.html#a175253bfecf26b89ced34342b0f2a4b2" title="Sets the Range to overlap of the two ranges.">setIntersectRange</a> ( range, limit );
<a name="l00134"></a>00134     <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>;
<a name="l00135"></a>00135   }
<a name="l00136"></a>00136   <span class="keywordflow">if</span>( high &lt;= 0.0 &amp;&amp; -range_length &lt; ( 1.05 * low ) ) {
<a name="l00137"></a>00137     <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> range ( -range_length, 0.0 );
<a name="l00138"></a>00138     <a class="code" href="classhippodraw_1_1AxisModelBase.html#a175253bfecf26b89ced34342b0f2a4b2" title="Sets the Range to overlap of the two ranges.">setIntersectRange</a> ( range, limit );
<a name="l00139"></a>00139     <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>;
<a name="l00140"></a>00140   }
<a name="l00141"></a>00141 
<a name="l00142"></a>00142   <span class="comment">// magnitude is used to hold the magnitude of the high or low values.</span>
<a name="l00143"></a>00143 
<a name="l00144"></a>00144   i = N_NICE - 1;
<a name="l00145"></a>00145   <span class="keywordflow">if</span>( myhigh != 0.0 )
<a name="l00146"></a>00146     magnitude = ceil( log10( abs( myhigh ) ) );
<a name="l00147"></a>00147   <span class="keywordflow">else</span>
<a name="l00148"></a>00148     magnitude = ceil( log10( abs( mylow ) ) );
<a name="l00149"></a>00149   
<a name="l00150"></a>00150   <span class="comment">// What this part does is go through the low, giving it round</span>
<a name="l00151"></a>00151   <span class="comment">// numbers first, but more coarse over time.</span>
<a name="l00152"></a>00152 
<a name="l00153"></a>00153   <span class="keywordflow">do</span> {
<a name="l00154"></a>00154     step = nice[i] * pow( 10.0, magnitude );
<a name="l00155"></a>00155     mylow = floor( low / step ) * step;
<a name="l00156"></a>00156     myhigh = mylow + 1.05 * range_length;
<a name="l00157"></a>00157     i--;
<a name="l00158"></a>00158     <span class="keywordflow">if</span>( i &lt; 0 ) {
<a name="l00159"></a>00159       i = N_NICE - 1;
<a name="l00160"></a>00160       magnitude--;
<a name="l00161"></a>00161     }
<a name="l00162"></a>00162   } <span class="keywordflow">while</span>( myhigh &lt; high );
<a name="l00163"></a>00163 
<a name="l00164"></a>00164   <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> range ( mylow, myhigh, init_range.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>() );  
<a name="l00165"></a>00165 
<a name="l00166"></a>00166   <a class="code" href="classhippodraw_1_1AxisModelBase.html#a175253bfecf26b89ced34342b0f2a4b2" title="Sets the Range to overlap of the two ranges.">setIntersectRange</a> ( range, limit );
<a name="l00167"></a>00167 
<a name="l00168"></a>00168   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>;
<a name="l00169"></a>00169 }
<a name="l00170"></a>00170 
<a name="l00171"></a>00171 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00172"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a756cd123abb9b5e712e793b0195376cc">00172</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a756cd123abb9b5e712e793b0195376cc" title="Adjusts the range for nice logging.">AxisModelLinear::adjustLogValues</a>()
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174   <span class="comment">// This doesn&#39;t do jack.</span>
<a name="l00175"></a>00175   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#a47adba99d1bb0dd9eb9800f931feb672" title="Returns the range represented by this AxisModel.">getRange</a>(<span class="keyword">false</span>);
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 
<a name="l00180"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a64ba10231c6565373522fe8a57284b1e">00180</a> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a64ba10231c6565373522fe8a57284b1e">AxisModelLinear::calcLow</a> ( <span class="keywordtype">int</span> parm, <span class="keywordtype">bool</span> dragging )
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182   <a class="code" href="classhippodraw_1_1AxisModelBase.html#ab09ff3762ac8d888dbdf6162f92d4daa" title="Sets the member m_start_dragging to the current range if dragging is starting.">startDragging</a> ( dragging );
<a name="l00183"></a>00183 
<a name="l00184"></a>00184   <span class="keywordtype">double</span> length = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#ad207cb443e371f73f07e874c504f60c1" title="Returns the length of the range object.">length</a> ();
<a name="l00185"></a>00185   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00186"></a>00186   <span class="keywordtype">double</span> high = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00187"></a>00187 
<a name="l00188"></a>00188   <span class="keywordtype">double</span> multiplier = ( parm - 50 ) / 50.0;
<a name="l00189"></a>00189   <span class="keywordtype">double</span> new_low = min ( low + length * multiplier, high );
<a name="l00190"></a>00190 
<a name="l00191"></a>00191   <span class="keywordflow">if</span>( new_low == <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>() ) <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>;
<a name="l00192"></a>00192 
<a name="l00193"></a>00193   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> ( new_low, high, <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>() );
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00198"></a><a class="code" href="classhippodraw_1_1AxisModelLinear.html#a35ce3f35fecb5248d73cc961746d8554">00198</a> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> <a class="code" href="classhippodraw_1_1AxisModelLinear.html#a35ce3f35fecb5248d73cc961746d8554">AxisModelLinear::calcHigh</a> ( <span class="keywordtype">int</span> parm, <span class="keywordtype">bool</span> dragging )
<a name="l00199"></a>00199 {
<a name="l00200"></a>00200   <a class="code" href="classhippodraw_1_1AxisModelBase.html#ab09ff3762ac8d888dbdf6162f92d4daa" title="Sets the member m_start_dragging to the current range if dragging is starting.">startDragging</a> ( dragging );
<a name="l00201"></a>00201 
<a name="l00202"></a>00202   <span class="keywordtype">double</span> length = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#ad207cb443e371f73f07e874c504f60c1" title="Returns the length of the range object.">length</a> ();
<a name="l00203"></a>00203   <span class="keywordtype">double</span> low = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00204"></a>00204   <span class="keywordtype">double</span> high = <a class="code" href="classhippodraw_1_1AxisModelBase.html#a6b2cf38e8271f05740ec08fc20ed6c4f" title="The starting range before start of dragging events.">m_start_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00205"></a>00205 
<a name="l00206"></a>00206   <span class="keywordtype">double</span> multiplier = ( parm - 50 ) / 50.0;
<a name="l00207"></a>00207   <span class="keywordtype">double</span> new_high = max ( high + length * multiplier, low );
<a name="l00208"></a>00208 
<a name="l00209"></a>00209   <span class="keywordflow">if</span>( new_high == <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>() ) <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> ( low, new_high, <a class="code" href="classhippodraw_1_1AxisModelBase.html#ae71dd536700e6f5636df8c8728c1383d" title="The current range of the axis.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>() );
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 } <span class="comment">// namespace hippodraw</span>
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</a> </small></address>
</body>
</html>