HOG2
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
MapEnvironment Class Reference

#include <Map2DEnvironment.h>

Inheritance diagram for MapEnvironment:
Inheritance graph
[legend]
Collaboration diagram for MapEnvironment:
Collaboration graph
[legend]

Public Member Functions

 MapEnvironment (Map *m, bool useOccupancy=false)
 
 MapEnvironment (MapEnvironment *)
 
virtual ~MapEnvironment ()
 
void SetGraphHeuristic (GraphHeuristic *h)
 
GraphHeuristicGetGraphHeuristic ()
 
virtual void GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const
 
bool GetNextSuccessor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove)
 
bool GetNext4Successor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove)
 
bool GetNext8Successor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove)
 
void GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const
 
tDirection GetAction (const xyLoc &s1, const xyLoc &s2) const
 
virtual void ApplyAction (xyLoc &s, tDirection dir) const
 
virtual BaseMapOccupancyInterfaceGetOccupancyInfo ()
 
virtual bool InvertAction (tDirection &a) const
 
std::string GetName ()
 
virtual double HCost (const xyLoc &) const
 Heuristic value between node and the stored goal. More...
 
virtual double HCost (const xyLoc &node1, const xyLoc &node2) const
 Heuristic value between two arbitrary nodes. More...
 
virtual double GCost (const xyLoc &node1, const xyLoc &node2) const
 
virtual double GCost (const xyLoc &node1, const tDirection &act) const
 
bool GoalTest (const xyLoc &node, const xyLoc &goal) const
 
bool GoalTest (const xyLoc &)
 
uint64_t GetMaxHash () const
 
uint64_t GetStateHash (const xyLoc &node) const
 
void GetStateFromHash (uint64_t parent, xyLoc &s) const
 
uint64_t GetActionHash (tDirection act) const
 
virtual void OpenGLDraw () const
 
virtual void OpenGLDraw (const xyLoc &l) const
 
virtual void OpenGLDraw (const xyLoc &l1, const xyLoc &l2, float v) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void OpenGLDraw (const xyLoc &, const tDirection &) const
 
virtual void GLLabelState (const xyLoc &, const char *) const
 
virtual void GLLabelState (const xyLoc &s, const char *str, double scale) const
 
virtual void GLDrawLine (const xyLoc &x, const xyLoc &y) const
 
std::string SVGHeader ()
 
std::string SVGDraw ()
 
std::string SVGDraw (const xyLoc &)
 
std::string SVGLabelState (const xyLoc &, const char *, double scale) const
 
std::string SVGLabelState (const xyLoc &, const char *, double scale, double xoff, double yoff) const
 
std::string SVGDrawLine (const xyLoc &x, const xyLoc &y, int width=1) const
 
std::string SVGFrameRect (int left, int top, int right, int bottom, int width=1)
 
void Draw (Graphics::Display &disp) const
 
void Draw (Graphics::Display &disp, const xyLoc &l) const
 
void DrawAlternate (Graphics::Display &disp, const xyLoc &l) const
 
void Draw (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v) const
 
void DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const char *txt) const
 
void DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v, const char *txt) const
 
void DrawLine (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const
 
void DrawArrow (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const
 
Graphics::point GetStateLoc (const xyLoc &l1)
 
void SetDrawOptions (drawOptions o)
 
MapGetMap () const
 
virtual void GetNextState (const xyLoc &currents, tDirection dir, xyLoc &news) const
 
void StoreGoal (xyLoc &)
 Stores the goal for use by single-state HCost. More...
 
void ClearGoal ()
 Clears the goal from memory. More...
 
bool IsGoalStored () const
 
void SetDiagonalCost (double val)
 
double GetDiagonalCost ()
 
bool FourConnected ()
 
bool EightConnected ()
 
void SetFourConnected ()
 
void SetEightConnected ()
 
- Public Member Functions inherited from SearchEnvironment< xyLoc, tDirection >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const xyLoc &stateID) const
 
virtual void UndoAction (xyLoc &s, tDirection a) const
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const xyLoc &node1, const xyLoc &node2, double parentHCost) const
 
virtual bool GoalTest (const xyLoc &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< xyLoc > &neighbors)
 
virtual double GetPathLength (const xyLoc &start, std::vector< tDirection > &neighbors)
 
virtual void SetOccupancyInfo (OccupancyInterface< xyLoc, tDirection > *)
 
virtual void OpenGLDraw () const
 
virtual void GLDrawPath (const std::vector< xyLoc > &x) const
 
virtual void SetColor (const rgbColor &r) const
 
virtual void SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const
 
virtual void GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const
 
virtual rgbColor GetColor () const
 
virtual void DrawLine (Graphics::Display &display, const xyLoc &x, const xyLoc &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< xyLoc >
 Heuristic ()
 
virtual ~Heuristic ()
 

Protected Attributes

GraphHeuristich
 
Mapmap
 
BaseMapOccupancyInterfaceoi
 
double DIAGONAL_COST
 
bool fourConnected
 
drawOptions drawParams
 
- Protected Attributes inherited from SearchEnvironment< xyLoc, tDirection >
bool bValidSearchGoal
 
xyLoc searchGoal
 
rgbColor color
 
GLfloat transparency
 

Private Member Functions

void GetMaxRect (long terrain, int x, int y, int endx, int endy, std::vector< bool > &drawn, Graphics::rect &r) const
 
void DrawSingleTerrain (long terrain, Graphics::Display &disp, std::vector< bool > &drawn) const
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< xyLoc >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 

Detailed Description

Definition at line 133 of file Map2DEnvironment.h.

Constructor & Destructor Documentation

◆ MapEnvironment() [1/2]

MapEnvironment::MapEnvironment ( Map m,
bool  useOccupancy = false 
)

Definition at line 18 of file Map2DEnvironment.cpp.

References kNoOptions, and ROOT_TWO.

◆ MapEnvironment() [2/2]

MapEnvironment::MapEnvironment ( MapEnvironment me)

Definition at line 31 of file Map2DEnvironment.cpp.

References Map::Clone(), DIAGONAL_COST, fourConnected, kNoOptions, map, and oi.

◆ ~MapEnvironment()

MapEnvironment::~MapEnvironment ( )
virtual

Definition at line 43 of file Map2DEnvironment.cpp.

Member Function Documentation

◆ ApplyAction()

void MapEnvironment::ApplyAction ( xyLoc s,
tDirection  dir 
) const
virtual

◆ ClearGoal()

void MapEnvironment::ClearGoal ( )
inlinevirtual

Clears the goal from memory.

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 205 of file Map2DEnvironment.h.

◆ Draw() [1/3]

void MapEnvironment::Draw ( Graphics::Display disp) const
virtual

◆ Draw() [2/3]

void MapEnvironment::Draw ( Graphics::Display disp,
const xyLoc l 
) const
virtual

◆ Draw() [3/3]

void MapEnvironment::Draw ( Graphics::Display disp,
const xyLoc l1,
const xyLoc l2,
float  v 
) const

◆ DrawAlternate()

void MapEnvironment::DrawAlternate ( Graphics::Display disp,
const xyLoc l 
) const

◆ DrawArrow()

void MapEnvironment::DrawArrow ( Graphics::Display disp,
const xyLoc x,
const xyLoc y,
double  width = 1.0 
) const

◆ DrawLine()

void MapEnvironment::DrawLine ( Graphics::Display disp,
const xyLoc x,
const xyLoc y,
double  width = 1.0 
) const

◆ DrawSingleTerrain()

void MapEnvironment::DrawSingleTerrain ( long  terrain,
Graphics::Display disp,
std::vector< bool > &  drawn 
) const
private

◆ DrawStateLabel() [1/2]

void MapEnvironment::DrawStateLabel ( Graphics::Display disp,
const xyLoc l1,
const char *  txt 
) const

◆ DrawStateLabel() [2/2]

void MapEnvironment::DrawStateLabel ( Graphics::Display disp,
const xyLoc l1,
const xyLoc l2,
float  v,
const char *  txt 
) const

◆ EightConnected()

bool MapEnvironment::EightConnected ( )
inline

Definition at line 210 of file Map2DEnvironment.h.

References fourConnected.

◆ FourConnected()

bool MapEnvironment::FourConnected ( )
inline

Definition at line 209 of file Map2DEnvironment.h.

References fourConnected.

◆ GCost() [1/2]

double MapEnvironment::GCost ( const xyLoc node1,
const tDirection act 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 485 of file Map2DEnvironment.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, and kW.

◆ GCost() [2/2]

double MapEnvironment::GCost ( const xyLoc node1,
const xyLoc node2 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 507 of file Map2DEnvironment.cpp.

References kSwamp, xyLoc::x, and xyLoc::y.

Referenced by MPLRTA::MPLRTAStar::GetPath().

◆ GetAction()

tDirection MapEnvironment::GetAction ( const xyLoc s1,
const xyLoc s2 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 392 of file Map2DEnvironment.cpp.

References kE, kN, kS, kStay, kTeleport, kW, xyLoc::x, and xyLoc::y.

Referenced by Map2DConstrainedEnvironment::GetAction().

◆ GetActionHash()

uint64_t MapEnvironment::GetActionHash ( tDirection  act) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 547 of file Map2DEnvironment.cpp.

◆ GetActions()

void MapEnvironment::GetActions ( const xyLoc nodeID,
std::vector< tDirection > &  actions 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 355 of file Map2DEnvironment.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, kW, loc::x, and loc::y.

Referenced by Map2DConstrainedEnvironment::GetActions().

◆ GetDiagonalCost()

double MapEnvironment::GetDiagonalCost ( )
inline

Definition at line 208 of file Map2DEnvironment.h.

References DIAGONAL_COST.

◆ GetGraphHeuristic()

GraphHeuristic * MapEnvironment::GetGraphHeuristic ( )

Definition at line 49 of file Map2DEnvironment.cpp.

◆ GetMap()

Map* MapEnvironment::GetMap ( ) const
inline

◆ GetMaxHash()

uint64_t MapEnvironment::GetMaxHash ( ) const

Definition at line 529 of file Map2DEnvironment.cpp.

◆ GetMaxRect()

void MapEnvironment::GetMaxRect ( long  terrain,
int  x,
int  y,
int  endx,
int  endy,
std::vector< bool > &  drawn,
Graphics::rect r 
) const
private

Definition at line 953 of file Map2DEnvironment.cpp.

◆ GetName()

std::string MapEnvironment::GetName ( )
inline

Definition at line 151 of file Map2DEnvironment.h.

References Map::GetMapName(), and map.

◆ GetNext4Successor()

bool MapEnvironment::GetNext4Successor ( const xyLoc currOpenNode,
const xyLoc goal,
xyLoc next,
double &  currHCost,
uint64_t &  special,
bool &  validMove 
)

Definition at line 102 of file Map2DEnvironment.cpp.

References kE, kN, kS, kW, xyLoc::x, and xyLoc::y.

◆ GetNext8Successor()

bool MapEnvironment::GetNext8Successor ( const xyLoc currOpenNode,
const xyLoc goal,
xyLoc next,
double &  currHCost,
uint64_t &  special,
bool &  validMove 
)

Definition at line 219 of file Map2DEnvironment.cpp.

◆ GetNextState()

void MapEnvironment::GetNextState ( const xyLoc currents,
tDirection  dir,
xyLoc news 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 1491 of file Map2DEnvironment.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.

◆ GetNextSuccessor()

bool MapEnvironment::GetNextSuccessor ( const xyLoc currOpenNode,
const xyLoc goal,
xyLoc next,
double &  currHCost,
uint64_t &  special,
bool &  validMove 
)

Definition at line 92 of file Map2DEnvironment.cpp.

◆ GetOccupancyInfo()

virtual BaseMapOccupancyInterface* MapEnvironment::GetOccupancyInfo ( )
inlinevirtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 148 of file Map2DEnvironment.h.

References oi.

◆ GetStateFromHash()

void MapEnvironment::GetStateFromHash ( uint64_t  parent,
xyLoc s 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 541 of file Map2DEnvironment.cpp.

References xyLoc::x, and xyLoc::y.

◆ GetStateHash()

uint64_t MapEnvironment::GetStateHash ( const xyLoc node) const
virtual

◆ GetStateLoc()

Graphics::point MapEnvironment::GetStateLoc ( const xyLoc l1)

Definition at line 1385 of file Map2DEnvironment.cpp.

References xyLoc::x, and xyLoc::y.

◆ GetSuccessors()

void MapEnvironment::GetSuccessors ( const xyLoc nodeID,
std::vector< xyLoc > &  neighbors 
) const
virtual

◆ GLDrawLine()

void MapEnvironment::GLDrawLine ( const xyLoc x,
const xyLoc y 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 643 of file Map2DEnvironment.cpp.

References Colors::GetColor(), PI, xyLoc::x, and xyLoc::y.

◆ GLLabelState() [1/2]

void MapEnvironment::GLLabelState ( const xyLoc s,
const char *  str 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 709 of file Map2DEnvironment.cpp.

References Colors::GetColor(), xyLoc::x, and xyLoc::y.

◆ GLLabelState() [2/2]

void MapEnvironment::GLLabelState ( const xyLoc s,
const char *  str,
double  scale 
) const
virtual

Definition at line 686 of file Map2DEnvironment.cpp.

References Colors::GetColor(), xyLoc::x, and xyLoc::y.

◆ GoalTest() [1/2]

bool MapEnvironment::GoalTest ( const xyLoc )
inline

Definition at line 163 of file Map2DEnvironment.h.

◆ GoalTest() [2/2]

bool MapEnvironment::GoalTest ( const xyLoc node,
const xyLoc goal 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 524 of file Map2DEnvironment.cpp.

References xyLoc::x, and xyLoc::y.

◆ HCost() [1/2]

virtual double MapEnvironment::HCost ( const xyLoc node) const
inlinevirtual

Heuristic value between node and the stored goal.

Asserts that the goal is stored

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 154 of file Map2DEnvironment.h.

Referenced by MPLRTA::MPLRTAStar::HCost(), Map2DConstrainedEnvironment::HCost(), and MPLRTA::MPLRTAStar::SetHCost().

◆ HCost() [2/2]

double MapEnvironment::HCost ( const xyLoc node1,
const xyLoc node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 455 of file Map2DEnvironment.cpp.

References max, xyLoc::x, and xyLoc::y.

◆ InvertAction()

bool MapEnvironment::InvertAction ( tDirection a) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 415 of file Map2DEnvironment.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, and kW.

Referenced by Map2DConstrainedEnvironment::InvertAction().

◆ IsGoalStored()

bool MapEnvironment::IsGoalStored ( ) const
inline

Definition at line 206 of file Map2DEnvironment.h.

◆ OpenGLDraw() [1/4]

void MapEnvironment::OpenGLDraw ( ) const
virtual

◆ OpenGLDraw() [2/4]

void MapEnvironment::OpenGLDraw ( const xyLoc initial,
const tDirection dir 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 612 of file Map2DEnvironment.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.

◆ OpenGLDraw() [3/4]

void MapEnvironment::OpenGLDraw ( const xyLoc l) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 573 of file Map2DEnvironment.cpp.

References DrawSphere(), Colors::GetColor(), xyLoc::x, and xyLoc::y.

◆ OpenGLDraw() [4/4]

void MapEnvironment::OpenGLDraw ( const xyLoc ,
const xyLoc ,
float   
) const
virtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 584 of file Map2DEnvironment.cpp.

References DrawSphere(), Colors::GetColor(), xyLoc::x, and xyLoc::y.

◆ SetDiagonalCost()

void MapEnvironment::SetDiagonalCost ( double  val)
inline

Definition at line 207 of file Map2DEnvironment.h.

References DIAGONAL_COST.

◆ SetDrawOptions()

void MapEnvironment::SetDrawOptions ( drawOptions  o)
inline

Definition at line 196 of file Map2DEnvironment.h.

References drawParams.

◆ SetEightConnected()

void MapEnvironment::SetEightConnected ( )
inline

Definition at line 212 of file Map2DEnvironment.h.

References fourConnected.

◆ SetFourConnected()

void MapEnvironment::SetFourConnected ( )
inline

◆ SetGraphHeuristic()

void MapEnvironment::SetGraphHeuristic ( GraphHeuristic h)

Definition at line 54 of file Map2DEnvironment.cpp.

◆ StoreGoal()

void MapEnvironment::StoreGoal ( xyLoc s)
inlinevirtual

Stores the goal for use by single-state HCost.

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 204 of file Map2DEnvironment.h.

◆ SVGDraw() [1/2]

std::string MapEnvironment::SVGDraw ( )

◆ SVGDraw() [2/2]

std::string MapEnvironment::SVGDraw ( const xyLoc l)

◆ SVGDrawLine()

std::string MapEnvironment::SVGDrawLine ( const xyLoc x,
const xyLoc y,
int  width = 1 
) const

◆ SVGFrameRect()

std::string MapEnvironment::SVGFrameRect ( int  left,
int  top,
int  right,
int  bottom,
int  width = 1 
)

◆ SVGHeader()

std::string MapEnvironment::SVGHeader ( )

Definition at line 732 of file Map2DEnvironment.cpp.

◆ SVGLabelState() [1/2]

std::string MapEnvironment::SVGLabelState ( const xyLoc l,
const char *  str,
double  scale 
) const

◆ SVGLabelState() [2/2]

std::string MapEnvironment::SVGLabelState ( const xyLoc l,
const char *  str,
double  scale,
double  xoff,
double  yoff 
) const

Member Data Documentation

◆ DIAGONAL_COST

double MapEnvironment::DIAGONAL_COST
protected

Definition at line 223 of file Map2DEnvironment.h.

Referenced by GetDiagonalCost(), MapEnvironment(), and SetDiagonalCost().

◆ drawParams

drawOptions MapEnvironment::drawParams
protected

Definition at line 225 of file Map2DEnvironment.h.

Referenced by SetDrawOptions().

◆ fourConnected

bool MapEnvironment::fourConnected
protected

◆ h

GraphHeuristic* MapEnvironment::h
protected

Definition at line 220 of file Map2DEnvironment.h.

◆ map

Map* MapEnvironment::map
protected

Definition at line 221 of file Map2DEnvironment.h.

Referenced by GetMap(), GetName(), and MapEnvironment().

◆ oi

BaseMapOccupancyInterface* MapEnvironment::oi
protected

Definition at line 222 of file Map2DEnvironment.h.

Referenced by GetOccupancyInfo(), and MapEnvironment().


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