61 #ifdef CHECK_MEMORY_LEAKS
74 myClosedEdgeId(closedEdgeId),
75 myAllowVehicles(allowVehicles),
76 myDisallowVehicles(disallowVehicles) {
87 for (std::vector<std::string>::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) {
88 if ((*i) == vehicleid) {
93 myAllowVehicles.push_back(vehicleid);
100 for (std::vector<std::string>::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) {
101 if ((*i) == vehicleid) {
102 myAllowVehicles.erase(i);
114 for (std::vector<std::string>::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) {
115 if ((*i) == vehicleid) {
120 myDisallowVehicles.push_back(vehicleid);
127 for (std::vector<std::string>::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) {
128 if ((*i) == vehicleid) {
129 myDisallowVehicles.erase(i);
138 std::vector<std::string>
140 return myAllowVehicles;
144 std::vector<std::string>
146 return myDisallowVehicles;
152 return myClosedEdgeId;
160 myNewDestinationId(newDestinationId),
171 return myNewDestinationId;
183 if (probability >= 0 && probability <= 1) {
195 myNewRouteId(newRouteId),
218 if (probability >= 0 && probability <= 1) {
241 for (std::vector<closingReroute*>::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) {
247 myClosingReroutes.push_back(cr);
254 for (std::vector<closingReroute*>::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) {
256 myClosingReroutes.erase(i);
268 for (std::vector<destProbReroute*>::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) {
274 myDestProbReroutes.push_back(dpr);
281 for (std::vector<destProbReroute*>::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) {
283 myDestProbReroutes.erase(i);
295 for (std::vector<routeProbReroute*>::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) {
301 myRouteProbReroutes.push_back(rpr);
308 for (std::vector<routeProbReroute*>::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) {
310 myRouteProbReroutes.erase(i);
331 std::vector<GNERerouter::closingReroute*>
333 return myClosingReroutes;
337 std::vector<GNERerouter::destProbReroute*>
339 return myDestProbReroutes;
343 std::vector<GNERerouter::routeProbReroute*>
345 return myRouteProbReroutes;
502 glRotated(180, 0, 0, 1);
519 if (s.
scale * exaggeration >= 3) {
522 for (
int lanePosIt = 0; lanePosIt < (int)i->positionsOverLanes.size(); lanePosIt++) {
524 glTranslated(i->positionsOverLanes.at(lanePosIt).x(), i->positionsOverLanes.at(lanePosIt).y(), 0);
525 glRotated(i->rotationsOverLanes.at(lanePosIt), 0, 0, 1);
527 glScaled(exaggeration, exaggeration, 1);
528 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
530 glBegin(GL_TRIANGLES);
531 glColor3d(1, .8f, 0);
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);
541 glTranslated(0, 0, .1);
546 glRotated(180, 0, 1, 0);
547 glTranslated(-w / 2., 2, 0);
550 glTranslated(w / 2., -2, 0);
555 glTranslated(-w / 2., 4, 0);
629 std::vector<std::string> edgeIds;
632 if (edgeIds.empty()) {
636 for (
int i = 0; i < (int)edgeIds.size(); i++) {
649 return canParse<SUMOReal>(value);
651 return canParse<bool>(value);
653 return canParse<bool>(value);
668 std::vector<std::string> edgeIds;
669 std::vector<GNEEdge*> edges;
673 for (
int i = 0; i < (int)edgeIds.size(); i++) {
676 edges.push_back(edge);
696 myOff = parse<bool>(value);
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
int pfDrawString(const char *c)
SUMOReal getProbability() const
get probability
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
~closingReroute()
destructor
~GNERerouter()
Destructor.
GUIVisualizationTextSettings addName
~destProbReroute()
destructor
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)
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
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...
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.
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
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
void insertAllowVehicle(std::string vehicleid)
insert an allow vehicle
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
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.
const std::string & getAdditionalID() const
returns the ID of additional
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
PositionVector myShape
The shape of the additional element.
std::string myFilename
filename of rerouter
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.
A point in 2D or 3D with translation and scaling methods.
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)
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)
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
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)
An Element which don't belongs to GNENet but has influency in the simulation.
rerouterInterval(SUMOTime begin, SUMOTime end)
constructor
std::vector< routeProbReroute * > getRouteProbReroutes() const
get reoute probability reroutes
SUMOReal y() const
Returns the y-position.
void removeClosingReroutes(closingReroute *cr)
remove a previously inserted closing reroute
RGBColor myBaseColor
base color (Default green)
void setProbability(SUMOReal probability)
set probability
~routeProbReroute()
destructor
GNENet * getNet() const
get the net object
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal pfdkGetStringWidth(const char *c)
closingReroute(std::string closedEdgeId, std::vector< std::string > allowVehicles, std::vector< std::string > disallowVehicles)
constructor
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)
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.
Position myPosition
The position in which this additional element is located.
bool closeTag()
Closes the most recently opened tag.
void insertDisallowVehicle(std::string vehicleid)
insert a disallow vehicle
~rerouterInterval()
destructor
void removeRouteProbReroute(routeProbReroute *rpr)
remove a previously inserted route probability reroute
SUMOReal getProbability() const
get probability
SUMOReal myProbability
probability of rerouter
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