O --- O
libPEDSIM Documentation
[HOME] [EXAMPLES] [ECOSYSTEM] [DOCUMENTATION] [DOWNLOAD]
O --- O
ped_scene.h
1 //
2 // pedsim - A microscopic pedestrian simulation system.
3 // Copyright (c) by Christian Gloor
4 //
5 
6 #ifndef _ped_scene_h_
7 #define _ped_scene_h_ 1
8 
9 //disable warnings on 255 char debug symbols
10 #pragma warning (disable : 4786)
11 //disable warnings on extern before template instantiation
12 #pragma warning (disable : 4231)
13 
14 #ifdef _WIN32
15 #ifdef _DLL
16 # define LIBEXPORT __declspec(dllexport)
17 # define EXPIMP_TEMPLATE
18 #else
19 # define LIBEXPORT __declspec(dllimport)
20 # define EXPIMP_TEMPLATE extern
21 #endif
22 #else
23 # define LIBEXPORT
24 # define EXPIMP_TEMPLATE
25 #endif
26 
27 #include <set>
28 #include <vector>
29 #include <map>
30 #include <list>
31 
32 using namespace std;
33 
34 namespace Ped {
35  class OutputWriter;
36  class Tagent;
37  class Tobstacle;
38  class Twaypoint;
39 }
40 
41 EXPIMP_TEMPLATE template class LIBEXPORT std::vector<Ped::Tagent*>;
42 EXPIMP_TEMPLATE template class LIBEXPORT std::vector<Ped::Tobstacle*>;
43 EXPIMP_TEMPLATE template class LIBEXPORT std::vector<Ped::Twaypoint*>;
44 EXPIMP_TEMPLATE template class LIBEXPORT std::vector<Ped::OutputWriter*>;
45 
46 namespace Ped {
47 
48  class Ttree;
49 
68  class LIBEXPORT Tscene {
69  friend class Ped::Tagent;
70  friend class Ped::Ttree;
71 
72  public:
73  Tscene();
74  Tscene(double left, double top, double width, double height);
75  virtual ~Tscene();
76 
77  virtual void clear();
78 
79  virtual void addAgent(Tagent* a);
80  virtual void addObstacle(Tobstacle* o);
81  virtual void addWaypoint(Twaypoint* w);
82  virtual bool removeAgent(Tagent* a);
83  virtual bool removeObstacle(Tobstacle* o);
84  virtual bool removeWaypoint(Twaypoint* w);
85 
86  virtual void cleanup();
87  virtual void moveAgents(double h);
88 
89  set<const Ped::Tagent*> getNeighbors(double x, double y, double dist) const;
90  const vector<Tagent*>& getAllAgents() const { return agents; };
91  const vector<Tobstacle*>& getAllObstacles() const { return obstacles; };
92  const vector<Twaypoint*>& getAllWaypoints() const { return waypoints; };
93 
94  void setOutputWriter(OutputWriter *ow) { outputwriters.push_back(ow); }
95 
96  protected:
97  vector<Tagent*> agents;
98  vector<Tobstacle*> obstacles;
99  vector<Twaypoint*> waypoints;
100  Ttree *tree;
101 
102  long int timestep;
103 
104  void placeAgent(const Ped::Tagent *a);
105  void moveAgent(const Ped::Tagent *a);
106  void getNeighbors(list<const Ped::Tagent*>& neighborList, double x, double y, double dist) const;
107 
108  private:
109  vector<OutputWriter*> outputwriters;
110  map<const Ped::Tagent*, Ttree*> treehash;
111 
112  };
113 }
114 #endif
O --- O

⁠(c) Christian Gloor [ c|h|g|l|o|o|r|@|s|i|l|m|a|r|i|l|.|o|r|g| ]