ALMaSS Rodenticide Model ODdox  1.0
IDMapScaled Class Reference

Used to map locations of animals in space. More...

#include <MovementMap.h>

Public Member Functions

void ClearMapValue (unsigned a_x, unsigned a_y)
 
TAnimalGetMapValue (unsigned a_x, unsigned a_y)
 
 IDMapScaled (Landscape *L, int a_gridsize)
 
void SetMapValue (unsigned a_x, unsigned a_y, TAnimal *p)
 
 ~IDMapScaled ()
 
- Public Member Functions inherited from IDMap< TAnimal * >
void ClearMapValue (unsigned x, unsigned y)
 
TAnimalGetMapValue (unsigned x, unsigned y)
 
 IDMap (Landscape *L)
 
void SetMapValue (unsigned x, unsigned y, TAnimal * p)
 
 ~IDMap ()
 

Public Attributes

int m_scale
 
- Public Attributes inherited from IDMap< TAnimal * >
vector< TAnimal * > m_TheMap
 
int maxx
 
int maxy
 

Detailed Description

Used to map locations of animals in space.

Constructor & Destructor Documentation

IDMapScaled::IDMapScaled ( Landscape L,
int  a_gridsize 
)

References m_scale, IDMap< TAnimal * >::m_TheMap, IDMap< TAnimal * >::maxx, IDMap< TAnimal * >::maxy, SetMapValue(), Landscape::SupplySimAreaHeight(), and Landscape::SupplySimAreaWidth().

485  : IDMap<TAnimal*>(L)
486 {
487  m_scale = a_gridsize;
488  maxx = (L->SupplySimAreaWidth() / m_scale) + 1;
489  maxy = (L->SupplySimAreaHeight() / m_scale) + 1;
490  m_TheMap.resize(maxx*maxy);
491  for (int y = 0; y<maxy; y++)
492  {
493  for (int x = 0; x<maxx; x++)
494  {
495  SetMapValue(x, y, NULL);
496  }
497  }
498 }
vector< TAnimal * > m_TheMap
Definition: MovementMap.h:99
int SupplySimAreaWidth(void)
Definition: landscape.h:1556
int maxy
Definition: MovementMap.h:101
int m_scale
Definition: MovementMap.h:135
int SupplySimAreaHeight(void)
Definition: landscape.h:1561
int maxx
Definition: MovementMap.h:100
void SetMapValue(unsigned a_x, unsigned a_y, TAnimal *p)
Definition: MovementMap.h:142
IDMapScaled::~IDMapScaled ( )
502 {
503  ;
504 }

Member Function Documentation

void IDMapScaled::ClearMapValue ( unsigned  a_x,
unsigned  a_y 
)
inline

On calling the a_x,a_y are in map coordinates not grid coords

References MovementMap::m_TheMap, and MovementMap::maxx.

148  {
150  a_x /= m_scale;
151  a_y /= m_scale;
152  m_TheMap[a_x + (maxx*a_y)] = NULL;
153  }
vector< TAnimal * > m_TheMap
Definition: MovementMap.h:99
int m_scale
Definition: MovementMap.h:135
int maxx
Definition: MovementMap.h:100
TAnimal* IDMapScaled::GetMapValue ( unsigned  a_x,
unsigned  a_y 
)
inline

On calling the a_x,a_y are in map coordinates not grid coords

References MovementMap::m_TheMap, and MovementMap::maxx.

136  {
138  a_x /= m_scale;
139  a_y /= m_scale;
140  return m_TheMap[a_x + (maxx*a_y)];
141  }
vector< TAnimal * > m_TheMap
Definition: MovementMap.h:99
int m_scale
Definition: MovementMap.h:135
int maxx
Definition: MovementMap.h:100
void IDMapScaled::SetMapValue ( unsigned  a_x,
unsigned  a_y,
TAnimal p 
)
inline

On calling the a_x,a_y are in map coordinates not grid coords

References MovementMap::m_TheMap, and MovementMap::maxx.

Referenced by IDMapScaled().

142  {
144  a_x /= m_scale;
145  a_y /= m_scale;
146  m_TheMap[a_x + (maxx*a_y)] = p;
147  }
vector< TAnimal * > m_TheMap
Definition: MovementMap.h:99
int m_scale
Definition: MovementMap.h:135
int maxx
Definition: MovementMap.h:100

Member Data Documentation

int IDMapScaled::m_scale

Referenced by IDMapScaled().


The documentation for this class was generated from the following files: