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
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
33
#include <
utils/gui/globjects/GUIGlObject.h
>
34
#include <
utils/gui/settings/GUIVisualizationSettings.h
>
35
#include <
utils/geom/Boundary.h
>
36
37
#include "
RTree.h
"
38
39
40
// specialized implementation for speedup and avoiding warnings
41
template
<>
42
inline
float
RTree<GUIGlObject*, GUIGlObject, float, 2, GUIVisualizationSettings, float, 8, 4>::RectSphericalVolume
(
Rect
* a_rect)
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
:
57
SUMORTree
()
58
:
RTree
<
GUIGlObject
*,
GUIGlObject
,
float
, 2,
GUIVisualizationSettings
,
float
>(&
GUIGlObject
::drawGL){
59
}
60
61
~SUMORTree
() {
62
}
63
67
void
addAdditionalGLObject
(
GUIGlObject
*o) {
68
Boundary
b = o->
getCenteringBoundary
();
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
77
void
removeAdditionalGLObject
(
GUIGlObject
*o) {
78
Boundary
b = o->
getCenteringBoundary
();
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
build
buildd
sumo-0.15.0~dfsg
src
foreign
rtree
SUMORTree.h
Generated on Wed Jul 18 2012 22:58:36 for SUMO - Simulation of Urban MObility by
1.8.1.1