SUMO - Simulation of Urban MObility
GNEJunction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A class for visualizing and editing junctions in netedit (adapted from
8 // GUIJunctionWrapper)
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <utility>
36 #include <utils/geom/Position.h>
43 #include <utils/gui/div/GLHelper.h>
48 #include <netbuild/NBOwnTLDef.h>
50 #include <netbuild/NBAlgorithms.h>
51 #include "tlslogo.cpp"
52 #include "GNENet.h"
53 #include "GNEEdge.h"
54 #include "GNECrossing.h"
55 #include "GNEUndoList.h"
56 #include "GNEViewNet.h"
57 #include "GNEChange_Attribute.h"
58 #include "GNEChange_Connection.h"
59 #include "GNEChange_TLS.h"
60 #include "GNEJunction.h"
61 
62 #ifdef CHECK_MEMORY_LEAKS
63 #include <foreign/nvwa/debug_new.h>
64 #endif // CHECK_MEMORY_LEAKS
65 
66 
67 // ===========================================================================
68 // static members
69 // ===========================================================================
72 
73 // ===========================================================================
74 // method definitions
75 // ===========================================================================
76 GNEJunction::GNEJunction(NBNode& nbn, GNENet* net, bool loaded) :
77  GUIGlObject(GLO_JUNCTION, nbn.getID()),
79  myNBNode(nbn),
80  myOrigPos(nbn.getPosition()),
81  myAmCreateEdgeSource(false),
82  myNet(net),
83  myLogicStatus(loaded ? LOADED : GUESSED),
84  myAmResponsible(false),
85  myHasValidLogic(loaded),
86  myAmTLSSelected(false) {
87  const double EXTENT = 2;
89  myOrigPos.x() - EXTENT, myOrigPos.y() - EXTENT,
90  myOrigPos.x() + EXTENT, myOrigPos.y() + EXTENT);
91  myMaxSize = 2 * EXTENT;
92  rebuildCrossings(false);
93 }
94 
95 
97  if (myAmResponsible) {
98  delete &myNBNode;
99  }
100  rebuildCrossings(true);
101 }
102 
103 
104 void
106  for (std::vector<GNECrossing*>::const_iterator it = myCrossings.begin(); it != myCrossings.end(); it++) {
107  (*it)->decRef();
108  if ((*it)->unreferenced()) {
109  delete *it;
110  }
111  }
112  myCrossings.clear();
113  if (!deleteOnly) {
114  const std::vector<NBNode::Crossing>& crossings = myNBNode.getCrossings();
115  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
116  myCrossings.push_back(new GNECrossing(*this, (*it).id));
117  myCrossings.back()->incRef();
118  }
119  }
120 }
121 
122 
125  GUISUMOAbstractView& parent) {
126  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
127  buildPopupHeader(ret, app);
131  buildPositionCopyEntry(ret, false);
132  //if (parent.getVisualisationSettings()->editMode != GNE_MODE_CONNECT) {
133  // // XXX if joinable
134  // new FXMenuCommand(ret, "Join adjacent edges", 0, &parent, MID_GNE_JOIN_EDGES);
135  //}
136  FXMenuCommand* mcCustomShape = new FXMenuCommand(ret, "Set custom shape", 0, &parent, MID_GNE_NODE_SHAPE);
137  FXMenuCommand* mcReplace = new FXMenuCommand(ret, "Replace by geometry node", 0, &parent, MID_GNE_NODE_REPLACE);
138  const int editMode = parent.getVisualisationSettings()->editMode;
139  const bool wrongMode = (editMode == GNE_MODE_CONNECT || editMode == GNE_MODE_TLS || editMode == GNE_MODE_CREATE_EDGE);
140  if (wrongMode) {
141  mcCustomShape->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
142  }
143  // checkIsRemovable requiers turnarounds to be computed. This is ugly
144  if (myNBNode.getIncomingEdges().size() == 2 && myNBNode.getOutgoingEdges().size() == 2) {
146  }
147  if (wrongMode || !myNBNode.checkIsRemovable()) {
148  mcReplace->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
149  }
150  // let the GNEViewNet store the popup position
151  (dynamic_cast<GNEViewNet&>(parent)).markPopupPosition();
152  return ret;
153 }
154 
155 
159  return 0;
160 }
161 
162 
163 Boundary
165  Boundary b = myBoundary;
166  b.grow(20);
167  return b;
168 }
169 
170 
171 void
173  glPushName(getGlID());
174  SUMOReal selectionScale = gSelected.isSelected(getType(), getGlID()) ? s.selectionScale : 1;
175  if (s.scale * selectionScale * myMaxSize < 1.) {
176  // draw something simple so that selection still works
178  } else {
179  // node shape has been computed and is valid for drawing
180  const bool drawShape = myNBNode.getShape().size() > 0 && s.drawJunctionShape;
181  const bool drawBubble = (!drawShape || myNBNode.getShape().area() < 4) && s.drawJunctionShape; // magic threshold
182 
183  if (drawShape) {
184  glPushMatrix();
185  setColor(s, false);
186  glTranslated(0, 0, getType());
187  PositionVector shape = myNBNode.getShape();
188  shape.closePolygon();
189  if (selectionScale > 1) {
190  shape.scaleRelative(selectionScale);
191  }
192  if (s.scale * selectionScale * myMaxSize < 40.) {
193  GLHelper::drawFilledPoly(shape, true);
194  } else {
196  }
197  glPopMatrix();
198  }
199  if (drawBubble) {
200  glPushMatrix();
201  setColor(s, true);
202  Position pos = myNBNode.getPosition();
203  glTranslated(pos.x(), pos.y(), getType() - 0.05);
204  GLHelper::drawFilledCircle(myMaxSize * selectionScale, 32);
205  glPopMatrix();
206  }
207 
209  // decorate in tls mode
210  if (!TLSDecalInitialized) {
211  FXImage* i = new FXGIFImage(myNet->getApp(), tlslogo, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
213  TLSDecalInitialized = true;
214  delete i;
215  }
216  glPushMatrix();
217  Position pos = myNBNode.getPosition();
218  glTranslated(pos.x(), pos.y(), getType() + 0.1);
219  glColor3d(1, 1, 1);
220  const SUMOReal halfWidth = 32 / s.scale;
221  const SUMOReal halfHeight = 64 / s.scale;
222  GUITexturesHelper::drawTexturedBox(TLSDecalGlID, -halfWidth, -halfHeight, halfWidth, halfHeight);
223  glPopMatrix();
224  }
225  // draw crossings
226  if (s.editMode != GNE_MODE_TLS) {
227  for (std::vector<GNECrossing*>::const_iterator it = myCrossings.begin(); it != myCrossings.end(); it++) {
228  (*it)->drawGL(s);
229  }
230  }
231  // (optional) draw name @todo expose this setting
233  }
234  glPopName();
235 }
236 
237 
238 void
240  const Position orig = myNBNode.getPosition();
241  setPosition(pos);
242  myNet->refreshElement(this);
243  const EdgeVector& incident = getNBNode()->getEdges();
244  for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) {
245  GNEEdge* edge = myNet->retrieveEdge((*it)->getID());
246  edge->updateJunctionPosition(this, orig);
247  }
248 }
249 
250 
251 void
253  Position newPos = myNBNode.getPosition();
254  std::string newPosValue = getAttribute(SUMO_ATTR_POSITION);
255  // actually the geometry is already up to date
256  // set the restore point to the end of the last change-set
258  // do not execute the command to avoid changing the edge geometry twice
259  undoList->add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, newPosValue), false);
260  setPosition(newPos);
261 }
262 
263 
264 void
266  if (!myNBNode.hasCustomShape()) {
267  myNBNode.myPoly.clear();
269  }
270 }
271 
272 
273 void
274 GNEJunction::setLogicValid(bool valid, GNEUndoList* undoList, const std::string& status) {
275  myHasValidLogic = valid;
276  if (!valid) {
277  assert(undoList != 0);
278  assert(undoList->hasCommandGroup());
279  undoList->add(new GNEChange_Attribute(this, GNE_ATTR_MODIFICATION_STATUS, status));
280  // allow edges to recompute their connections
283  for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
284  NBEdge* srcNBE = *it;
285  NBEdge* turnEdge = srcNBE->getTurnDestination();
286  GNEEdge* srcEdge = myNet->retrieveEdge(srcNBE->getID());
287  std::vector<NBEdge::Connection> connections = srcNBE->getConnections(); // make a copy!
288  // delete in reverse so that undoing will add connections in the original order
289  for (std::vector<NBEdge::Connection>::reverse_iterator con_it = connections.rbegin(); con_it != connections.rend(); con_it++) {
290  bool hasTurn = con_it->toEdge == turnEdge;
291  undoList->add(new GNEChange_Connection(
292  srcEdge, con_it->fromLane, con_it->toEdge->getID(),
293  con_it->toLane, con_it->mayDefinitelyPass, false), true);
294  // needs to come after GNEChange_Connection
295  // XXX bug: this code path will not be used on a redo!
296  if (hasTurn) {
297  myNet->addExplicitTurnaround(srcNBE->getID());
298  }
299  }
300  undoList->add(new GNEChange_Attribute(srcEdge, GNE_ATTR_MODIFICATION_STATUS, status), true);
301  }
302  invalidateTLS(undoList);
303  } else {
304  rebuildCrossings(false);
305  }
306 }
307 
308 
309 void
310 GNEJunction::invalidateTLS(GNEUndoList* undoList, const NBConnection& deletedConnection) {
311  assert(undoList->hasCommandGroup());
312  // NBLoadedSUMOTLDef becomes invalid, replace with NBOwnTLDef which will be dynamically recomputed
313  const std::set<NBTrafficLightDefinition*> tls = myNBNode.getControllingTLS(); // make a copy!
314  for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
315  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(*it);
316  if (tlDef != 0) {
317  NBTrafficLightDefinition* replacementDef = 0;
318  std::string newID = tlDef->getID(); // + "_reguessed"; // changes due to reguessing will be visible in diff
319  if (deletedConnection != NBConnection::InvalidConnection) {
320  // create replacement before deleting the original because deletion will mess up saving original nodes
321  NBLoadedSUMOTLDef* repl = new NBLoadedSUMOTLDef(tlDef, tlDef->getLogic());
322  repl->removeConnection(deletedConnection);
323  replacementDef = repl;
324  } else {
325  replacementDef = new NBOwnTLDef(newID, tlDef->getOffset(), tlDef->getType());
326  }
327  undoList->add(new GNEChange_TLS(this, tlDef, false), true);
328  undoList->add(new GNEChange_TLS(this, replacementDef, true, false, newID), true);
329  // the removed traffic light may have controlled more than one junction. These too have become invalid now
330  const std::vector<NBNode*> coNodes = tlDef->getNodes(); // make a copy!
331  for (std::vector<NBNode*>::const_iterator it_node = coNodes.begin(); it_node != coNodes.end(); it_node++) {
332  GNEJunction* sharing = myNet->retrieveJunction((*it_node)->getID());
333  undoList->add(new GNEChange_TLS(sharing, tlDef, false), true);
334  undoList->add(new GNEChange_TLS(sharing, replacementDef, true, false, newID), true);
335  }
336  }
337  }
338 }
339 
340 void
342  // @todo implement GNEChange_Crossing
343  UNUSED_PARAMETER(undoList);
344  // make a copy because the original will be modified
345  const std::vector<NBNode::Crossing> crossings = myNBNode.getCrossings();
346  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
347  EdgeSet edgeSet((*it).edges.begin(), (*it).edges.end());
348  if (edgeSet.count(edge->getNBEdge()) == 1) {
349  myNBNode.removeCrossing((*it).edges);
350  }
351  }
352 }
353 
354 
355 std::string
357  switch (key) {
358  case SUMO_ATTR_ID:
359  return getMicrosimID();
360  break;
361  case SUMO_ATTR_POSITION:
362  return toString(myNBNode.getPosition());
363  break;
364  case SUMO_ATTR_TYPE:
365  return toString(myNBNode.getType());
366  break;
368  return myLogicStatus;
369  break;
370  case SUMO_ATTR_SHAPE:
371  return toString(myNBNode.getShape());
372  case SUMO_ATTR_RADIUS:
373  return toString(myNBNode.getRadius());
375  return myNBNode.getKeepClear() ? "true" : "false";
376  default:
377  throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed");
378  }
379 }
380 
381 
382 void
383 GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
384  if (value == getAttribute(key)) {
385  return; //avoid needless changes, later logic relies on the fact that attributes have changed
386  }
387  switch (key) {
388  case SUMO_ATTR_ID:
389  case SUMO_ATTR_POSITION:
391  case SUMO_ATTR_SHAPE:
392  case SUMO_ATTR_RADIUS:
394  undoList->add(new GNEChange_Attribute(this, key, value), true);
395  break;
396  case SUMO_ATTR_TYPE: {
397  undoList->p_begin("change junction type");
399  if (!getNBNode()->isTLControlled()) {
400  // create new traffic light
401  undoList->add(new GNEChange_TLS(this, 0, true), true);
402  }
403  } else if (getNBNode()->isTLControlled()) {
404  // delete old traffic light
405  // make a copy because we will modify the original
406  const std::set<NBTrafficLightDefinition*> tls = myNBNode.getControllingTLS();
407  for (std::set<NBTrafficLightDefinition*>::iterator it = tls.begin(); it != tls.end(); it++) {
408  undoList->add(new GNEChange_TLS(this, *it, false), true);
409  }
410  }
411  // must be the final step, otherwise we do not know which traffic lights to remove via GNEChange_TLS
412  undoList->add(new GNEChange_Attribute(this, key, value), true);
413  undoList->p_end();
414  break;
415  }
416  default:
417  throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed");
418  }
419 }
420 
421 
422 bool
423 GNEJunction::isValid(SumoXMLAttr key, const std::string& value) {
424  switch (key) {
425  case SUMO_ATTR_ID:
426  return isValidID(value) && myNet->retrieveJunction(value, false) == 0;
427  break;
428  case SUMO_ATTR_TYPE:
430  break;
431  case SUMO_ATTR_POSITION:
432  bool ok;
433  return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1;
434  break;
435  case SUMO_ATTR_SHAPE: {
436  bool ok = true;
438  value, "user-supplied position", 0, ok, true);
439  return ok;
440  break;
441  }
442  case SUMO_ATTR_RADIUS:
443  return canParse<SUMOReal>(value);
444  break;
446  return value == "true" || value == "false";
447  break;
448  default:
449  throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed");
450  }
451 }
452 
453 // ===========================================================================
454 // private
455 // ===========================================================================
456 
457 void
458 GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value) {
459  switch (key) {
460  case SUMO_ATTR_ID:
461  myNet->renameJunction(this, value);
462  break;
463  case SUMO_ATTR_TYPE: {
465  break;
466  }
467  case SUMO_ATTR_POSITION:
468  bool ok;
469  myOrigPos = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0];
470  move(myOrigPos);
471  break;
473  myLogicStatus = value;
474  break;
475  case SUMO_ATTR_SHAPE: {
476  bool ok;
477  const PositionVector shape = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, true);
478  myNBNode.setCustomShape(shape);
479  break;
480  }
481  case SUMO_ATTR_RADIUS:
482  myNBNode.setRadius(parse<SUMOReal>(value));
483  break;
485  myNBNode.setKeepClear(value == "true");
486  break;
487  default:
488  throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed");
489  }
490 }
491 
492 
493 void
495  const Position& orig = myNBNode.getPosition();
496  myBoundary.moveby(pos.x() - orig.x(), pos.y() - orig.y());
498  /* //reshift also shifts the junction shape. this is not needed because shape is not yet computed
499  * const Position& orig = myNBNode.getPosition();
500  * myNBNode.reshiftPosition(pos.x() - orig.x(), pos.y() - orig.y());
501  */
502 }
503 
504 
505 SUMOReal
507  switch (s.junctionColorer.getActive()) {
508  case 0:
509  if (bubble) {
510  return 1;
511  } else {
512  return 0;
513  }
514  case 1:
515  return gSelected.isSelected(getType(), getGlID()) ? 1 : 0;
516  case 2:
517  switch (myNBNode.getType()) {
519  return 0;
521  return 1;
522  case NODETYPE_PRIORITY:
523  return 2;
525  return 3;
527  return 4;
529  return 5;
530  case NODETYPE_DISTRICT:
531  return 6;
532  case NODETYPE_NOJUNCTION:
533  return 7;
534  case NODETYPE_DEAD_END:
536  return 8;
537  case NODETYPE_UNKNOWN:
538  case NODETYPE_INTERNAL:
539  assert(false);
540  return 8;
542  return 9;
543  case NODETYPE_ZIPPER:
544  return 10;
546  return 11;
547  }
548  default:
549  assert(false);
550  return 0;
551  }
552 }
553 
554 
555 void
556 GNEJunction::setColor(const GUIVisualizationSettings& s, bool bubble) const {
558  // override with special colors
559  if (gSelected.isSelected(getType(), getGlID())) {
561  }
562  if (myAmCreateEdgeSource) {
563  glColor3d(0, 1, 0);
564  }
565 }
566 
567 void
570  tlCont.insert(tlDef, forceInsert); // may return false for tlDef which controls multiple junctions
571  tlDef->addNode(&myNBNode);
572 }
573 
574 
575 void
578  tlCont.extract(tlDef);
580 }
581 
582 void
584  EdgeSet edgeSet(crossing.edges.begin(), crossing.edges.end());
585  for (std::vector<NBNode::Crossing>::iterator it = myNBNode.myCrossings.begin(); it != myNBNode.myCrossings.end(); ++it) {
586  EdgeSet edgeSet2((*it).edges.begin(), (*it).edges.end());
587  if (edgeSet == edgeSet2) {
588  (*it).width = crossing.width;
589  (*it).priority = crossing.priority;
590  myNet->refreshElement(this);
591  break;
592  }
593  }
594 }
595 
596 /****************************************************************************/
bool myAmResponsible
whether we are responsible for deleting myNBNode
Definition: GNEJunction.h:246
void rebuildCrossings(bool deleteOnly)
rebuilds crossing objects for this junction
GUIVisualizationTextSettings junctionName
void removeConnection(const NBConnection &conn, bool reconstruct=true)
removes the given connection from the traffic light if recontruct=true, reconstructs the logic and in...
bool myHasValidLogic
whether this junctions logic is valid
Definition: GNEJunction.h:249
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges.
Definition: NBNode.h:240
std::string myLogicStatus
modification status of the junction logic (all connections across this junction)
Definition: GNEJunction.h:243
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:278
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
static StringBijection< SumoXMLNodeType > NodeTypes
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:541
std::vector< Crossing > myCrossings
Vector of crossings.
Definition: NBNode.h:751
SUMOReal width
This lane&#39;s width.
Definition: NBNode.h:143
Whether vehicles must keep the junction clear.
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
void invalidateShape()
GUIVisualizationSettings * getVisualisationSettings()
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
SUMOReal getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:272
PositionVector myPoly
the (outer) shape of the junction
Definition: NBNode.h:766
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
Definition: GNENet.cpp:592
bool hasString(const std::string &str) const
A loaded (complete) traffic light logic.
bool myAmCreateEdgeSource
Definition: GNEJunction.h:237
static GUIGlID add(FXImage *i)
Adds a texture to use.
static const NBConnection InvalidConnection
Definition: NBConnection.h:125
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:264
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:304
bool isValid(SumoXMLAttr key, const std::string &value)
TrafficLightType getType() const
get the algorithm type (static etc..)
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
friend class GNEChange_TLS
Definition: GNEJunction.h:63
Stores the information about how to visualize structures.
static int TLSDecalGlID
gl-id of the tls-decal (drawn in tls-mode)
Definition: GNEJunction.h:258
The representation of a single edge during network building.
Definition: NBEdge.h:70
const std::vector< Crossing > & getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.h:640
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.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:154
void scaleRelative(SUMOReal factor)
enlarges/shrinks the polygon by a factor based at the centroid
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
Definition: GNENet.h:337
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
Definition: GLHelper.cpp:130
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:76
int editMode
the current NETEDIT mode (temporary)
void p_begin(const std::string &description)
Definition: GNEUndoList.cpp:75
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:520
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
Definition: GNENet.cpp:845
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static bool TLSDecalInitialized
whether the tls-decal has been initialized
Definition: GNEJunction.h:261
bool checkIsRemovable() const
Definition: NBNode.cpp:1517
bool myAmTLSSelected
whether this junction is selected in tls-mode
Definition: GNEJunction.h:252
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:322
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1597
GNENet * myNet
Definition: GNEJunction.h:240
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
void registerMove(GNEUndoList *undoList)
registers completed movement with the undoList
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
removes a traffic light
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:123
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
Position myOrigPos
restore point for undo
Definition: GNEJunction.h:226
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
void setColor(const GUIVisualizationSettings &s, bool bubble) const
sets junction color depending on circumstances
bool priority
whether the pedestrians have priority
Definition: NBNode.h:151
SUMOTime getOffset()
Returns the offset.
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
Definition: GNENet.cpp:836
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:95
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges.
Definition: NBNode.h:248
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
const std::string & getID() const
Returns the id.
Definition: Named.h:65
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:167
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:2400
const Position & getPosition() const
Returns the position of this node.
Definition: NBNode.h:228
The turning radius at an intersection in m.
std::set< NBEdge * > EdgeSet
Definition: NBCont.h:51
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
Definition: NBNode.h:318
static void drawTexturedBox(unsigned int which, SUMOReal size)
Draws a named texture as a box with the given size.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:55
void updateCrossingAttributes(NBNode::Crossing crossing)
modify the specified crossing (using friend privileges)
void setRadius(SUMOReal radius)
set the turning radius
Definition: NBNode.h:510
void p_end()
Definition: GNEUndoList.cpp:82
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:529
A list of positions.
SUMOReal getColorValue(const GUIVisualizationSettings &s, bool bubble) const
determines color value
const unsigned char tlslogo[]
Definition: tlslogo.cpp:23
friend class GNEChange_Attribute
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:265
void removeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
SUMOReal myMaxSize
The maximum size (in either x-, or y-dimension) for determining whether to draw or not...
Definition: GNEJunction.h:229
const EdgeVector & getEdges() const
Returns all edges which participate in this node.
Definition: NBNode.h:256
const T getColor(const SUMOReal value) const
NBNode * getNBNode()
returns the internal NBNode
Definition: GNEJunction.h:149
NBTrafficLightLogic * getLogic()
Returns the internal logic.
GUIColorer junctionColorer
The junction colorer.
const std::string getID() const
function to support debugging
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1591
NBNode & myNBNode
A reference to the represented junction.
Definition: GNEJunction.h:223
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
void setKeepClear(bool keepClear)
set the keepClear flag
Definition: NBNode.h:515
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
static void computeTurnDirectionsForNode(NBNode *node, bool warn)
Computes turnaround destinations for all incoming edges of the given nodes (if any) ...
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.h:132
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:61
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:201
bool hasCommandGroup() const
Definition: GNEUndoList.h:111
virtual ~GNEJunction()
Destructor.
Definition: GNEJunction.cpp:96
Boundary myBoundary
The represented junction&#39;s boundary.
Definition: GNEJunction.h:232
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:41
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
void move(Position pos)
reposition the node at pos and informs the edges
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
Definition: GNEEdge.cpp:203
The popup menu of a globject.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
EdgeVector edges
The edges being crossed.
Definition: NBNode.h:139
Represents a single node (junction) during network building.
Definition: NBNode.h:74
T get(const std::string &str) const
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
A definition of a pedestrian crossing.
Definition: NBNode.h:132
GNEJunction(NBNode &nbn, GNENet *net, bool loaded=false)
Constructor.
Definition: GNEJunction.cpp:76
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
#define SUMOReal
Definition: config.h:214
std::vector< GNECrossing * > myCrossings
the built crossing objects
Definition: GNEJunction.h:255
bool drawJunctionShape
whether the shape of the junction should be drawn
static const RGBColor selectionColor
Definition: GNENet.h:83
void moveby(SUMOReal x, SUMOReal y)
Moves the boundary by the given amount.
Definition: Boundary.cpp:250
std::string getAttribute(SumoXMLAttr key) const
void setPosition(Position pos)
reposition the NBNnode and nothing else
SUMOReal area() const
Returns the area (0 for non-closed)
A traffic light logics which must be computed (only nodes/edges are given)
Definition: NBOwnTLDef.h:54
void closePolygon()
ensures that the last position equals the first
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:761
A window containing a gl-object&#39;s parameter.
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:2126
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:2514
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occured errors.
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.h:379
void addTrafficLight(NBTrafficLightDefinition *tlDef, bool forceInsert)
adds a traffic light
FXApp * getApp()
Definition: GNENet.h:384
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
a junction