HOG2
LoadedBBAbstraction.h
Go to the documentation of this file.
1 /*
2  * LoadedBBAbstraction.h
3  * hog
4  *
5  * Created by Nathan Sturtevant on 4/12/06.
6  * Copyright 2006 Nathan Sturtevant. All rights reserved.
7  *
8  */
9 
10 #include "GraphAbstraction.h"
11 #include "GLUtil.h"
12 
13 #include <cassert>
14 
15 #ifndef LOADEDBBABSTRACTION_H
16 #define LOADEDBBABSTRACTION_H
17 
18 
20 public:
21  LoadedBBAbstraction(char *, char *);
22  virtual ~LoadedBBAbstraction();
23  virtual void VerifyHierarchy();
24  double h(node *a, node *b);
25  // virtual void draw();
26  // virtual void rebuild();
27  // virtual int GetRevision() { return 0; }
28 
29  bool Pathable(node *from, node *to);
30  bool Pathable(unsigned int from, unsigned int to);
31  //path *getQuickPath(node *from, node *to);
32  void GetNumAbstractGraphs(node *from, node *to, std::vector<node *> &fromChain, std::vector<node *> &toChain);
33  //node *GetNthParent(node *, int n);
34 
35  //void ClearMarkedNodes();
36  void clearDisplayLists();
37  void OpenGLDraw() const;
38  void ToggleDrawAbstraction(int which);
39  void DrawLevelConnections(node *n) const;
40  void DrawGraph(Graph *g) const;
41  recVec GetNodeLoc(node *n) const;
42 
43  // first step to allowing simple loaded adjustments...
44 // virtual void RemoveNode(node *n);
45 // void RemoveEdge(edge *e, unsigned int absLevel);
46  virtual void AddNode(node *n);
47  virtual void AddEdge(edge *e, unsigned int absLevel);
48  // this must be called after RemoveEdge, but RemoveNode will take care of itself
49  //void RepairAbstraction();
51  edge *findEdgeParent(edge *e, unsigned int absLevel);
52 private:
53  class BoundingBox {
54  public:
55  bool pointInBox(double x, double y, double z);
56  void OpenGLDraw() const;
57  double x1, x2, y1, y2, z1, z2;
58  };
59 
60  std::vector<BoundingBox> boxes;
62  void cleanMemory();
63  void buildAbstractions(Graph *g);
64  void loadBoxes(char *boxFile);
65  Graph *loadGraph(char *fname);
67  void addNodeToParent(node *n, node *parent);
68  void addNeighborsInBox(Graph *g, node *n, int which, node *parent);
69  int findBoundingBox(node *n);
70  unsigned long levelDraw;
71 
72  virtual void RemoveNode(node *) { assert(false); }
74  virtual void RemoveEdge(edge *, unsigned int) { assert(false); }
75  virtual void RepairAbstraction() { }
76 };
77 
78 #endif
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
LoadedBBAbstraction::cleanMemory
void cleanMemory()
Definition: LoadedBBAbstraction.cpp:396
LoadedBBAbstraction::loadBoxes
void loadBoxes(char *boxFile)
Definition: LoadedBBAbstraction.cpp:85
recVec
A generic vector (essentially the same as a point, but offers normalization)
Definition: GLUtil.h:78
LoadedBBAbstraction::clearDisplayLists
void clearDisplayLists()
LoadedBBAbstraction::addNeighborsInBox
void addNeighborsInBox(Graph *g, node *n, int which, node *parent)
Definition: LoadedBBAbstraction.cpp:514
LoadedBBAbstraction::VerifyHierarchy
virtual void VerifyHierarchy()
verify that the hierarchy is consistent
Definition: LoadedBBAbstraction.cpp:293
LoadedBBAbstraction::BoundingBox::y1
double y1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::BoundingBox::x2
double x2
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::~LoadedBBAbstraction
virtual ~LoadedBBAbstraction()
Definition: LoadedBBAbstraction.cpp:80
LoadedBBAbstraction::RepairAbstraction
virtual void RepairAbstraction()
This must be called after any of the above add/remove operations.
Definition: LoadedBBAbstraction.h:75
LoadedBBAbstraction::RemoveEdge
virtual void RemoveEdge(edge *, unsigned int)
remove edge from abstraction
Definition: LoadedBBAbstraction.h:74
LoadedBBAbstraction::GetNumAbstractGraphs
void GetNumAbstractGraphs(node *from, node *to, std::vector< node * > &fromChain, std::vector< node * > &toChain)
Graph
A generic Graph class.
Definition: Graph.h:66
LoadedBBAbstraction::createNewParent
node * createNewParent(Graph *, node *n)
Definition: LoadedBBAbstraction.cpp:539
LoadedBBAbstraction
Definition: LoadedBBAbstraction.h:19
LoadedBBAbstraction::loadGraph
Graph * loadGraph(char *fname)
Definition: LoadedBBAbstraction.cpp:233
LoadedBBAbstraction::BoundingBox::z2
double z2
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::addNodeToParent
void addNodeToParent(node *n, node *parent)
Definition: LoadedBBAbstraction.cpp:531
LoadedBBAbstraction::DrawLevelConnections
void DrawLevelConnections(node *n) const
Definition: LoadedBBAbstraction.cpp:178
LoadedBBAbstraction::boxes
std::vector< BoundingBox > boxes
Definition: LoadedBBAbstraction.h:60
LoadedBBAbstraction::DrawGraph
void DrawGraph(Graph *g) const
Definition: LoadedBBAbstraction.cpp:143
LoadedBBAbstraction::BoundingBox::x1
double x1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::BoundingBox::pointInBox
bool pointInBox(double x, double y, double z)
Definition: LoadedBBAbstraction.cpp:29
LoadedBBAbstraction::findNodeParent
node * findNodeParent(node *n)
Definition: LoadedBBAbstraction.cpp:592
LoadedBBAbstraction::BoundingBox
Definition: LoadedBBAbstraction.h:53
LoadedBBAbstraction::LoadedBBAbstraction
LoadedBBAbstraction(char *, char *)
Construct a new Graph hierarchy.
Definition: LoadedBBAbstraction.cpp:71
GLUtil.h
LoadedBBAbstraction::BoundingBox::z1
double z1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::ToggleDrawAbstraction
void ToggleDrawAbstraction(int which)
Definition: LoadedBBAbstraction.cpp:115
LoadedBBAbstraction::GetNodeLoc
recVec GetNodeLoc(node *n) const
Definition: LoadedBBAbstraction.cpp:198
LoadedBBAbstraction::findEdgeParent
edge * findEdgeParent(edge *e, unsigned int absLevel)
LoadedBBAbstraction::abstractGraph
Graph * abstractGraph(Graph *g)
Definition: LoadedBBAbstraction.cpp:447
LoadedBBAbstraction::findBoundingBox
int findBoundingBox(node *n)
Definition: LoadedBBAbstraction.cpp:498
LoadedBBAbstraction::AddNode
virtual void AddNode(node *n)
add node to abstraction
Definition: LoadedBBAbstraction.cpp:576
LoadedBBAbstraction::levelDraw
unsigned long levelDraw
Definition: LoadedBBAbstraction.h:70
LoadedBBAbstraction::Pathable
bool Pathable(node *from, node *to)
is there a legal path between these 2 nodes?
Definition: LoadedBBAbstraction.cpp:557
LoadedBBAbstraction::h
double h(node *a, node *b)
heuristic cost between any two nodes
Definition: LoadedBBAbstraction.cpp:107
LoadedBBAbstraction::RemoveNode
virtual void RemoveNode(node *)
remove node from abstraction
Definition: LoadedBBAbstraction.h:72
LoadedBBAbstraction::AddEdge
virtual void AddEdge(edge *e, unsigned int absLevel)
add edge to abstraction
Definition: LoadedBBAbstraction.cpp:580
LoadedBBAbstraction::buildAbstractions
void buildAbstractions(Graph *g)
Definition: LoadedBBAbstraction.cpp:415
LoadedBBAbstraction::BoundingBox::y2
double y2
Definition: LoadedBBAbstraction.h:57
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
LoadedBBAbstraction::OpenGLDraw
void OpenGLDraw() const
Definition: LoadedBBAbstraction.cpp:124
GraphAbstraction.h
LoadedBBAbstraction::BoundingBox::OpenGLDraw
void OpenGLDraw() const
Definition: LoadedBBAbstraction.cpp:38
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129