65 const std::string& streetName,
const std::string& edgeType,
int priority,
67 MSEdge(id, numericalID, function, streetName, edgeType, priority, distance),
83 bool hasNormalSuccessors =
false;
85 if (!out->isTazConnector()) {
86 hasNormalSuccessors =
true;
98 assert(laneNo < (
int)
myLanes->size());
99 return *((*myLanes)[laneNo]);
105 std::vector<GUIGlID> ret;
110 if (includeInternal || edge->
isNormal()) {
111 ret.push_back(edge->
getGlID());
122 const MSEdge* edge = i->second;
136 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
137 ret.
add((*i)->getShape().getBoxBoundary());
143 const std::vector<MSLane*>& lanes = (*it)->getLanes();
144 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
145 ret.
add((*it_lane)->getShape().front());
149 const std::vector<MSLane*>& lanes = (*it)->getLanes();
150 for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
151 ret.
add((*it_lane)->getShape().back());
211 for (
const auto& kv : lane->getParametersMap()) {
212 ret->
mkItem((
"laneParam " +
toString(lane->getIndex()) +
":" + kv.first).c_str(),
false, kv.second);
226 ret->
mkItem(
TL(
"Type Information:"),
false,
"");
268 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
290 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName || drawEdgeValue || drawEdgeScaleValue) {
292 if (lane1 !=
nullptr && lane2 !=
nullptr) {
298 if (spreadSuperposed) {
302 Position shift(dist * cos(shiftA), dist * sin(shiftA));
308 }
else if (drawInternalEdgeName) {
310 }
else if (drawCwaEdgeName) {
313 if (drawStreetName) {
318 std::string value =
"";
319 if (activeScheme == 31) {
322 }
else if (activeScheme == 32) {
332 && color.
alpha() != 0
340 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName) {
343 Position shift(dist * cos(shiftA), dist * sin(shiftA));
349 if (drawEdgeScaleValue) {
351 std::string value =
"";
360 if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawEdgeValue) {
363 Position shift(dist * cos(shiftA), dist * sin(shiftA));
372 FXMutexLock locker(
myLock);
380 FXMutexLock locker(
myLock);
383 assert(container != 0);
394 if (vehicleControl !=
nullptr) {
397 FXMutexLock locker(
myLock);
399 for (std::vector<MSLane*>::const_iterator msl =
myLanes->begin(); msl !=
myLanes->end(); ++msl, ++laneIndex) {
402 double segmentOffset = 0;
404 segment !=
nullptr; segment = segment->getNextSegment()) {
405 const double length = segment->
getLength();
406 if (laneIndex < segment->numQueues()) {
408 std::vector<MEVehicle*> queue = segment->getQueue(laneIndex);
409 const int queueSize = (int)queue.size();
410 double vehiclePosition = segmentOffset + length;
413 for (
int i = 0; i < queueSize; ++i) {
417 const double relPos = segmentOffset + length * (now - entry) / (intendedLeave - entry);
418 if (relPos < vehiclePosition) {
419 vehiclePosition = relPos;
421 while (vehiclePosition < segmentOffset) {
425 vehiclePosition += length;
435 segmentOffset += length;
447 return (*
myLanes)[0]->getSpeedLimit();
470 int activeMicroScheme = -1;
471 switch (activeScheme) {
473 activeMicroScheme = 0;
476 activeMicroScheme = 18;
479 activeMicroScheme = 30;
493 switch (activeScheme) {
496 segment !=
nullptr; segment = segment->getNextSegment()) {
503 segment !=
nullptr; segment = segment->getNextSegment()) {
505 c.
getScheme().
getColor(segment->getRelativeOccupancy() > segment->getRelativeJamThreshold() ? 2 :
506 (segment->getRelativeOccupancy() * 2 < segment->getRelativeJamThreshold() ? 0 : 1)));
511 segment !=
nullptr; segment = segment->getNextSegment()) {
517 segment !=
nullptr; segment = segment->getNextSegment()) {
523 segment !=
nullptr; segment = segment->getNextSegment()) {
529 segment !=
nullptr; segment = segment->getNextSegment()) {
541 switch (activeScheme) {
581 switch (activeScheme) {
615 const std::vector<MSLane*>& lanes =
getLanes();
616 const bool isClosed = lane->
isClosed();
617 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
630 edges.push_back(
this);
641 const std::vector<MSLane*>& lanes =
getLanes();
642 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
644 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
645 if ((*v)->getLane() == (*i)) {
649 (*i)->releaseVehicles();
GUISelectedStorage gSelected
A global holder of selected objects.
GUIIcon
An enumeration of icons used by the gui applications.
std::vector< MSEdge * > MSEdgeVector
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
static void pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
static void popName()
pop Name
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
A road/street connecting two junctions (gui-version)
double getClickPriority() const override
Returns the priority of receiving mouse clicks.
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
double getAllowedSpeed() const
FXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void drawMesoVehicles(const GUIVisualizationSettings &s) const
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
void closeTraffic(const GUILane *lane)
close this edge for traffic
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
virtual void closeBuilding() override
Has to be called after all edges were built and all connections were set.
void addRerouter()
add a rerouter
static double getTotalLength(bool includeInternal, bool eachLane)
Boundary getBoundary() const
Returns the street's geometry.
static std::vector< GUIGlID > getIDs(bool includeInternal)
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
const std::string getOptionalName() const override
Returns the street name.
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
double getScaleValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the scaling value according to the current scheme index
bool isSelected() const override
whether this lane is selected in the GUI
double getPendingEmits() const
get number of vehicles waiting for departure on this edge
bool setFunctionalColor(const GUIColorer &c) const
sets the color according to the current scheme index and some edge function
bool myShowDeadEnd
whether to highlight this edge as a dead-end edge
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, double distance)
Constructor.
static const double INVALID_PRIORITY
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
Representation of a lane in the micro simulation (gui-version)
double getScaleValue(const GUIVisualizationSettings &s, int activeScheme, bool s2) const
gets the scaling value according to the current scheme index
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
double getColorValueWithFunctional(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index including values for things that set the c...
const PositionVector & getShape(bool secondary) const override
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
The class responsible for building and deletion of vehicles (gui-version)
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
A MSVehicle extended by some values for usage within the gui.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
double getEdgeData(const MSEdge *edge, const std::string &attr)
retrieve loaded edged weight for the given attribute and the current simulation time
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
T getColor(const double value) const
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings vehicleSize
GUIVisualizationSizeSettings containerSize
GUIVisualizationTextSettings internalEdgeName
static const double MISSING_DATA
GUIVisualizationTextSettings edgeScaleValue
GUIColorer edgeColorer
The mesoscopic edge colorer.
bool drawJunctionShape
whether the shape of the junction should be drawn
std::string edgeData
key for coloring by edgeData
GUIVisualizationTextSettings edgeValue
GUIVisualizationSizeSettings personSize
GUIVisualizationTextSettings cwaEdgeName
GUIVisualizationRainbowSettings edgeValueRainBow
checks and thresholds for rainbow coloring
bool hideConnectors
flag to show or hide connectors
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
double scale
information about a lane's width (temporary, used for a single view)
bool secondaryShape
whether secondary lane shape shall be drawn
GUIVisualizationTextSettings streetName
int getLaneEdgeScaleMode() const
Returns the number of the active lane (edge) scaling schme.
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
Setting bundles for optional drawing names with size and color.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
std::string edgeParam
key for coloring by edge parameter
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
std::string edgeDataScaling
key for scaling by edgeData
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
A single mesoscopic segment (cell)
double getEntryBlockTimeSeconds() const
get the earliest entry time in seconds
double getLastHeadwaySeconds() const
get the last headway time in seconds
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
double getLength() const
Returns the length of the segment in meters.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
int numQueues() const
return the number of queues
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
int getCarNumber() const
Returns the total number of cars on the segment.
double getFlow() const
returns flow based on headway
double getLastEntryTimeSeconds() const
Returns the entry time for the current segment.
double getBlockTimeSeconds() const
Returns the time at which the vehicle was blocked on the current segment.
double getEventTimeSeconds() const
Returns the earliest leave time for the current segment.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
A road/street connecting two junctions.
std::string myStreetName
the real-world name of this edge (need not be unique)
double getBruttoOccupancy() const
double getFlow() const
return flow based on meanSpead
std::set< MSTransportable *, ComparatorNumericalIdLess > myContainers
Containers on the edge.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
const std::string & getStreetName() const
Returns the street name of the edge.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
void rebuildAllowedLanes(const bool onInit=false)
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
bool isNormal() const
return whether this edge is an internal edge
const SumoXMLEdgeFunc myFunction
the purpose of the edge
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
MSEdgeVector myPredecessors
The preceeding edges.
const MSJunction * getToJunction() const
double getLength() const
return the length of the edge
virtual void closeBuilding()
const MSJunction * getFromJunction() const
double getMeanSpeed() const
get the mean speed
static DictType myDict
Static dictionary to associate string-ids with objects.
std::set< MSTransportable *, ComparatorNumericalIdLess > myPersons
Persons on the edge for drawing and pushbutton.
bool isTazConnector() const
MSEdgeVector mySuccessors
The succeeding edges.
bool isInternal() const
return whether this edge is an internal edge
double getTimePenalty() const
const std::string & getEdgeType() const
Returns the type of the edge.
double getMeanFriction() const
get the mean friction over the lanes
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
std::shared_ptr< const std::vector< MSLane * > > myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane,...
static MELoop * gMesoNet
mesoscopic simulation infrastructure
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
const ConstMSEdgeVector & getOutgoing() const
Representation of a lane in the micro simulation.
std::vector< MSVehicle * > VehCont
Container for vehicles.
double getLength() const
Returns the lane's length.
double interpolateLanePosToGeometryPos(double lanePos) const
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
static MSEdge mySpecialDest_keepDestination
special destination values
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
const std::string & getID() const
Returns the id.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
void add(const Position &pos)
Adds the given position to this one.
void mul(double val)
Multiplies position with the given value.
double length() const
Returns the length.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
unsigned char alpha() const
Returns the alpha-amount of the color.
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
bool hideMax
whether data above threshold should not be colored
double minThreshold
threshold below which value should not be colored
bool hideMin
whether data below threshold should not be colored
double maxThreshold
threshold above which value should not be colored
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double minSize
The minimum size to draw this object.
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size
edge type specific meso parameters
SUMOTime begin
The begin time these definitions are valid.
SUMOTime end
The end time these definitions are valid.
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations or vias to use.