<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Mercator: Forest.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Mercator</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</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> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">Forest.h</div> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This file may be redistributed and modified only under the terms of</span> <a name="l00002"></a>00002 <span class="comment">// the GNU General Public License (See COPYING for details).</span> <a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2004 Alistair Riddoch</span> <a name="l00004"></a>00004 <a name="l00005"></a>00005 <span class="preprocessor">#ifndef MERCATOR_FOREST_H</span> <a name="l00006"></a>00006 <span class="preprocessor"></span><span class="preprocessor">#define MERCATOR_FOREST_H</span> <a name="l00007"></a>00007 <span class="preprocessor"></span> <a name="l00008"></a>00008 <span class="preprocessor">#include <Mercator/RandCache.h></span> <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="preprocessor">#include <wfmath/axisbox.h></span> <a name="l00011"></a>00011 <span class="preprocessor">#include <wfmath/polygon.h></span> <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="preprocessor">#include <map></span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="keyword">namespace </span>Mercator { <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="keyword">class </span>Plant; <a name="l00018"></a>00018 <span class="keyword">class </span>Area; <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="keyword">class </span>SpeciesParameter; <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="keyword">typedef</span> std::map<std::string, SpeciesParameter> ParameterDict; <a name="l00023"></a>00023 <a name="l00025"></a><a class="code" href="classMercator_1_1SpeciesParameter.html">00025</a> <span class="keyword">class </span><a class="code" href="classMercator_1_1SpeciesParameter.html" title="A set of constraints on a plant parameter.">SpeciesParameter</a> { <a name="l00026"></a>00026 <span class="keyword">public</span>: <a name="l00028"></a><a class="code" href="classMercator_1_1SpeciesParameter.html#ab5c0efb6c88180525c677a0a452bfbd6">00028</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1SpeciesParameter.html#ab5c0efb6c88180525c677a0a452bfbd6" title="The minimum value a parameter should take.">min</a>; <a name="l00030"></a><a class="code" href="classMercator_1_1SpeciesParameter.html#ab33d598516288430fc1320e61ca4f363">00030</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1SpeciesParameter.html#ab33d598516288430fc1320e61ca4f363" title="The range of values a parameter should take.">range</a>; <a name="l00031"></a>00031 }; <a name="l00032"></a>00032 <a name="l00038"></a><a class="code" href="classMercator_1_1Species.html">00038</a> <span class="keyword">class </span><a class="code" href="classMercator_1_1Species.html" title="Data about a species of plant in a Forest.">Species</a> { <a name="l00039"></a>00039 <span class="keyword">public</span>: <a name="l00041"></a><a class="code" href="classMercator_1_1Species.html#aba3daa063c674dcb26c2646aec2eeb64">00041</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Species.html#aba3daa063c674dcb26c2646aec2eeb64" title="Probability that this species will occur at each grid node.">m_probability</a>; <a name="l00042"></a>00042 <a name="l00044"></a><a class="code" href="classMercator_1_1Species.html#ad0e8bae03d00a00b2cb063a8e0712e28">00044</a> <span class="keywordtype">float</span> <a class="code" href="classMercator_1_1Species.html#ad0e8bae03d00a00b2cb063a8e0712e28" title="Multiplyer for how deviated from the grid items should be.">m_deviation</a>; <a name="l00045"></a>00045 <a name="l00047"></a><a class="code" href="classMercator_1_1Species.html#aa3e6edad393cfae7fa51314ab18852b6">00047</a> ParameterDict <a class="code" href="classMercator_1_1Species.html#aa3e6edad393cfae7fa51314ab18852b6" title="Arbitrary parameters.">m_parameters</a>; <a name="l00048"></a>00048 }; <a name="l00049"></a>00049 <a name="l00056"></a><a class="code" href="classMercator_1_1Forest.html">00056</a> <span class="keyword">class </span><a class="code" href="classMercator_1_1Forest.html" title="This is the core class for any area to be populated with vegetation.">Forest</a> { <a name="l00057"></a>00057 <span class="keyword">public</span>: <a name="l00061"></a><a class="code" href="classMercator_1_1Forest.html#aab5c8f01f127c3712cec8feecf308b11">00061</a> <span class="keyword">typedef</span> std::map<int, Plant> <a class="code" href="classMercator_1_1Forest.html#aab5c8f01f127c3712cec8feecf308b11" title="STL map to store a sparse array of Plant objects.">PlantColumn</a>; <a name="l00062"></a>00062 <a name="l00067"></a><a class="code" href="classMercator_1_1Forest.html#a411fbb3e363aab7c828dc971a1cb79e7">00067</a> <span class="keyword">typedef</span> std::map<int, PlantColumn> <a class="code" href="classMercator_1_1Forest.html#a411fbb3e363aab7c828dc971a1cb79e7" title="STL map to store a sparse array of PlantColumn objects.">PlantStore</a>; <a name="l00068"></a>00068 <a name="l00070"></a><a class="code" href="classMercator_1_1Forest.html#a1c37d9ff86927f8a321c11d7863fb0fb">00070</a> <span class="keyword">typedef</span> std::vector<Species> <a class="code" href="classMercator_1_1Forest.html#a1c37d9ff86927f8a321c11d7863fb0fb" title="STL vector of plant species in this forest.">PlantSpecies</a>; <a name="l00071"></a>00071 <span class="keyword">private</span>: <a name="l00073"></a><a class="code" href="classMercator_1_1Forest.html#a7e5a46e870cabacd8e2cc603e5052563">00073</a> <a class="code" href="classMercator_1_1Area.html" title="Region of terrain surface which is modified.">Area</a>* <a class="code" href="classMercator_1_1Forest.html#a7e5a46e870cabacd8e2cc603e5052563" title="Area of terrain affected by the presence of this forest.">m_area</a>; <a name="l00074"></a>00074 <a name="l00076"></a><a class="code" href="classMercator_1_1Forest.html#a60c624f6c9d5f4072966cd4781c6e3db">00076</a> <a class="code" href="classMercator_1_1Forest.html#a1c37d9ff86927f8a321c11d7863fb0fb" title="STL vector of plant species in this forest.">PlantSpecies</a> <a class="code" href="classMercator_1_1Forest.html#a60c624f6c9d5f4072966cd4781c6e3db" title="List of species in this forest.">m_species</a>; <a name="l00078"></a><a class="code" href="classMercator_1_1Forest.html#a5165573152c38e263a9a00be0ce74580">00078</a> <a class="code" href="classMercator_1_1Forest.html#a411fbb3e363aab7c828dc971a1cb79e7" title="STL map to store a sparse array of PlantColumn objects.">PlantStore</a> <a class="code" href="classMercator_1_1Forest.html#a5165573152c38e263a9a00be0ce74580" title="2D spatial container with all the vegetation instances in.">m_plants</a>; <a name="l00080"></a><a class="code" href="classMercator_1_1Forest.html#a882a6643f133042f02c49d97367f0121">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classMercator_1_1Forest.html#a882a6643f133042f02c49d97367f0121" title="Seed value used to initialise the random number generator.">m_seed</a>; <a name="l00082"></a><a class="code" href="classMercator_1_1Forest.html#a052c370e85140508359d3379a9890a9e">00082</a> <a class="code" href="classRandCache.html" title="A cache of random values.">RandCache</a> <a class="code" href="classMercator_1_1Forest.html#a052c370e85140508359d3379a9890a9e" title="Cache for optimising random number generation.">m_randCache</a>; <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="keyword">public</span>: <a name="l00085"></a>00085 <span class="keyword">explicit</span> <a class="code" href="classMercator_1_1Forest.html#aa8a24b07cca96b4bcbdfd34f76337f42" title="Construct a new forest with the given seed.">Forest</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> seed = 0); <a name="l00086"></a>00086 <a class="code" href="classMercator_1_1Forest.html#a42699b0a53bd855a5402958c62f0b01f" title="Destruct a forest.">~Forest</a>(); <a name="l00087"></a>00087 <a name="l00089"></a><a class="code" href="classMercator_1_1Forest.html#a3be0de2f6a4ba69bb8d2ee5aa5cd5b2b">00089</a> <a class="code" href="classMercator_1_1Area.html" title="Region of terrain surface which is modified.">Area</a>* <a class="code" href="classMercator_1_1Forest.html#a3be0de2f6a4ba69bb8d2ee5aa5cd5b2b" title="Accessor for polygonal area.">getArea</a>()<span class="keyword"> const </span>{ <a name="l00090"></a>00090 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Forest.html#a7e5a46e870cabacd8e2cc603e5052563" title="Area of terrain affected by the presence of this forest.">m_area</a>; <a name="l00091"></a>00091 } <a name="l00092"></a>00092 <a name="l00094"></a><a class="code" href="classMercator_1_1Forest.html#a3335de1bfb8d303af2d69a002b150b85">00094</a> <a class="code" href="classMercator_1_1Forest.html#a1c37d9ff86927f8a321c11d7863fb0fb" title="STL vector of plant species in this forest.">PlantSpecies</a> & <a class="code" href="classMercator_1_1Forest.html#a3335de1bfb8d303af2d69a002b150b85" title="Accessor for list of species in this forest.">species</a>() { <a name="l00095"></a>00095 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Forest.html#a60c624f6c9d5f4072966cd4781c6e3db" title="List of species in this forest.">m_species</a>; <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <a name="l00100"></a><a class="code" href="classMercator_1_1Forest.html#afc97c7d0b03b3d114ee457a2f4dacd20">00100</a> <span class="keyword">const</span> <a class="code" href="classMercator_1_1Forest.html#a411fbb3e363aab7c828dc971a1cb79e7" title="STL map to store a sparse array of PlantColumn objects.">PlantStore</a> & <a class="code" href="classMercator_1_1Forest.html#afc97c7d0b03b3d114ee457a2f4dacd20" title="Accessor for container of vegetation.">getPlants</a>()<span class="keyword"> const </span>{ <a name="l00101"></a>00101 <span class="keywordflow">return</span> <a class="code" href="classMercator_1_1Forest.html#a5165573152c38e263a9a00be0ce74580" title="2D spatial container with all the vegetation instances in.">m_plants</a>; <a name="l00102"></a>00102 } <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Forest.html#ab8f9d264aa46a7cef0981cf9732d22c8" title="Assign an area to this forest.">setArea</a>(<a class="code" href="classMercator_1_1Area.html" title="Region of terrain surface which is modified.">Area</a>* a); <a name="l00105"></a>00105 <a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classMercator_1_1Forest.html#aca3f6d06b2fd7ad3b00c5ad39765e8a5" title="This function uses a pseudo-random technique to populate the forest with trees. This algorithm as the...">populate</a>(); <a name="l00107"></a>00107 }; <a name="l00108"></a>00108 <a name="l00109"></a>00109 } <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="preprocessor">#endif // MERCATOR_FOREST_H</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated for Mercator by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>