O --- O
libPEDSIM Documentation
[HOME] [EXAMPLES] [ECOSYSTEM] [DOCUMENTATION] [DOWNLOAD]
O --- O
ped_tree.h
1 //
2 // pedsim - A microscopic pedestrian simulation system.
3 // Copyright (c) by Christian Gloor
4 //
5 
6 #ifndef _ped_tree_h_
7 #define _ped_tree_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 
29 using namespace std;
30 
31 namespace Ped {
32  class Tagent;
33  class Tscene;
34 }
35 
36 EXPIMP_TEMPLATE template class LIBEXPORT std::set<const Ped::Tagent*>;
37 
38 namespace Ped {
39  class LIBEXPORT Ttree {
40  friend class Tscene;
41 
42  public:
43  Ttree(Ped::Tscene *scene, int depth, double x, double y, double w, double h);
44  virtual ~Ttree();
45 
46  virtual void clear();
47 
48  virtual void addAgent(const Ped::Tagent *a);
49  virtual void moveAgent(const Ped::Tagent *a);
50  virtual bool removeAgent(const Ped::Tagent *a);
51 
52  virtual set<const Ped::Tagent*> getAgents() const;
53  virtual void getAgents(list<const Ped::Tagent*>& outputList) const;
54 
55  virtual bool intersects(double px, double py, double pr) const;
56 
57  double getx() const { return x; };
58  double gety() const { return y; };
59  double getw() const { return w; };
60  double geth() const { return h; };
61 
62  double getdepth() const { return depth; };
63 
64  protected:
65  virtual int cut();
66  virtual void addChildren();
67  Ttree* getChildByPosition(double x, double y);
68 
69  bool isleaf;
70  double x;
71  double y;
72  double w;
73  double h;
74  int depth;
75 
76  Ttree *tree1;
77  Ttree *tree2;
78  Ttree *tree3;
79  Ttree *tree4;
80 
81  Ped::Tscene *scene;
82 
83  private:
84  set<const Ped::Tagent*> agents; // set and not vector, since we need to delete elements from the middle very often
85  // set and not list, since deletion is based on pointer (search O(log n) instead of O(n)).
86 
87 
88  };
89 }
90 
91 #endif
O --- O

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