61 #include <osg/Geometry> 64 #ifdef CHECK_MEMORY_LEAKS 66 #endif // CHECK_MEMORY_LEAKS 74 MSEdge*
const edge,
unsigned int numericalID,
77 MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index),
83 int e = (int)
myShape.size() - 1;
84 for (
int i = 0; i < e; ++i) {
107 const MSLane::VehCont::iterator& at,
173 unsigned int noLinks = (
unsigned int)
myLinks.size();
191 for (
int i = noLinks; --i >= 0;) {
201 unsigned int noLinks = (
unsigned int)
myLinks.size();
221 for (
int i = noLinks; --i >= 0;) {
239 glTranslated(end.
x(), end.
y(), 0);
240 glRotated(rot, 0, 0, 1);
248 unsigned int noLinks = (
unsigned int)
myLinks.size();
266 for (
unsigned int i = 0; i < noLinks; ++i) {
282 glTranslated(end.
x(), end.
y(), 0);
283 glRotated(rot, 0, 0, 1);
293 glTranslated(end.
x(), end.
y(), 0);
294 glRotated(rot, 0, 0, 1);
341 glTranslated(end.
x(), end.
y(), 0);
342 glRotated(rot, 0, 0, 1);
346 for (std::vector<MSLink*>::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
399 for (std::vector<MSLink*>::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
400 const MSLane* connected = (*i)->getLane();
401 if (connected == 0) {
408 glVertex2f(p1.
x(), p1.
y());
409 glVertex2f(p2.
x(), p2.
y());
423 bool mustDrawMarkings =
false;
431 const bool drawDetails = s.
scale * exaggeration > 5;
432 if (isCrossing || isWalkingArea) {
437 glTranslated(0, 0,
getType() - 0.2);
447 glGetFloatv(GL_CURRENT_COLOR, color);
451 if (s.
scale * exaggeration < 1.) {
462 const SUMOReal halfRailWidth = 0.725 * exaggeration;
469 glTranslated(0, 0, .1);
474 drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
475 }
else if (isCrossing) {
480 glColor3d(0.9, 0.9, 0.9);
482 glColor3d(0.1, 0.1, 0.1);
484 glTranslated(0, 0, .2);
486 glTranslated(0, 0, -.2);
488 }
else if (isWalkingArea) {
490 glTranslated(0, 0, .2);
491 if (s.
scale * exaggeration < 20.) {
496 glTranslated(0, 0, -.2);
497 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES 504 const int cornerDetail = drawDetails && !isInternal ? s.
scale * exaggeration : 0;
514 if ((!isInternal || isCrossing) && drawDetails) {
517 glTranslated(0, 0, .5);
527 glTranslated(0, 0, .1);
537 if (mustDrawMarkings && drawDetails) {
550 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
551 if ((*v)->getLane() ==
this) {
557 for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
577 int e = (int)
getShape().size() - 1;
578 for (
int i = 0; i < e; ++i) {
586 glVertex2d(-mw, -t - length);
609 int e = (int)
getShape().size() - 1;
611 for (
int i = 0; i < e; ++i) {
617 for (
int side = -1; side <= 1; side += 2) {
619 glVertex2d(side * mw, -t);
620 glVertex2d(side * mw, -t - 0.35);
634 glTranslated(0, 0, 0.1);
635 int e = (int)
getShape().size() - 1;
636 for (
int i = 0; i < e; ++i) {
642 glVertex2d(-halfWidth, -t);
643 glVertex2d(-halfWidth, -t - length);
644 glVertex2d(halfWidth, -t - length);
645 glVertex2d(halfWidth, -t);
668 new FXMenuCommand(ret, (
"pos: " +
toString(pos) +
" height: " +
toString(height)).c_str(), 0, 0, 0);
669 new FXMenuSeparator(ret);
671 new FXMenuSeparator(ret);
673 new FXMenuCommand(ret,
"Reopen lane", 0, &parent,
MID_CLOSE_LANE);
674 new FXMenuCommand(ret,
"Reopen edge", 0, &parent,
MID_CLOSE_EDGE);
730 const std::vector<SUMOReal>&
736 const std::vector<SUMOReal>&
791 switch (activeScheme) {
805 const size_t activeScheme = c.
getActive();
807 switch (activeScheme) {
809 for (PositionVector::const_iterator ii =
myShape.begin(); ii !=
myShape.end() - 1; ++ii) {
814 for (
int ii = 1; ii < (int)
myShape.size(); ++ii) {
827 switch (activeScheme) {
928 switch (activeScheme) {
1011 osg::Vec4ubArray* colors =
dynamic_cast<osg::Vec4ubArray*
>(myGeom->getColorArray());
1013 myGeom->setColorArray(colors);
1028 if (rebuildAllowed) {
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
The link is a partial left direction.
The link has green light, may pass.
SVCPermissions myPermissions
The vClass permissions for this lane.
void drawLane2LaneConnections() const
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
VehCont myVehicles
The lane's vehicles. The entering vehicles are inserted at the front of this container and the leavin...
const std::vector< SUMOReal > & getShapeRotations() const
MSEdge & getEdge() const
Returns the lane's edge.
bool lefthand() const
return whether the network was built for lefthand traffic
Representation of a vehicle in the micro simulation.
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
SUMOReal getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
const SUMOReal SUMO_const_laneWidth
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
static void debugVertices(const PositionVector &shape, SUMOReal size, SUMOReal layer=256)
draw vertex numbers for the given shape (in a random color)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Copy edge name (for lanes only)
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
GUIColorer laneColorer
The lane colorer.
The link has green light, has to brake.
Stores the information about how to visualize structures.
SUMOReal getLength() const
Returns the lane's length.
void drawTextAtEnd(const std::string &text, const PositionVector &shape, SUMOReal x, const GUIVisualizationTextSettings &settings) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
int myIndex
The lane index.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
const RGBColor & getLinkColor(const LinkState &ls)
std::vector< MSVehicle * > VehCont
Container for vehicles.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Notification
Definition of a vehicle state.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width, int cornerDetail=0, SUMOReal offset=0)
Draws thick lines.
const std::string & getStreetName() const
Returns the street name of the edge.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
SUMOReal getWidth() const
Returns the lane's width.
void drawMarkings(const GUIVisualizationSettings &s, SUMOReal scale) const
draw lane borders and white markings
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
SVCPermissions myOriginalPermissions
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
This is an uncontrolled, right-before-left link.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
const std::vector< SUMOReal > & getShapeLengths() const
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
const SUMOReal SUMO_const_laneOffset
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SUMOReal myWidth
Lane width [m].
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads or pedestrian crossings
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
A storage for edge travel times and efforts.
The link is controlled by a tls which is off, not blinking, may pass.
SUMOReal x() const
Returns the x-position.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
GUIGlID getGlID() const
Returns the numerical id of the object.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
bool integrateNewVehicle(SUMOTime t)
A class that stores a 2D geometrical boundary.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
const std::set< const MSVehicle * > & getParkingVehicles(const MSLane *lane) const
return parking vehicles on the given lane
The link is a (hard) left direction.
PositionVector myShape
The shape of the lane.
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
void drawBikeMarkings() const
bike lane markings on top of an intersection
PositionVector reverse() const
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Executes planned vehicle movements with regards to right-of-way.
unsigned char blue() const
Returns the blue-amount of the color.
The link is a straight direction.
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
int getIndex() const
Returns the respond index (for visualization)
A road/street connecting two junctions (gui-version)
std::vector< SUMOReal > myShapeRotations
The rotations of the shape parts.
A road/street connecting two junctions.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void rebuildAllowedLanes()
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
This is an uncontrolled, minor link, has to brake.
A point in 2D or 3D with translation and scaling methods.
void planMovements(const SUMOTime t)
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
unsigned char alpha() const
Returns the alpha-amount of the color.
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
SUMOReal z() const
Returns the z-position.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
int getLinkTLIndex(MSLink *link) const
const T getColor(const SUMOReal value) const
SUMOReal firstWaitingTime() const
GUIVisualizationTextSettings drawLinkTLIndex
The link is a (hard) right direction.
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
GUILane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, unsigned int index)
Constructor.
float minSize
The minimum size to draw this object.
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
SUMOReal myLength
Lane length [m].
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some lane function
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
int getIndex() const
Returns the lane's index.
GUIScaler edgeScaler
The mesoscopic edge scaler.
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
const std::string & getEdgeType() const
Returns the type of the edge.
vehicle is a passenger car (a "normal" car)
SUMOReal getEdgeLaneNumber() const
static SUMOReal naviDegree(const SUMOReal angle)
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, SUMOReal x1, SUMOReal x2) const
const SUMOReal myLengthGeometryFactor
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void unlock()
release mutex lock
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
The edge is a pedestrian walking area (a special type of internal edge)
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
static SUMOReal getAssumedSpeed(const MSEdge *edge)
return current travel speed assumption
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
bool havePriority() const
Returns whether this link is a major link.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
A MSNet extended by some values for usage within the gui.
int getPriority() const
Returns the priority of the edge.
The link has yellow light, may pass.
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
The link is controlled by a tls which is off and blinks, has to brake.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
SUMOReal getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
MSEdge *const myEdge
The lane's edge, for routing only.
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
SUMOReal y() const
Returns the y-position.
The edge is a pedestrian crossing (a special type of internal edge)
void detectCollisions(SUMOTime timestep, const std::string &stage)
The link has red light (must brake)
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
This is an uncontrolled, major link, may pass.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
unsigned int getLinkTLID(MSLink *link) const
bool myAmClosed
state for dynamic lane closings
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
const PositionVector & getShape() const
Returns this lane's shape.
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
The link is a 180 degree turn (left-hand network)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
LinkState getState() const
Returns the current state of the link.
unsigned char green() const
Returns the green-amount of the color.
GUIVisualizationSizeSettings vehicleSize
bool retrieveExistingEffort(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns an effort for an edge and time if stored.
The link has yellow light, has to brake anyway.
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
The edge is an internal edge.
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
GUIScaler laneScaler
The lane scaler.
unsigned char red() const
Returns the red-amount of the color.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
A window containing a gl-object's parameter.
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
The link has red light (must brake) but indicates upcoming green.
GUIVisualizationTextSettings drawLinkJunctionIndex
void releaseVehicles() const
Allows to use the container for microsimulation again.
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
The link has no direction (is a dead end link)
const PositionVector & getShape() const
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
A MSVehicle extended by some values for usage within the gui.