65#define RENDERING_BUFFER 10
80GUILane::GUILane(
const std::string&
id,
double maxSpeed,
double friction,
double length,
81 MSEdge*
const edge,
int numericalID,
85 int index,
bool isRampAccel,
86 const std::string& type,
88 MSLane(id, maxSpeed, friction, length, edge, numericalID, shape, width, permissions, changeLeft, changeRight, index, isRampAccel, type, outlineShape),
118 const double origLength =
myShape.length();
122 assert(fabs(
myShape.length() - origLength) < POSITION_EPS);
131 std::vector<double>& rotations,
132 std::vector<double>& lengths,
133 std::vector<RGBColor>& colors) {
137 rotations.reserve(shape.size() - 1);
138 lengths.reserve(shape.size() - 1);
139 colors.reserve(shape.size() - 1);
140 int e = (int) shape.size() - 1;
141 for (
int i = 0; i < e; ++i) {
145 rotations.push_back(
RAD2DEG(atan2(s.
x() - f.
x(), f.
y() - s.
y())));
161 const MSLane::VehCont::iterator& at,
163 FXMutexLock locker(
myLock);
184 FXMutexLock locker(
myLock);
190 FXMutexLock locker(
myLock);
197 FXMutexLock locker(
myLock);
204 FXMutexLock locker(
myLock);
211 FXMutexLock locker(
myLock);
218 FXMutexLock locker(
myLock);
225 FXMutexLock locker(
myLock);
232 FXMutexLock locker(
myLock);
239 FXMutexLock locker(
myLock);
246 FXMutexLock locker(
myLock);
254 int noLinks = (int)
myLinks.size();
269 double w =
myWidth / (double) noLinks;
271 for (
int i = noLinks; --i >= 0;) {
272 double x2 = x1 - (double)(w / 2.);
281 int noLinks = (int)
myLinks.size();
304 double w =
myWidth / (double) noLinks;
306 for (
int i = noLinks; --i >= 0;) {
307 double x2 = x1 - (double)(w / 2.);
320 int noLinks = (int)
myLinks.size();
341 double w =
myWidth / (double) noLinks;
342 if (isRailSignal && noLinks > 1 &&
myLinks.back()->isTurnaround() && s.
showRails) {
343 w =
myWidth / (double)(noLinks - 1);
346 for (
int i = 0; i < noLinks; ++i) {
356 const double rot =
RAD2DEG(atan2((end.x() - f.
x()), (f.
y() - end.y())));
359 glTranslated(end.x(), end.y(), 0);
360 glRotated(rot, 0, 0, 1);
361 glTranslated(0, stopOffsetPassenger, 0);
377 const double rot =
RAD2DEG(atan2((end.x() - f.
x()), (f.
y() - end.y())));
378 if (link ==
nullptr) {
385 glTranslated(end.x(), end.y(), 0);
386 glRotated(rot, 0, 0, 1);
396 glTranslated(end.x(), end.y(), 0);
397 glRotated(rot, 0, 0, 1);
433 glScaled(scale, scale, 1);
461 const double rot =
RAD2DEG(atan2((end.x() - f.
x()), (f.
y() - end.y())));
464 glTranslated(end.x(), end.y(), 0);
465 glRotated(rot, 0, 0, 1);
523 if (exaggeration > 1) {
524 centroid =
myEdge->getToJunction()->getShape().getCentroid();
527 const GUILane* connected =
dynamic_cast<GUILane*
>(link->getLane());
528 if (connected ==
nullptr) {
535 if (exaggeration > 1) {
536 p1 = centroid + ((p1 - centroid) * exaggeration);
537 p2 = centroid + ((p2 - centroid) * exaggeration);
539 glVertex2d(p1.
x(), p1.
y());
540 glVertex2d(p2.
x(), p2.
y());
570 glTranslated(0, 0, baseShape.
getMinZ());
580 glTranslated(0, 0,
getType() - 0.2);
583 glTranslated(0, 0,
getType() - 0.4);
591 const std::vector<RGBColor>& segmentColors =
static_cast<const GUIEdge*
>(
myEdge)->getSegmentColors();
592 if (segmentColors.size() > 0) {
595 for (
int ii = 0; ii < (int)baseShape.size() - 1; ++ii) {
602 double junctionExaggeration = 1;
612 if (shapeColors.size() > 0) {
623 bool mustDrawMarkings =
false;
624 bool hiddenBidi =
getBidiLane() !=
nullptr &&
myEdge->getNumericalID() >
myEdge->getBidiEdge()->getNumericalID();
625 const bool detailZoom = s.
scale * exaggeration > 5;
629 if (hiddenBidi && !spreadSuperposed) {
632 }
else if (drawRails) {
639 if (spreadSuperposed) {
645 const double halfInnerFeetWidth = halfGauge - 0.039 * exaggeration;
646 const double halfRailWidth = detailZoom ? (halfInnerFeetWidth + 0.15 * exaggeration) :
SUMO_const_halfLaneWidth * exaggeration;
647 const double halfCrossTieWidth = halfGauge * 1.81;
648 if (shapeColors.size() > 0) {
656 glTranslated(0, 0, .1);
664 glTranslated(0, 0, .2);
667#ifdef GUILane_DEBUG_DRAW_CROSSING_OUTLINE
670 glTranslated(0, 0, 0.4);
672 glTranslated(0, 0, -0.4);
678 glTranslated(0, 0, -.2);
682 glTranslated(0, 0, .2);
687 glTranslated(0, 0, -.2);
700 if (spreadSuperposed) {
704 if (shapeColors.size() > 0) {
711#ifdef GUILane_DEBUG_DRAW_FOE_INTERSECTIONS
723 glTranslated(0, 0, .5);
730 glColor3d(0.3, 0.3, 0.3);
751 if (shapeColors.size() > 0) {
761 glTranslated(0, 0, 1000);
768 glTranslated(0, 0, -1000);
770 glTranslated(0, 0, .1);
772 if ((drawDetails || junctionExaggeration > 1) && s.
showLane2Lane) {
807 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
808 if ((*v)->getLane() ==
this) {
870 const bool s2 =
false;
871 const int e = (int)
getShape(s2).size() - 1;
872 const double markWidth = 0.1;
874 for (
int i = 0; i < e; ++i) {
880 for (
int side = -1; side <= 1; side += 2) {
882 glVertex2d(side * mw, -t);
883 glVertex2d(side * mw, -t - 0.35);
884 glVertex2d(side * (mw + markWidth), -t - 0.35);
885 glVertex2d(side * (mw + markWidth), -t);
897 const bool s2 =
false;
931 int e = (int)
getShape(s2).size() - 1;
932 for (
int i = 0; i < e; ++i) {
940 glVertex2d(-mw, -t - lengthSolid);
941 glVertex2d(-mw2, -t - lengthSolid);
942 glVertex2d(-mw2, -t);
947 glVertex2d(-mw3, -t);
948 glVertex2d(-mw3, -t - lengthBroken);
949 glVertex2d(-mw4, -t - lengthBroken);
950 glVertex2d(-mw4, -t);
963 int e = (int)
getShape(s2).size() - 1;
964 const double widthFactor = spreadSuperposed ? 0.4 : 1;
965 const double w =
MAX2(POSITION_EPS,
myWidth * widthFactor);
968 const double sideOffset = spreadSuperposed ? w * -0.5 : 0;
969 for (
int i = 0; i < e; ++i) {
975 glBegin(GL_TRIANGLES);
976 glVertex2d(sideOffset, -t - length);
977 glVertex2d(sideOffset - w4 * exaggeration, -t);
978 glVertex2d(sideOffset + w4 * exaggeration, -t);
990 glTranslated(0, 0, 5);
991 glColor3d(1.0, 0.3, 0.3);
992 const double orthoLength = 0.5;
994 const std::vector<const MSLane*>& foeLanes = link->
getFoeLanes();
996 if (foeLanes.size() == conflicts.size()) {
997 for (
int i = 0; i < (int)foeLanes.size(); ++i) {
998 const MSLane* l = foeLanes[i];
1001 if (ortho.
length() < orthoLength) {
1028 if (
getEdge().hasDistance()) {
1031 new FXMenuSeparator(ret);
1033 new FXMenuSeparator(ret);
1047 new FXMenuSeparator(ret);
1049 FXMenuPane* reachableByClass =
new FXMenuPane(ret);
1066 if (restrictions !=
nullptr) {
1067 for (
const auto& elem : *restrictions) {
1068 ret->
mkItem((std::string(
" ") +
TL(
"allowed speed [m/s]") + std::string(
": ") +
toString(elem.first)).c_str(),
false, elem.second);
1083 ret->
mkItem(
TL(
"routing type"),
false,
myEdge->getRoutingType());
1086 ret->
mkItem(
TL(
"distance [km]"),
false,
myEdge->getDistance() / 1000);
1098 if (dw !=
nullptr) {
1105 for (
const auto& kv :
myEdge->getParametersMap()) {
1106 ret->
mkItem((
"edgeParam:" + kv.first).c_str(),
false, kv.second);
1133const std::vector<double>&
1139const std::vector<double>&
1145std::vector<RGBColor>&
1159 return (
double)
myEdge->getLanes().size();
1191 switch (activeScheme) {
1221 if (activeScheme < 0) {
1224 switch (activeScheme) {
1226 if (
myEdge->isCrossing()) {
1247 std::vector<RGBColor> tazColors;
1249 if (e->isTazConnector() && e->hasParameter(
"tazColor")) {
1254 if (e->isTazConnector() && e->hasParameter(
"tazColor")) {
1258 if (tazColors.size() > 0) {
1260 col = tazColors[randColor];
1276 shapeColors.clear();
1277 switch (activeScheme) {
1279 for (PositionVector::const_iterator ii = shape.begin(); ii != shape.end() - 1; ++ii) {
1286 for (
int ii = 1; ii < (int)shape.size(); ++ii) {
1287 const double inc = (shape[ii].z() - shape[ii - 1].z()) /
MAX2(POSITION_EPS, shape[ii].distanceTo2D(shape[ii - 1]));
1317 switch (activeScheme) {
1326 return myEdge->getPermissions() == 0 ? 10 : 3;
1337 if (
myEdge->isTazConnector()) {
1403 return myEdge->getPriority();
1423 return myEdge->getRoutingSpeed();
1466 return myEdge->getDistance();
1469 return fabs(
myEdge->getDistance());
1482 if (&item.second->getLane().getEdge() ==
myEdge) {
1489 capacity += pa->getCapacity() - pa->getOccupancy();
1504 switch (activeScheme) {
1553 return myEdge->getPriority();
1595 osg::Vec4ubArray* colors =
dynamic_cast<osg::Vec4ubArray*
>(myGeom->getColorArray());
1597 myGeom->setColorArray(colors);
1612 if (rebuildAllowed) {
1623 const double slength =
myLength / no;
1626 for (
int i = 0; i < no; ++i) {
1629 int index = result.indexOfClosest(pos);
1630 if (pos.
distanceTo(result[index]) > POSITION_EPS) {
1631 index = result.insertAtClosest(pos,
false);
1668 if (
myEdge->isCrossing()) {
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only).
@ MID_REACHABILITY
show reachability from a given lane
@ MID_CLOSE_LANE
close lane
@ MID_CLOSE_EDGE
close edge
@ MID_ADD_REROUTER
add rerouter
@ GLO_SHAPE
reserved GLO type to pack shapes
GUISelectedStorage gSelected
A global holder of selected objects.
GUIIcon
An enumeration of icons used by the gui applications.
GUIPropertySchemeStorage< GUIColorScheme > GUIColorer
const std::string invalid_return< std::string >::value
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a (exclusive) railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a waterway edge.
bool isAirway(SVCPermissions permissions)
Returns whether an edge with the given permissions is an airway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_SHIP
is an arbitrary ship
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_AUTHORITY
authorities vehicles
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_PARKING_AREA
A parking area.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ PARTLEFT
The link is a partial left direction.
@ RIGHT
The link is a (hard) right direction.
@ TURN
The link is a 180 degree turn.
@ LEFT
The link is a (hard) left direction.
@ STRAIGHT
The link is a straight direction.
@ TURN_LEFTHAND
The link is a 180 degree turn (left-hand network).
@ PARTRIGHT
The link is a partial right direction.
@ NODIR
The link has no direction (is a dead end link).
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
@ LINKSTATE_TL_YELLOW_MAJOR
The link has yellow light, may pass.
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
@ LINKSTATE_DEADEND
This is a dead end link.
@ LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
@ LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
@ LINKSTATE_TL_RED
The link has red light (must brake).
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
@ LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
@ LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
const double SUMO_const_laneWidth
const double SUMO_const_laneMarkWidth
const double SUMO_const_halfLaneWidth
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
static void pushName(unsigned int name)
push Name
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0).
static void popMatrix()
pop matrix
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void debugVertices(const PositionVector &shape, const GUIVisualizationTextSettings &settings, double scale, double layer=1024)
draw vertex numbers for the given shape (in a random color)
static void popName()
pop Name
static void pushMatrix()
push matrix
static void drawInverseMarkings(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double maxLength, double spacing, double halfWidth, bool cl, bool cr, bool lefthand, double scale)
@bried draw the space between markings (in road color)
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, double offset, bool lessDetail)
draw crossties for railroads or pedestrian crossings
A MSVehicle extended by some values for usage within the gui.
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 getScaleValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the scaling value according to the current scheme index
static const double INVALID_PRIORITY
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app, bool addSeparator=true) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
GUIGlObject(GUIGlObjectType type, const std::string µsimID, FXIcon *icon)
Constructor.
static bool gSecondaryShape
whether secondary shapes are currently being drawn
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
void debugDrawFoeIntersections() const
draw intersection positions of foe internal lanes with this one
std::vector< double > myShapeLengths
The lengths of the shape parts.
std::vector< MSParkingArea * > * myParkingAreas
list of parkingAreas on this lane
const VehCont & getVehiclesSecure() const override
Returns the vehicles container; locks it for microsimulation.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
bool isLaneOrEdgeSelected() const
whether this lane or its parent edge is selected in the GUI
void updateMesoGUISegments() override
void initRotations(const PositionVector &shape, std::vector< double > &rotations, std::vector< double > &lengths, std::vector< RGBColor > &colors)
double myHalfLaneWidth
Half of lane width, for speed-up.
PositionVector splitAtSegments(const PositionVector &shape)
add intermediate points at segment borders
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
double firstWaitingTime() const
double setPartialOccupation(MSVehicle *v) override
Sets the information about a vehicle lapping into this lane.
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
double getPendingEmits() const
get number of vehicles waiting for departure on this lane
void setJunctionApproaches() const override
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
static GUIVisualizationSettings * myCachedGUISettings
cached for tracking color value
void drawJunctionChangeProhibitions() const
bike lane markings on top of an intersection
static const RGBColor MESO_USE_LANE_COLOR
special color to signify alternative coloring scheme
std::vector< double > myShapeLengths2
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify) override
bool setMultiColor(const GUIVisualizationSettings &s, const GUIColorer &c, RGBColor &col) const
sets multiple colors according to the current scheme index and some lane function
void addSecondaryShape(const PositionVector &shape) override
double getScaleValue(const GUIVisualizationSettings &s, int activeScheme, bool s2) const
gets the scaling value according to the current scheme index
void resetPartialOccupation(MSVehicle *v) override
Removes the information about a vehicle lapping into this lane.
void integrateNewVehicles() override
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void drawArrows(bool secondaryShape) const
std::vector< int > mySegmentStartIndex
the shape indices where the meso segment changes (for segmentsIndex > 0)
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached).
bool neighLaneNotBidi() const
whether any of the neighboring lanes is not a bidi-lane
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
double getClickPriority() const override
Returns the priority of receiving mouse clicks.
bool isSelected() const override
whether this lane is selected in the GUI
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
const std::vector< double > & getShapeRotations(bool secondary) const
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...
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
GUILane(const std::string &id, double maxSpeed, double friction, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, SVCPermissions changeLeft, SVCPermissions changeRight, int index, bool isRampAccel, const std::string &type, const PositionVector &outlineShape)
Constructor.
void removeParking(MSBaseVehicle *veh) override
remove parking vehicle
std::vector< double > myShapeRotations2
double myLengthGeometryFactor2
void planMovements(const SUMOTime t) override
double getColorValueForTracker() const
return color value based on cached settings
std::vector< RGBColor > myShapeColors2
double getEdgeLaneNumber() const
double myReachability
the time distance from a particular edge
double getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
std::vector< double > myShapeRotations
The rotations of the shape parts.
TesselatedPolygon * myTesselation
An object that stores the tesselation.
void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED) override
Inserts the vehicle into this lane, and informs it about entering the network.
const PositionVector & getShape(bool secondary) const override
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, const MSLink *link, const PositionVector &shape, double x1, double x2) const
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
std::vector< RGBColor > & getShapeColors(bool secondary) const
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
double getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
const std::vector< double > & getShapeLengths(bool secondary) const
void drawMarkings(const GUIVisualizationSettings &s, double scale) const
draw lane borders and white markings
void drawBikeMarkings() const
bike lane markings on top of an intersection
void executeMovements(const SUMOTime t) override
PositionVector myShape2
secondary shape for visualization
bool myAmClosed
state for dynamic lane closings
void drawLane2LaneConnections(double exaggeration, bool s2) const
void releaseVehicles() const override
Allows to use the container for microsimulation again.
void drawDirectionIndicators(double exaggeration, bool spreadSuperposed, bool s2) const
direction indicators for lanes
void detectCollisions(SUMOTime timestep, const std::string &stage) override
void swapAfterLaneChange(SUMOTime t) override
moves myTmpVehicles int myVehicles after a lane change procedure
A MSNet extended by some values for usage within the gui.
int getLinkTLID(const MSLink *const link) const
double getMeanData(const MSLane *lane, const std::string &id, const std::string &attr)
retrieve live lane/edge weight for the given meanData id and attribute
int getLinkTLIndex(const MSLink *const link) const
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
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 checkFont(const std::string &text)
ensure that the font covers the given text
T getColor(const double value) const
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
A MSVehicle extended by some values for usage within the gui.
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings vehicleSize
GUIVisualizationSizeSettings junctionSize
static const double MISSING_DATA
bool showBikeMarkings
Information whether bicycle lane marking shall be drawn.
std::string edgeDataID
id for coloring by live edgeData
GUIScaler laneScaler
The lane scaler.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
bool drawJunctionShape
whether the shape of the junction should be drawn
std::string edgeData
key for coloring by edgeData
GUIVisualizationTextSettings geometryIndices
bool realisticLinkRules
Information whether link rules (colored bars) shall be drawn with a realistic color scheme.
bool trueZ
drawl all objects according to their z data
GUIVisualizationTextSettings drawLinkJunctionIndex
bool gaming
whether the application is in gaming mode or not
bool showRails
Information whether rails shall be drawn.
double laneWidthExaggeration
The lane exaggeration (upscale thickness).
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
bool showSublanes
Whether to show sublane boundaries.
static const RGBColor & getLinkColor(const LinkState &ls, bool realistic=false)
map from LinkState to color constants
double scale
information about a lane's width (temporary, used for a single view)
bool forceDrawForRectangleSelection
flag to force draw for rectangle selection (see drawForRectangleSelection)
bool showLaneDirection
Whether to show direction indicators for lanes.
bool secondaryShape
whether secondary lane shape shall be drawn
GUIScaler edgeScaler
The mesoscopic edge scaler.
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
GUIColorer laneColorer
The lane colorer.
bool laneShowBorders
Information whether lane borders shall be drawn.
double laneMinSize
The minimum visual lane width for drawing.
GUIVisualizationTextSettings drawLinkTLIndex
bool drawCrossingsAndWalkingareas
whether crossings and walkingareas shall be drawn
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
std::string edgeParam
key for coloring by edge parameter
std::string edgeDataScaling
key for scaling by edgeData
static double naviDegree(const double angle)
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length).
The base class for microscopic and mesoscopic vehicles.
static const MSDriveWay * retrieveDepartDriveWay(const MSEdge *edge, const std::string &id)
A road/street connecting two junctions.
double getTimePenalty() const
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
void rebuildAllowedLanes(const bool onInit=false, bool updateVehicles=false)
A storage for edge travel times and efforts.
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
static double gLateralResolution
static int gNumSimThreads
how many threads to use for simulation
static bool gLefthand
Whether lefthand-drive is being simulated.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
SVCPermissions myPermissions
The vClass permissions for this lane.
std::set< const MSBaseVehicle * > myParkingVehicles
MSLane * getParallelLane(int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
virtual void removeParking(MSBaseVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
double myLength
Lane length [m].
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
PositionVector myShape
The shape of the lane.
PositionVector * myOutlineShape
the outline of the lane (optional)
std::map< long long, SVCPermissions > myPermissionChanges
double getFrictionCoefficient() const
Returns the lane's friction coefficient.
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
MSLane(const std::string &id, double maxSpeed, double friction, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, SVCPermissions changeLeft, SVCPermissions changeRight, int index, bool isRampAccel, const std::string &type, const PositionVector &outlineShape)
Constructor.
const MSLane * getNormalSuccessorLane() const
get normal lane following this internal lane, for normal lanes, the lane itself is returned
MSEdge *const myEdge
The lane's edge, for routing only.
bool allowsChangingRight(SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
double myMaxSpeed
Lane-wide speed limit [m/s].
const MSLink * getLinkTo(const MSLane *const) const
returns the link to the given lane or nullptr, if it is not connected
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step....
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool isWalkingArea() const
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
void resetPermissions(long long transientID)
const std::string myLaneType
the type of this lane
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
StopOffset myLaneStopOffset
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
int getIndex() const
Returns the lane's index.
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
const double myWidth
Lane width [m].
const double myLengthGeometryFactor
precomputed myShape.length / myLength
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
int myIndex
The lane index.
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
std::vector< MSLink * > myLinks
static const long CHANGE_PERMISSIONS_GUI
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
double interpolateGeometryPosToLanePos(double geometryPos) const
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
double interpolateLanePosToGeometryPos(double lanePos) const
virtual void setJunctionApproaches() const
Register junction approaches for all vehicles after velocities have been planned.
MSLane * getBidiLane() const
retrieve bidirectional lane or nullptr
double getLengthGeometryFactor() const
return shape.length() / myLength
virtual const PositionVector & getShape(bool) const
MSEdge & getEdge() const
Returns the lane's edge.
double getEmissions() const
Returns the sum of last step emissions The value is always per 1s, so multiply by step length if nece...
const MSLane * getNormalPredecessorLane() const
get normal lane leading to this internal lane, for normal lanes, the lane itself is returned
double getWidth() const
Returns the lane's width.
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
double getMeanSpeed() const
Returns the mean speed on this lane.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
const std::vector< const MSLane * > & getFoeLanes() const
LinkState getState() const
Returns the current state of the link.
MSLane * getLane() const
Returns the connected lane.
int getIndex() const
Returns the respond index (for visualization).
bool havePriority() const
Returns whether this link is a major link.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
const std::vector< ConflictInfo > & getConflicts() const
Notification
Definition of a vehicle state.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
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,...
A lane area vehicles can halt at.
VehicleVector getBlockingVehicles(int linkIndex) override
return vehicles that block the intersection/rail signal for vehicles that wish to pass the given link...
std::vector< const MSDriveWay * > getBlockingDriveWays(int linkIndex) override
return vehicles that approach the intersection/rail signal and have priority over vehicles that wish ...
Representation of a vehicle in the micro simulation.
const std::string & getID() const
Returns the id.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
double x() const
Returns the x-position.
double z() const
Returns the z-position.
double y() const
Returns the y-position.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double getMinZ() const
return minimum z-coordinate
double length() const
Returns the length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0, double deg=90) const
return orthogonal through p (extending this vector if necessary)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed).
double nearest_offset_to_point25D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D projected onto the 3D geometry
PositionVector reverse() const
reverse position vector
unsigned char red() const
Returns the red-amount of the color.
static const RGBColor BLUE
unsigned char alpha() const
Returns the alpha-amount of the color.
static SumoRNG * getColorRNG()
get color RNG
static RGBColor parseColor(std::string coldef)
Parses a color information.
unsigned char green() const
Returns the green-amount of the color.
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
unsigned char blue() const
Returns the blue-amount of the color.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static const RGBColor MAGENTA
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1).
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 startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static std::string wrapText(const std::string s, int width)
remove leading and trailing whitespace
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
static const RGBColor SUMO_color_DEADEND_SHOW
color for highlighthing deadends
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double exaggeration
The size exaggeration (upscale).
bool constantSize
whether the object shall be drawn with constant size regardless of zoom
double minSize
The minimum size to draw this object.
bool show(const GUIGlObject *o) const
whether to show the text
edge type specific meso parameters