SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  // Refresh element (neccesary to avoid grabbing problems)
398 }
399 
400 
401 Position
403  return myPosition;
404 }
405 
406 
407 void
409  //GNERerouterDialog rerouterDialog(this);
410 }
411 
412 
413 void
415  // change Position
416  myPosition = Position(offsetx, offsety);
417  updateGeometry();
418 }
419 
420 
421 void
423  undoList->p_begin("position of " + toString(getTag()));
424  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition), true, toString(Position(oldPosx, oldPosy))));
425  undoList->p_end();
426  // Refresh element
428 }
429 
430 
431 void
432 GNERerouter::writeAdditional(OutputDevice& device, const std::string&) {
433  // Write parameters
434  device.openTag(getTag());
435  device.writeAttr(SUMO_ATTR_ID, getID());
436  device.writeAttr(SUMO_ATTR_EDGES, joinToString(getEdgeChildIds(), " ").c_str());
438  if (!myFilename.empty()) {
440  }
441  device.writeAttr(SUMO_ATTR_X, myPosition.x());
442  device.writeAttr(SUMO_ATTR_Y, myPosition.y());
443  if (myBlocked) {
445  }
446  // Close tag
447  device.closeTag();
448 }
449 
450 
451 std::string
453  return myFilename;
454 }
455 
456 
457 SUMOReal
459  return myProbability;
460 }
461 
462 
463 bool
465  return myOff;
466 }
467 
468 
469 void
470 GNERerouter::setFilename(std::string filename) {
471  myFilename = filename;
472 }
473 
474 
475 void
477  myProbability = probability;
478 }
479 
480 
481 void
483  myOff = off;
484 }
485 
486 
487 const std::string&
489  return myViewNet->getNet()->getMicrosimID();
490 }
491 
492 
493 void
495  // Start drawing adding an gl identificator
496  glPushName(getGlID());
497 
498  // Add a draw matrix for drawing logo
499  glPushMatrix();
500  glTranslated(myShape[0].x(), myShape[0].y(), getType());
501  glColor3d(1, 1, 1);
502  glRotated(180, 0, 0, 1);
503 
504  // Draw icon depending of rerouter is or isn't selected
505  if (isAdditionalSelected()) {
507  } else {
509  }
510 
511  // Pop draw matrix
512  glPopMatrix();
513 
514  // Show Lock icon depending of the Edit mode
515  drawLockIcon(0.4);
516 
517  // Draw symbols in every lane
518  const SUMOReal exaggeration = s.addSize.getExaggeration(s);
519  if (s.scale * exaggeration >= 3) {
520  // draw rerouter symbol over all lanes
521  for (childEdges::const_iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) {
522  for (int lanePosIt = 0; lanePosIt < (int)i->positionsOverLanes.size(); lanePosIt++) {
523  glPushMatrix();
524  glTranslated(i->positionsOverLanes.at(lanePosIt).x(), i->positionsOverLanes.at(lanePosIt).y(), 0);
525  glRotated(i->rotationsOverLanes.at(lanePosIt), 0, 0, 1);
526  glTranslated(0, 0, getType());
527  glScaled(exaggeration, exaggeration, 1);
528  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
529 
530  glBegin(GL_TRIANGLES);
531  glColor3d(1, .8f, 0);
532  // base
533  glVertex2d(0 - 1.4, 0);
534  glVertex2d(0 - 1.4, 6);
535  glVertex2d(0 + 1.4, 6);
536  glVertex2d(0 + 1.4, 0);
537  glVertex2d(0 - 1.4, 0);
538  glVertex2d(0 + 1.4, 6);
539  glEnd();
540 
541  glTranslated(0, 0, .1);
542  glColor3d(0, 0, 0);
543  pfSetPosition(0, 0);
544  pfSetScale(3.f);
545  SUMOReal w = pfdkGetStringWidth("U");
546  glRotated(180, 0, 1, 0);
547  glTranslated(-w / 2., 2, 0);
548  pfDrawString("U");
549 
550  glTranslated(w / 2., -2, 0);
551  std::string str = toString((int)(myProbability * 100)) + "%";
552  pfSetPosition(0, 0);
553  pfSetScale(.7f);
554  w = pfdkGetStringWidth(str.c_str());
555  glTranslated(-w / 2., 4, 0);
556  pfDrawString(str.c_str());
557  glPopMatrix();
558  }
559  }
560  glPopName();
561  }
562 
563  // Draw connections
564  drawConnections();
565 
566  // Pop name
567  glPopName();
568 
569  // Draw name
570  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
571 }
572 
573 
574 std::string
576  switch (key) {
577  case SUMO_ATTR_ID:
578  return getAdditionalID();
579  case SUMO_ATTR_EDGES:
580  return joinToString(getEdgeChildIds(), " ");
581  case SUMO_ATTR_POSITION:
582  return toString(myPosition);
583  case SUMO_ATTR_FILE:
584  return myFilename;
585  case SUMO_ATTR_PROB:
586  return toString(myProbability);
587  case SUMO_ATTR_OFF:
588  return toString(myOff);
590  return toString(myBlocked);
591  default:
592  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
593  }
594 }
595 
596 
597 void
598 GNERerouter::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
599  if (value == getAttribute(key)) {
600  return; //avoid needless changes, later logic relies on the fact that attributes have changed
601  }
602  switch (key) {
603  case SUMO_ATTR_ID:
604  case SUMO_ATTR_EDGES:
605  case SUMO_ATTR_POSITION:
606  case SUMO_ATTR_FILE:
607  case SUMO_ATTR_PROB:
608  case SUMO_ATTR_OFF:
610  undoList->p_add(new GNEChange_Attribute(this, key, value));
611  updateGeometry();
612  break;
613  default:
614  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
615  }
616 }
617 
618 
619 bool
620 GNERerouter::isValid(SumoXMLAttr key, const std::string& value) {
621  switch (key) {
622  case SUMO_ATTR_ID:
623  if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) {
624  return true;
625  } else {
626  return false;
627  }
628  case SUMO_ATTR_EDGES: {
629  std::vector<std::string> edgeIds;
630  SUMOSAXAttributes::parseStringVector(value, edgeIds);
631  // Empty Edges aren't valid
632  if (edgeIds.empty()) {
633  return false;
634  }
635  // Iterate over parsed edges
636  for (int i = 0; i < (int)edgeIds.size(); i++) {
637  if (myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false) == NULL) {
638  return false;
639  }
640  }
641  return true;
642  }
643  case SUMO_ATTR_POSITION:
644  bool ok;
645  return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1;
646  case SUMO_ATTR_FILE:
647  return isValidFileValue(value);
648  case SUMO_ATTR_PROB:
649  return canParse<SUMOReal>(value);
650  case SUMO_ATTR_OFF:
651  return canParse<bool>(value);
653  return canParse<bool>(value);
654  default:
655  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
656  }
657 }
658 
659 
660 void
661 GNERerouter::setAttribute(SumoXMLAttr key, const std::string& value) {
662  switch (key) {
663  case SUMO_ATTR_ID:
664  setAdditionalID(value);
665  break;
666  case SUMO_ATTR_EDGES: {
667  // Declare variables
668  std::vector<std::string> edgeIds;
669  std::vector<GNEEdge*> edges;
670  GNEEdge* edge;
671  SUMOSAXAttributes::parseStringVector(value, edgeIds);
672  // Iterate over parsed edges and obtain pointer to edges
673  for (int i = 0; i < (int)edgeIds.size(); i++) {
674  edge = myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false);
675  if (edge) {
676  edges.push_back(edge);
677  }
678  }
679  // Set new childs
680  setEdgeChilds(edges);
681  break;
682  }
683  case SUMO_ATTR_POSITION:
684  bool ok;
685  myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0];
686  updateGeometry();
687  getViewNet()->update();
688  break;
689  case SUMO_ATTR_FILE:
690  myFilename = value;
691  break;
692  case SUMO_ATTR_PROB:
693  myProbability = parse<SUMOReal>(value);
694  break;
695  case SUMO_ATTR_OFF:
696  myOff = parse<bool>(value);
697  break;
699  myBlocked = parse<bool>(value);
700  getViewNet()->update();
701  break;
702  default:
703  throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed");
704  }
705 }
706 
707 /****************************************************************************/
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:702
long long int SUMOTime
Definition: SUMOTime.h:43
~GNERerouter()
Destructor.
GUIVisualizationTextSettings addName
Stores the information about how to visualize structures.
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
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:328
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:86
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
void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety)
change the position of the rerouter geometry
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'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)
method for setting the attribute and letting the object perform additional changes ...
std::set< rerouterInterval > myRerouterIntervals
set with the rerouterInterval
Definition: GNERerouter.h:331
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)
method for checking if the key and their conrrespond attribute are valids
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.
the edges of a route
const std::string & getAdditionalID() const
returns the ID of additional
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
Definition: GNENet.cpp:784
PositionVector myShape
The shape of the additional element.
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:322
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:93
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
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
SUMOTime getBegin() const
get time begin
SUMOTime getEnd() const
get time end
void setAdditionalID(const std::string &id)
set the ID of additional
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:55
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1250
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList *undoList)
updated geometry changes in the attributes of additional
void pfSetScale(SUMOReal s)
Definition: polyfonts.c:465
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
rerouterInterval(SUMOTime begin, SUMOTime end)
constructor
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:912
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:214
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:325
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
Position myBlockIconPosition
position of the block icon