SUMO - Simulation of Urban MObility
GNEConnection.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A class for visualizing connections between lanes
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2016 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 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <string>
32 #include <iostream>
33 #include <utility>
34 #include <time.h>
40 #include <utils/common/ToString.h>
45 #include <utils/gui/div/GLHelper.h>
47 
48 #include "GNEConnection.h"
49 #include "GNEEdge.h"
50 #include "GNELane.h"
51 
52 #ifdef CHECK_MEMORY_LEAKS
53 #include <foreign/nvwa/debug_new.h>
54 #endif // CHECK_MEMORY_LEAKS
55 
56 
57 
58 // ===========================================================================
59 // static member definitions
60 // ===========================================================================
61 
62 
63 // ===========================================================================
64 // method definitions
65 // ===========================================================================
66 
67 GNEConnection::GNEConnection(GNEEdge* edgeFrom, GNEEdge* edgeTo, GNELane* fromLane, GNELane* toLane, bool pass, bool keepClear, SUMOReal contPos, bool uncontrolled) :
69  myEdgeFrom(edgeFrom),
70  myEdgeTo(edgeTo),
71  myFromLane(fromLane),
72  myToLane(toLane),
73  myPass(pass),
74  myKeepClear(keepClear),
75  myContPos(contPos),
76  myUncontrolled(uncontrolled) {
77  // Update geometry
79 }
80 
82 
83 
84 void
86 }
87 
88 
89 GNEEdge*
91  return myEdgeFrom;
92 }
93 
94 
95 GNEEdge*
97  return myEdgeTo;
98 }
99 
100 
101 GNELane*
103  return myFromLane;
104 }
105 
106 
107 GNELane*
109  return myToLane;
110 }
111 
112 
113 int
115  return myFromLane->getIndex();
116 }
117 
118 
119 int
121  return myToLane->getIndex();
122 }
123 
124 
125 bool
127  return myPass;
128 }
129 
130 
131 bool
133  return myKeepClear;
134 }
135 
136 
137 SUMOReal
139  return myContPos;
140 }
141 
142 
143 bool
145  return myUncontrolled;
146 }
147 
148 
149 void
151  myPass = pass;
152 }
153 
154 
155 void
157  myKeepClear = keepClear;
158 }
159 
160 
161 void
163  myContPos = contPos;
164 }
165 
166 
167 void
168 GNEConnection::setUncontrolled(bool uncontrolled) {
169  myUncontrolled = uncontrolled ;
170 }
171 
172 
175  // Currently ignored before implementation to avoid warnings
176  UNUSED_PARAMETER(app);
177  UNUSED_PARAMETER(parent);
178  return NULL;
179 }
180 
181 
184  // Currently ignored before implementation to avoid warnings
185  UNUSED_PARAMETER(app);
186  UNUSED_PARAMETER(parent);
187  return NULL;
188 }
189 
190 
191 Boundary
193  return Boundary();
194 }
195 
196 
197 void
199  // Currently ignored before implementation to avoid warnings
200  UNUSED_PARAMETER(s);
201 }
202 
203 
204 std::string
206  // Currently ignored before implementation to avoid warnings
207  UNUSED_PARAMETER(key);
208  return "";
209 }
210 
211 
212 void
213 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
214  // Currently ignored before implementation to avoid warnings
215  UNUSED_PARAMETER(key);
216  UNUSED_PARAMETER(value);
217  UNUSED_PARAMETER(undoList);
218 }
219 
220 
221 bool
222 GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
223  // Currently ignored before implementation to avoid warnings
224  UNUSED_PARAMETER(key);
225  UNUSED_PARAMETER(value);
226  return false;
227 }
228 
229 
230 void
231 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
232  // Currently ignored before implementation to avoid warnings
233  UNUSED_PARAMETER(key);
234  UNUSED_PARAMETER(value);
235 }
236 
237 
238 /****************************************************************************/
int getFromLaneIndex()
get lane index of the incoming lane
GNEEdge * getEdgeTo()
get the name of the edge the vehicles may reach when leaving "from"
void updateGeometry()
update pre-computed geometry information
void setKeepClear(bool keepClear)
set parameter keepClear
bool isValid(SumoXMLAttr key, const std::string &value)
Stores the information about how to visualize structures.
a connection
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEEdge * myEdgeTo
The name of the edge the vehicles may reach when leaving "from".
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
bool getKeepClear()
get parameter keepClear
GNELane * myFromLane
the incoming lane
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEEdge * myEdgeFrom
The name of the edge the vehicles leave.
unsigned int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:485
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
bool myPass
if set, vehicles which pass this (lane-2-lane) connection) will not wait
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
int getToLaneIndex()
get lane index of the outgoing lane
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool getPass()
get parameter pass
bool myKeepClear
if set to false, vehicles which pass this (lane-2-lane) connection) will not worry about blocking the...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNELane * myToLane
the outgoing lane
~GNEConnection()
Destructor.
SUMOReal myContPos
if set to 0, no internal junction will be built for this connection. If set to a positive value...
GNELane * getFromLane()
the get incoming lane
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
void setUncontrolled(bool uncontrolled)
set parameter uncontrolled
void setPass(bool pass)
set parameter pass
The popup menu of a globject.
void setContPos(SUMOReal contPos)
set parameter ContPos
SUMOReal getContPos()
get parameter ContPos
#define SUMOReal
Definition: config.h:214
bool getUncontrolled()
get parameter uncontrolled
GNELane * getToLane()
get outgoing lane
GNEConnection(GNEEdge *edgeFrom, GNEEdge *edgeTo, GNELane *fromLane, GNELane *toLane, bool pass, bool keepClear, SUMOReal contPos, bool uncontrolled)
Constructor.
std::string getAttribute(SumoXMLAttr key) const
A window containing a gl-object&#39;s parameter.
GNEEdge * getEdgeFrom()
get the name of the edge the vehicles leave
bool myUncontrolled
if set to true, This connection will not be TLS-controlled despite its node being controlled...