Sophie

Sophie

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

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_e91d7d57230b93275afa36a649c1c346.html">colorreps</a>
  </div>
</div>
<div class="contents">
<h1>BinToColorMap.cxx</h1><a href="BinToColorMap_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="BinToColorMap_8h.html" title="hippodraw::BinToColorMap class interface">BinToColorMap.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00015"></a>00015 <span class="keyword">using</span> std :: string;
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="keyword">namespace </span>hippodraw {
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#a8a0877c15733d748749776570aaba329">00021</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#a8a0877c15733d748749776570aaba329" title="The constructor.">BinToColorMap::BinToColorMap</a> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * name )
<a name="l00022"></a>00022   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( name )
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024   <a class="code" href="classhippodraw_1_1BinToColor.html#a81832d0db8b53d015516aadc7b13060b" title="A set of control points that might be used for the value to color transform.">m_control_points</a>.push_back ( .5 );
<a name="l00025"></a>00025   <a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c" title="Calculate the gamma factor based on current control points.">calcGamma</a> ( );
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="keywordtype">bool</span>
<a name="l00029"></a>00029 <a class="code" href="classhippodraw_1_1BinToColorMap.html#af4a0148f4d3a3e07a421300b9521d135" title="Retruns true.">BinToColorMap::</a>
<a name="l00030"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#af4a0148f4d3a3e07a421300b9521d135">00030</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#af4a0148f4d3a3e07a421300b9521d135" title="Retruns true.">hasControlPoints</a> ()<span class="keyword"> const</span>
<a name="l00031"></a>00031 <span class="keyword"></span>{
<a name="l00032"></a>00032   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keywordtype">void</span>
<a name="l00036"></a>00036 <a class="code" href="classhippodraw_1_1BinToColorMap.html#a6947116ba25f31da074809f0ca8b9cb2" title="Set the value of the control points.">BinToColorMap::</a>
<a name="l00037"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#a6947116ba25f31da074809f0ca8b9cb2">00037</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#a6947116ba25f31da074809f0ca8b9cb2" title="Set the value of the control points.">setControlPoints</a> ( <span class="keyword">const</span> std::vector &lt; double &gt; &amp; points )
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039   <a class="code" href="classhippodraw_1_1BinToColor.html#a81832d0db8b53d015516aadc7b13060b" title="A set of control points that might be used for the value to color transform.">m_control_points</a>[0] = points[0];
<a name="l00040"></a>00040   <a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c" title="Calculate the gamma factor based on current control points.">calcGamma</a> ( );
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keywordtype">void</span>
<a name="l00044"></a>00044 <a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c" title="Calculate the gamma factor based on current control points.">BinToColorMap::</a>
<a name="l00045"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c">00045</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c" title="Calculate the gamma factor based on current control points.">calcGamma</a> ( )
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047   <span class="keywordtype">double</span> f = <a class="code" href="classhippodraw_1_1BinToColor.html#a81832d0db8b53d015516aadc7b13060b" title="A set of control points that might be used for the value to color transform.">m_control_points</a>[0];
<a name="l00048"></a>00048   <a class="code" href="classhippodraw_1_1BinToColorMap.html#a50241d462577efe591bbd456d0c0b015" title="The gamma correction factor.">m_gamma</a> = std::pow ( 100., ( f - 0.5) );
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#a0d585a95505e8a412036fc8ff3eccd21">00051</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#a8a0877c15733d748749776570aaba329" title="The constructor.">BinToColorMap::BinToColorMap</a>( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinToColorMap.html" title="The base class for the value to the color transformation.">BinToColorMap</a> &amp; bin_to_color )
<a name="l00052"></a>00052   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( bin_to_color )
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055   <a class="code" href="classhippodraw_1_1BinToColorMap.html#a1951711673d1297250e9607dc140fc1a" title="vector of reds for color map.">m_reds</a> = bin_to_color.<a class="code" href="classhippodraw_1_1BinToColorMap.html#a1951711673d1297250e9607dc140fc1a" title="vector of reds for color map.">m_reds</a>;
<a name="l00056"></a>00056   <a class="code" href="classhippodraw_1_1BinToColorMap.html#a7b97174c3ea3639f19956c1a869f2276" title="vector of greens for color map.">m_greens</a> = bin_to_color.<a class="code" href="classhippodraw_1_1BinToColorMap.html#a7b97174c3ea3639f19956c1a869f2276" title="vector of greens for color map.">m_greens</a>;
<a name="l00057"></a>00057   <a class="code" href="classhippodraw_1_1BinToColorMap.html#a067a68d593da370b79eeb6f9f0d75fe7" title="vector of blues for color map.">m_blues</a> = bin_to_color.<a class="code" href="classhippodraw_1_1BinToColorMap.html#a067a68d593da370b79eeb6f9f0d75fe7" title="vector of blues for color map.">m_blues</a>;
<a name="l00058"></a>00058   <a class="code" href="classhippodraw_1_1BinToColor.html#a81832d0db8b53d015516aadc7b13060b" title="A set of control points that might be used for the value to color transform.">m_control_points</a> = bin_to_color.<a class="code" href="classhippodraw_1_1BinToColor.html#a81832d0db8b53d015516aadc7b13060b" title="A set of control points that might be used for the value to color transform.">m_control_points</a>;
<a name="l00059"></a>00059   <a class="code" href="classhippodraw_1_1BinToColorMap.html#af14fb979f54ba55f8d5028ad91eb9f8c" title="Calculate the gamma factor based on current control points.">calcGamma</a> ();
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00064"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#a4f81d80fdb2bd44241d20d151bcebada">00064</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#a4f81d80fdb2bd44241d20d151bcebada" title="The destructor.">BinToColorMap::~BinToColorMap</a>()
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keywordtype">void</span>
<a name="l00069"></a>00069 <a class="code" href="classhippodraw_1_1BinToColorMap.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">BinToColorMap::</a>
<a name="l00070"></a><a class="code" href="classhippodraw_1_1BinToColorMap.html#a63a596c7bccb4282016c1a5a4f0cf8a0">00070</a> <a class="code" href="classhippodraw_1_1BinToColorMap.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">doubleToColor</a> ( <span class="keywordtype">double</span> value, <a class="code" href="classhippodraw_1_1Color.html" title="A Color class for creating the color object following the standard RGB color space...">Color</a> &amp; color )<span class="keyword"> const</span>
<a name="l00071"></a>00071 <span class="keyword"></span>{
<a name="l00072"></a>00072   <span class="keywordtype">double</span> tmp = ( value - <a class="code" href="classhippodraw_1_1BinToColor.html#a48e433b9625c7e774073dce89c270905" title="The minimum value expected.">m_vmin</a> ) / <a class="code" href="classhippodraw_1_1BinToColor.html#ae9fd181c15aa94a45d97274d011e7b26" title="The distance of the expected values, i.e.">m_dv</a>;
<a name="l00073"></a>00073   <span class="keywordtype">int</span> index = static_cast &lt; <span class="keywordtype">int</span> &gt; (255. * std::pow( tmp, <a class="code" href="classhippodraw_1_1BinToColorMap.html#a50241d462577efe591bbd456d0c0b015" title="The gamma correction factor.">m_gamma</a>) );
<a name="l00074"></a>00074   assert ( index &lt; 256 );
<a name="l00075"></a>00075   color.<a class="code" href="classhippodraw_1_1Color.html#aff0b32998d700c5a25a89f1b0304b035" title="Sets the color.">setColor</a> ( <a class="code" href="classhippodraw_1_1BinToColorMap.html#a1951711673d1297250e9607dc140fc1a" title="vector of reds for color map.">m_reds</a>[index], <a class="code" href="classhippodraw_1_1BinToColorMap.html#a7b97174c3ea3639f19956c1a869f2276" title="vector of greens for color map.">m_greens</a>[index], <a class="code" href="classhippodraw_1_1BinToColorMap.html#a067a68d593da370b79eeb6f9f0d75fe7" title="vector of blues for color map.">m_blues</a>[index] );
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 } <span class="comment">// namespace hippodraw</span>
<a name="l00079"></a>00079 
</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>