Sophie

Sophie

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

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_6dcc65b7c74f97460af44109581e51d3.html">reps</a>
  </div>
</div>
<div class="contents">
<h1>AverageTextRep.cxx</h1><a href="AverageTextRep_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">#include &quot;<a class="code" href="AverageTextRep_8h.html" title="hippodraw::AverageTextRep class interface">AverageTextRep.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="ViewBase_8h.html" title="hippodraw::ViewBase class interface">graphics/ViewBase.h</a>&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;<a class="code" href="string__convert_8h.html" title="The namespace for conversion to string.">pattern/string_convert.h</a>&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="NTupleProjector_8h.html" title="hippodraw::NTupleProjector class interface">projectors/NTupleProjector.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="keyword">using namespace </span>hippodraw;
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="keyword">using</span> std::string;
<a name="l00021"></a>00021 
<a name="l00022"></a><a class="code" href="classhippodraw_1_1AverageTextRep.html#a1dcfbf3dc0610938fb89664ce683c2a3">00022</a> AverageTextRep::AverageTextRep ( )
<a name="l00023"></a>00023   : <a class="code" href="classhippodraw_1_1TextRepBase.html" title="A base class for representations that draws a value as text.">TextRepBase</a> ( <span class="stringliteral">&quot;averagex&quot;</span> )
<a name="l00024"></a>00024 {
<a name="l00025"></a>00025   <a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> = <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a>;
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <a class="code" href="classhippodraw_1_1AverageTextRep.html#a1dcfbf3dc0610938fb89664ce683c2a3" title="The default constructor.">AverageTextRep::</a>
<a name="l00029"></a><a class="code" href="classhippodraw_1_1AverageTextRep.html#a0e1c608d4c959902372f74eab21801c4">00029</a> <a class="code" href="classhippodraw_1_1AverageTextRep.html#a1dcfbf3dc0610938fb89664ce683c2a3" title="The default constructor.">AverageTextRep</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7" title="Axes constants.">hippodraw::Axes::Type</a> axis )
<a name="l00030"></a>00030   : <a class="code" href="classhippodraw_1_1TextRepBase.html" title="A base class for representations that draws a value as text.">TextRepBase</a> ( <span class="stringliteral">&quot;averagex&quot;</span> )
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032   <a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> = axis;
<a name="l00033"></a>00033   <span class="keywordflow">if</span> ( axis == <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">Axes::Y</a> ) <a class="code" href="classhippodraw_1_1RepBase.html#adb41893ba19e889e56c559f25fc1a68a" title="The name of the representation.">m_name</a> = <span class="stringliteral">&quot;averagey&quot;</span> ;
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="classhippodraw_1_1AverageTextRep.html#acbcc7ef7fc605cc0d9fec0af89ff4d88">00036</a> <a class="code" href="classhippodraw_1_1AverageTextRep.html#a1dcfbf3dc0610938fb89664ce683c2a3" title="The default constructor.">AverageTextRep::AverageTextRep</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1AverageTextRep.html" title="A TextRepBase class that draws the projected values as a calculated average.">AverageTextRep</a> &amp; rep )
<a name="l00037"></a>00037   : <a class="code" href="classhippodraw_1_1TextRepBase.html" title="A base class for representations that draws a value as text.">TextRepBase</a>( rep )
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039   <a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> = rep.<a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a>;
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="comment">/* virtual */</span>
<a name="l00043"></a><a class="code" href="classhippodraw_1_1AverageTextRep.html#ab2b96fa7b2189b29a67f432912d081c2">00043</a> <a class="code" href="classhippodraw_1_1RepBase.html" title="The base class for the point representation hierarchy.">RepBase</a> * <a class="code" href="classhippodraw_1_1AverageTextRep.html#ab2b96fa7b2189b29a67f432912d081c2" title="Returns a copy of the object.">AverageTextRep::clone</a> ()
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1AverageTextRep.html#a1dcfbf3dc0610938fb89664ce683c2a3" title="The default constructor.">AverageTextRep</a> ( *<span class="keyword">this</span> );
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keywordtype">void</span>
<a name="l00049"></a>00049 <a class="code" href="classhippodraw_1_1AverageTextRep.html#a4cc64b6a532e957ddfe09425f919c3bd" title="Draws the values from the projector to the view.">AverageTextRep::</a>
<a name="l00050"></a><a class="code" href="classhippodraw_1_1AverageTextRep.html#a4cc64b6a532e957ddfe09425f919c3bd">00050</a> <a class="code" href="classhippodraw_1_1AverageTextRep.html#a4cc64b6a532e957ddfe09425f919c3bd" title="Draws the values from the projector to the view.">drawProjectedValues</a> ( <a class="code" href="classhippodraw_1_1ProjectorBase.html" title="The base class for the Projector hierarchy.">ProjectorBase</a> &amp; projector,
<a name="l00051"></a>00051                       <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> &amp; view )
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054   <span class="keywordtype">double</span> average = projector.<a class="code" href="classhippodraw_1_1ProjectorBase.html#a1c60f056b547997cfc239cf3a9fc9bce" title="Get the Average of all projected values on the specified axis.">getAverage</a> ( <a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> );
<a name="l00055"></a>00055 
<a name="l00056"></a>00056   <span class="keywordtype">string</span> text ( <span class="stringliteral">&quot;average &quot;</span> );
<a name="l00057"></a>00057  
<a name="l00058"></a>00058   <span class="keywordflow">if</span> (<a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> == <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> ) {
<a name="l00059"></a>00059     text += <span class="stringliteral">&quot;X&quot;</span>; 
<a name="l00060"></a>00060   }
<a name="l00061"></a>00061   <span class="keywordflow">if</span> (<a class="code" href="classhippodraw_1_1AverageTextRep.html#a0cc3b8d40711f95477ca3b421141a2ec" title="The axis for which the average is calculated.">m_axis</a> == <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">Axes::Y</a> ) {
<a name="l00062"></a>00062     text += <span class="stringliteral">&quot;Y&quot;</span>;
<a name="l00063"></a>00063   }
<a name="l00064"></a>00064   text += <span class="stringliteral">&quot;-value &quot;</span>;
<a name="l00065"></a>00065   text += <a class="code" href="namespacehippodraw_1_1Axes.html#ae2337bddf33bc8b17dd5c08e665422cd" title="Converts from string representation ot Axes::Type representation.">String::convert</a> ( average );
<a name="l00066"></a>00066 
<a name="l00067"></a>00067   view.<a class="code" href="classhippodraw_1_1ViewBase.html#a22a47195eeee5c3564b9cb9389460ff5" title="Draws a text string at a point in the view&amp;#39;s coordinate system.">drawText</a> ( text, 5, 10, <a class="code" href="classhippodraw_1_1RepBase.html#a62b5da1fc596e97288d8b46245437ade" title="The size of the representation.">m_size</a>, 0, <span class="charliteral">&#39;l&#39;</span>, <span class="charliteral">&#39;t&#39;</span>, <span class="keyword">true</span>, 0, &amp;<a class="code" href="classhippodraw_1_1RepBase.html#a84fab7a272aa627b0cdac824474d3a17" title="The color of the representation.">m_color</a> );
<a name="l00068"></a>00068 }
</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>