ALMaSS Rodenticide ODdox  1.1
The rodenticide model description following ODdox protocol
IDMapScaled Class Reference

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

#include <MovementMap.h>

Public Member Functions

TAnimalGetMapValue (unsigned a_x, unsigned a_y)
 
void SetMapValue (unsigned a_x, unsigned a_y, TAnimal *p)
 
void ClearMapValue (unsigned a_x, unsigned a_y)
 
 IDMapScaled (Landscape *L, int a_gridsize)
 
 ~IDMapScaled ()
 
- Public Member Functions inherited from IDMap< TAnimal * >
TAnimalGetMapValue (unsigned x, unsigned y)
 
void SetMapValue (unsigned x, unsigned y, TAnimal * p)
 
void ClearMapValue (unsigned x, unsigned y)
 
 IDMap (Landscape *L)
 
 ~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::IDMapScaled ( Landscape L,
int  a_gridsize 
)
497  : IDMap<TAnimal*>(L)
498 {
499  m_scale = a_gridsize;
500  maxx = (L->SupplySimAreaWidth() / m_scale) + 1;
501  maxy = (L->SupplySimAreaHeight() / m_scale) + 1;
502  m_TheMap.resize(maxx*maxy);
503  for (int y = 0; y<maxy; y++)
504  {
505  for (int x = 0; x<maxx; x++)
506  {
507  SetMapValue(x, y, NULL);
508  }
509  }
510 }

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

◆ ~IDMapScaled()

IDMapScaled::~IDMapScaled ( )
514 {
515  ;
516 }

Member Function Documentation

◆ ClearMapValue()

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

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

148  {
150  a_x /= m_scale;
151  a_y /= m_scale;
152  m_TheMap[a_x + (maxx*a_y)] = NULL;
153  }

References m_scale, IDMap< TAnimal * >::m_TheMap, and IDMap< TAnimal * >::maxx.

◆ GetMapValue()

TAnimal* IDMapScaled::GetMapValue ( unsigned  a_x,
unsigned  a_y 
)
inline

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

136  {
138  a_x /= m_scale;
139  a_y /= m_scale;
140  return m_TheMap[a_x + (maxx*a_y)];
141  }

References m_scale, IDMap< TAnimal * >::m_TheMap, and IDMap< TAnimal * >::maxx.

◆ SetMapValue()

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

142  {
144  a_x /= m_scale;
145  a_y /= m_scale;
146  m_TheMap[a_x + (maxx*a_y)] = p;
147  }

References m_scale, IDMap< TAnimal * >::m_TheMap, and IDMap< TAnimal * >::maxx.

Referenced by IDMapScaled().

Member Data Documentation

◆ m_scale

int IDMapScaled::m_scale

The documentation for this class was generated from the following files:
IDMapScaled::m_scale
int m_scale
Definition: MovementMap.h:135
IDMap< TAnimal * >::m_TheMap
vector< TAnimal * > m_TheMap
Definition: MovementMap.h:99
IDMap< TAnimal * >::maxx
int maxx
Definition: MovementMap.h:100
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
IDMap< TAnimal * >
IDMapScaled::SetMapValue
void SetMapValue(unsigned a_x, unsigned a_y, TAnimal *p)
Definition: MovementMap.h:142
IDMap< TAnimal * >::maxy
int maxy
Definition: MovementMap.h:101