HOG2
MapSectorAbstraction.h
Go to the documentation of this file.
1 /*
2  * $Id: MapSectorAbstraction.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 8/8/05.
6  * Modified by Nathan Sturtevant on 02/29/20.
7  *
8  * This file is part of HOG2. See https://github.com/nathansttt/hog2 for licensing information.
9  *
10  */
11 
12 #include "MapAbstraction.h"
13 
14 #ifndef MAPSectorABSTRACTION_H
15 #define MAPSectorABSTRACTION_H
16 
17 class MapSectorAbstraction : public MapAbstraction {
18 public:
20  MapSectorAbstraction(Map *, int, int);
21  MapSectorAbstraction(Map *, int);
23  MapAbstraction *Clone(Map *_m) { return new MapSectorAbstraction(_m, sectorSize); }
24 
25  virtual bool Pathable(node *from, node *to);
26 
27  // utility functions
29  virtual void VerifyHierarchy();
30 
31  // hierarchical modifications
33  virtual void RemoveNode(node *n);
35  virtual void RemoveEdge(edge *e, unsigned int absLevel);
37  virtual void AddNode(node *n);
39  virtual void AddEdge(edge *e, unsigned int absLevel);
42  virtual void RepairAbstraction();
43 private:
44  void buildAbstraction();
45  void buildNodeIntoParent(node *n, node *parent);
46  void abstractionBFS(node *which, node *parent, int quadrant);
47  int getQuadrant(node *which);
48 
49  void addEdges(Graph *g);
50  void addNodes(Graph *g);
51 
53 };
54 
55 #endif
MapSectorAbstraction::Pathable
virtual bool Pathable(node *from, node *to)
Definition: MapSectorAbstraction.cpp:38
MapSectorAbstraction
Definition: MapSectorAbstraction.h:17
MapSectorAbstraction::AddEdge
virtual void AddEdge(edge *e, unsigned int absLevel)
add edge to abstraction
Definition: MapSectorAbstraction.cpp:83
MapSectorAbstraction::MapSectorAbstraction
MapSectorAbstraction(Map *, int, int)
Creat a SectorAbstraction of the map.
Definition: MapSectorAbstraction.cpp:19
MapSectorAbstraction::getQuadrant
int getQuadrant(node *which)
Definition: MapSectorAbstraction.cpp:173
MapSectorAbstraction::sectorSize
int sectorSize
Definition: MapSectorAbstraction.h:52
MapSectorAbstraction::~MapSectorAbstraction
~MapSectorAbstraction()
Definition: MapSectorAbstraction.cpp:34
MapSectorAbstraction::Clone
MapAbstraction * Clone(Map *_m)
Definition: MapSectorAbstraction.h:23
MapSectorAbstraction::AddNode
virtual void AddNode(node *n)
add node to abstraction
Definition: MapSectorAbstraction.cpp:76
Graph
A generic Graph class.
Definition: Graph.h:66
MapSectorAbstraction::buildNodeIntoParent
void buildNodeIntoParent(node *n, node *parent)
Definition: MapSectorAbstraction.cpp:164
MapSectorAbstraction::RemoveNode
virtual void RemoveNode(node *n)
remove node from abstraction
Definition: MapSectorAbstraction.cpp:64
MapSectorAbstraction::RemoveEdge
virtual void RemoveEdge(edge *e, unsigned int absLevel)
remove edge from abstraction
Definition: MapSectorAbstraction.cpp:70
MapSectorAbstraction::buildAbstraction
void buildAbstraction()
Definition: MapSectorAbstraction.cpp:95
MapSectorAbstraction::addNodes
void addNodes(Graph *g)
Definition: MapSectorAbstraction.cpp:108
MapSectorAbstraction::addEdges
void addEdges(Graph *g)
Definition: MapSectorAbstraction.cpp:129
MapSectorAbstraction::VerifyHierarchy
virtual void VerifyHierarchy()
verify that the hierarchy is consistent
Definition: MapSectorAbstraction.cpp:58
MapSectorAbstraction::RepairAbstraction
virtual void RepairAbstraction()
This must be called after any of the above add/remove operations.
Definition: MapSectorAbstraction.cpp:91
MapSectorAbstraction::abstractionBFS
void abstractionBFS(node *which, node *parent, int quadrant)
Definition: MapSectorAbstraction.cpp:151
MapAbstraction.h
MapSectorAbstraction::sectorMultiplier
int sectorMultiplier
Definition: MapSectorAbstraction.h:52
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
Map
A tile-based representation of the world.
Definition: Map.h:142
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129