Sophie

Sophie

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

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_eff62de51072964fc77c85daa9c2b3ad.html">transforms</a>
  </div>
</div>
<div class="contents">
<h1>LogTransform.cxx</h1><a href="LogTransform_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#endif</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="LogTransform_8h.html" title="LogTransform class interface.">transforms/LogTransform.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="AxisModelBase_8h.html" title="hippodraw::AxisModelBase class interface">axes/AxisModelBase.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="AxisTick_8h.html" title="AxisTick class interface.">axes/AxisTick.h</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#ifdef ITERATOR_MEMBER_DEFECT</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="keyword">using namespace </span>std;
<a name="l00031"></a>00031 <span class="preprocessor">#else</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="keyword">using</span> std::abs;
<a name="l00033"></a>00033 <span class="keyword">using</span> std::log10;
<a name="l00034"></a>00034 <span class="keyword">using</span> std::pow;
<a name="l00035"></a>00035 <span class="keyword">using</span> std::transform;
<a name="l00036"></a>00036 <span class="keyword">using</span> std::vector;
<a name="l00037"></a>00037 <span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="keyword">using namespace </span>hippodraw;
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a38b7bd7f0a43cb5880c37f194238b0b0">00041</a> LogTransform::LogTransform ()
<a name="l00042"></a>00042   : <a class="code" href="classhippodraw_1_1UnaryTransform.html" title="A transform that transforms coordinates in one dimension from one coordinate system...">UnaryTransform</a> ( 10 * DBL_MIN, DBL_MAX )
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   <a class="code" href="classhippodraw_1_1TransformBase.html#adb41893ba19e889e56c559f25fc1a68a" title="Name of the Transform.">m_name</a> = <span class="stringliteral">&quot;Log&quot;</span>;
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a133ded57da1dbd7d6895d97877f65474">00047</a> <a class="code" href="classhippodraw_1_1LogTransform.html#a133ded57da1dbd7d6895d97877f65474" title="The virtual destructor.">LogTransform::~LogTransform</a> ()
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a65091c382bbbe49977ba61e9dcc086df">00051</a> <a class="code" href="classhippodraw_1_1LogTransform.html#a38b7bd7f0a43cb5880c37f194238b0b0" title="The default constructor.">LogTransform::LogTransform</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1LogTransform.html" title="A UnaryTransform which takes the log of the coordinate.">LogTransform</a> &amp; lt )
<a name="l00052"></a>00052   : <a class="code" href="classhippodraw_1_1UnaryTransform.html" title="A transform that transforms coordinates in one dimension from one coordinate system...">UnaryTransform</a> ( lt )
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 <span class="preprocessor">#ifdef CLONE_DEFECT</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><a class="code" href="classhippodraw_1_1TransformBase.html" title="A transform that transforms coordinates from one coordinate system to another.">TransformBase</a> * <a class="code" href="classhippodraw_1_1LogTransform.html#ab88a549aa670d712ff998fda1aa05b73" title="Creates a new Transform object by copying an existing one.">LogTransform::clone</a> () const
<a name="l00058"></a>00058 <span class="preprocessor">#else</span>
<a name="l00059"></a><a class="code" href="classhippodraw_1_1LogTransform.html#ab88a549aa670d712ff998fda1aa05b73">00059</a> <span class="preprocessor"></span><a class="code" href="classhippodraw_1_1LogTransform.html" title="A UnaryTransform which takes the log of the coordinate.">LogTransform</a>  * <a class="code" href="classhippodraw_1_1LogTransform.html#ab88a549aa670d712ff998fda1aa05b73" title="Creates a new Transform object by copying an existing one.">LogTransform::clone</a> () const
<a name="l00060"></a>00060 <span class="preprocessor">#endif</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span>{
<a name="l00062"></a>00062   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1LogTransform.html" title="A UnaryTransform which takes the log of the coordinate.">LogTransform</a> ( *<span class="keyword">this</span> );
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="keywordtype">bool</span>
<a name="l00066"></a>00066 <a class="code" href="classhippodraw_1_1LogTransform.html#a792fef1281c0bcc191b5bf4330f5eeb3">LogTransform::</a>
<a name="l00067"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a792fef1281c0bcc191b5bf4330f5eeb3">00067</a> <a class="code" href="classhippodraw_1_1LogTransform.html#a792fef1281c0bcc191b5bf4330f5eeb3">isLinear</a> ()<span class="keyword"> const</span>
<a name="l00068"></a>00068 <span class="keyword"></span>{
<a name="l00069"></a>00069   <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a><a class="code" href="classhippodraw_1_1LogTransform.html#aee3a2817949711b6b0a3465c032126a8">00072</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1LogTransform.html#aee3a2817949711b6b0a3465c032126a8" title="Transforms the coordinate @ x.">LogTransform::transform</a> ( <span class="keywordtype">double</span> &amp; x )<span class="keyword"> const</span>
<a name="l00073"></a>00073 <span class="keyword"></span>{
<a name="l00074"></a>00074   x = log10 ( x );
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="classhippodraw_1_1LogTransform.html#ae08ffa4131d0bb8a4072fb2c90ee28e9">00077</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1LogTransform.html#ae08ffa4131d0bb8a4072fb2c90ee28e9" title="Inverse transforms the coordinate x.">LogTransform::inverseTransform</a> ( <span class="keywordtype">double</span> &amp; x )<span class="keyword"> const</span>
<a name="l00078"></a>00078 <span class="keyword"></span>{
<a name="l00079"></a>00079   x = pow ( 10.0, x );
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="keywordtype">void</span>
<a name="l00083"></a>00083 <a class="code" href="classhippodraw_1_1LogTransform.html#aee3a2817949711b6b0a3465c032126a8" title="Transforms the coordinate @ x.">LogTransform::</a>
<a name="l00084"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a1005e56655132bca417febd05bb02a74">00084</a> <a class="code" href="classhippodraw_1_1LogTransform.html#aee3a2817949711b6b0a3465c032126a8" title="Transforms the coordinate @ x.">transform</a> ( std::vector &lt; double &gt; &amp; x )<span class="keyword"> const</span>
<a name="l00085"></a>00085 <span class="keyword"></span>{
<a name="l00086"></a>00086 <span class="comment">//  #ifdef TRANSFORM_DEFECT</span>
<a name="l00087"></a>00087   vector&lt; double &gt;::iterator first = x.begin();
<a name="l00088"></a>00088   <span class="keywordflow">for</span> ( ; first != x.end(); ++first ) {
<a name="l00089"></a>00089     *first = log10 ( *first );
<a name="l00090"></a>00090   }
<a name="l00091"></a>00091 <span class="comment">//  #else</span>
<a name="l00092"></a>00092 
<a name="l00093"></a>00093   <span class="comment">// The following doesn&#39;t work for MS BC++ nor gcc 3.0.  It does work</span>
<a name="l00094"></a>00094   <span class="comment">// with older versions of gcc and Sun CC, however.  So, who is right?</span>
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 <span class="comment">//    std::transform ( x.begin (), x.end (), x.begin (), log10 );</span>
<a name="l00097"></a>00097 <span class="comment">//  #endif</span>
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 <span class="comment">/* virtual */</span>
<a name="l00101"></a><a class="code" href="classhippodraw_1_1LogTransform.html#ab36d3909864539674c1cfb50d1ffa66f">00101</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1LogTransform.html#ab36d3909864539674c1cfb50d1ffa66f" title="Validates the Range, and adjusts the argument Range so that the values are positive...">LogTransform::validate</a> ( <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range )<span class="keyword"> const</span>
<a name="l00102"></a>00102 <span class="keyword"></span>{
<a name="l00103"></a>00103   <span class="keywordtype">double</span> lo = range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a> ();
<a name="l00104"></a>00104   <span class="keywordtype">double</span> hi = range.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a> ();
<a name="l00105"></a>00105 
<a name="l00106"></a>00106   <span class="keywordflow">if</span> ( hi &lt;= 0.0 ) hi = 1.0;
<a name="l00107"></a>00107 <span class="comment">//   if ( lo &lt;= 0.0 ) lo = hi - 0.99 * hi;</span>
<a name="l00108"></a>00108   <span class="keywordflow">if</span> ( lo &lt;= 0.0 ) lo = range.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>();
<a name="l00109"></a>00109 
<a name="l00110"></a>00110   range.<a class="code" href="classhippodraw_1_1Range.html#a2618a41860251089e4ab57a83429c27f" title="Sets the minimum of the range object.">setLow</a> ( lo );
<a name="l00111"></a>00111   range.<a class="code" href="classhippodraw_1_1Range.html#a57518687fc2be69b208d7424048b9baa" title="Sets the maximum of the range object.">setHigh</a> ( hi );
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">/* virtual */</span>
<a name="l00115"></a>00115 <span class="keyword">const</span> vector &lt; AxisTick &gt; &amp;
<a name="l00116"></a>00116 <a class="code" href="classhippodraw_1_1LogTransform.html#a63520cdf916ece9fb7de60f014dff1b7" title="Sets the vector of ticks along the axis to which this Log transform is applied.">LogTransform::</a>
<a name="l00117"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a63520cdf916ece9fb7de60f014dff1b7">00117</a> <a class="code" href="classhippodraw_1_1LogTransform.html#a63520cdf916ece9fb7de60f014dff1b7" title="Sets the vector of ticks along the axis to which this Log transform is applied.">setTicks</a> ( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00118"></a>00118 {
<a name="l00119"></a>00119   <a class="code" href="classhippodraw_1_1LogTransform.html#ada2f4d52253c008767b6ac38f94e985b">setTickStep</a>( axis );
<a name="l00120"></a>00120   <a class="code" href="classhippodraw_1_1LogTransform.html#a14bf1587975bfb3064dd9cc74c8ac66a">setFirstTick</a>( axis );
<a name="l00121"></a>00121 
<a name="l00122"></a>00122   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1LogTransform.html#af8a49cf2363c45baf09c0c2b8e1849fb">genTicks</a>( axis );
<a name="l00123"></a>00123 }
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="classhippodraw_1_1LogTransform.html#ada2f4d52253c008767b6ac38f94e985b">00125</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1LogTransform.html#ada2f4d52253c008767b6ac38f94e985b">LogTransform::setTickStep</a>( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a47adba99d1bb0dd9eb9800f931feb672" title="Returns the range represented by this AxisModel.">getRange</a>(<span class="keyword">true</span>);
<a name="l00128"></a>00128   <span class="keywordtype">double</span> low = range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00129"></a>00129   <span class="keywordtype">double</span> high = range.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>();
<a name="l00130"></a>00130   <span class="keywordtype">double</span> rangeMag = high / low;
<a name="l00131"></a>00131   
<a name="l00132"></a>00132   <span class="comment">// The following algorithm determines the magnitude of the range.</span>
<a name="l00133"></a>00133   <span class="keywordtype">double</span> rmag = floor( log10( rangeMag ) );
<a name="l00134"></a>00134 
<a name="l00135"></a>00135   <span class="comment">// This is used to determine the first tick.</span>
<a name="l00136"></a>00136   <span class="keywordtype">double</span> pmag = ceil( log10( low ) );
<a name="l00137"></a>00137 
<a name="l00138"></a>00138   <span class="comment">// Now we find the magnitude between ticks, getting the minimum</span>
<a name="l00139"></a>00139   <span class="comment">// number of ticks without going below 4.</span>
<a name="l00140"></a>00140   <span class="keywordtype">double</span> tmag = floor( rmag / 3.0 );
<a name="l00141"></a>00141 
<a name="l00142"></a>00142   <span class="keywordtype">double</span> tick_step = pow( 10.0, tmag );
<a name="l00143"></a>00143 
<a name="l00144"></a>00144   axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#af933579f4160e62b19ce2fba5f530c91" title="Sets the magnitude of the range.">setRMag</a>( rmag );
<a name="l00145"></a>00145   axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a447254d994d524156b490c0f78dc5c5a" title="Sets the magnitude of the power of ten for the tick labels.">setPMag</a>( pmag );
<a name="l00146"></a>00146   axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#ae8434910717057b1d2e5a92bba63a756" title="Sets the tick step.">setTickStep</a>( tick_step );
<a name="l00147"></a>00147   
<a name="l00148"></a>00148 }
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a14bf1587975bfb3064dd9cc74c8ac66a">00150</a> <span class="keywordtype">void</span> <a class="code" href="classhippodraw_1_1LogTransform.html#a14bf1587975bfb3064dd9cc74c8ac66a">LogTransform::setFirstTick</a>( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00151"></a>00151 {
<a name="l00152"></a>00152   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a47adba99d1bb0dd9eb9800f931feb672" title="Returns the range represented by this AxisModel.">getRange</a>(<span class="keyword">true</span>);
<a name="l00153"></a>00153   <span class="keywordtype">double</span> low = range.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00154"></a>00154   
<a name="l00155"></a>00155   <span class="comment">//double high = range.high();</span>
<a name="l00156"></a>00156   
<a name="l00157"></a>00157   <span class="comment">// This sets the first tick as the low value rounded up to the</span>
<a name="l00158"></a>00158   <span class="comment">// nearest power of 10.</span>
<a name="l00159"></a>00159   <span class="keywordtype">double</span> pmag = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#aa5f0390d0531f504b59bbb13de685328" title="Returns the magnitude of the power of ten for the tick labels.">getPMag</a>();
<a name="l00160"></a>00160   <span class="keywordtype">double</span> first_tick = pow( 10.0, pmag );
<a name="l00161"></a>00161   <span class="keywordtype">double</span> tmp = 0.0;
<a name="l00162"></a>00162   <span class="keywordflow">while</span>( ( tmp = <a class="code" href="classhippodraw_1_1LogTransform.html#abd74bd08997bb9927bc4e82b38b216c8">prevStep</a>( first_tick, axis )) &gt;= low ) {
<a name="l00163"></a>00163     first_tick = tmp;
<a name="l00164"></a>00164   }
<a name="l00165"></a>00165 
<a name="l00166"></a>00166   axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a74b0210580d8668f96dabcc2d2260928" title="Sets the value for first tick step.">setFirstTick</a>( first_tick );
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 
<a name="l00173"></a><a class="code" href="LogTransform_8cxx.html#a5b78abe7ec141d8c13ef2163a0518883">00173</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespacehippodraw.html#a677bae1007193bb8a36edc63239a541a">FLT_EQUAL</a>( <span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y )
<a name="l00174"></a>00174 {
<a name="l00175"></a>00175   <span class="keywordflow">return</span> ( (<span class="keywordtype">double</span>)abs( x - y ) &lt;= 2.0 * ( y * FLT_EPSILON + FLT_MIN ) );
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 
<a name="l00181"></a>00181 <span class="keyword">const</span> vector &lt; AxisTick &gt; &amp;
<a name="l00182"></a>00182 <a class="code" href="classhippodraw_1_1LogTransform.html#af8a49cf2363c45baf09c0c2b8e1849fb">LogTransform::</a>
<a name="l00183"></a><a class="code" href="classhippodraw_1_1LogTransform.html#af8a49cf2363c45baf09c0c2b8e1849fb">00183</a> <a class="code" href="classhippodraw_1_1LogTransform.html#af8a49cf2363c45baf09c0c2b8e1849fb">genTicks</a> ( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00184"></a>00184 {
<a name="l00185"></a>00185   <span class="keywordtype">double</span> ylabel;
<a name="l00186"></a>00186 
<a name="l00187"></a>00187   <span class="keywordtype">int</span> num_ticks = 0;
<a name="l00188"></a>00188 
<a name="l00189"></a>00189   <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>.clear ();
<a name="l00190"></a>00190   
<a name="l00191"></a>00191   <span class="comment">// mag is used for scientific notation.</span>
<a name="l00192"></a>00192   <span class="keywordtype">double</span> mag;
<a name="l00193"></a>00193 
<a name="l00194"></a>00194   <span class="keywordtype">char</span> pstr[10];
<a name="l00195"></a>00195   <span class="keywordtype">char</span> labl[10];
<a name="l00196"></a>00196   
<a name="l00197"></a>00197   <span class="keywordtype">double</span> first_tick = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#ad75d6349899399e6ca07cb1103d86480" title="Returns the value for the first tick step.">getFirstTick</a>();
<a name="l00198"></a>00198   <span class="keywordtype">double</span> tick_step  = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a4421f43d8e6dbd79ef9e5f863b2da21c" title="Returns the tick step in the true coordinate system.">getTickStep</a>();
<a name="l00199"></a>00199   <span class="keywordtype">double</span> scale_factor = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#afbde1a57da2ad6bd8e170d77e36e64bb" title="Returns the scale factor.">getScaleFactor</a>();
<a name="l00200"></a>00200   <span class="keywordtype">double</span> max_ticks    = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#aa9c4760aa8c522cbb7b7ae6dc826d27d" title="Returns the value for maximum number of ticks.">getMaxTicks</a>();
<a name="l00201"></a>00201   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; range = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a47adba99d1bb0dd9eb9800f931feb672" title="Returns the range represented by this AxisModel.">getRange</a>(<span class="keyword">true</span>);
<a name="l00202"></a>00202 
<a name="l00203"></a>00203   <span class="keywordtype">double</span> range_low = range.<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> range_high = range.<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> last_tick = first_tick;<span class="comment">//pow( 10.0, ceil( log10( range_high ) ) );</span>
<a name="l00207"></a>00207   <span class="keywordtype">double</span> tmp = 0.0;
<a name="l00208"></a>00208   <span class="keywordflow">while</span> ( ( tmp = <a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">nextStep</a>( last_tick, axis ) ) &lt;= range_high ) {
<a name="l00209"></a>00209     last_tick = tmp;
<a name="l00210"></a>00210   }
<a name="l00211"></a>00211 
<a name="l00212"></a>00212   <span class="comment">// The flag for scientific notation activation.</span>
<a name="l00213"></a>00213   <span class="keywordtype">bool</span> sci_not = 
<a name="l00214"></a>00214     ( floor( log10( last_tick ) ) &gt; 3.0 ) ||
<a name="l00215"></a>00215     ( floor ( log10 ( first_tick ) ) ) &lt; -3.0;
<a name="l00216"></a>00216   <span class="keywordflow">if</span>( sci_not ) {
<a name="l00217"></a>00217     sprintf( pstr, <span class="stringliteral">&quot;%%1.0fe%%d&quot;</span> );
<a name="l00218"></a>00218   }
<a name="l00219"></a>00219 
<a name="l00220"></a>00220   <span class="keywordtype">double</span> value = first_tick / tick_step;
<a name="l00221"></a>00221   <span class="keywordtype">bool</span> fresh = <span class="keyword">true</span>;
<a name="l00222"></a>00222   <span class="keywordflow">while</span>( value &lt;= range_high || <a class="code" href="namespacehippodraw.html#a677bae1007193bb8a36edc63239a541a">FLT_EQUAL</a>( range_high, value ) ) {
<a name="l00223"></a>00223     <span class="keywordflow">if</span>( num_ticks &gt;= max_ticks ) {
<a name="l00224"></a>00224       <span class="comment">// So far, this has only occurred for empty histograms. The</span>
<a name="l00225"></a>00225       <span class="comment">//easy fix was to do nothing, but there ought to be a better</span>
<a name="l00226"></a>00226       <span class="comment">// way to handle this.</span>
<a name="l00227"></a>00227       <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>;
<a name="l00228"></a>00228     }
<a name="l00229"></a>00229 
<a name="l00230"></a>00230     <span class="keywordflow">if</span>( !fresh ) {
<a name="l00231"></a>00231       value = <a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">nextStep</a>( value, axis );
<a name="l00232"></a>00232     } <span class="keywordflow">else</span> {
<a name="l00233"></a>00233       value *= tick_step;
<a name="l00234"></a>00234       fresh = <span class="keyword">false</span>;
<a name="l00235"></a>00235     }
<a name="l00236"></a>00236 
<a name="l00237"></a>00237     <span class="keywordflow">if</span>( value &gt; range_high ) <span class="keywordflow">break</span>;
<a name="l00238"></a>00238     <span class="keywordflow">if</span>( sci_not ) {
<a name="l00239"></a>00239       mag = floor( log10( value ) );
<a name="l00240"></a>00240       ylabel = value / pow( 10.0, mag );
<a name="l00241"></a>00241       sprintf( pstr, <span class="stringliteral">&quot;%%1.0fe%%d&quot;</span> );
<a name="l00242"></a>00242       sprintf( labl, pstr, ylabel, static_cast&lt;int&gt;( mag ) );
<a name="l00243"></a>00243     } <span class="keywordflow">else</span> {
<a name="l00244"></a>00244       ylabel = value;
<a name="l00245"></a>00245       <span class="keywordtype">double</span> tmp = floor( log10( value ) );
<a name="l00246"></a>00246       <span class="keywordflow">if</span>( tmp &gt; 0.0 ) tmp = 0.0;
<a name="l00247"></a>00247       tmp = fabs( tmp );
<a name="l00248"></a>00248       sprintf( pstr, <span class="stringliteral">&quot;%%1.%df&quot;</span>, static_cast&lt;int&gt;( tmp ) );
<a name="l00249"></a>00249       sprintf( labl, pstr, ylabel );
<a name="l00250"></a>00250     } 
<a name="l00251"></a>00251     
<a name="l00252"></a>00252     <span class="keywordtype">double</span> y = value / scale_factor;
<a name="l00253"></a>00253     <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>.push_back( <a class="code" href="classhippodraw_1_1AxisTick.html" title="A class to maintain tick coordinates and string values.">AxisTick</a> ( y, labl ) );
<a name="l00254"></a>00254     
<a name="l00255"></a>00255     num_ticks++;
<a name="l00256"></a>00256   }
<a name="l00257"></a>00257 
<a name="l00258"></a>00258   <span class="keywordflow">if</span> ( num_ticks &lt; 3 )
<a name="l00259"></a>00259     {
<a name="l00260"></a>00260 
<a name="l00261"></a>00261       <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>.clear();
<a name="l00262"></a>00262       
<a name="l00263"></a>00263       <span class="keywordtype">double</span> xx = (log10(range_high) - log10(range_low)) / 4;
<a name="l00264"></a>00264       <span class="keywordtype">double</span> yy = log10(range_low);
<a name="l00265"></a>00265     
<a name="l00266"></a>00266       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=1; i&lt;4; i++)
<a name="l00267"></a>00267         {
<a name="l00268"></a>00268         
<a name="l00269"></a>00269           value = pow (10.0, xx * i + yy);
<a name="l00270"></a>00270           
<a name="l00271"></a>00271           <span class="keywordflow">if</span>( value &gt; range_high ) <span class="keywordflow">continue</span>;
<a name="l00272"></a>00272           
<a name="l00273"></a>00273           <span class="keywordtype">double</span> tmp = floor( log10( value ) );
<a name="l00274"></a>00274           <span class="keywordflow">if</span>( tmp &gt; 0.0 ) tmp = 0.0;
<a name="l00275"></a>00275           tmp = fabs( tmp );
<a name="l00276"></a>00276           <span class="keywordflow">if</span> (tmp == 0.0)
<a name="l00277"></a>00277             {
<a name="l00278"></a>00278               value = floor(value);
<a name="l00279"></a>00279             }
<a name="l00280"></a>00280       
<a name="l00281"></a>00281           sprintf( pstr, <span class="stringliteral">&quot;%%1.%df&quot;</span>, static_cast&lt;int&gt;( tmp ) );
<a name="l00282"></a>00282           sprintf( labl, pstr, value); 
<a name="l00283"></a>00283       
<a name="l00284"></a>00284           <span class="keywordtype">double</span> y = value / scale_factor;
<a name="l00285"></a>00285           
<a name="l00286"></a>00286           <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>.push_back( <a class="code" href="classhippodraw_1_1AxisTick.html" title="A class to maintain tick coordinates and string values.">AxisTick</a> ( y, labl ) );
<a name="l00287"></a>00287         }
<a name="l00288"></a>00288     }
<a name="l00289"></a>00289 
<a name="l00290"></a>00290   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1LogTransform.html#afb83347aa94ee29360b10d085dba3e02" title="The ticks generated by this transform.">m_ticks</a>;
<a name="l00291"></a>00291 }
<a name="l00292"></a>00292 
<a name="l00293"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">00293</a> <span class="keywordtype">double</span> <a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">LogTransform::nextStep</a> ( <span class="keywordtype">double</span> current, <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00294"></a>00294 {
<a name="l00295"></a>00295   <span class="keywordtype">double</span> tick_step = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a4421f43d8e6dbd79ef9e5f863b2da21c" title="Returns the tick step in the true coordinate system.">getTickStep</a>(); <span class="comment">// Must already be called</span>
<a name="l00296"></a>00296   <span class="keywordflow">if</span>( tick_step == 1.0 ) {
<a name="l00297"></a>00297     <span class="keywordtype">int</span> bottom = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>( current /
<a name="l00298"></a>00298                                  pow( 10.0, floor( log10( current ) ) ) );
<a name="l00299"></a>00299     <span class="comment">// Look! I used a switch statement in C++!!!!!  What this does</span>
<a name="l00300"></a>00300     <span class="comment">// is go through and add the intermediate 2 and 5 ticks if the</span>
<a name="l00301"></a>00301     <span class="comment">// powers of 10 alone would not have given the minimum number of</span>
<a name="l00302"></a>00302     <span class="comment">// ticks.  m_tick_step is completely ignored if the flag is</span>
<a name="l00303"></a>00303     <span class="comment">// true, since it is assumed to be 0.</span>
<a name="l00304"></a>00304     
<a name="l00307"></a>00307     <span class="keywordflow">switch</span>( bottom ) {
<a name="l00308"></a>00308     <span class="keywordflow">case</span> 1:
<a name="l00309"></a>00309       current *= 2.0;
<a name="l00310"></a>00310       <span class="keywordflow">break</span>;
<a name="l00311"></a>00311     <span class="keywordflow">case</span> 2:
<a name="l00312"></a>00312       current /= 2.0;
<a name="l00313"></a>00313       current *= 5.0;
<a name="l00314"></a>00314       <span class="keywordflow">break</span>;
<a name="l00315"></a>00315     <span class="keywordflow">case</span> 3:
<a name="l00316"></a>00316       current /= 4.0;
<a name="l00317"></a>00317       current *= 5.0;
<a name="l00318"></a>00318       <span class="keywordflow">break</span>;
<a name="l00319"></a>00319     <span class="keywordflow">case</span> 4: <span class="comment">// a 5 becomes a 4 sometimes because of round of error</span>
<a name="l00320"></a>00320     <span class="keywordflow">case</span> 5:
<a name="l00321"></a>00321       current *= 2.0;
<a name="l00322"></a>00322       <span class="keywordflow">break</span>;
<a name="l00323"></a>00323     <span class="keywordflow">default</span>:
<a name="l00324"></a>00324       current *= 2.0;
<a name="l00325"></a>00325 <span class="comment">//       assert ( false );</span>
<a name="l00326"></a>00326     }
<a name="l00327"></a>00327   } <span class="keywordflow">else</span> {
<a name="l00328"></a>00328     current *= tick_step;
<a name="l00329"></a>00329   }
<a name="l00330"></a>00330   <span class="keywordflow">return</span> current;
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 
<a name="l00335"></a><a class="code" href="classhippodraw_1_1LogTransform.html#abd74bd08997bb9927bc4e82b38b216c8">00335</a> <span class="keywordtype">double</span> <a class="code" href="classhippodraw_1_1LogTransform.html#abd74bd08997bb9927bc4e82b38b216c8">LogTransform::prevStep</a> ( <span class="keywordtype">double</span> current, <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337   <span class="keywordtype">double</span> tick_step = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a4421f43d8e6dbd79ef9e5f863b2da21c" title="Returns the tick step in the true coordinate system.">getTickStep</a>(); <span class="comment">// It must already be called.</span>
<a name="l00338"></a>00338   <span class="keywordflow">if</span>( tick_step == 1.0 ) {
<a name="l00339"></a>00339     <span class="keywordtype">int</span> base = <span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>( current /
<a name="l00340"></a>00340                                  pow( 10.0, floor( log10( current ) ) ) );
<a name="l00341"></a>00341     <span class="comment">// Look! I used a switch statement in C++!!!!!  What this does</span>
<a name="l00342"></a>00342     <span class="comment">// is go through and add the intermediate 2 and 5 ticks if the</span>
<a name="l00343"></a>00343     <span class="comment">// powers of 10 alone would not have given the minimum number of</span>
<a name="l00344"></a>00344     <span class="comment">// ticks.  m_tick_step is completely ignored if the flag is</span>
<a name="l00345"></a>00345     <span class="comment">// true, since it is assumed to be 0.</span>
<a name="l00346"></a>00346     
<a name="l00347"></a>00347     <span class="keywordflow">switch</span>( base ) {
<a name="l00348"></a>00348     <span class="keywordflow">case</span> 1:
<a name="l00349"></a>00349       current /= 2.0;
<a name="l00350"></a>00350       <span class="keywordflow">break</span>;
<a name="l00351"></a>00351     <span class="keywordflow">case</span> 2:
<a name="l00352"></a>00352       current /= 2.0;
<a name="l00353"></a>00353       <span class="keywordflow">break</span>;
<a name="l00354"></a>00354     <span class="keywordflow">case</span> 4:
<a name="l00355"></a>00355       current /= 5.0;
<a name="l00356"></a>00356       current *= 2.0;
<a name="l00357"></a>00357       <span class="keywordflow">break</span>;
<a name="l00358"></a>00358     <span class="keywordflow">case</span> 5:
<a name="l00359"></a>00359       current /= 5.0;
<a name="l00360"></a>00360       current *= 2.0;
<a name="l00361"></a>00361       <span class="keywordflow">break</span>;
<a name="l00362"></a>00362     <span class="keywordflow">default</span>:
<a name="l00363"></a>00363       assert ( <span class="keyword">false</span> );
<a name="l00364"></a>00364     }
<a name="l00365"></a>00365   } <span class="keywordflow">else</span> {
<a name="l00366"></a>00366     current /= tick_step;
<a name="l00367"></a>00367   }
<a name="l00368"></a>00368   <span class="keywordflow">return</span> current;
<a name="l00369"></a>00369 }
<a name="l00370"></a>00370 
<a name="l00371"></a>00371 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00372"></a><a class="code" href="classhippodraw_1_1LogTransform.html#ae2ab75931c7af475c0d558f24a9236db">00372</a> <a class="code" href="classhippodraw_1_1LogTransform.html#ae2ab75931c7af475c0d558f24a9236db" title="Sets the range of given axis to be a new &amp;quot;nice&amp;quot; within the limits given...">LogTransform::adjustValues</a> ( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis, <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="l00373"></a>00373 {
<a name="l00374"></a>00374   <span class="comment">//Because the low value, the high value, and the length value of the</span>
<a name="l00375"></a>00375   <span class="comment">//range were so frequently used, I added those three fields. There </span>
<a name="l00376"></a>00376   <span class="comment">//should be an improvement in performance.</span>
<a name="l00377"></a>00377   
<a name="l00378"></a>00378   <span class="keywordtype">double</span> mylow, myhigh;
<a name="l00379"></a>00379 
<a name="l00380"></a>00380   <span class="comment">// We want to make sure that this is autoscaled. Therefore, to </span>
<a name="l00381"></a>00381   <span class="comment">// be on the safe side we set the minimum range to 0, so that </span>
<a name="l00382"></a>00382   <span class="comment">// the minimum positive value is used.</span>
<a name="l00383"></a>00383   <span class="comment">//   Range log( 0.0, getRange().high(), getRange().pos() );</span>
<a name="l00384"></a>00384   <span class="comment">//   setRange( log );</span>
<a name="l00385"></a>00385   
<a name="l00386"></a>00386   <a class="code" href="classhippodraw_1_1LogTransform.html#a0df014b4ca10fbb97335a532cfecd69c">adjustLogValues</a>( axis );
<a name="l00387"></a>00387   <a class="code" href="classhippodraw_1_1LogTransform.html#ada2f4d52253c008767b6ac38f94e985b">setTickStep</a>( axis ); <span class="comment">// For tick steps are needed by nextStep() &amp; prevStep().</span>
<a name="l00388"></a>00388 
<a name="l00389"></a>00389   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; init_range = axis.<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="l00390"></a>00390   <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="l00391"></a>00391   <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="l00392"></a>00392 
<a name="l00393"></a>00393   myhigh = mylow = pow( 10.0, axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#aa5f0390d0531f504b59bbb13de685328" title="Returns the magnitude of the power of ten for the tick labels.">getPMag</a>() );
<a name="l00394"></a>00394 
<a name="l00395"></a>00395   <span class="comment">// This decreases mylow so that &quot;myrange&quot; covers the whole range</span>
<a name="l00396"></a>00396   <span class="comment">// and then some.</span>
<a name="l00397"></a>00397   <span class="keywordtype">double</span> scale_factor = axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#afbde1a57da2ad6bd8e170d77e36e64bb" title="Returns the scale factor.">getScaleFactor</a>();
<a name="l00398"></a>00398   <span class="keywordflow">while</span>( mylow &gt;= low * scale_factor ) {
<a name="l00399"></a>00399     mylow = <a class="code" href="classhippodraw_1_1LogTransform.html#abd74bd08997bb9927bc4e82b38b216c8">prevStep</a>( mylow, axis );
<a name="l00400"></a>00400   }
<a name="l00401"></a>00401   
<a name="l00402"></a>00402   <span class="comment">// This increases myhigh so that &quot;myrange&quot; covers the whole range</span>
<a name="l00403"></a>00403   <span class="comment">// and then some.</span>
<a name="l00404"></a>00404   <span class="keywordflow">while</span>( myhigh &lt;= high * scale_factor ) {
<a name="l00405"></a>00405     myhigh = <a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">nextStep</a>( myhigh, axis );
<a name="l00406"></a>00406   }
<a name="l00407"></a>00407   
<a name="l00408"></a>00408   <span class="comment">// If the range has a magnitude &lt; 10.0, reduce the minimum of the</span>
<a name="l00409"></a>00409   <span class="comment">// range by one tick mark.</span>
<a name="l00410"></a>00410   <span class="keywordflow">if</span>( myhigh / mylow &lt; 10.0 ) {
<a name="l00411"></a>00411     mylow = <a class="code" href="classhippodraw_1_1LogTransform.html#abd74bd08997bb9927bc4e82b38b216c8">prevStep</a>( mylow, axis );
<a name="l00412"></a>00412   }
<a name="l00413"></a>00413   
<a name="l00414"></a>00414   <span class="comment">// If the range still has a magnitude &lt; 10.0, increase the maximum</span>
<a name="l00415"></a>00415   <span class="comment">// of the range by one tick mark until the magnitude is 10.0.</span>
<a name="l00416"></a>00416   <span class="keywordflow">while</span>( myhigh / mylow &lt; 10.0 ) {
<a name="l00417"></a>00417     myhigh = <a class="code" href="classhippodraw_1_1LogTransform.html#a6d23bdbdcee6694d68c8357585af3c93">nextStep</a>( myhigh, axis );
<a name="l00418"></a>00418   }
<a name="l00419"></a>00419 
<a name="l00420"></a>00420   myhigh /= scale_factor;
<a name="l00421"></a>00421   mylow  /= scale_factor;
<a name="l00422"></a>00422 
<a name="l00423"></a>00423   <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> new_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="l00424"></a>00424   
<a name="l00425"></a>00425   <span class="comment">// Compare the newrange with init_range. If new range is too wide</span>
<a name="l00426"></a>00426   <span class="comment">// compared to init_range, then do not set newrange.</span>
<a name="l00427"></a>00427 
<a name="l00428"></a>00428   <span class="keywordtype">double</span> new_width = new_range.length();
<a name="l00429"></a>00429   <span class="keywordtype">double</span> init_width = init_range.<a class="code" href="classhippodraw_1_1Range.html#ad207cb443e371f73f07e874c504f60c1" title="Returns the length of the range object.">length</a>();
<a name="l00430"></a>00430   
<a name="l00431"></a>00431   <span class="keywordflow">if</span> ( new_width &gt; init_width * 10 ){  <span class="comment">// This 10 is a hack. Could be any</span>
<a name="l00432"></a>00432                                        <span class="comment">// decent number.</span>
<a name="l00433"></a>00433     <span class="keywordflow">if</span> ( low &lt; 0 ) {
<a name="l00434"></a>00434       low *= 1.05;    <span class="comment">// This 5% is also a hack.</span>
<a name="l00435"></a>00435     }
<a name="l00436"></a>00436     <span class="keywordflow">else</span>{
<a name="l00437"></a>00437       low *= 0.95;
<a name="l00438"></a>00438     }
<a name="l00439"></a>00439     
<a name="l00440"></a>00440     <span class="keywordflow">if</span> ( high &lt; 0 ){
<a name="l00441"></a>00441       high *= 0.95;
<a name="l00442"></a>00442     }
<a name="l00443"></a>00443     <span class="keywordflow">else</span>{
<a name="l00444"></a>00444       high *= 1.05;
<a name="l00445"></a>00445     }
<a name="l00446"></a>00446     
<a name="l00447"></a>00447     <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> newRange ( low, high, init_range.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>() );
<a name="l00448"></a>00448     axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a175253bfecf26b89ced34342b0f2a4b2" title="Sets the Range to overlap of the two ranges.">setIntersectRange</a> ( newRange, limit );
<a name="l00449"></a>00449     <span class="keywordflow">return</span> axis.<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="l00450"></a>00450   
<a name="l00451"></a>00451   }
<a name="l00452"></a>00452 
<a name="l00453"></a>00453   axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#a175253bfecf26b89ced34342b0f2a4b2" title="Sets the Range to overlap of the two ranges.">setIntersectRange</a> ( new_range, limit );
<a name="l00454"></a>00454 
<a name="l00455"></a>00455   <span class="keywordflow">return</span> axis.<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="l00456"></a>00456 }
<a name="l00457"></a>00457 
<a name="l00458"></a>00458 
<a name="l00459"></a><a class="code" href="classhippodraw_1_1LogTransform.html#a0df014b4ca10fbb97335a532cfecd69c">00459</a> <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;  <a class="code" href="classhippodraw_1_1LogTransform.html#a0df014b4ca10fbb97335a532cfecd69c">LogTransform::adjustLogValues</a> ( <a class="code" href="classhippodraw_1_1AxisModelBase.html" title="The AxisModelBase class maintains the Range and scaling of an axis.">AxisModelBase</a> &amp; axis )
<a name="l00460"></a>00460 {
<a name="l00461"></a>00461   <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp; r = axis.<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="l00462"></a>00462   <span class="keywordtype">double</span> low = r.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00463"></a>00463   <span class="keywordtype">double</span> high = r.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>();
<a name="l00464"></a>00464   <span class="keywordtype">double</span> pos = r.<a class="code" href="classhippodraw_1_1Range.html#a4b02f1648e2efd2c179f8398b350285b" title="Returns the first positive element in range.">pos</a>();
<a name="l00465"></a>00465   
<a name="l00466"></a>00466   <span class="keywordflow">if</span>( low &gt; 0.0 ) <span class="keywordflow">return</span> r;
<a name="l00467"></a>00467 
<a name="l00468"></a>00468   <span class="keywordflow">if</span>( pos == high ) { <span class="comment">// Will give no range</span>
<a name="l00469"></a>00469     <span class="keywordtype">double</span> l = pos / 10.0;
<a name="l00470"></a>00470     <span class="keywordtype">double</span> h = pos * 10.0;
<a name="l00471"></a>00471     axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#addffd7d4904f8f6261dae4e2cb51b734" title="Sets the Range to the low and high values.">setRange</a> ( l, h, pos );
<a name="l00472"></a>00472 
<a name="l00473"></a>00473     <span class="keywordflow">return</span> axis.<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="l00474"></a>00474   }
<a name="l00475"></a>00475   <span class="keywordflow">if</span>( pos == DBL_MAX || pos &lt;= 0.0 ) { <span class="comment">// No positive values!!!</span>
<a name="l00476"></a>00476     axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#addffd7d4904f8f6261dae4e2cb51b734" title="Sets the Range to the low and high values.">setRange</a> ( 0.01, 100.0, 1.0 );
<a name="l00477"></a>00477     <span class="keywordflow">return</span> axis.<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="l00478"></a>00478   }
<a name="l00479"></a>00479   <span class="keywordflow">if</span> ( low &lt;= 0.0 ) axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#addffd7d4904f8f6261dae4e2cb51b734" title="Sets the Range to the low and high values.">setRange</a> ( 0.5 * pos, high, pos );
<a name="l00480"></a>00480   <span class="keywordflow">else</span>  axis.<a class="code" href="classhippodraw_1_1AxisModelBase.html#addffd7d4904f8f6261dae4e2cb51b734" title="Sets the Range to the low and high values.">setRange</a> ( pos, high, pos );
<a name="l00481"></a>00481 
<a name="l00482"></a>00482   <span class="keywordflow">return</span> axis.<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="l00483"></a>00483 }
</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>