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 // An rtree for networks
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2012 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>
36 
37 #include "RTree.h"
38 
39 
40 // specialized implementation for speedup and avoiding warnings
41 template<>
43 {
44  ASSERT(a_rect);
45  const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
46  const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
47  return .78539816f * (extent0 * extent0 + extent1 * extent1);
48 }
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
54 class SUMORTree : public RTree<GUIGlObject*, GUIGlObject, float, 2, GUIVisualizationSettings>, public Boundary
55 {
56 public:
59  }
60 
62  }
63 
69  const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
70  const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
71  Insert(cmin, cmax, o);
72  }
73 
79  const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
80  const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
81  Remove(cmin, cmax, o);
82  }
83 
84 };
85 
86 
87 #endif
88 
89 /****************************************************************************/
90