SUMO - Simulation of Urban MObility
GNERerouter.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <string>
31 #include <iostream>
32 #include <utility>
38 #include <utils/common/ToString.h>
39 #include <utils/geom/GeomHelper.h>
46 #include <utils/gui/div/GLHelper.h>
50 
51 #include "GNEViewNet.h"
52 #include "GNERerouter.h"
53 #include "GNERerouterDialog.h"
54 #include "GNELane.h"
55 #include "GNEEdge.h"
56 #include "GNEViewNet.h"
57 #include "GNEUndoList.h"
58 #include "GNENet.h"
59 #include "GNEChange_Attribute.h"
60 
61 #ifdef CHECK_MEMORY_LEAKS
62 #include <foreign/nvwa/debug_new.h>
63 #endif
64 
65 // ===========================================================================
66 // member method definitions
67 // ===========================================================================
68 
69 // ---------------------------------------------------------------------------
70 // GNERerouter::closingReroute - methods
71 // ---------------------------------------------------------------------------
72 
73 GNERerouter::closingReroute::closingReroute(std::string closedEdgeId, std::vector<std::string> allowVehicles, std::vector<std::string> disallowVehicles) :
74  myClosedEdgeId(closedEdgeId),
75  myAllowVehicles(allowVehicles),
76  myDisallowVehicles(disallowVehicles) {
77 }
78 
79 
81 }
82 
83 
84 void
86  // Check if was already inserted
87  for (std::vector<std::string>::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) {
88  if ((*i) == vehicleid) {
89  throw ProcessError(vehicleid + " already inserted");
90  }
91  }
92  // insert in vector
93  myAllowVehicles.push_back(vehicleid);
94 }
95 
96 
97 void
99  // find and remove
100  for (std::vector<std::string>::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) {
101  if ((*i) == vehicleid) {
102  myAllowVehicles.erase(i);
103  return;
104  }
105  }
106  // Throw error if don't exist
107  throw ProcessError(vehicleid + " not exist");
108 }
109 
110 
111 void
113  // Check if was already inserted
114  for (std::vector<std::string>::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) {
115  if ((*i) == vehicleid) {
116  throw ProcessError(vehicleid + " already inserted");
117  }
118  }
119  // insert in vector
120  myDisallowVehicles.push_back(vehicleid);
121 }
122 
123 
124 void
126  // find and remove
127  for (std::vector<std::string>::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) {
128  if ((*i) == vehicleid) {
129  myDisallowVehicles.erase(i);
130  return;
131  }
132  }
133  // Throw error if don't exist
134  throw ProcessError(vehicleid + " not exist");
135 }
136 
137 
138 std::vector<std::string>
140  return myAllowVehicles;
141 }
142 
143 
144 std::vector<std::string>
146  return myDisallowVehicles;
147 }
148 
149 
150 std::string
152  return myClosedEdgeId;
153 }
154 
155 // ---------------------------------------------------------------------------
156 // GNERerouter::destProbReroute - methods
157 // ---------------------------------------------------------------------------
158 
159 GNERerouter::destProbReroute::destProbReroute(std::string newDestinationId, SUMOReal probability):
160  myNewDestinationId(newDestinationId),
161  myProbability(probability) {
162 }
163 
164 
166 }
167 
168 
169 std::string
171  return myNewDestinationId;
172 }
173 
174 
175 SUMOReal
177  return myProbability;
178 }
179 
180 
181 void
183  if (probability >= 0 && probability <= 1) {
184  myProbability = probability;
185  } else {
186  throw InvalidArgument(toString(probability) + " isn't a probability");
187  }
188 }
189 
190 // ---------------------------------------------------------------------------
191 // GNERerouter::routeProbReroute - methods
192 // ---------------------------------------------------------------------------
193 
194 GNERerouter::routeProbReroute::routeProbReroute(std::string newRouteId, SUMOReal probability) :
195  myNewRouteId(newRouteId),
196  myProbability(probability) {
197 }
198 
199 
201 }
202 
203 
204 std::string
206  return myNewRouteId;
207 }
208 
209 
210 SUMOReal
212  return myProbability;
213 }
214 
215 
216 void
218  if (probability >= 0 && probability <= 1) {
219  myProbability = probability;
220  } else {
221  throw InvalidArgument(toString(probability) + " isn't a probability");
222  }
223 }
224 
225 // ---------------------------------------------------------------------------
226 // GNERerouter::rerouterInterval - methods
227 // ---------------------------------------------------------------------------
228 
230  std::pair<SUMOTime, SUMOTime>(begin, end) {
231 }
232 
233 
235 }
236 
237 
238 void
240  // Check if was already inserted
241  for (std::vector<closingReroute*>::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) {
242  if ((*i) == cr) {
243  throw ProcessError("closing reroute " + cr->getClosedEdgeId() + " already inserted");
244  }
245  }
246  // insert in vector
247  myClosingReroutes.push_back(cr);
248 }
249 
250 
251 void
253  // find and remove
254  for (std::vector<closingReroute*>::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) {
255  if ((*i) == cr) {
256  myClosingReroutes.erase(i);
257  return;
258  }
259  }
260  // Throw error if don't exist
261  throw ProcessError("closing reroute " + cr->getClosedEdgeId() + " not exist");
262 }
263 
264 
265 void
267  // Check if was already inserted
268  for (std::vector<destProbReroute*>::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) {
269  if ((*i) == dpr) {
270  throw ProcessError("destiny probability reroute " + dpr->getNewDestinationId() + " already inserted");
271  }
272  }
273  // insert in vector
274  myDestProbReroutes.push_back(dpr);
275 }
276 
277 
278 void
280  // find and remove
281  for (std::vector<destProbReroute*>::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) {
282  if ((*i) == dpr) {
283  myDestProbReroutes.erase(i);
284  return;
285  }
286  }
287  // Throw error if don't exist
288  throw ProcessError("destiny probability reroute " + dpr->getNewDestinationId() + " not exist");
289 }
290 
291 
292 void
294  // Check if was already inserted
295  for (std::vector<routeProbReroute*>::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) {
296  if ((*i) == rpr) {
297  throw ProcessError("route probability reroute " + rpr->getNewRouteId() + " already inserted");
298  }
299  }
300  // insert in vector
301  myRouteProbReroutes.push_back(rpr);
302 }
303 
304 
305 void
307  // find and remove
308  for (std::vector<routeProbReroute*>::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) {
309  if ((*i) == rpr) {
310  myRouteProbReroutes.erase(i);
311  return;
312  }
313  }
314  // Throw error if don't exist
315  throw ProcessError("route probability reroute " + rpr->getNewRouteId() + " not exist");
316 }
317 
318 
319 SUMOTime
321  return first;
322 }
323 
324 
325 SUMOTime
327  return second;
328 }
329 
330 
331 std::vector<GNERerouter::closingReroute*>
333  return myClosingReroutes;
334 }
335 
336 
337 std::vector<GNERerouter::destProbReroute*>
339  return myDestProbReroutes;
340 }
341 
342 
343 std::vector<GNERerouter::routeProbReroute*>
345  return myRouteProbReroutes;
346 }
347 
348 
349 // ---------------------------------------------------------------------------
350 // GNERerouter - methods
351 // ---------------------------------------------------------------------------
352 
353 GNERerouter::GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector<GNEEdge*> edges, const std::string& filename, SUMOReal probability, bool off, const std::set<rerouterInterval>& rerouterIntervals, bool blocked) :
354  GNEAdditionalSet(id, viewNet, pos, SUMO_TAG_REROUTER, blocked, std::vector<GNEAdditional * >(), edges),
355  myFilename(filename),
356  myProbability(probability),
357  myOff(off),
358  myRerouterIntervals(rerouterIntervals) {
359  // Update geometry;
360  updateGeometry();
361  // Set colors
362  myBaseColor = RGBColor(76, 170, 50, 255);
363  myBaseColorSelected = RGBColor(161, 255, 135, 255);
364 }
365 
366 
368 }
369 
370 
371 void
373  // Clear shape
374  myShape.clear();
375 
376  // Set block icon position
378 
379  // Set block icon offset
380  myBlockIconOffset = Position(-0.5, -0.5);
381 
382  // Set block icon rotation, and using their rotation for draw logo
384 
385  // Set position
386  myShape.push_back(myPosition);
387 
388  // Add shape of childs (To avoid graphics errors)
389  for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) {
390  myShape.append(i->edge->getLanes().at(0)->getShape());
391  }
392 
393  // Update geometry of additionalSet parent
395 }
396 
397 
398 Position
400  return myPosition;
401 }
402 
403 
404 void
406  //GNERerouterDialog rerouterDialog(this);
407 }
408 
409 
410 void
412  // if item isn't blocked
413  if (myBlocked == false) {
414  // change Position
415  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(Position(posx, posy, 0))));
416  }
417 }
418 
419 
420 void
421 GNERerouter::writeAdditional(OutputDevice& device, const std::string&) {
422  // Write parameters
423  device.openTag(getTag());
424  device.writeAttr(SUMO_ATTR_ID, getID());
425  device.writeAttr(SUMO_ATTR_EDGES, joinToString(getEdgeChildIds(), " ").c_str());
427  if (!myFilename.empty()) {
429  }
430  device.writeAttr(SUMO_ATTR_X, myPosition.x());
431  device.writeAttr(SUMO_ATTR_Y, myPosition.y());
432  // Close tag
433  device.closeTag();
434 }
435 
436 
437 std::string
439  return myFilename;
440 }
441 
442 
443 SUMOReal
445  return myProbability;
446 }
447 
448 
449 bool
451  return myOff;
452 }
453 
454 
455 void
456 GNERerouter::setFilename(std::string filename) {
457  myFilename = filename;
458 }
459 
460 
461 void
463  myProbability = probability;
464 }
465 
466 
467 void
469  myOff = off;
470 }
471 
472 
473 const std::string&
475  return myViewNet->getNet()->getMicrosimID();
476 }
477 
478 
479 void
481  // Start drawing adding an gl identificator
482  glPushName(getGlID());
483 
484  // Add a draw matrix for drawing logo
485  glPushMatrix();
486  glTranslated(myShape[0].x(), myShape[0].y(), getType());
487  glColor3d(1, 1, 1);
488  glRotated(180, 0, 0, 1);
489 
490  // Draw icon depending of rerouter is or isn't selected
491  if (isAdditionalSelected()) {
493  } else {
495  }
496 
497  // Pop draw matrix
498  glPopMatrix();
499 
500  // Show Lock icon depending of the Edit mode
501  drawLockIcon(0.4);
502 
503  // Draw symbols in every lane
504  const SUMOReal exaggeration = s.addSize.getExaggeration(s);
505  if (s.scale * exaggeration >= 3) {
506  // draw rerouter symbol over all lanes
507  for (childEdges::const_iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) {
508  for (int lanePosIt = 0; lanePosIt < (int)i->positionsOverLanes.size(); lanePosIt++) {
509  glPushMatrix();
510  glTranslated(i->positionsOverLanes.at(lanePosIt).x(), i->positionsOverLanes.at(lanePosIt).y(), 0);
511  glRotated(i->rotationsOverLanes.at(lanePosIt), 0, 0, 1);
512  glTranslated(0, 0, getType());
513  glScaled(exaggeration, exaggeration, 1);
514  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
515 
516  glBegin(GL_TRIANGLES);
517  glColor3d(1, .8f, 0);
518  // base
519  glVertex2d(0 - 1.4, 0);
520  glVertex2d(0 - 1.4, 6);
521  glVertex2d(0 + 1.4, 6);
522  glVertex2d(0 + 1.4, 0);
523  glVertex2d(0 - 1.4, 0);
524  glVertex2d(0 + 1.4, 6);
525  glEnd();
526 
527  glTranslated(0, 0, .1);
528  glColor3d(0, 0, 0);
529  pfSetPosition(0, 0);
530  pfSetScale(3.f);
531  SUMOReal w = pfdkGetStringWidth("U");
532  glRotated(180, 0, 1, 0);
533  glTranslated(-w / 2., 2, 0);
534  pfDrawString("U");
535 
536  glTranslated(w / 2., -2, 0);
537  std::string str = toString((int)(myProbability * 100)) + "%";
538  pfSetPosition(0, 0);
539  pfSetScale(.7f);
540  w = pfdkGetStringWidth(str.c_str());
541  glTranslated(-w / 2., 4, 0);
542  pfDrawString(str.c_str());
543  glPopMatrix();
544  }
545  }
546  glPopName();
547  }
548 
549  // Draw connections
550  drawConnections();
551 
552  // Pop name
553  glPopName();
554 
555  // Draw name
556  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
557 }
558 
559 
560 std::string
562  switch (key) {
563  case SUMO_ATTR_ID:
564  return getAdditionalID();
565  case SUMO_ATTR_EDGES:
566  return joinToString(getEdgeChildIds(), " ");
567  case SUMO_ATTR_POSITION:
568  return toString(myPosition);
569  case SUMO_ATTR_FILE:
570  return myFilename;
571  case SUMO_ATTR_PROB:
572  return toString(myProbability);
573  case SUMO_ATTR_OFF:
574  return toString(myOff);
575  default:
576  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
577  }
578 }
579 
580 
581 void
582 GNERerouter::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
583  if (value == getAttribute(key)) {
584  return; //avoid needless changes, later logic relies on the fact that attributes have changed
585  }
586  switch (key) {
587  case SUMO_ATTR_ID:
588  case SUMO_ATTR_EDGES:
589  case SUMO_ATTR_POSITION:
590  case SUMO_ATTR_FILE:
591  case SUMO_ATTR_PROB:
592  case SUMO_ATTR_OFF:
593  undoList->p_add(new GNEChange_Attribute(this, key, value));
594  updateGeometry();
595  break;
596  default:
597  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
598  }
599 }
600 
601 
602 bool
603 GNERerouter::isValid(SumoXMLAttr key, const std::string& value) {
604  switch (key) {
605  case SUMO_ATTR_ID:
606  if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) {
607  return true;
608  } else {
609  return false;
610  }
611  case SUMO_ATTR_EDGES: {
612  std::vector<std::string> edgeIds;
613  SUMOSAXAttributes::parseStringVector(value, edgeIds);
614  // Empty Edges aren't valid
615  if (edgeIds.empty()) {
616  return false;
617  }
618  // Iterate over parsed edges
619  for (int i = 0; i < (int)edgeIds.size(); i++) {
620  if (myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false) == NULL) {
621  return false;
622  }
623  }
624  return true;
625  }
626  case SUMO_ATTR_POSITION:
627  bool ok;
628  return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1;
629  case SUMO_ATTR_FILE:
630  return isValidFileValue(value);
631  case SUMO_ATTR_PROB:
632  return canParse<SUMOReal>(value);
633  case SUMO_ATTR_OFF:
634  return canParse<bool>(value);
635  default:
636  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
637  }
638 }
639 
640 
641 void
642 GNERerouter::setAttribute(SumoXMLAttr key, const std::string& value) {
643  switch (key) {
644  case SUMO_ATTR_ID:
645  setAdditionalID(value);
646  break;
647  case SUMO_ATTR_EDGES: {
648  // Declare variables
649  std::vector<std::string> edgeIds;
650  std::vector<GNEEdge*> edges;
651  GNEEdge* edge;
652  SUMOSAXAttributes::parseStringVector(value, edgeIds);
653  // Iterate over parsed edges and obtain pointer to edges
654  for (int i = 0; i < (int)edgeIds.size(); i++) {
655  edge = myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false);
656  if (edge) {
657  edges.push_back(edge);
658  }
659  }
660  // Set new childs
661  setEdgeChilds(edges);
662  break;
663  }
664  case SUMO_ATTR_POSITION:
665  bool ok;
666  myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0];
667  updateGeometry();
668  getViewNet()->update();
669  break;
670  case SUMO_ATTR_FILE:
671  myFilename = value;
672  break;
673  case SUMO_ATTR_PROB:
674  myProbability = parse<SUMOReal>(value);
675  break;
676  case SUMO_ATTR_OFF:
677  myOff = parse<bool>(value);
678  break;
679  default:
680  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
681  }
682 }
683 
684 /****************************************************************************/
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
std::vector< std::string > getDisallowVehicles() const
get disallow vehicles
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
int pfDrawString(const char *c)
Definition: polyfonts.c:1074
SUMOReal getProbability() const
get probability
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:616
long long int SUMOTime
Definition: SUMOTime.h:43
std::vector< std::string > myAllowVehicles
vector of allow vehicles
Definition: GNERerouter.h:93
~GNERerouter()
Destructor.
GUIVisualizationTextSettings addName
Stores the information about how to visualize structures.
std::vector< closingReroute * > myClosingReroutes
vector with the closingReroutes
Definition: GNERerouter.h:212
bool isAdditionalSelected() const
childEdges myChildEdges
map of child edges and their positions and rotation
void setOff(bool off)
set attribute to enable or disable inactive initially
void pfSetPosition(SUMOReal x, SUMOReal y)
Definition: polyfonts.c:480
const std::string & getParentName() const
Returns the name of the parent object (if any)
void setProbability(SUMOReal probability)
set probability
SUMOReal myProbability
probability with which a vehicle will use the given edge as destination
Definition: GNERerouter.h:126
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:329
std::string getAttribute(SumoXMLAttr key) const
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void writeAdditional(OutputDevice &device, const std::string &)
writte additional element into a xml file
std::string getClosedEdgeId() const
get closed edge Id
bool getOff() const
get attribute to enable or disable inactive initially
An Element wich group additionalSet elements.
void removeDisallowVehicle(std::string vehicleid)
remove a previously inserted disallow vehicle
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
GUIGlID getGlID() const
Returns the numerical id of the object.
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
void removeAllowVehicle(std::string vehicleid)
remove a previously inserted allow vehicle
Definition: GNERerouter.cpp:98
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
void insertAllowVehicle(std::string vehicleid)
insert an allow vehicle
Definition: GNERerouter.cpp:85
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
RGBColor myBaseColorSelected
base color selected (Default blue)
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::set< rerouterInterval > myRerouterIntervals
set with the rerouterInterval
Definition: GNERerouter.h:332
void setProbability(SUMOReal probability)
set probability of rerouter
GUIVisualizationSizeSettings addSize
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
void updateConnections()
update connections.
bool isValid(SumoXMLAttr key, const std::string &value)
static bool isValidFileValue(const std::string &value)
true if value is a valid file value
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::vector< routeProbReroute * > myRouteProbReroutes
vector with the routeProbReroutes
Definition: GNERerouter.h:218
the edges of a route
const std::string & getAdditionalID() const
returns the ID of additional
PositionVector myShape
The shape of the additional element.
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:323
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
std::string myNewDestinationId
id of new edge destination
Definition: GNERerouter.h:123
GNERerouter(const std::string &id, GNEViewNet *viewNet, Position pos, std::vector< GNEEdge * > edges, const std::string &filename, SUMOReal probability, bool off, const std::set< rerouterInterval > &rerouterIntervals, bool blocked)
Constructor.
void setBlockIconRotation(GNELane *lane=NULL)
void insertDestProbReroutes(destProbReroute *dpr)
insert destiny probability reroute
void setEdgeChilds(std::vector< GNEEdge * > edges)
set edge childs
friend class GNEChange_Attribute
declare friend class
void removeDestProbReroutes(destProbReroute *dpr)
remove a previously inserted destiny probability reroute
std::vector< destProbReroute * > getDestProbReroutes() const
get destiny probability reroutes
routeProbReroute(std::string newRouteId, SUMOReal probability)
constructor
void drawLockIcon(SUMOReal size=0.5) const
draw lock icon
SUMOReal myProbability
probability with which a vehicle will use the given edge as destination
Definition: GNERerouter.h:156
SUMOTime getBegin() const
get time begin
SUMOTime getEnd() const
get time end
void setAdditionalID(const std::string &id)
set the ID of additional
std::string myNewRouteId
id of new route
Definition: GNERerouter.h:153
const std::string getID() const
function to support debugging
void insertRouteProbReroute(routeProbReroute *rpr)
insert route probability reroute
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
void drawConnections() const
draw connections.
std::string getNewRouteId() const
get new route id
std::string getFilename() const
get filename of rerouter
Position myBlockIconOffset
The offSet of the block icon.
std::vector< std::string > getAllowVehicles() const
get allow vehicles
void insertClosingReroutes(closingReroute *cr)
insert a new closing reroute
std::vector< closingReroute * > getClosingReroutes() const
get closing reroutes
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1093
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
void pfSetScale(SUMOReal s)
Definition: polyfonts.c:465
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
std::vector< std::string > myDisallowVehicles
vector of disallow vehicles
Definition: GNERerouter.h:96
rerouterInterval(SUMOTime begin, SUMOTime end)
constructor
std::vector< destProbReroute * > myDestProbReroutes
vector with the destProbReroutes
Definition: GNERerouter.h:215
std::vector< routeProbReroute * > getRouteProbReroutes() const
get reoute probability reroutes
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
void removeClosingReroutes(closingReroute *cr)
remove a previously inserted closing reroute
RGBColor myBaseColor
base color (Default green)
void setProbability(SUMOReal probability)
set probability
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:845
void moveAdditional(SUMOReal posx, SUMOReal posy, GNEUndoList *undoList)
change the position of the rerouter geometry
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal pfdkGetStringWidth(const char *c)
Definition: polyfonts.c:1113
closingReroute(std::string closedEdgeId, std::vector< std::string > allowVehicles, std::vector< std::string > disallowVehicles)
constructor
Definition: GNERerouter.cpp:73
void updateGeometry()
update pre-computed geometry information
std::vector< std::string > getEdgeChildIds() const
get ids of edge childs
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:188
Position getPositionInView() const
Returns position of Rerouter in view.
SumoXMLTag getTag() const
get Tag assigned to this object
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Position myPosition
The position in which this additional element is located.
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:213
void insertDisallowVehicle(std::string vehicleid)
insert a disallow vehicle
void removeRouteProbReroute(routeProbReroute *rpr)
remove a previously inserted route probability reroute
SUMOReal getProbability() const
get probability
SUMOReal myProbability
probability of rerouter
Definition: GNERerouter.h:326
std::string getNewDestinationId() const
id of new edge destination
static GUIGlID getGif(GUITexture which)
returns a texture Gif previously defined in the enum GUITexture
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.
void setFilename(std::string filename)
set filename of rerouter
destProbReroute(std::string newDestinationId, SUMOReal probability)
constructor
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.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void append(const PositionVector &v, SUMOReal sameThreshold=2.0)
void openAdditionalDialog()
open GNERerouterDialog
SUMOReal getProbability() const
get probability of rerouter
std::string myClosedEdgeId
edge ID
Definition: GNERerouter.h:90
Position myBlockIconPosition
position of the block icon