SUMO - Simulation of Urban MObility
GNEConnection.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing connections between lanes
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
27 #include <utils/gui/div/GLHelper.h>
32 #include <netedit/GNENet.h>
33 #include <netedit/GNEUndoList.h>
34 #include <netedit/GNEViewNet.h>
36 
37 #include "GNEConnection.h"
38 #include "GNEJunction.h"
39 #include "GNEEdge.h"
40 #include "GNELane.h"
41 #include "GNEInternalLane.h"
42 
43 
44 // ===========================================================================
45 // static member definitions
46 // ===========================================================================
47 int NUM_POINTS = 5;
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
52 
54  GNENetElement(from->getNet(), "from" + from->getMicrosimID() + "to" + to->getMicrosimID(),
56  myFromLane(from),
57  myToLane(to),
58  myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
59  mySpecialColor(nullptr),
60  myShapeDeprecated(true) {
61 }
62 
63 
65 }
66 
67 
68 void
70  // Get shape of from and to lanes
72  if (myShapeDeprecated) {
73  // first check if object has to be removed from grid (SUMOTree)
74  if (updateGrid) {
76  }
77  // Clear containers
78  myShape.clear();
79  myShapeRotations.clear();
80  myShapeLengths.clear();
81 
82  PositionVector laneShapeFrom;
83  if ((int)getEdgeFrom()->getNBEdge()->getLanes().size() > nbCon.fromLane) {
84  laneShapeFrom = getEdgeFrom()->getNBEdge()->getLanes().at(nbCon.fromLane).shape;
85  } else {
86  return;
87  }
88  PositionVector laneShapeTo;
89  if ((int)nbCon.toEdge->getLanes().size() > nbCon.toLane) {
90  laneShapeTo = nbCon.toEdge->getLanes().at(nbCon.toLane).shape;
91  } else {
92  return;
93  }
94  // Calculate shape of connection depending of the size of Junction shape
95  // value obtanied from GNEJunction::drawgl
96  if (nbCon.customShape.size() != 0) {
97  myShape = nbCon.customShape;
98  } else if (getEdgeFrom()->getNBEdge()->getToNode()->getShape().area() > 4) {
99  if (nbCon.shape.size() != 0) {
100  myShape = nbCon.shape;
101  // only append via shape if it exists
102  if (nbCon.haveVia) {
103  myShape.append(nbCon.viaShape);
104  }
105  } else {
106  // Calculate shape so something can be drawn immidiately
108  laneShapeFrom,
109  laneShapeTo,
110  NUM_POINTS, getEdgeFrom()->getNBEdge()->getTurnDestination() == nbCon.toEdge,
111  (double) 5. * (double) getEdgeFrom()->getNBEdge()->getNumLanes(),
112  (double) 5. * (double) nbCon.toEdge->getNumLanes());
113  }
114  } else {
115  myShape.clear();
116  myShape.push_back(laneShapeFrom.positionAtOffset(MAX2(0.0, laneShapeFrom.length() - 1)));
117  myShape.push_back(laneShapeTo.positionAtOffset(MIN2(1.0, laneShapeFrom.length())));
118  }
119  // check if internal junction marker must be calculated
120  if (nbCon.haveVia && (nbCon.shape.size() != 0)) {
121  // create marker for interal junction waiting position (contPos)
122  const double orthoLength = 0.5;
123  Position pos = nbCon.shape.back();
124  myInternalJunctionMarker = nbCon.shape.getOrthogonal(pos, 10, true, 0.1);
125  if (myInternalJunctionMarker.length() < orthoLength) {
127  }
128  } else {
129  myInternalJunctionMarker.clear();
130  }
131  // Obtain lengths and shape rotations
132  int segments = (int) myShape.size() - 1;
133  if (segments >= 0) {
134  myShapeRotations.reserve(segments);
135  myShapeLengths.reserve(segments);
136  for (int i = 0; i < segments; ++i) {
137  const Position& f = myShape[i];
138  const Position& s = myShape[i + 1];
139  myShapeLengths.push_back(f.distanceTo2D(s));
140  myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double)M_PI);
141  }
142  }
143 
144  // mark connection as non-deprecated
145  myShapeDeprecated = false;
146 
147  // last step is to check if object has to be added into grid (SUMOTree) again
148  if (updateGrid) {
149  myNet->addGLObjectIntoGrid(this);
150  }
151  }
152 }
153 
154 
155 Boundary
157  if (myShape.size() == 0) {
158  // we need to use the center of junction parent as boundary if shape is empty
160  return Boundary(junctionParentPosition.x() - 0.1, junctionParentPosition.y() - 0.1,
161  junctionParentPosition.x() + 0.1, junctionParentPosition.x() + 0.1);
162  } else {
163  return myShape.getBoxBoundary();
164  }
165 }
166 
167 
168 GNEEdge*
170  return &(myFromLane->getParentEdge());
171 }
172 
173 
174 GNEEdge*
176  return &(myToLane->getParentEdge());
177 }
178 
179 
180 GNELane*
182  return myFromLane;
183 }
184 
185 
186 GNELane*
188  return myToLane;
189 }
190 
191 
192 int
194  return myFromLane->getIndex();
195 }
196 
197 
198 int
200  return myToLane->getIndex();
201 }
202 
203 
207 }
208 
209 
212  return NBConnection(getEdgeFrom()->getNBEdge(), getFromLaneIndex(),
213  getEdgeTo()->getNBEdge(), getToLaneIndex(),
214  (int)getNBEdgeConnection().tlLinkIndex);
215 }
216 
217 
218 void
221 }
222 
223 
224 LinkState
226  return myLinkState;
227 }
228 
229 
230 const PositionVector&
232  if (myShape.size() > 0) {
233  return myShape;
234  } else {
236  }
237 }
238 
239 
240 void
242  myShapeDeprecated = true;
243 }
244 
245 
246 void
250  nbCon.toEdge,
251  nbCon.fromLane,
252  nbCon.toLane,
253  nbCon.mayDefinitelyPass,
254  nbCon.tlID);
255 }
256 
257 
260  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
261  buildPopupHeader(ret, app);
264  // build selection and show parameters menu
267  // build position copy entry
268  buildPositionCopyEntry(ret, false);
269  // create menu commands
270  FXMenuCommand* mcCustomShape = new FXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
271  // check if menu commands has to be disabled
272  EditMode editMode = myNet->getViewNet()->getCurrentEditMode();
273  const bool wrongMode = (editMode == GNE_MODE_CONNECT || editMode == GNE_MODE_TLS || editMode == GNE_MODE_CREATE_EDGE);
274  if (wrongMode) {
275  mcCustomShape->disable();
276  }
277  return ret;
278 }
279 
280 
281 Boundary
283  Boundary b = getBoundary();
284  b.grow(20);
285  return b;
286 }
287 
288 
289 void
291  // Check if connection must be drawed
293  // Push draw matrix 1
294  glPushMatrix();
295  // Push name
296  glPushName(getGlID());
297  // Traslate matrix
298  glTranslated(0, 0, GLO_JUNCTION + 0.1); // must draw on top of junction
299  // Set color
301  // override with special colors (unless the color scheme is based on selection)
303  } else if (mySpecialColor != nullptr) {
305  } else {
306  // Set color depending of the link state
308  }
309  // draw connection checking whether it is not too small if isn't being drawn for selecting
310  if ((s.scale < 1.) && !s.drawForSelecting) {
311  // If it's small, dra a simple line
313  } else {
314  // draw a list of lines
316  glTranslated(0, 0, 0.1);
317  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
318  // check if internal junction marker has to be drawn
319  if (myInternalJunctionMarker.size() > 0) {
321  }
322  }
323  // check if dotted contour has to be drawn
324  if (!s.drawForSelecting && (myNet->getViewNet()->getDottedAC() == this)) {
326  }
327  // Pop name
328  glPopName();
329  // Pop draw matrix 1
330  glPopMatrix();
331  }
332 }
333 
334 
335 void
337  mySpecialColor = color;
338 }
339 
340 std::string
342  if (key == SUMO_ATTR_ID) {
343  // used by GNEReferenceCounter
344  // @note: may be called for connections without a valid nbCon reference
345  return getMicrosimID();
346  }
348  switch (key) {
349  case SUMO_ATTR_FROM:
350  return getEdgeFrom()->getID();
351  case SUMO_ATTR_TO:
352  return nbCon.toEdge->getID();
353  case SUMO_ATTR_FROM_LANE:
354  return toString(nbCon.toLane);
355  case SUMO_ATTR_TO_LANE:
356  return toString(nbCon.toLane);
357  case SUMO_ATTR_PASS:
358  return toString(nbCon.mayDefinitelyPass);
360  return toString(nbCon.keepClear);
361  case SUMO_ATTR_CONTPOS:
362  return toString(nbCon.contPos);
364  return toString(nbCon.uncontrolled);
366  return toString(nbCon.visibility);
368  return toString(nbCon.tlLinkIndex);
369  case SUMO_ATTR_SPEED:
370  return toString(nbCon.speed);
372  return toString(nbCon.customShape);
373  case GNE_ATTR_SELECTED:
375  case GNE_ATTR_GENERIC:
376  return getGenericParametersStr();
377  default:
378  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
379  }
380 }
381 
382 
383 void
384 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
385  switch (key) {
386  case SUMO_ATTR_FROM:
387  case SUMO_ATTR_TO:
388  case SUMO_ATTR_FROM_LANE:
389  case SUMO_ATTR_TO_LANE:
390  case SUMO_ATTR_PASS:
392  case SUMO_ATTR_CONTPOS:
395  case SUMO_ATTR_SPEED:
397  case GNE_ATTR_SELECTED:
398  case GNE_ATTR_GENERIC:
399  // no special handling
400  undoList->p_add(new GNEChange_Attribute(this, key, value));
401  break;
403  if (value != getAttribute(key)) {
404  // trigger GNEChange_TLS
405  undoList->p_begin("change tls linkIndex for connection");
406  // make a copy
407  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
408  for (NBTrafficLightDefinition* tlDef : defs) {
409  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
410  NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
411  if (tllogic != nullptr) {
412  NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(tlDef, tllogic);
413  newDef->addConnection(getEdgeFrom()->getNBEdge(), getEdgeTo()->getNBEdge(),
414  getLaneFrom()->getIndex(), getLaneTo()->getIndex(), parse<int>(value), false);
415  std::vector<NBNode*> nodes = tlDef->getNodes();
416  for (NBNode* node : nodes) {
417  GNEJunction* junction = getNet()->retrieveJunction(node->getID());
418  undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
419  undoList->add(new GNEChange_TLS(junction, newDef, true), true);
420  }
421  } else {
422  WRITE_ERROR("Could not set attribute '" + toString(key) + "' (tls is broken)");
423  }
424  }
425  undoList->p_end();
426  }
427  break;
428  default:
429  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
430  }
431 }
432 
433 
434 bool
435 GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
436  // Currently ignored before implementation to avoid warnings
437  switch (key) {
438  case SUMO_ATTR_FROM:
439  case SUMO_ATTR_TO:
440  case SUMO_ATTR_FROM_LANE:
441  case SUMO_ATTR_TO_LANE:
442  return false;
443  case SUMO_ATTR_PASS:
444  return canParse<bool>(value);
446  return canParse<bool>(value);
447  case SUMO_ATTR_CONTPOS:
448  return canParse<double>(value);
450  return canParse<bool>(value);
452  return canParse<double>(value) && (parse<double>(value) > 0);
454  if (getNBEdgeConnection().uncontrolled == false
455  && getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS().size() > 0
456  && canParse<int>(value)
457  && parse<int>(value) >= 0) {
459  return def->getMaxValidIndex() >= parse<int>(value);
460  } else {
461  return false;
462  }
463  case SUMO_ATTR_SPEED:
464  return canParse<double>(value) && (parse<double>(value) > 0);
465  case SUMO_ATTR_CUSTOMSHAPE: {
466  // empty custom shapes are allowed
467  return canParse<PositionVector>(value);
468  }
469  case GNE_ATTR_SELECTED:
470  return canParse<bool>(value);
471  case GNE_ATTR_GENERIC:
472  return isGenericParametersValid(value);
473  default:
474  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
475  }
476 }
477 
478 
479 std::string
481  std::string result;
482  // Generate an string using the following structure: "key1=value1|key2=value2|...
483  for (auto i : getNBEdgeConnection().getParametersMap()) {
484  result += i.first + "=" + i.second + "|";
485  }
486  // remove the last "|"
487  if (!result.empty()) {
488  result.pop_back();
489  }
490  return result;
491 }
492 
493 
494 std::vector<std::pair<std::string, std::string> >
496  std::vector<std::pair<std::string, std::string> > result;
497  // iterate over parameters map and fill result
498  for (auto i : getNBEdgeConnection().getParametersMap()) {
499  result.push_back(std::make_pair(i.first, i.second));
500  }
501  return result;
502 }
503 
504 
505 void
506 GNEConnection::setGenericParametersStr(const std::string& value) {
507  // clear parameters
509  // separate value in a vector of string using | as separator
510  std::vector<std::string> parsedValues;
511  StringTokenizer stValues(value, "|", true);
512  while (stValues.hasNext()) {
513  parsedValues.push_back(stValues.next());
514  }
515  // check that parsed values (A=B)can be parsed in generic parameters
516  for (auto i : parsedValues) {
517  std::vector<std::string> parsedParameters;
518  StringTokenizer stParam(i, "=", true);
519  while (stParam.hasNext()) {
520  parsedParameters.push_back(stParam.next());
521  }
522  // Check that parsed parameters are exactly two and contains valid chracters
523  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
524  getNBEdgeConnection().setParameter(parsedParameters.front(), parsedParameters.back());
525  }
526  }
527 }
528 
529 // ===========================================================================
530 // private
531 // ===========================================================================
532 
533 void
534 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
536  switch (key) {
537  case SUMO_ATTR_PASS:
538  nbCon.mayDefinitelyPass = parse<bool>(value);
539  break;
541  nbCon.keepClear = parse<bool>(value);
542  break;
544  nbCon.uncontrolled = parse<bool>(value);
545  break;
546  case SUMO_ATTR_CONTPOS:
547  nbCon.contPos = parse<double>(value);
548  break;
550  nbCon.visibility = parse<double>(value);
551  break;
552  case SUMO_ATTR_SPEED:
553  nbCon.speed = parse<double>(value);
554  break;
555  case SUMO_ATTR_CUSTOMSHAPE: {
556  const bool init = (myShape.size() == 0);
557  if (!init) {
558  // first remove object from net grid
560  }
561  nbCon.customShape = parse<PositionVector>(value);
562  if (!init) {
563  // add object into net again
564  myNet->addGLObjectIntoGrid(this);
565  }
566  break;
567  }
568  case GNE_ATTR_SELECTED:
569  if (parse<bool>(value)) {
571  } else {
573  }
574  break;
575  case GNE_ATTR_GENERIC:
577  break;
578  default:
579  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
580  }
581  // Update Geometry after setting a new attribute (but avoided for certain attributes)
582  if((key != SUMO_ATTR_ID) && (key != GNE_ATTR_GENERIC) && (key != GNE_ATTR_SELECTED)) {
583  updateGeometry(true);
584  }
585 }
586 
587 
588 void
590 }
591 
592 
593 /****************************************************************************/
int NUM_POINTS
Position getPositionInView() const
Return current position.
std::vector< double > myShapeLengths
The lengths of the shape parts.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:160
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1855
int toLane
The lane the connections yields in.
Definition: NBEdge.h:188
double scale
information about a lane&#39;s width (temporary, used for a single view)
bool isValid(SumoXMLAttr key, const std::string &value)
Whether vehicles must keep the junction clear.
whether a given shape is user-defined
GNENet * myNet
the net to inform about updates
std::string next()
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:178
void append(const PositionVector &v, double sameThreshold=2.0)
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:185
GNENet * getNet() const
get Net in which this element is placed
A loaded (complete) traffic light logic.
LinkState getLinkState() const
get LinkState
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
A SUMO-compliant built logic for a traffic light.
Stores the information about how to visualize structures.
connectio between two lanes
a connection
double y() const
Returns the y-position.
Definition: Position.h:62
foe visibility distance of a link
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
double x() const
Returns the x-position.
Definition: Position.h:57
mode for editing tls
Definition: GNEViewNet.h:58
The base class for traffic light logic definitions.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
T MAX2(T a, T b)
Definition: StdDefs.h:76
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:589
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:197
GNELane * myFromLane
incoming lane of this connection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:206
const std::string & getID() const
Returns the id.
Definition: Named.h:78
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
The link is controlled by a tls which is off, not blinking, may pass.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void setSpecialColor(const RGBColor *Color2)
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:212
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNELane * getLaneFrom() const
get lane of the incoming lane
double area() const
Returns the area (0 for non-closed)
PositionVector shape
shape of Connection
Definition: NBEdge.h:218
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:200
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
bool myShapeDeprecated
flag to indicate that connection&#39;s shape has to be updated
int getFromLaneIndex() const
get lane index of the incoming lane
int getToLaneIndex() const
get lane index of the outgoing lane
PositionVector myShape
the shape of the connection
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:757
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
double speed
custom speed for connection
Definition: NBEdge.h:209
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void updateID()
update internal ID of Connection
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:573
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1260
std::vector< double > myShapeRotations
LinkState myLinkState
Linkstate.
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:191
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:420
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:182
GNEConnection(GNELane *from, GNELane *to)
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:887
GNELane * getLaneTo() const
get lane of the outgoing lane
A list of positions.
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1160
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, bool reconstruct=true)
Adds a connection and immediately informs the edges.
friend class GNEChange_Attribute
declare friend class
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:464
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Boundary getBoundary() const
Returns the street&#39;s geometry.
T MIN2(T a, T b)
Definition: StdDefs.h:70
GNELane * myToLane
outgoing lane of this connection
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
~GNEConnection()
Destructor.
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:270
EditMode
Definition: GNEViewNet.h:42
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:194
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
EditMode getCurrentEditMode() const
get the current edit mode
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1979
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:247
void updateGeometry(bool updateGrid)
update pre-computed geometry information
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:617
double length() const
Returns the length.
PositionVector viaShape
shape of via
Definition: NBEdge.h:230
NBConnection getNBConnection() const
get NBConnection
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
#define M_PI
Definition: odrSpiral.cpp:40
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
Definition: GLHelper.cpp:471
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
Definition: NBNode.h:308
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
bool showConnections()
show connections over junctions
Definition: GNEViewNet.cpp:749
const std::string & getTagStr() const
get tag assigned to this object in string format
PositionVector myInternalJunctionMarker
waiting position for internal junction
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:203
element is selected
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:242
void markConnectionGeometryDeprecated()
check that connection&#39;s Geometry has to be updated
The popup menu of a globject.
std::string getAttribute(SumoXMLAttr key) const
Represents a single node (junction) during network building.
Definition: NBNode.h:68
GUIGlID getGlID() const
Returns the numerical id of the object.
void updateLinkState()
recompute cached myLinkState
link: the index of the link within the traffic light
edit junction shape
Definition: GUIAppEnum.h:744
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
virtual int getMaxValidIndex()
Returns the maximum index controlled by this traffic light.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
mode for connecting lanes
Definition: GNEViewNet.h:56
mode for creating new edges
Definition: GNEViewNet.h:46
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:613
const PositionVector & getShape() const
get Position vector calculated in updateGeometry(bool updateGrid)
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:224
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
Definition: NBNode.cpp:476
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1153
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
Definition: NBEdge.cpp:1143
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:441
std::string getGenericParametersStr() const
return generic parameters in string format
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const RGBColor * mySpecialColor
optional special color
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1730
void clearParameter()
Clears the parameter map.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
a junction
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:579