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
GUIJunctionWrapper.cpp
Go to the documentation of this file.
1
/****************************************************************************/
11
// }
12
/****************************************************************************/
13
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
14
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
15
/****************************************************************************/
16
//
17
// This file is part of SUMO.
18
// SUMO is free software: you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation, either version 3 of the License, or
21
// (at your option) any later version.
22
//
23
/****************************************************************************/
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#ifdef WIN32
36
#include <windows.h>
37
#endif
38
39
#include <GL/gl.h>
40
41
#include <string>
42
#include <utility>
43
#include <
microsim/MSLane.h
>
44
#include <
microsim/MSJunction.h
>
45
#include <
utils/geom/Position.h
>
46
#include <
microsim/MSNet.h
>
47
#include <
microsim/MSInternalJunction.h
>
48
#include <
gui/GUIApplicationWindow.h
>
49
#include <
gui/GUIGlobals.h
>
50
#include <
utils/gui/windows/GUIAppEnum.h
>
51
#include <
utils/gui/windows/GUISUMOAbstractView.h
>
52
#include "
GUIJunctionWrapper.h
"
53
#include <
utils/gui/globjects/GUIGLObjectPopupMenu.h
>
54
#include <
utils/gui/div/GUIGlobalSelection.h
>
55
#include <
utils/gui/div/GUIParameterTableWindow.h
>
56
#include <
utils/gui/div/GLHelper.h
>
57
#include <
foreign/polyfonts/polyfonts.h
>
58
59
#ifdef CHECK_MEMORY_LEAKS
60
#include <
foreign/nvwa/debug_new.h
>
61
#endif // CHECK_MEMORY_LEAKS
62
63
64
// ===========================================================================
65
// method definitions
66
// ===========================================================================
67
GUIJunctionWrapper::GUIJunctionWrapper
(
MSJunction
& junction)
68
:
GUIGlObject
(
GLO_JUNCTION
, junction.getID()),
69
myJunction(junction) {
70
if
(
myJunction
.
getShape
().
size
() == 0) {
71
Position
pos =
myJunction
.
getPosition
();
72
myBoundary
=
Boundary
(pos.
x
() - 1., pos.
y
() - 1., pos.
x
() + 1., pos.
y
() + 1.);
73
}
else
{
74
myBoundary
=
myJunction
.
getShape
().
getBoxBoundary
();
75
}
76
myMaxSize
=
MAX2
(
myBoundary
.
getWidth
(),
myBoundary
.
getHeight
());
77
#ifdef HAVE_INTERNAL_LANES
78
myIsInner
=
dynamic_cast<
MSInternalJunction
*
>
(&
myJunction
) != 0;
79
#else
80
myIsInner =
false
;
81
#endif
82
}
83
84
85
GUIJunctionWrapper::~GUIJunctionWrapper
() {}
86
87
88
GUIGLObjectPopupMenu
*
89
GUIJunctionWrapper::getPopUpMenu
(
GUIMainWindow
& app,
90
GUISUMOAbstractView
& parent) {
91
GUIGLObjectPopupMenu
* ret =
new
GUIGLObjectPopupMenu
(app, parent, *
this
);
92
buildPopupHeader
(ret, app);
93
buildCenterPopupEntry
(ret);
94
buildNameCopyPopupEntry
(ret);
95
buildSelectionPopupEntry
(ret);
96
buildPositionCopyEntry
(ret,
false
);
97
return
ret;
98
}
99
100
101
GUIParameterTableWindow
*
102
GUIJunctionWrapper::getParameterWindow
(
GUIMainWindow
&
/*app*/
,
103
GUISUMOAbstractView
&) {
104
return
0;
105
}
106
107
108
Boundary
109
GUIJunctionWrapper::getCenteringBoundary
()
const
{
110
Boundary
b =
myBoundary
;
111
b.
grow
(20);
112
return
b;
113
}
114
115
116
void
117
GUIJunctionWrapper::drawGL
(
const
GUIVisualizationSettings
& s)
const
{
118
// check whether it is not too small
119
if
(s.
scale
*
myMaxSize
< 1.) {
120
return
;
121
}
122
if
(!
myIsInner
) {
123
glPushName(
getGlID
());
124
glPushMatrix();
125
glColor3d(0, 0, 0);
126
glTranslated(0, 0,
getType
());
127
GLHelper::drawFilledPoly
(
myJunction
.
getShape
(),
true
);
128
glPopMatrix();
129
}
130
if
(
myIsInner
) {
131
drawName
(
myJunction
.
getPosition
(), s.
scale
, s.
internalJunctionName
);
132
}
else
{
133
drawName
(
myJunction
.
getPosition
(), s.
scale
, s.
junctionName
);
134
}
135
glPopName();
136
}
137
138
139
/****************************************************************************/
140
build
buildd
sumo-0.15.0~dfsg
src
guisim
GUIJunctionWrapper.cpp
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1