void GUILane::drawGL(const GUIVisualizationSettings& s) const { glPushMatrix(); const bool isInternal = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL; bool mustDrawMarkings = false; const bool drawDetails = s.scale * s.laneWidthExaggeration > 5; if (isInternal) { // draw internal lanes on top of junctions glTranslated(0, 0, GLO_JUNCTION + 0.1); } else { glTranslated(0, 0, getType()); } // set lane color if (!MSGlobals::gUseMesoSim) { setColor(s); glPushName(getGlID()); // do not register for clicks in MESOSIM } // draw lane // check whether it is not too small if (s.scale * s.laneWidthExaggeration < 1.) { GLHelper::drawLine(myShape); if (!MSGlobals::gUseMesoSim) { glPopName(); } glPopMatrix(); } else { if (isRailway(myPermissions)) { // draw as railway const SUMOReal halfRailWidth = 0.725 * s.laneWidthExaggeration; GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfRailWidth); glColor3d(1, 1, 1); glTranslated(0, 0, .1); GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfRailWidth - 0.2); drawCrossties(s, s.laneWidthExaggeration); } else { const SUMOReal laneWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth; mustDrawMarkings = !isInternal; GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, laneWidth * s.laneWidthExaggeration); } if (!MSGlobals::gUseMesoSim) { glPopName(); } glPopMatrix(); // draw ROWs (not for inner lanes) if (!isInternal && drawDetails) { glPushMatrix(); glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape GUINet* net = (GUINet*) MSNet::getInstance(); glTranslated(0, 0, .2); drawLinkRules(*net); if (s.showLinkDecals && !isRailway(myPermissions)) { drawArrows(); } if (s.showLane2Lane) { // this should be independent to the geometry: // draw from end of first to the begin of second drawLane2LaneConnections(); } glTranslated(0, 0, .1); if (s.drawLinkJunctionIndex) { drawLinkNo(); } if (s.drawLinkTLIndex) { drawTLSLinkNo(*net); } glPopMatrix(); } } if (mustDrawMarkings && drawDetails) { // needs matrix reset drawMarkings(s, s.laneWidthExaggeration); } // draw vehicles if (s.scale > s.minVehicleSize) { // retrieve vehicles from lane; disallow simulation const MSLane::VehCont& vehicles = getVehiclesSecure(); for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) { if ((*v)->getLane() == this) { static_cast<const GUIVehicle* const>(*v)->drawGL(s); } // else: this is the shadow during a continuous lane change } // draw parking vehicles const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(this); for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) { static_cast<const GUIVehicle* const>(*v)->drawGL(s); } // allow lane simulation releaseVehicles(); } }
void GNELane::drawGL(const GUIVisualizationSettings& s) const { glPushMatrix(); glPushName(getGlID()); glTranslated(0, 0, getType()); const bool selectedEdge = gSelected.isSelected(myParentEdge.getType(), myParentEdge.getGlID()); const bool selected = gSelected.isSelected(getType(), getGlID()); if (mySpecialColor != 0) { GLHelper::setColor(*mySpecialColor); } else if (selected) { GLHelper::setColor(GNENet::selectedLaneColor); } else if (selectedEdge) { GLHelper::setColor(GNENet::selectionColor); } else { const GUIColorer& c = s.laneColorer; if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) { GLHelper::setColor(c.getScheme().getColor(getColorValue(c.getActive()))); } }; // draw lane // check whether it is not too small const SUMOReal selectionScale = selected || selectedEdge ? s.selectionScale : 1; const SUMOReal exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive())); if (s.scale * exaggeration < 1.) { if (myShapeColors.size() > 0) { GLHelper::drawLine(getShape(), myShapeColors); } else { GLHelper::drawLine(getShape()); } glPopMatrix(); } else { if (drawAsRailway(s)) { // draw as railway const SUMOReal halfRailWidth = 0.725 * exaggeration; if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, myShapeColors, halfRailWidth); } else { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, halfRailWidth); } RGBColor current = GLHelper::getColor(); glColor3d(1, 1, 1); glTranslated(0, 0, .1); GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, halfRailWidth - 0.2); GLHelper::setColor(current); drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration); } else { // the actual lane // reduce lane width to make sure that a selected edge can still be seen const SUMOReal halfWidth = selectionScale * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - (selectedEdge ? .3 : 0)); if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, myShapeColors, halfWidth); } else { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, halfWidth); } } glPopMatrix(); if (exaggeration == 1) { drawMarkings(selectedEdge, exaggeration); } // draw ROWs only if target junction has a valid logic) if (myParentEdge.getDest()->isLogicValid() && s.scale > 3) { drawArrows(); } } glPopName(); }