SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NamedRTree.h
Go to the documentation of this file.
1
/****************************************************************************/
7
// A RT-tree for efficient storing of SUMO's Named objects
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
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 NamedRTree_h
21
#define NamedRTree_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
33
#include <set>
34
#include <
foreign/rtree/RTree.h
>
35
#include <
utils/common/Named.h
>
36
37
//#include "RTree.h"
38
39
40
// specialized implementation for speedup and avoiding warnings
41
template
<>
42
inline
float
RTree<Named*, Named, float, 2, Named::StoringVisitor, float, 8, 4>::RectSphericalVolume
(
Rect
* a_rect) {
43
ASSERT
(a_rect);
44
const
float
extent0 = a_rect->
m_max
[0] - a_rect->
m_min
[0];
45
const
float
extent1 = a_rect->
m_max
[1] - a_rect->
m_min
[1];
46
return
.78539816f * (extent0 * extent0 + extent1 * extent1);
47
}
48
49
50
// ===========================================================================
51
// class definitions
52
// ===========================================================================
60
class
NamedRTree
:
private
RTree
<Named*, Named, float, 2, Named::StoringVisitor > {
61
public
:
63
NamedRTree
()
64
:
RTree
<
Named
*,
Named
,
float
, 2,
Named
::StoringVisitor,
float
>(&
Named
::addTo) {
65
}
66
67
69
~NamedRTree
() {
70
}
71
72
79
void
Insert
(
const
float
a_min[2],
const
float
a_max[2],
Named
* a_data) {
80
RTree<Named*, Named, float, 2, Named::StoringVisitor, float>::Insert
(a_min, a_max, a_data);
81
}
82
83
90
void
Remove
(
const
float
a_min[2],
const
float
a_max[2],
Named
* a_data) {
91
RTree<Named*, Named, float, 2, Named::StoringVisitor, float>::Remove
(a_min, a_max, a_data);
92
}
93
94
98
void
RemoveAll
() {
99
RTree<Named*, Named, float, 2, Named::StoringVisitor, float>::RemoveAll
();
100
}
101
102
112
int
Search
(
const
float
a_min[2],
const
float
a_max[2],
const
Named::StoringVisitor
& c)
const
{
113
return
RTree<Named*, Named, float, 2, Named::StoringVisitor, float>::Search
(a_min, a_max, c);
114
}
115
116
117
};
118
119
120
#endif
121
122
/****************************************************************************/
123
home
delphi
sumo
src
utils
common
NamedRTree.h
Generated by
1.8.2