Mercator
Forest.h
1 // This file may be redistributed and modified only under the terms of
2 // the GNU General Public License (See COPYING for details).
3 // Copyright (C) 2004 Alistair Riddoch
4 
5 #ifndef MERCATOR_FOREST_H
6 #define MERCATOR_FOREST_H
7 
8 #include <Mercator/RandCache.h>
9 
10 #include <wfmath/axisbox.h>
11 #include <wfmath/polygon.h>
12 
13 #include <map>
14 
15 namespace Mercator {
16 
17 class Plant;
18 class Area;
19 
20 class SpeciesParameter;
21 
22 typedef std::map<std::string, SpeciesParameter> ParameterDict;
23 
26  public:
28  float min;
30  float range;
31 };
32 
38 class Species {
39  public:
42 
44  float m_deviation;
45 
47  ParameterDict m_parameters;
48 };
49 
56 class Forest {
57  public:
61  typedef std::map<int, Plant> PlantColumn;
62 
67  typedef std::map<int, PlantColumn> PlantStore;
68 
70  typedef std::vector<Species> PlantSpecies;
71  private:
74 
80  unsigned long m_seed;
83 
84  public:
85  explicit Forest(unsigned long seed = 0);
86  ~Forest();
87 
89  Area* getArea() const {
90  return m_area;
91  }
92 
95  return m_species;
96  }
97 
100  const PlantStore & getPlants() const {
101  return m_plants;
102  }
103 
104  void setArea(Area* a);
105 
106  void populate();
107 };
108 
109 }
110 
111 #endif // MERCATOR_FOREST_H