Sophie

Sophie

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

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_974d432048ef135a7d3fc83794dbf3e9.html">binners</a>
  </div>
</div>
<div class="contents">
<h1>BinnerAxis.cxx</h1><a href="BinnerAxis_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="comment">//inconsistent dll</span>
<a name="l00013"></a>00013 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#include &quot;msdevstudio/MSconfig.h&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#endif</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="BinnerAxis_8h.html" title="hippodraw::BinnerAxis class interface">BinnerAxis.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="keyword">using</span> std::vector;
<a name="l00020"></a>00020 <span class="keyword">using</span> std::string;
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="keyword">using namespace </span>hippodraw;
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="keywordtype">int</span> BinnerAxis::s_num_bins = 50;
<a name="l00025"></a>00025 <span class="keywordtype">double</span> BinnerAxis::s_bin_factor = 0.75;
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a3781c9d06955c73ad2c31fe9a2c867e2">00027</a> BinnerAxis::BinnerAxis ( <span class="keyword">const</span> <span class="keywordtype">char</span> * name )
<a name="l00028"></a>00028   : m_name ( name ), 
<a name="l00029"></a>00029     m_dragging ( false ),
<a name="l00030"></a>00030     m_num_bins ( s_num_bins ), 
<a name="l00031"></a>00031     m_range( 0.0, 50.0 ),
<a name="l00032"></a>00032     m_offset( 0.0 ),
<a name="l00033"></a>00033     m_width ( -1.0 )
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#ae57af280ac293adcbedd9b35b7229b64">00037</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae57af280ac293adcbedd9b35b7229b64" title="The copy constructor.">BinnerAxis::BinnerAxis</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html" title="The base class for the BinnerAxis hierarchy.">BinnerAxis</a> &amp; binner )
<a name="l00038"></a>00038   : m_name ( binner.m_name ),
<a name="l00039"></a>00039     m_dragging ( false ),
<a name="l00040"></a>00040     m_num_bins( binner.m_num_bins ),
<a name="l00041"></a>00041     m_range ( binner.m_range ),
<a name="l00042"></a>00042     m_offset ( binner.m_offset ),
<a name="l00043"></a>00043     m_width ( binner.m_width )
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a51e2f7e1fd80011cf12a8f5d6ff4101b">00047</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a51e2f7e1fd80011cf12a8f5d6ff4101b" title="The destructor.">BinnerAxis::~BinnerAxis</a> ()
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;
<a name="l00052"></a>00052 <a class="code" href="classhippodraw_1_1BinnerAxis.html#a11c23a386abb9eb8a42f0c2c2835d640" title="Returns the name of this binner.">BinnerAxis::</a>
<a name="l00053"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a11c23a386abb9eb8a42f0c2c2835d640">00053</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a11c23a386abb9eb8a42f0c2c2835d640" title="Returns the name of this binner.">name</a> ()<span class="keyword"> const</span>
<a name="l00054"></a>00054 <span class="keyword"></span>{
<a name="l00055"></a>00055   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a6f9e296fcf5c68222c08850e8279025e" title="The name of the binner.">m_name</a>;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="keywordtype">bool</span>
<a name="l00059"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#aea00ee032ab2ade6c600cb8873a96791">00059</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#aea00ee032ab2ade6c600cb8873a96791" title="Returns true if all the bins have the same width.">BinnerAxis::hasEqualWidths</a> ()<span class="keyword"> const</span>
<a name="l00060"></a>00060 <span class="keyword"></span>{
<a name="l00061"></a>00061   <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00062"></a>00062 }
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 <span class="keywordtype">double</span>
<a name="l00065"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#ae0b7f618f15e06d690406ba901667413">00065</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae0b7f618f15e06d690406ba901667413" title="Returns the lower edge of the first bin.">BinnerAxis::axisGetLow</a>()<span class="keyword"> const</span>
<a name="l00066"></a>00066 <span class="keyword"></span>{
<a name="l00067"></a>00067   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="keywordtype">double</span>
<a name="l00071"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a2a03cb0eaf3ffd934b34158dbcc1919e">00071</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a2a03cb0eaf3ffd934b34158dbcc1919e" title="Returns the lower edge of the last + 1 bin.">BinnerAxis::axisGetHigh</a>()<span class="keyword"> const</span>
<a name="l00072"></a>00072 <span class="keyword"></span>{
<a name="l00073"></a>00073   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>();
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1Range.html" title="Expresses a range of values.">Range</a> &amp;
<a name="l00077"></a>00077 <a class="code" href="classhippodraw_1_1BinnerAxis.html#a401b9ceaf58d9b40bb1a926067d1d74f" title="Returns the range.">BinnerAxis::</a>
<a name="l00078"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a401b9ceaf58d9b40bb1a926067d1d74f">00078</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a401b9ceaf58d9b40bb1a926067d1d74f" title="Returns the range.">getRange</a>()<span class="keyword"> const</span>
<a name="l00079"></a>00079 <span class="keyword"></span>{
<a name="l00080"></a>00080   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>;
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 <span class="keywordtype">int</span>
<a name="l00084"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#ab32a846b798ef7a6155c992899611f89">00084</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#ab32a846b798ef7a6155c992899611f89" title="Returns the number of bins.">BinnerAxis::axisNumberOfBins</a> ()<span class="keyword"> const</span>
<a name="l00085"></a>00085 <span class="keyword"></span>{
<a name="l00086"></a>00086   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a>;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 <span class="keywordtype">void</span>
<a name="l00090"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a8ad5aca9b2416bbdacc4efb718d9e9f7">00090</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a8ad5aca9b2416bbdacc4efb718d9e9f7" title="Sets the starting Range.">BinnerAxis::setStartRange</a> ( <span class="keywordtype">bool</span> dragging )<span class="keyword"> const</span>
<a name="l00091"></a>00091 <span class="keyword"></span>{
<a name="l00092"></a>00092   <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#a33768fb41293951bdef93213f6f08dba" title="The status of dragging.">m_dragging</a> == <span class="keyword">false</span> ) {
<a name="l00093"></a>00093     <a class="code" href="classhippodraw_1_1BinnerAxis.html#a54269bfb843c9b6d664ac39a28c07cdb" title="The Range at the start of dragging.">m_range_start</a> = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>;
<a name="l00094"></a>00094   }
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a33768fb41293951bdef93213f6f08dba" title="The status of dragging.">m_dragging</a> = dragging;
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 <span class="keywordtype">void</span>
<a name="l00100"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a6b4a02c58f7d8d2df7758ff176d4773a">00100</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a6b4a02c58f7d8d2df7758ff176d4773a" title="Sets the starting width parameter.">BinnerAxis::setStartWidth</a> ( <span class="keywordtype">bool</span> dragging )<span class="keyword"> const</span>
<a name="l00101"></a>00101 <span class="keyword"></span>{
<a name="l00102"></a>00102   <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#a33768fb41293951bdef93213f6f08dba" title="The status of dragging.">m_dragging</a> == <span class="keyword">false</span> ) {
<a name="l00103"></a>00103     <a class="code" href="classhippodraw_1_1BinnerAxis.html#afa44042bdf228ea2cdb4dcd15d6755e2" title="The width parameter at the start of dragging.">m_width_start</a> = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a5ba0c3bb5218fbc9d33dce426d8f70c0" title="The width parameter for the binning.">m_width</a>;
<a name="l00104"></a>00104   }
<a name="l00105"></a>00105 
<a name="l00106"></a>00106   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a33768fb41293951bdef93213f6f08dba" title="The status of dragging.">m_dragging</a> = dragging;
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 
<a name="l00109"></a>00109 
<a name="l00110"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a48eb5a47beae0249579f9e6b7ffd03ca">00110</a> <span class="keyword">const</span> vector&lt; double &gt; &amp; <a class="code" href="classhippodraw_1_1BinnerAxis.html#a48eb5a47beae0249579f9e6b7ffd03ca" title="Returns the vector of coordinates of the bin edges i.e returns the member m_edges...">BinnerAxis::binEdges</a> ()
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112   
<a name="l00113"></a>00113   <span class="keywordflow">if</span>( <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>.size() == 0 )
<a name="l00114"></a>00114     {
<a name="l00115"></a>00115       <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>.resize( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> + 1);
<a name="l00116"></a>00116       
<a name="l00117"></a>00117       <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>[0] = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a3865c37c86de4e4eafc43b6b40ef05b9" title="Returns the minimum of the range object.">low</a>();
<a name="l00118"></a>00118 
<a name="l00119"></a>00119       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a>; i ++ )
<a name="l00120"></a>00120         <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>[i] = <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>[i-1] + <a class="code" href="classhippodraw_1_1BinnerAxis.html#a2c08ed7c0a6fec02df8133e8943d69e8" title="Returns the width of each bin.">axisBinWidth</a>( i );
<a name="l00121"></a>00121 
<a name="l00122"></a>00122       <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>[ m_num_bins + 1 ] = <a class="code" href="classhippodraw_1_1BinnerAxis.html#ae71dd536700e6f5636df8c8728c1383d" title="The range of the bins.">m_range</a>.<a class="code" href="classhippodraw_1_1Range.html#a10f7231db7f0fe0855fc344e98575714" title="Returns the maximum of the range object.">high</a>();
<a name="l00123"></a>00123     }
<a name="l00124"></a>00124   
<a name="l00125"></a>00125   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1BinnerAxis.html#aa84ab96d23f2e6ced906a720ff7df01e" title="The coordinates of the edges of bins.">m_bin_edges</a>;
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 
<a name="l00128"></a>00128 <span class="keywordtype">double</span>
<a name="l00129"></a>00129 <a class="code" href="classhippodraw_1_1BinnerAxis.html#a002b7efc640b613851377fa58e678566" title="Calculates the bin width parameter when dragging a slider control.">BinnerAxis::</a>
<a name="l00130"></a><a class="code" href="classhippodraw_1_1BinnerAxis.html#a002b7efc640b613851377fa58e678566">00130</a> <a class="code" href="classhippodraw_1_1BinnerAxis.html#a002b7efc640b613851377fa58e678566" title="Calculates the bin width parameter when dragging a slider control.">calcBinWidth</a> ( <span class="keywordtype">int</span> parm, <span class="keywordtype">bool</span> dragging )<span class="keyword"> const</span>
<a name="l00131"></a>00131 <span class="keyword"></span>{
<a name="l00132"></a>00132   <a class="code" href="classhippodraw_1_1BinnerAxis.html#a6b4a02c58f7d8d2df7758ff176d4773a" title="Sets the starting width parameter.">setStartWidth</a> ( dragging );
<a name="l00133"></a>00133 
<a name="l00134"></a>00134   <span class="keywordtype">double</span> multiplier = ( 50 - parm ) / 50.0;
<a name="l00135"></a>00135   <span class="keywordtype">int</span> num_start = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a37aa88906e00d9e9a766db3f1b2b0c3a" title="Returns the number of bins given the width parameter width.">getNob</a> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#afa44042bdf228ea2cdb4dcd15d6755e2" title="The width parameter at the start of dragging.">m_width_start</a> );
<a name="l00136"></a>00136   <span class="keywordflow">if</span> ( num_start == 1 ) {
<a name="l00137"></a>00137     multiplier *= 4.0;
<a name="l00138"></a>00138   }
<a name="l00139"></a>00139   <span class="keywordtype">double</span> num_new = num_start + num_start * multiplier;
<a name="l00140"></a>00140 
<a name="l00141"></a>00141   num_new = std::max ( 1.0, num_new );
<a name="l00142"></a>00142   <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> = static_cast &lt; <span class="keywordtype">int</span> &gt; ( num_new );
<a name="l00143"></a>00143   <span class="keywordtype">double</span> new_width = <a class="code" href="classhippodraw_1_1BinnerAxis.html#a730f95590fd83b70820cd1a5edc8ff0c" title="Calculates the bin width parameter given the number of bins.">calcWidthParm</a> ( <a class="code" href="classhippodraw_1_1BinnerAxis.html#af113be2bbd858bb78acf33de386fac3a" title="The number of bins.">m_num_bins</a> );
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="keywordflow">return</span> new_width;
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147 
</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>