65 #include <osg/Geometry> 75 MSEdge*
const edge,
int numericalID,
78 MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index, isRampAccel),
89 int e = (int)
myShape.size() - 1;
90 for (
int i = 0; i < e; ++i) {
113 const MSLane::VehCont::iterator& at,
193 int noLinks = (int)
myLinks.size();
208 double w =
myWidth / (double) noLinks;
211 for (
int i = noLinks; --i >= 0;) {
212 double x2 = x1 - (double)(w / 2.);
221 int noLinks = (int)
myLinks.size();
238 double w =
myWidth / (double) noLinks;
241 for (
int i = noLinks; --i >= 0;) {
242 double x2 = x1 - (double)(w / 2.);
255 int noLinks = (int)
myLinks.size();
270 double w =
myWidth / (double) noLinks;
273 for (
int i = 0; i < noLinks; ++i) {
285 const double rot =
RAD2DEG(atan2((end.
x() - f.
x()), (f.
y() - end.
y())));
289 glTranslated(end.
x(), end.
y(), 0);
290 glRotated(rot, 0, 0, 1);
300 glTranslated(end.
x(), end.
y(), 0);
301 glRotated(rot, 0, 0, 1);
345 const double rot =
RAD2DEG(atan2((end.
x() - f.
x()), (f.
y() - end.
y())));
348 glTranslated(end.
x(), end.
y(), 0);
349 glRotated(rot, 0, 0, 1);
353 for (std::vector<MSLink*>::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
406 for (std::vector<MSLink*>::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
407 const MSLane* connected = (*i)->getLane();
408 if (connected == 0) {
415 glVertex2d(p1.
x(), p1.
y());
416 glVertex2d(p2.
x(), p2.
y());
430 bool mustDrawMarkings =
false;
439 if (isCrossing || isWalkingArea) {
444 glTranslated(0, 0,
getType() - 0.2);
452 const std::vector<RGBColor>& segmentColors =
static_cast<const GUIEdge*
>(
myEdge)->getSegmentColors();
453 if (segmentColors.size() > 0) {
456 for (
int ii = 0; ii < (int)
myShape.size() - 1; ++ii) {
463 glGetFloatv(GL_CURRENT_COLOR, color);
467 if (s.
scale * exaggeration < 1.) {
478 const double halfRailWidth = 0.725 * exaggeration;
485 glTranslated(0, 0, .1);
488 drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
489 }
else if (isCrossing) {
494 glColor3d(0.9, 0.9, 0.9);
496 glColor3d(0.1, 0.1, 0.1);
498 glTranslated(0, 0, .2);
500 glTranslated(0, 0, -.2);
502 }
else if (isWalkingArea) {
504 glTranslated(0, 0, .2);
505 if (s.
scale * exaggeration < 20.) {
510 glTranslated(0, 0, -.2);
511 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES 518 const int cornerDetail = drawDetails && !isInternal ? (int)(s.
scale * exaggeration) : 0;
519 const double offset = halfWidth *
MAX2(0., (exaggeration - 1));
526 #ifdef GUILane_DEBUG_DRAW_VERTICES 534 glTranslated(0, 0, .5);
554 glTranslated(0, 0, .1);
582 for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
583 if ((*v)->getLane() ==
this) {
589 for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
607 int e = (int)
getShape().size() - 1;
608 for (
int i = 0; i < e; ++i) {
613 const double length =
MIN2((
double)3, myShapeLengths[i] - t);
616 glVertex2d(-mw, -t - length);
639 int e = (int)
getShape().size() - 1;
641 for (
int i = 0; i < e; ++i) {
647 for (
int side = -1; side <= 1; side += 2) {
649 glVertex2d(side * mw, -t);
650 glVertex2d(side * mw, -t - 0.35);
664 glTranslated(0, 0, 0.1);
665 int e = (int)
getShape().size() - 1;
666 for (
int i = 0; i < e; ++i) {
672 glVertex2d(-halfWidth, -t);
673 glVertex2d(-halfWidth, -t - length);
674 glVertex2d(halfWidth, -t - length);
675 glVertex2d(halfWidth, -t);
686 glColor3d(0.3, 0.3, 0.3);
689 int e = (int)
getShape().size() - 1;
690 for (
int i = 0; i < e; ++i) {
696 glBegin(GL_TRIANGLES);
697 glVertex2d(0, -t - length);
724 new FXMenuCommand(ret, (
"pos: " +
toString(pos) +
" height: " +
toString(height)).c_str(), 0, 0, 0);
725 new FXMenuSeparator(ret);
727 new FXMenuSeparator(ret);
730 new FXMenuCommand(ret,
"Reopen lane", 0, &parent,
MID_CLOSE_LANE);
731 new FXMenuCommand(ret,
"Reopen edge", 0, &parent,
MID_CLOSE_EDGE);
733 new FXMenuCommand(ret,
"Reopen lane (override rerouter)", 0, &parent,
MID_CLOSE_LANE);
734 new FXMenuCommand(ret,
"Reopen edge (override rerouter)", 0, &parent,
MID_CLOSE_EDGE);
793 const std::vector<double>&
799 const std::vector<double>&
858 switch (activeScheme) {
874 switch (activeScheme) {
876 for (PositionVector::const_iterator ii =
myShape.begin(); ii !=
myShape.end() - 1; ++ii) {
881 for (
int ii = 1; ii < (int)
myShape.size(); ++ii) {
894 switch (activeScheme) {
997 switch (activeScheme) {
1082 osg::Vec4ubArray* colors =
dynamic_cast<osg::Vec4ubArray*
>(myGeom->getColorArray());
1084 myGeom->setColorArray(colors);
1099 if (rebuildAllowed) {
1109 const double slength =
myLength / no;
1112 for (
int i = 0; i < no; ++i) {
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
The link is a partial left direction.
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
The link has green light, may pass.
std::string getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
static double gLateralResolution
SVCPermissions myPermissions
The vClass permissions for this lane.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
double getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
double scale
information about a lane's width (temporary, used for a single view)
void resetPermissions(long transientID)
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
int getPriority() const
Returns the priority of the edge.
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.
void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
double z() const
Returns the z-position.
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
static const long CHANGE_PERMISSIONS_GUI
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
int getLinkTLID(MSLink *link) const
int indexOfClosest(const Position &p) const
index of the closest position to p
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, double size, RGBColor color)
draw text and the end of shape
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
unsigned char alpha() const
Returns the alpha-amount of the color.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
GUIColorer laneColorer
The lane colorer.
void drawCrossties(double length, double spacing, double halfWidth) const
draw crossties for railroads or pedestrian crossings
The link has green light, has to brake.
Stores the information about how to visualize structures.
static void debugVertices(const PositionVector &shape, double size, double layer=256)
draw vertex numbers for the given shape (in a random color)
const double SUMO_const_laneWidth
double y() const
Returns the y-position.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
PositionVector splitAtSegments(const PositionVector &shape)
add intermediate points at segment borders
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.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
The link is a 180 degree turn.
Notification
Definition of a vehicle state.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
double x() const
Returns the x-position.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
bool showLaneDirection
Whether to show direction indicators for lanes.
PositionVector reverse() const
reverse position vector
unsigned char blue() const
Returns the blue-amount of the color.
bool laneShowBorders
Information whether lane borders shall be drawn.
This is an uncontrolled, right-before-left link.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
std::map< long, SVCPermissions > myPermissionChanges
const double SUMO_const_laneOffset
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
A storage for edge travel times and efforts.
The link is controlled by a tls which is off, not blinking, may pass.
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
const std::vector< double > & getShapeRotations() const
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
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.
double getWidth() const
Returns the lane's width.
bool integrateNewVehicle(SUMOTime t)
A class that stores a 2D geometrical boundary.
std::vector< double > myShapeLengths
The lengths of the shape parts.
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
The link is a (hard) left direction.
PositionVector myShape
The shape of the lane.
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
static OptionsCont & getOptions()
Retrieves the options.
GUILane(const std::string &id, double maxSpeed, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel)
Constructor.
const std::set< const MSVehicle * > & getParkingVehicles(const MSLane *lane) const
return parking vehicles on the given lane
LinkState getState() const
Returns the current state of the link.
const std::string & getEdgeType() const
Returns the type of the edge.
double getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
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.
A road/street connecting two junctions (gui-version)
double firstWaitingTime() const
A road/street connecting two junctions.
static double naviDegree(const double angle)
void rebuildAllowedLanes()
double myLength
Lane length [m].
int getIndex() const
Returns the lane's index.
bool executeMovements(SUMOTime t, std::vector< MSLane *> &into)
double getEdgeLaneNumber() const
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
double minSize
The minimum size to draw this object.
double interpolateGeometryPosToLanePos(double geometryPos) const
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
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)
void drawBikeMarkings() const
bike lane markings on top of an intersection
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
bool showSublanes
Whether to show sublane boundaries.
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
bool havePriority() const
Returns whether this link is a major link.
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIVisualizationTextSettings drawLinkTLIndex
The link is a (hard) right direction.
const PositionVector & getShape() const
virtual bool executeMovements(SUMOTime t, std::vector< MSLane *> &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
Boundary & grow(double by)
extends the boundary by the given amount
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
const T getColor(const double value) const
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
double laneMinSize
The minimum visual lane width for drawing.
double getHCEmissions() const
Returns the sum of last step HC emissions.
GUIScaler edgeScaler
The mesoscopic edge scaler.
The link is a partial right direction.
bool lefthand() const
return whether the network was built for lefthand traffic
std::vector< MSVehicle * > VehCont
Container for vehicles.
vehicle is a passenger car (a "normal" car)
const std::string & getStreetName() const
Returns the street name of the edge.
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)
void setPermissions(SVCPermissions permissions, long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
void drawMarkings(const GUIVisualizationSettings &s, double scale) const
draw lane borders and white markings
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
void drawLane2LaneConnections() const
double getCOEmissions() const
Returns the sum of last step CO emissions.
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, double x1, double x2) const
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
double length() const
Returns the length.
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
A MSNet extended by some values for usage within the gui.
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...
MSInsertionControl & getInsertionControl()
Returns the insertion control.
unsigned char green() const
Returns the green-amount of the color.
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.
MSEdge *const myEdge
The lane's edge, for routing only.
const std::vector< double > & getShapeLengths() const
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)
This is an uncontrolled, major link, may pass.
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
int getIndex() const
Returns the respond index (for visualization)
std::vector< double > myShapeRotations
The rotations of the shape parts.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
bool myAmClosed
state for dynamic lane closings
void drawDirectionIndicators() const
direction indicators for lanes
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
unsigned char red() const
Returns the red-amount of the color.
The link is a 180 degree turn (left-hand network)
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth)
Draws a triangle at the end of the given line.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
GUIVisualizationSizeSettings vehicleSize
double getMeanSpeed() const
Returns the mean speed on this lane.
double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
const double myLengthGeometryFactor
precomputed myShape.length / myLength
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
The link has yellow light, has to brake anyway.
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length) ...
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Copy edge name (for lanes only)
double myHalfLaneWidth
Half of lane width, for speed-up.
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
The edge is an internal edge.
GUIScaler laneScaler
The lane scaler.
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
double myMaxSpeed
Lane-wide speedlimit [m/s].
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
void releaseVehicles() const
Allows to use the container for microsimulation again.
int getLinkTLIndex(MSLink *link) const
A window containing a gl-object's parameter.
static const RGBColor & getLinkColor(const LinkState &ls)
The link has red light (must brake) but indicates upcoming green.
GUIVisualizationTextSettings drawLinkJunctionIndex
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
const double myWidth
Lane width [m].
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.
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)
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
static RGBColor getColor()
gets the gl-color
A MSVehicle extended by some values for usage within the gui.