-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.h
50 lines (41 loc) · 1.54 KB
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef MAP_H
#define MAP_H
#include <iostream>
#include "gl_const.h"
#include <sstream>
#include <string>
#include <algorithm>
#include "tinyxml2.h"
//That's the class that stores BOTH grid map data AND start-goal locations.
//getValue reads the input XML and fills the Map object.
//Some naive checks are already included in getValue but still on some corrupted XMLs it may fail,
//so be sure to invoke it passing the correct XML (e.g. with correctly filled map tag, e.g. <map>.
//Map is NOT to be modified during the search. It should be passed as a const pointer.
//Think of it as an "independent" piece of data that is managed by outer (non-search related) proccesses.
//Search algorithm should create it own object/structures needed to run the search on that map.
class Map
{
protected:
int height, width;
int start_i, start_j;
int goal_i, goal_j;
double cellSize;
int** Grid;
public:
Map();
Map(const Map& orig);
virtual ~Map();
virtual bool getMap(const char *FileName);
bool CellIsTraversable (int i, int j) const;
bool CellOnGrid (int i, int j) const;
virtual bool CellIsObstacle(int i, int j) const;
virtual int getValue(int i, int j) const;
int getMapHeight() const;
int getMapWidth() const;
double getCellSize() const;
int getStartI() const;
int getStartJ() const;
int getFinishI() const;
int getFinishJ() const;
};
#endif