Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RoadMapPath.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright © and trademark ™ 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
44 #ifndef __ROADMAP_PATH_H__
45 #define __ROADMAP_PATH_H__
46 
47 #include "mengeCommon.h"
48 
49 namespace Menge {
50 
51  class RoadMapPath;
52 
53  #ifdef _WIN32
54  #include <hash_map>
58  typedef stdext::hash_map< size_t, RoadMapPath * > PathMap;
59  #else
60  #ifndef DOXYGEN_SHOULD_SKIP_THIS
61  #include <tr1/unordered_map>
65  typedef std::tr1::unordered_map< size_t, RoadMapPath * > PathMap;
66  #endif // DOXYGEN_SHOULD_SKIP_THIS
67  #endif
68 
69 
70  namespace Agents {
71  class BaseAgent;
72  class PrefVelocity;
73  }
74 
75  namespace BFSM {
76  class Goal;
77  }
78 
82  class RoadMapPath {
83  public:
89  RoadMapPath( size_t pointCount );
90 
94  ~RoadMapPath();
95 
102  void setWayPoint( size_t i, const Vector2 & pos );
103 
109  inline void setGoalPos( const BFSM::Goal * goal ) { _goal = goal; }
110 
117  void setPrefDirection( const Agents::BaseAgent * agent, Agents::PrefVelocity & pVel );
118 
125  inline size_t getWayPointCount() const { return _wayPointCount; }
126 
136  Vector2 getWayPoint( size_t i ) const;
137 
143  const BFSM::Goal * getGoal() const { return _goal; }
144 
150  inline size_t getTargetID() const { return _targetID; }
151 
152  protected:
156  const BFSM::Goal * _goal;
157 
163 
167  size_t _targetID;
168 
173 
178 
179  };
180 } // namespace Menge
181 #endif // __ROADMAP_PATH_H__
size_t getWayPointCount() const
Reports the number of waypoints in the path.
Definition: RoadMapPath.h:125
size_t _targetID
The index of the current target.
Definition: RoadMapPath.h:167
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
void setPrefDirection(const Agents::BaseAgent *agent, Agents::PrefVelocity &pVel)
Sets the direction of the preferred velocity (and target).
Definition: RoadMapPath.cpp:72
~RoadMapPath()
Destructor.
Definition: RoadMapPath.cpp:59
Vector2 getWayPoint(size_t i) const
Returns the position of the ith waypoint.
Definition: RoadMapPath.cpp:127
size_t _wayPointCount
The number of way points in the path.
Definition: RoadMapPath.h:172
The base, abstract class defining goals.
Definition: Goal.h:110
const BFSM::Goal * _goal
The ultimate goal.
Definition: RoadMapPath.h:156
void setWayPoint(size_t i, const Vector2 &pos)
Sets the position of the ith waypoint.
Definition: RoadMapPath.cpp:65
void setGoalPos(const BFSM::Goal *goal)
Sets the ultimate goal.
Definition: RoadMapPath.h:109
Vector2 _validPos
The last valid position – validity means the target goal was visible.
Definition: RoadMapPath.h:162
The namespace contains the Behavior Finite State Machine (BFSM) definition.
A path on a roadmap between vertices.
Definition: RoadMapPath.h:82
Vector2 * _wayPoints
The way points along the path.
Definition: RoadMapPath.h:177
const BFSM::Goal * getGoal() const
Returns the ultimate goal.
Definition: RoadMapPath.h:143
RoadMapPath(size_t pointCount)
Constructor.
Definition: RoadMapPath.cpp:53
The definition of a preferred velocity.
Definition: PrefVelocity.h:68
Defines the basic agent properties and functionality that all simulation agents share.
Definition: BaseAgent.h:123
size_t getTargetID() const
Returns the current target waypoint index.
Definition: RoadMapPath.h:150
The namespace that contains the basic simulation mechanisms.