SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMORTree.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A RT-tree for efficient storing of SUMO's GL-objects
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef SUMORTree_h
21 #define SUMORTree_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
35 #include <utils/geom/Boundary.h>
37 
38 #include "RTree.h"
39 
40 
41 // specialized implementation for speedup and avoiding warnings
42 template<>
44 {
45  ASSERT(a_rect);
46  const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
47  const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
48  return .78539816f * (extent0 * extent0 + extent1 * extent1);
49 }
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
61 class SUMORTree : private RTree<GUIGlObject*, GUIGlObject, float, 2, GUIVisualizationSettings>, public Boundary
62 {
63 public:
67  }
68 
69 
71  virtual ~SUMORTree() {
72  }
73 
74 
81  virtual void Insert(const float a_min[2], const float a_max[2], GUIGlObject* a_dataId) {
84  }
85 
86 
93  virtual void Remove(const float a_min[2], const float a_max[2], GUIGlObject* a_dataId) {
96  }
97 
98 
108  virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings& c) {
111  }
112 
113 
119  const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
120  const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
121  Insert(cmin, cmax, o);
122  }
123 
124 
130  const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
131  const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
132  Remove(cmin, cmax, o);
133  }
134 
135 
136 protected:
139 
140 };
141 
142 
143 #endif
144 
145 /****************************************************************************/
146