Eclipse 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-2019 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 std::string
70  // currently unused
71  return "";
72 }
73 
74 
75 void
77  // Get shape of from and to lanes
79  if (myShapeDeprecated) {
80  // Clear geometry
82  // obtain lane shape from
83  PositionVector laneShapeFrom;
84  if ((int)getEdgeFrom()->getNBEdge()->getLanes().size() > nbCon.fromLane) {
85  laneShapeFrom = getEdgeFrom()->getNBEdge()->getLanes().at(nbCon.fromLane).shape;
86  } else {
87  return;
88  }
89  // obtain lane shape to
90  PositionVector laneShapeTo;
91  if ((int)nbCon.toEdge->getLanes().size() > nbCon.toLane) {
92  laneShapeTo = nbCon.toEdge->getLanes().at(nbCon.toLane).shape;
93  } else {
94  return;
95  }
96  // Calculate shape of connection depending of the size of Junction shape
97  // value obtanied from GNEJunction::drawgl
98  if (nbCon.customShape.size() != 0) {
100  } else if (getEdgeFrom()->getNBEdge()->getToNode()->getShape().area() > 4) {
101  if (nbCon.shape.size() != 0) {
102  myGeometry.shape = nbCon.shape;
103  // only append via shape if it exists
104  if (nbCon.haveVia) {
106  }
107  } else {
108  // Calculate shape so something can be drawn immidiately
110  laneShapeFrom,
111  laneShapeTo,
112  NUM_POINTS, getEdgeFrom()->getNBEdge()->getTurnDestination() == nbCon.toEdge,
113  (double) 5. * (double) getEdgeFrom()->getNBEdge()->getNumLanes(),
114  (double) 5. * (double) nbCon.toEdge->getNumLanes());
115  }
116  } else {
117  myGeometry.shape.push_back(laneShapeFrom.positionAtOffset(MAX2(0.0, laneShapeFrom.length() - 1)));
118  myGeometry.shape.push_back(laneShapeTo.positionAtOffset(MIN2(1.0, laneShapeFrom.length())));
119  }
120  // check if internal junction marker must be calculated
121  if (nbCon.haveVia && (nbCon.shape.size() != 0)) {
122  // create marker for interal junction waiting position (contPos)
123  const double orthoLength = 0.5;
124  Position pos = nbCon.shape.back();
125  myInternalJunctionMarker = nbCon.shape.getOrthogonal(pos, 10, true, 0.1);
126  if (myInternalJunctionMarker.length() < orthoLength) {
128  }
129  } else {
130  myInternalJunctionMarker.clear();
131  }
132  // Obtain lengths and shape rotations
134  // mark connection as non-deprecated
135  myShapeDeprecated = false;
136  }
137 }
138 
139 
140 Position
142  // currently unused
143  return Position(0, 0);
144 }
145 
146 
147 Boundary
149  if (myGeometry.shape.size() == 0) {
150  // we need to use the center of junction parent as boundary if shape is empty
152  return Boundary(junctionParentPosition.x() - 0.1, junctionParentPosition.y() - 0.1,
153  junctionParentPosition.x() + 0.1, junctionParentPosition.x() + 0.1);
154  } else {
156  }
157 }
158 
159 
160 GNEEdge*
162  return &(myFromLane->getParentEdge());
163 }
164 
165 
166 GNEEdge*
168  return &(myToLane->getParentEdge());
169 }
170 
171 
172 GNELane*
174  return myFromLane;
175 }
176 
177 
178 GNELane*
180  return myToLane;
181 }
182 
183 
184 int
186  return myFromLane->getIndex();
187 }
188 
189 
190 int
192  return myToLane->getIndex();
193 }
194 
195 
199 }
200 
201 
204  return NBConnection(getEdgeFrom()->getNBEdge(), getFromLaneIndex(),
205  getEdgeTo()->getNBEdge(), getToLaneIndex(),
206  (int)getNBEdgeConnection().tlLinkIndex);
207 }
208 
209 
210 void
213 }
214 
215 
216 LinkState
218  return myLinkState;
219 }
220 
221 
222 const PositionVector&
224  if (myGeometry.shape.size() > 0) {
225  return myGeometry.shape;
226  } else {
228  }
229 }
230 
231 
232 void
234  myShapeDeprecated = true;
235 }
236 
237 
238 void
242  nbCon.toEdge,
243  nbCon.fromLane,
244  nbCon.toLane,
245  nbCon.mayDefinitelyPass,
246  nbCon.tlID);
247 }
248 
249 
252  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
253  buildPopupHeader(ret, app);
256  // build selection and show parameters menu
259  // build position copy entry
260  buildPositionCopyEntry(ret, false);
261  // create menu commands
262  FXMenuCommand* mcCustomShape = new FXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
263  // check if menu commands has to be disabled
265  const bool wrongMode = (editMode == GNE_NMODE_CONNECT || editMode == GNE_NMODE_TLS || editMode == GNE_NMODE_CREATE_EDGE);
266  if (wrongMode) {
267  mcCustomShape->disable();
268  }
269  return ret;
270 }
271 
272 
273 Boundary
275  Boundary b = getBoundary();
276  b.grow(20);
277  return b;
278 }
279 
280 
281 void
283  // declare a flag to check if shape has to be draw
284  bool drawConnection = true;
287  drawConnection = !myShapeDeprecated;
290  drawConnection = !myShapeDeprecated;
291  } else {
292  drawConnection = false;
293  }
294  // Check if connection must be drawed
295  if (drawConnection) {
296  // check if boundary has to be drawn
297  if (s.drawBoundaries) {
299  }
300  // Push draw matrix 1
301  glPushMatrix();
302  // Push name
303  glPushName(getGlID());
304  // Traslate matrix
305  glTranslated(0, 0, GLO_JUNCTION + 0.1); // must draw on top of junction
306  // Set color
307  if (drawUsingSelectColor()) {
308  // override with special colors (unless the color scheme is based on selection)
310  } else if (mySpecialColor != nullptr) {
312  } else {
313  // Set color depending of the link state
315  }
316  // draw connection checking whether it is not too small if isn't being drawn for selecting
317  const double selectionScale = isAttributeCarrierSelected() ? s.selectionScale : 1;
318  if ((s.scale * selectionScale < 5.) && !s.drawForSelecting) {
319  // If it's small, draw a simple line
321  } else {
322  // draw a list of lines
323  const bool spreadSuperposed = s.scale >= 1 && s.spreadSuperposed && myFromLane->drawAsRailway(s) && getEdgeFrom()->getNBEdge()->isBidiRail();
324  PositionVector shapeSuperposed = myGeometry.shape;
325  if (spreadSuperposed) {
326  shapeSuperposed.move2side(0.5);
327  }
328  GLHelper::drawBoxLines(shapeSuperposed, myGeometry.shapeRotations, myGeometry.shapeLengths, 0.2 * selectionScale);
329  glTranslated(0, 0, 0.1);
330  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
331  // check if internal junction marker has to be drawn
332  if (myInternalJunctionMarker.size() > 0) {
334  }
335  // check if dotted contour has to be drawn (not useful at high zoom)
336  if (myNet->getViewNet()->getDottedAC() == this) {
337  GLHelper::drawShapeDottedContourAroundShape(s, getType(), shapeSuperposed, 0.25);
338  }
339  }
340  // Pop name
341  glPopName();
342  // Pop draw matrix 1
343  glPopMatrix();
344  }
345 }
346 
347 
348 void
350  mySpecialColor = color;
351 }
352 
353 std::string
355  if (key == SUMO_ATTR_ID) {
356  // used by GNEReferenceCounter
357  // @note: may be called for connections without a valid nbCon reference
358  return getMicrosimID();
359  }
361  switch (key) {
362  case SUMO_ATTR_FROM:
363  return getEdgeFrom()->getID();
364  case SUMO_ATTR_TO:
365  return nbCon.toEdge->getID();
366  case SUMO_ATTR_FROM_LANE:
367  return toString(nbCon.toLane);
368  case SUMO_ATTR_TO_LANE:
369  return toString(nbCon.toLane);
370  case SUMO_ATTR_PASS:
371  return toString(nbCon.mayDefinitelyPass);
373  return toString(nbCon.keepClear);
374  case SUMO_ATTR_CONTPOS:
375  return toString(nbCon.contPos);
377  return toString(nbCon.uncontrolled);
379  return toString(nbCon.visibility);
381  return toString(nbCon.tlLinkIndex);
382  case SUMO_ATTR_SPEED:
383  return toString(nbCon.speed);
384  case SUMO_ATTR_DIR:
385  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getDirection(
386  getEdgeFrom()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
387  case SUMO_ATTR_STATE:
388  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getLinkState(
389  getEdgeFrom()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
391  return toString(nbCon.customShape);
392  case GNE_ATTR_SELECTED:
394  case GNE_ATTR_GENERIC:
395  return getGenericParametersStr();
396  default:
397  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
398  }
399 }
400 
401 
402 void
403 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
404  switch (key) {
405  case SUMO_ATTR_FROM:
406  case SUMO_ATTR_TO:
407  case SUMO_ATTR_FROM_LANE:
408  case SUMO_ATTR_TO_LANE:
409  case SUMO_ATTR_PASS:
411  case SUMO_ATTR_CONTPOS:
414  case SUMO_ATTR_SPEED:
416  case GNE_ATTR_SELECTED:
417  case GNE_ATTR_GENERIC:
418  // no special handling
419  undoList->p_add(new GNEChange_Attribute(this, myNet, key, value));
420  break;
422  if (value != getAttribute(key)) {
423  // trigger GNEChange_TLS
424  undoList->p_begin("change tls linkIndex for connection");
425  // make a copy
426  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
427  for (NBTrafficLightDefinition* tlDef : defs) {
428  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
429  NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
430  if (tllogic != nullptr) {
431  NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(tlDef, tllogic);
432  newDef->addConnection(getEdgeFrom()->getNBEdge(), getEdgeTo()->getNBEdge(),
433  getLaneFrom()->getIndex(), getLaneTo()->getIndex(), parse<int>(value), false);
434  std::vector<NBNode*> nodes = tlDef->getNodes();
435  for (NBNode* node : nodes) {
436  GNEJunction* junction = getNet()->retrieveJunction(node->getID());
437  undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
438  undoList->add(new GNEChange_TLS(junction, newDef, true), true);
439  }
440  } else {
441  WRITE_ERROR("Could not set attribute '" + toString(key) + "' (tls is broken)");
442  }
443  }
444  undoList->p_end();
445  }
446  break;
447  case SUMO_ATTR_DIR:
448  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
449  case SUMO_ATTR_STATE:
450  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
451  default:
452  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
453  }
454 }
455 
456 
457 bool
458 GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
459  // Currently ignored before implementation to avoid warnings
460  switch (key) {
461  case SUMO_ATTR_FROM:
462  case SUMO_ATTR_TO:
463  case SUMO_ATTR_FROM_LANE:
464  case SUMO_ATTR_TO_LANE:
465  return false;
466  case SUMO_ATTR_PASS:
467  return canParse<bool>(value);
469  return canParse<bool>(value);
470  case SUMO_ATTR_CONTPOS:
471  return canParse<double>(value) && (parse<double>(value) >= -1);
473  return canParse<bool>(value);
475  return canParse<double>(value) && (parse<double>(value) >= -1);
477  if (getNBEdgeConnection().uncontrolled == false
478  && getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS().size() > 0
479  && canParse<int>(value)
480  && parse<int>(value) >= 0) {
482  return def->getMaxValidIndex() >= parse<int>(value);
483  } else {
484  return false;
485  }
486  case SUMO_ATTR_SPEED:
487  return canParse<double>(value) && (parse<double>(value) >= -1);
488  case SUMO_ATTR_CUSTOMSHAPE: {
489  // empty custom shapes are allowed
490  return canParse<PositionVector>(value);
491  }
492  case SUMO_ATTR_STATE:
493  return false;
494  case SUMO_ATTR_DIR:
495  return false;
496  case GNE_ATTR_SELECTED:
497  return canParse<bool>(value);
498  case GNE_ATTR_GENERIC:
499  return isGenericParametersValid(value);
500  default:
501  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
502  }
503 }
504 
505 
506 std::string
508  std::string result;
509  // Generate an string using the following structure: "key1=value1|key2=value2|...
510  for (auto i : getNBEdgeConnection().getParametersMap()) {
511  result += i.first + "=" + i.second + "|";
512  }
513  // remove the last "|"
514  if (!result.empty()) {
515  result.pop_back();
516  }
517  return result;
518 }
519 
520 
521 std::vector<std::pair<std::string, std::string> >
523  std::vector<std::pair<std::string, std::string> > result;
524  // iterate over parameters map and fill result
525  for (auto i : getNBEdgeConnection().getParametersMap()) {
526  result.push_back(std::make_pair(i.first, i.second));
527  }
528  return result;
529 }
530 
531 
532 void
533 GNEConnection::setGenericParametersStr(const std::string& value) {
534  // clear parameters
536  // separate value in a vector of string using | as separator
537  std::vector<std::string> parsedValues;
538  StringTokenizer stValues(value, "|", true);
539  while (stValues.hasNext()) {
540  parsedValues.push_back(stValues.next());
541  }
542  // check that parsed values (A=B)can be parsed in generic parameters
543  for (auto i : parsedValues) {
544  std::vector<std::string> parsedParameters;
545  StringTokenizer stParam(i, "=", true);
546  while (stParam.hasNext()) {
547  parsedParameters.push_back(stParam.next());
548  }
549  // Check that parsed parameters are exactly two and contains valid chracters
550  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
551  getNBEdgeConnection().setParameter(parsedParameters.front(), parsedParameters.back());
552  }
553  }
554 }
555 
556 // ===========================================================================
557 // private
558 // ===========================================================================
559 
560 void
561 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
563  switch (key) {
564  case SUMO_ATTR_PASS:
565  nbCon.mayDefinitelyPass = parse<bool>(value);
566  break;
568  nbCon.keepClear = parse<bool>(value);
569  break;
571  nbCon.uncontrolled = parse<bool>(value);
572  break;
573  case SUMO_ATTR_CONTPOS:
574  nbCon.contPos = parse<double>(value);
575  break;
577  nbCon.visibility = parse<double>(value);
578  break;
579  case SUMO_ATTR_SPEED:
580  nbCon.speed = parse<double>(value);
581  break;
582  case SUMO_ATTR_STATE:
583  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
584  case SUMO_ATTR_DIR:
585  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
586  case SUMO_ATTR_CUSTOMSHAPE: {
587  nbCon.customShape = parse<PositionVector>(value);
588  break;
589  }
590  case GNE_ATTR_SELECTED:
591  if (parse<bool>(value)) {
593  } else {
595  }
596  break;
597  case GNE_ATTR_GENERIC:
599  break;
600  default:
601  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
602  }
603  // Update Geometry after setting a new attribute (but avoided for certain attributes)
604  if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_GENERIC) && (key != GNE_ATTR_SELECTED)) {
606  updateGeometry();
607  }
608 }
609 
610 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:181
NBEdge::Connection::tlID
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:212
GNEConnection::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEConnection.cpp:507
GNEConnection::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEConnection.cpp:458
GLO_CONNECTION
a connection
Definition: GUIGlObjectTypes.h:55
GNEJunction::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNEJunction.cpp:113
GNEConnection::mySpecialColor
const RGBColor * mySpecialColor
optional special color
Definition: GNEConnection.h:182
NBEdge::Connection::toEdge
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:206
GNENetElement::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:148
GNEConnection::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEConnection.cpp:533
GLHelper::getColor
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
GNEConnection::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEConnection.cpp:76
NBNode::getLinkState
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2014
NBEdge::Connection::haveVia
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:245
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
NBTrafficLightDefinition::getMaxValidIndex
virtual int getMaxValidIndex()
Returns the maximum index controlled by this traffic light.
Definition: NBTrafficLightDefinition.h:357
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEInternalLane.h
LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
Definition: SUMOXMLDefinitions.h:1148
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:80
NBEdge::Connection::uncontrolled
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:263
OptionsCont.h
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:629
GLHelper::drawBoxLines
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:182
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:95
NUM_POINTS
int NUM_POINTS
Definition: GNEConnection.cpp:47
SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:717
SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
Definition: SUMOXMLDefinitions.h:699
GUIGLObjectPopupMenu.h
NBEdge::Connection::contPos
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:224
NBNode::computeSmoothShape
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:504
GNEConnection::getLinkState
LinkState getLinkState() const
get LinkState
Definition: GNEConnection.cpp:217
NBEdge::isBidiRail
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:683
GNEAttributeCarrier::isGenericParametersValid
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
Definition: GNEAttributeCarrier.cpp:1354
GNEConnection::myFromLane
GNELane * myFromLane
incoming lane of this connection
Definition: GNEConnection.h:173
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:223
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
StringTokenizer::next
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Definition: StringTokenizer.cpp:100
SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:385
PositionVector::extrapolate
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Definition: PositionVector.cpp:1025
SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
Definition: SUMOXMLDefinitions.h:707
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:476
GNEConnection::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEConnection.cpp:69
GLHelper.h
NBLoadedSUMOTLDef::getLogic
NBTrafficLightLogic * getLogic()
Returns the internal logic.
Definition: NBLoadedSUMOTLDef.h:123
GNE_NMODE_CREATE_EDGE
mode for creating new edges
Definition: GNEViewNetHelper.h:65
GNEConnection::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEConnection.cpp:403
GNE_NMODE_TLS
mode for editing tls
Definition: GNEViewNetHelper.h:69
NBEdge::Connection::tlLinkIndex
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:215
GNENetElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNENetElement.cpp:169
GUIVisualizationColorSettings::selectedConnectionColor
RGBColor selectedConnectionColor
connection selection color
Definition: GUIVisualizationSettings.h:139
GNEConnection::getEdgeTo
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
Definition: GNEConnection.cpp:167
PositionVector
A list of positions.
Definition: PositionVector.h:46
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
GNEConnection::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEConnection.cpp:251
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:382
GNEConnection::getLaneFrom
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
Definition: GNEConnection.cpp:173
SUMO_ATTR_DIR
The abstract direction of a link.
Definition: SUMOXMLDefinitions.h:703
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNELane::drawAsRailway
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1147
NBEdge::Connection::fromLane
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:203
GNENetElement::NetElementGeometry::shape
PositionVector shape
The shape of the netElement element.
Definition: GNENetElement.h:57
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:812
GUIAppEnum.h
GNEJunction.h
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:638
GNELane::getIndex
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:733
NBEdge::Connection::speed
double speed
custom speed for connection
Definition: NBEdge.h:230
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:132
NBEdge::Connection::toLane
int toLane
The lane the connections yields in.
Definition: NBEdge.h:209
RGBColor
Definition: RGBColor.h:40
GNENetElement::NetElementGeometry::shapeRotations
std::vector< double > shapeRotations
The rotations of the single shape parts.
Definition: GNENetElement.h:60
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:174
GNEConnection::setSpecialColor
void setSpecialColor(const RGBColor *Color2)
Definition: GNEConnection.cpp:349
NBLoadedSUMOTLDef::addConnection
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, bool reconstruct=true)
Adds a connection and immediately informs the edges.
Definition: NBLoadedSUMOTLDef.cpp:96
GNENetElement::myGeometry
NetElementGeometry myGeometry
netElement geometry
Definition: GNENetElement.h:199
GNEConnection::updateID
void updateID()
update internal ID of Connection
Definition: GNEConnection.cpp:211
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
NBEdge::Connection::viaShape
PositionVector viaShape
shape of via
Definition: NBEdge.h:251
GUIVisualizationSettings::detailSettings
GUIVisualizationDetailSettings detailSettings
detail settings
Definition: GUIVisualizationSettings.h:655
NBEdge::Connection::mayDefinitelyPass
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:218
SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:693
GNEConnection::getLaneTo
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
Definition: GNEConnection.cpp:179
GUIGlObject::buildNameCopyPopupEntry
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
Definition: GUIGlObject.cpp:226
GNEConnection::GNEConnection
GNEConnection(GNELane *from, GNELane *to)
Definition: GNEConnection.cpp:53
GNEConnection::getEdgeFrom
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
Definition: GNEConnection.cpp:161
GNEEdge::getNBEdge
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:625
GNEConnection::getToLaneIndex
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
Definition: GNEConnection.cpp:191
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
SUMO_ATTR_PASS
Definition: SUMOXMLDefinitions.h:765
GNENetElement::NetElementGeometry::calculateShapeRotationsAndLengths
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
Definition: GNENetElement.cpp:55
GNEConnection::getFromLaneIndex
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
Definition: GNEConnection.cpp:185
GNEConnection::getNBEdgeConnection
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
Definition: GNEConnection.cpp:197
GNEConnection::myShapeDeprecated
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
Definition: GNEConnection.h:185
StringTokenizer
Definition: StringTokenizer.h:62
GNEViewNet::getNetworkViewOptions
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:411
GNEChange_TLS.h
GNEViewNet.h
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:246
NBEdge::Connection::shape
PositionVector shape
shape of Connection
Definition: NBEdge.h:239
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNELane::getParentEdge
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1292
GNEConnection::getBoundary
Boundary getBoundary() const
Returns the street's geometry.
Definition: GNEConnection.cpp:148
NBEdge::getNumLanes
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
GNEInternalLane::colorForLinksState
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
Definition: GNEInternalLane.cpp:194
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:623
GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
Definition: GNEViewNetHelper.h:47
GNENet::retrieveJunction
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:1001
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:309
GNEConnection::myToLane
GNELane * myToLane
outgoing lane of this connection
Definition: GNEConnection.h:176
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEConnection::myLinkState
LinkState myLinkState
Linkstate.
Definition: GNEConnection.h:179
GNE_NMODE_CONNECT
mode for connecting lanes
Definition: GNEViewNetHelper.h:67
Position::x
double x() const
Returns the x-position.
Definition: Position.h:57
GNEEdge.h
GNEConnection::~GNEConnection
~GNEConnection()
Destructor.
Definition: GNEConnection.cpp:64
SUMOXMLDefinitions::isValidGenericParameterKey
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1034
GUIVisualizationSettings::selectionScale
double selectionScale
the current selection scaling in NETEDIT (temporary)
Definition: GUIVisualizationSettings.h:632
PositionVector::append
void append(const PositionVector &v, double sameThreshold=2.0)
Definition: PositionVector.cpp:688
GNENetElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNENetElement.cpp:163
GLHelper::drawLine
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
GNEChange_TLS
Definition: GNEChange_TLS.h:43
GNENetElement
Definition: GNENetElement.h:42
GNEViewNetHelper::NetworkViewOptions::showConnections
bool showConnections() const
check if select show connections checkbox is enabled
Definition: GNEViewNetHelper.cpp:1637
NBEdge::getConnectionRef
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:1155
NBConnection
Definition: NBConnection.h:44
GNEEdge::getGNEJunctionDestiny
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:505
MID_GNE_CONNECTION_EDIT_SHAPE
edit junction shape
Definition: GUIAppEnum.h:857
GLHelper::drawShapeDottedContourAroundShape
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, 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:461
GNENetElement::NetElementGeometry::clearGeometry
void clearGeometry()
reset geometry
Definition: GNENetElement.cpp:47
NetworkEditMode
NetworkEditMode
@brie enum for network edit modes
Definition: GNEViewNetHelper.h:53
GNELane.h
SUMOXMLDefinitions::isValidGenericParameterValue
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1041
NBEdge::getLanes
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2067
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:716
PositionVector::getOrthogonal
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
Definition: PositionVector.cpp:1500
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:649
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:637
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
GNEConnection::getNBConnection
NBConnection getNBConnection() const
get NBConnection
Definition: GNEConnection.cpp:203
NBNode::getShape
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2143
SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:705
GNEConnection::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEConnection.cpp:282
GUIMainWindow
Definition: GUIMainWindow.h:47
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
GNEConnection::myInternalJunctionMarker
PositionVector myInternalJunctionMarker
waiting position for internal junction
Definition: GNEConnection.h:188
SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:683
GNEConnection::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEConnection.cpp:522
GNENetElement::getNet
GNENet * getNet() const
get Net in which this element is placed
Definition: GNENetElement.cpp:107
GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:49
NBNode::getControllingTLS
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:322
InvalidArgument
Definition: UtilExceptions.h:57
NBEdge::Connection::keepClear
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:221
GNEConnection::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEConnection.cpp:354
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:203
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:267
SUMO_ATTR_UNCONTROLLED
Definition: SUMOXMLDefinitions.h:764
NBEdge::Connection::customShape
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:233
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
GNENetElement::myNet
GNENet * myNet
the net to inform about updates
Definition: GNENetElement.h:196
GNEConnection::updateLinkState
void updateLinkState()
recompute cached myLinkState
Definition: GNEConnection.cpp:239
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:99
config.h
GUIVisualizationSettings::addSize
GUIVisualizationSizeSettings addSize
Definition: GUIVisualizationSettings.h:580
GLO_JUNCTION
a junction
Definition: GUIGlObjectTypes.h:51
GNEConnection::markConnectionGeometryDeprecated
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
Definition: GNEConnection.cpp:233
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:968
StringTokenizer.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
GUIVisualizationSettings::spreadSuperposed
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Definition: GUIVisualizationSettings.h:477
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
GUIVisualizationSettings::drawDetail
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
Definition: GUIVisualizationSettings.cpp:1621
GNENetElement::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:132
NBTrafficLightLogic
A SUMO-compliant built logic for a traffic light.
Definition: NBTrafficLightLogic.h:52
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:68
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationDetailSettings::connectionsDemandMode
static const double connectionsDemandMode
draw connections in demand mode
Definition: GUIVisualizationSettings.h:281
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
NBLoadedSUMOTLDef.h
GNEJunction
Definition: GNEJunction.h:48
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
GNEUndoList::p_begin
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
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
NBEdge::Connection::visibility
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:227
PositionVector::area
double area() const
Returns the area (0 for non-closed)
Definition: PositionVector.cpp:502
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
GNEConnection::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEConnection.cpp:274
GNEViewNetHelper::EditModes::networkEditMode
NetworkEditMode networkEditMode
the current Network edit mode
Definition: GNEViewNetHelper.h:312
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
GNEConnection::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNEConnection.cpp:141
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEConnection::getShape
const PositionVector & getShape() const
get Position vector calculated in updateGeometry()
Definition: GNEConnection.cpp:223
GNEChange_Attribute.h
GNENet.h
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
PositionVector::move2side
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Definition: PositionVector.cpp:1086
NBTrafficLightDefinition
The base class for traffic light logic definitions.
Definition: NBTrafficLightDefinition.h:68
GNEUndoList.h
SUMO_ATTR_CONTPOS
Definition: SUMOXMLDefinitions.h:746
GNENetElement::NetElementGeometry::shapeLengths
std::vector< double > shapeLengths
The lengths of the single shape parts.
Definition: GNENetElement.h:63
GUIVisualizationSettings::drawForSelecting
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
Definition: GUIVisualizationSettings.h:635
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1364
GNEConnection.h
NBLoadedSUMOTLDef
A loaded (complete) traffic light logic.
Definition: NBLoadedSUMOTLDef.h:45