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
#include <string>
36
#include <utility>
37
#include <
microsim/MSLane.h
>
38
#include <
microsim/MSJunction.h
>
39
#include <
utils/geom/Position.h
>
40
#include <
microsim/MSNet.h
>
41
#include <
microsim/MSInternalJunction.h
>
42
#include <
gui/GUIApplicationWindow.h
>
43
#include <
gui/GUIGlobals.h
>
44
#include <
utils/gui/windows/GUIAppEnum.h
>
45
#include <
utils/gui/windows/GUISUMOAbstractView.h
>
46
#include "
GUIJunctionWrapper.h
"
47
#include <
utils/gui/globjects/GUIGLObjectPopupMenu.h
>
48
#include <
utils/gui/div/GUIGlobalSelection.h
>
49
#include <
utils/gui/div/GUIParameterTableWindow.h
>
50
#include <
utils/gui/div/GLHelper.h
>
51
#include <
foreign/polyfonts/polyfonts.h
>
52
#include <
utils/gui/globjects/GLIncludes.h
>
53
54
#ifdef CHECK_MEMORY_LEAKS
55
#include <
foreign/nvwa/debug_new.h
>
56
#endif // CHECK_MEMORY_LEAKS
57
58
59
// ===========================================================================
60
// method definitions
61
// ===========================================================================
62
GUIJunctionWrapper::GUIJunctionWrapper
(
MSJunction
& junction)
63
:
GUIGlObject
(
GLO_JUNCTION
, junction.getID()),
64
myJunction(junction) {
65
if
(
myJunction
.
getShape
().
size
() == 0) {
66
Position
pos =
myJunction
.
getPosition
();
67
myBoundary
=
Boundary
(pos.
x
() - 1., pos.
y
() - 1., pos.
x
() + 1., pos.
y
() + 1.);
68
}
else
{
69
myBoundary
=
myJunction
.
getShape
().
getBoxBoundary
();
70
}
71
myMaxSize
=
MAX2
(
myBoundary
.
getWidth
(),
myBoundary
.
getHeight
());
72
#ifdef HAVE_INTERNAL_LANES
73
myIsInner
=
dynamic_cast<
MSInternalJunction
*
>
(&
myJunction
) != 0;
74
#else
75
myIsInner =
false
;
76
#endif
77
}
78
79
80
GUIJunctionWrapper::~GUIJunctionWrapper
() {}
81
82
83
GUIGLObjectPopupMenu
*
84
GUIJunctionWrapper::getPopUpMenu
(
GUIMainWindow
& app,
85
GUISUMOAbstractView
& parent) {
86
GUIGLObjectPopupMenu
* ret =
new
GUIGLObjectPopupMenu
(app, parent, *
this
);
87
buildPopupHeader
(ret, app);
88
buildCenterPopupEntry
(ret);
89
buildNameCopyPopupEntry
(ret);
90
buildSelectionPopupEntry
(ret);
91
buildPositionCopyEntry
(ret,
false
);
92
return
ret;
93
}
94
95
96
GUIParameterTableWindow
*
97
GUIJunctionWrapper::getParameterWindow
(
GUIMainWindow
&
/*app*/
,
98
GUISUMOAbstractView
&) {
99
return
0;
100
}
101
102
103
Boundary
104
GUIJunctionWrapper::getCenteringBoundary
()
const
{
105
Boundary
b =
myBoundary
;
106
b.
grow
(20);
107
return
b;
108
}
109
110
111
void
112
GUIJunctionWrapper::drawGL
(
const
GUIVisualizationSettings
& s)
const
{
113
// check whether it is not too small
114
if
(s.
scale
*
myMaxSize
< 1.) {
115
return
;
116
}
117
if
(!
myIsInner
) {
118
glPushName(
getGlID
());
119
glPushMatrix();
120
glColor3d(0, 0, 0);
121
glTranslated(0, 0,
getType
());
122
GLHelper::drawFilledPoly
(
myJunction
.
getShape
(),
true
);
123
glPopMatrix();
124
}
125
if
(
myIsInner
) {
126
drawName
(
myJunction
.
getPosition
(), s.
scale
, s.
internalJunctionName
);
127
}
else
{
128
drawName
(
myJunction
.
getPosition
(), s.
scale
, s.
junctionName
);
129
}
130
glPopName();
131
}
132
133
134
/****************************************************************************/
135
build
buildd
sumo-0.16.0~dfsg
src
guisim
GUIJunctionWrapper.cpp
Generated on Tue Apr 16 2013 01:32:16 for SUMO - Simulation of Urban MObility by
1.8.3.1