68 myProbability(probability),
70 myTimeThreshold(timeThreshold) {
152 i->writeRerouterInterval(device);
186 const std::vector<GNERerouterInterval*>&
194 int numOverlappings = 0;
204 return numOverlappings;
211 std::vector<GNERerouterInterval*> sortedIntervals;
245 glRotated(180, 0, 0, 1);
263 if (s.
scale * exaggeration >= 3) {
267 glTranslated(i.first.x(), i.first.y(),
getType());
268 glRotated(-1 * i.second, 0, 0, 1);
269 glScaled(exaggeration, exaggeration, 1);
270 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
272 glBegin(GL_TRIANGLES);
273 glColor3d(1, .8f, 0);
275 glVertex2d(0 - 1.4, 0);
276 glVertex2d(0 - 1.4, 6);
277 glVertex2d(0 + 1.4, 6);
278 glVertex2d(0 + 1.4, 0);
279 glVertex2d(0 - 1.4, 0);
280 glVertex2d(0 + 1.4, 6);
370 return canParse<double>(value) && (parse<double>(value) >= 0) && (parse<double>(value) <= 1);
372 return canParse<double>(value) && (parse<double>(value) >= 0);
374 return canParse<bool>(value);
376 return canParse<bool>(value);
392 i->removeAdditionalParent(
this);
397 for (
auto i : myEdgeChilds) {
398 i->addAdditionalParent(
this);
416 myOff = parse<bool>(value);
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
double scale
information about a lane's width (temporary, used for a single view)
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
void removeRerouterInterval(GNERerouterInterval *rerouterInterval)
add rerouter interval
~GNERerouter()
Destructor.
GUIVisualizationTextSettings addName
void add(const Position &pos)
Adds the given position to this one.
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
const std::string & getAdditionalID() const
returns Additional ID
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
Position getPositionInView() const
Returns position of additional in view.
int getNumberOfOverlappedIntervals() const
get number of overlapped intervals
double x() const
Returns the x-position.
Position myPosition
position of rerouter in view
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
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...
const std::string & getParentName() const
Returns the name of the parent object (if any)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static const RGBColor BLACK
double myProbability
probability of rerouter
static bool isValidFilename(const std::string &value)
true if value is a valid file value
static std::vector< GNEEdge * > parseGNEEdges(GNENet *net, const std::string &value)
parse string into vector of GNEEdges
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
void changeAdditionalID(const std::string &newID)
change ID of additional
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void addRerouterInterval(GNERerouterInterval *rerouterInterval)
add rerouter interval
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
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::vector< GNERerouterInterval * > myRerouterIntervals
set with the GNERerouterInterval
GUIVisualizationSizeSettings addSize
Dialog for edit rerouters.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void drawChildConnections() const
draw connections between Parent and childrens
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawLockIcon(double size=0.5) const
draw lock icon
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
friend class GNEChange_Attribute
declare friend class
GNERerouter(const std::string &id, GNEViewNet *viewNet, Position pos, std::vector< GNEEdge *> edges, const std::string &filename, double probability, bool off, double timeThreshold)
Constructor.
block movement of a graphic element
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
void updateChildConnections()
update Connection's geometry
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
Position myBlockIconOffset
The offSet of the block icon.
void sortIntervals()
sort intervals
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
An Element which don't belongs to GNENet but has influency in the simulation.
const std::vector< GNERerouterInterval * > & getRerouterIntervals() const
get rerouter intervals
void setBlockIconRotation(GNELane *additionalLane=NULL)
std::vector< std::pair< Position, double > > mySymbolsPositionAndRotation
position and rotation of every simbol over lane
void updateGeometry()
update pre-computed geometry information
GNENet * getNet() const
get the net object
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
double myTimeThreshold
attribute to configure activation time threshold
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
bool isAdditionalSelected() const
static bool checkGNEEdgesValid(GNENet *net, const std::string &value, bool report)
check if a list of edge IDs is valid
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 openAdditionalDialog()
open GNERerouterDialog
Position myBlockIconPosition
position of the block icon
std::vector< GNEEdge * > myEdgeChilds
vector with the edge childs of this additional
SumoXMLTag getTag() const
get XML Tag assigned to this object