void GNEDetectorEntry::drawGL(const GUIVisualizationSettings& s) const { // Start drawing adding gl identificator glPushName(getGlID()); // Push detector matrix glPushMatrix(); glTranslated(0, 0, getType()); // Set initial values if(isAdditionalSelected()) { glColor3d(myBaseColorSelected.red(), myBaseColorSelected.green(), myBaseColorSelected.blue()); } else { glColor3d(myBaseColor.red(), myBaseColor.green(), myBaseColor.blue()); } const SUMOReal exaggeration = s.addSize.getExaggeration(s); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Push poligon matrix glPushMatrix(); glScaled(exaggeration, exaggeration, 1); glTranslated(myShape[0].x(), myShape[0].y(), 0); glRotated(myShapeRotations[0], 0, 0, 1); // Draw poligon glBegin(GL_LINES); glVertex2d(1.7, 0); glVertex2d(-1.7, 0); glEnd(); glBegin(GL_QUADS); glVertex2d(-1.7, .5); glVertex2d(-1.7, -.5); glVertex2d(1.7, -.5); glVertex2d(1.7, .5); glEnd(); // first Arrow glTranslated(1.5, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); // second Arrow glTranslated(-3, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); // Pop poligon matrix glPopMatrix(); // Pop detector matrix glPopMatrix(); // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Draw icon drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_ENTRY), 1.5, 1); // Show Lock icon depending of the Edit mode drawLockIcon(0.4); } // Draw name drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); // pop gl identificator glPopName(); }
void GNEDetectorExit::drawGL(const GUIVisualizationSettings& s) const { // Start drawing adding gl identificator glPushName(getGlID()); // Push detector matrix glPushMatrix(); glTranslated(0, 0, getType()); // Set initial values if (isAttributeCarrierSelected()) { GLHelper::setColor(myViewNet->getNet()->selectedAdditionalColor); } else { GLHelper::setColor(s.SUMO_color_E3Exit); } const double exaggeration = s.addSize.getExaggeration(s); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Push polygon matrix glPushMatrix(); glScaled(exaggeration, exaggeration, 1); glTranslated(myShape[0].x(), myShape[0].y(), 0); glRotated(myShapeRotations[0], 0, 0, 1); // Draw polygon glBegin(GL_LINES); glVertex2d(1.7, 0); glVertex2d(-1.7, 0); glEnd(); glBegin(GL_QUADS); glVertex2d(-1.7, .5); glVertex2d(-1.7, -.5); glVertex2d(1.7, -.5); glVertex2d(1.7, .5); glEnd(); // draw details if isn't being drawn for selecting if(!s.drawForSelecting) { // first Arrow glTranslated(1.5, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); // second Arrow glTranslated(-3, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); } // Pop polygon matrix glPopMatrix(); // Pop detector matrix glPopMatrix(); // Check if the distance is enought to draw details if (((s.scale * exaggeration) >= 10)) { // Push matrix glPushMatrix(); // Traslate to center of detector glTranslated(myShape.getLineCenter().x(), myShape.getLineCenter().y(), getType() + 0.1); // Rotate depending of myBlockIconRotation glRotated(myBlockIconRotation, 0, 0, -1); //move to logo position glTranslated(1.9, 0, 0); // draw Entry logo if isn't being drawn for selecting if(s.drawForSelecting) { GLHelper::setColor(s.SUMO_color_E3Exit); GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1); } else if (isAttributeCarrierSelected()) { GLHelper::drawText("E3", Position(), .1, 2.8, myViewNet->getNet()->selectedAdditionalColor); } else { GLHelper::drawText("E3", Position(), .1, 2.8, s.SUMO_color_E3Exit); } //move to logo position glTranslated(1.7, 0, 0); // Rotate depending of myBlockIconRotation glRotated(90, 0, 0, 1); // draw Entry text if isn't being drawn for selecting if(s.drawForSelecting) { GLHelper::setColor(s.SUMO_color_E3Exit); GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1); } else if (isAttributeCarrierSelected()) { GLHelper::drawText("Exit", Position(), .1, 1, myViewNet->getNet()->selectedAdditionalColor); } else { GLHelper::drawText("Exit", Position(), .1, 1, s.SUMO_color_E3Exit); } // pop matrix glPopMatrix(); // Show Lock icon depending of the Edit mode and if isn't being drawn for selecting if(!s.drawForSelecting) { drawLockIcon(0.4); } } // Draw name if isn't being drawn for selecting if(!s.drawForSelecting) { drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); } // check if dotted contour has to be drawn if(!s.drawForSelecting && (myViewNet->getACUnderCursor() == this)) { GLHelper::drawShapeDottedContour(getType(), myShape[0], 3.4, 5, myShapeRotations[0], 0, 2); } // pop gl identificator glPopName(); }
void GNEDetectorE1::drawGL(const GUIVisualizationSettings& s) const { // get values glPushName(getGlID()); SUMOReal width = (SUMOReal) 2.0 * s.scale; glLineWidth(1.0); const SUMOReal exaggeration = s.addSize.getExaggeration(s); // draw shape glColor3d(1, 1, 0); glPushMatrix(); glTranslated(0, 0, getType()); glTranslated(myShape[0].x(), myShape[0].y(), 0); glRotated(myShapeRotations[0], 0, 0, 1); glScaled(exaggeration, exaggeration, 1); glBegin(GL_QUADS); glVertex2d(-1.0, 2); glVertex2d(-1.0, -2); glVertex2d( 1.0, -2); glVertex2d( 1.0, 2); glEnd(); glTranslated(0, 0, .01); glBegin(GL_LINES); glVertex2d(0, 2 - .1); glVertex2d(0, -2 + .1); glEnd(); // outline if (width * exaggeration > 1) { glColor3d(1, 1, 1); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_QUADS); glVertex2f(-1.0, 2); glVertex2f(-1.0, -2); glVertex2f( 1.0, -2); glVertex2f( 1.0, 2); glEnd(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } // position indicator if (width * exaggeration > 1) { glRotated(90, 0, 0, -1); glColor3d(1, 1, 1); glBegin(GL_LINES); glVertex2d(0, 1.7); glVertex2d(0, -1.7); glEnd(); } // Pop shape matrix glPopMatrix(); // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Add a draw matrix drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_E1)); // Show Lock icon depending of the Edit mode drawLockIcon(); } // Finish draw drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); glPopName(); }
void GNEVariableSpeedSignal::drawGL(const GUIVisualizationSettings& s) const { // Start drawing adding an gl identificator glPushName(getGlID()); // Add a draw matrix for drawing logo glPushMatrix(); glTranslated(myShape[0].x(), myShape[0].y(), getType()); glColor3d(1, 1, 1); glRotated(180, 0, 0, 1); // Draw icon depending of rerouter is or isn't selected if (isAdditionalSelected()) { GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGNALSELECTED), 1); } else { GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGNAL), 1); } // Pop draw icon matrix glPopMatrix(); // Show Lock icon depending of the Edit mode drawLockIcon(0.4); // Push matrix to draw every symbol over lane glPushMatrix(); // Traslate to 0,0 glTranslated(0, 0, getType()); // Obtain exaggeration const SUMOReal exaggeration = s.addSize.getExaggeration(s); // Iterate over lanes for (childLanes::const_iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { // Draw every signal over Lane glPushMatrix(); glScaled(exaggeration, exaggeration, 1); glTranslated(i->positionOverLane.x(), i->positionOverLane.y(), 0); glRotated(i->rotationOverLane, 0, 0, 1); glTranslated(0, -1.5, 0); int noPoints = 9; if (s.scale > 25) { noPoints = (int)(9.0 + s.scale / 10.0); if (noPoints > 36) { noPoints = 36; } } glColor3d(1, 0, 0); GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints); if (s.scale >= 5) { glTranslated(0, 0, .1); glColor3d(0, 0, 0); GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); // Draw speed SUMOReal speed = i->lane->getSpeed(); // Show as Km/h speed *= 3.6f; if (((int) speed + 1) % 10 == 0) { speed = (SUMOReal)(((int) speed + 1) / 10 * 10); } // draw the speed string std::string speedToDraw = toString<SUMOReal>(speed); glColor3d(1, 1, 0); glTranslated(0, 0, .1); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); pfSetPosition(0, 0); pfSetScale(1.2f); SUMOReal w = pfdkGetStringWidth(speedToDraw.c_str()); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 0.3, 0); pfDrawString(speedToDraw.c_str()); } glPopMatrix(); } // Pop symbol matrix glPopMatrix(); // Draw connections drawConnections(); // Draw name drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); // Pop name glPopName(); }
void GNEContainerStop::drawGL(const GUIVisualizationSettings& s) const { // Start drawing adding an gl identificator glPushName(getGlID()); // Add a draw matrix glPushMatrix(); // Start with the drawing of the area traslating matrix to origin glTranslated(0, 0, getType()); // Set color of the base if (isAdditionalSelected()) { GLHelper::setColor(myBaseColorSelected); } else { GLHelper::setColor(myBaseColor); } // Obtain exaggeration of the draw const SUMOReal exaggeration = s.addSize.getExaggeration(s); // Draw the area using shape, shapeRotations, shapeLenghts and value of exaggeration GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, exaggeration); // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Add a draw matrix glPushMatrix(); // Obtain rotation of the sing depeding of the option "lefthand" SUMOReal rotSign = OptionsCont::getOptions().getBool("lefthand"); // Set color of the lines if (isAdditionalSelected()) { GLHelper::setColor(myTextColorSelected); } else { GLHelper::setColor(myTextColor); } // Iterate over every line for (int i = 0; i < (int)myLines.size(); ++i) { // Add a new push matrix glPushMatrix(); // Traslate End positionof signal glTranslated(mySignPos.x(), mySignPos.y(), 0); // Rotate 180 (Eje X -> Mirror) glRotated(180, 1, 0, 0); // Rotate again depending of the option rotSign glRotated(rotSign * myBlockIconRotation, 0, 0, 1); // Set poligon mode glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // set polyfront position ot 0 pfSetPosition(0, 0); // Set polyfront scale to 1 pfSetScale(1.f); // traslate matrix for every line glTranslated(1.2, -(double)i, 0); // draw line pfDrawString(myLines[i].c_str()); // pop matrix glPopMatrix(); } // Start drawing sign traslating matrix to signal position glTranslated(mySignPos.x(), mySignPos.y(), 0); // Define nº points (for efficiency) int noPoints = 9; // If the scale * exaggeration is more than 25, recalculate nº points if (s.scale * exaggeration > 25) { noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } // scale matrix depending of the exaggeration glScaled(exaggeration, exaggeration, 1); // Draw green circle GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); // Traslate to front glTranslated(0, 0, .1); // Set color of the lines if (isAdditionalSelected()) { GLHelper::setColor(mySignColorSelected); } else { GLHelper::setColor(mySignColor); } // draw another circle in the same position, but a little bit more small GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); // If the scale * exageration is equal or more than 4.5, draw H if (s.scale * exaggeration >= 4.5) { if (isAdditionalSelected()) { GLHelper::drawText("C", Position(), .1, 1.6, myBaseColorSelected, myBlockIconRotation); } else { GLHelper::drawText("C", Position(), .1, 1.6, myBaseColor, myBlockIconRotation); } } // pop draw matrix glPopMatrix(); // Show Lock icon depending of the Edit mode drawLockIcon(); } // pop draw matrix glPopMatrix(); // Draw name drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); // Pop name glPopName(); }