Skip to content

Commit

Permalink
fixing vehicle name glitches refs #3907
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 22, 2018
1 parent e536d05 commit 70667d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/guisim/GUIBaseVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,8 @@ GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos
}
*/
glTranslated(0, MIN2(length / 2, double(5)), -getType()); // drawing name at GLO_MAX fails unless translating z
glScaled(1 / upscale, 1 / upscaleLength, 1);
glRotated(-degAngle, 0, 0, 1);
glScaled(1 / upscale, 1 / upscale, 1);
drawName(Position(0, 0), s.scale,
getVType().getGuiShape() == SVS_PEDESTRIAN ? s.personName : s.vehicleName, s.angle);
if (s.vehicleName.show && myVehicle.getParameter().line != "") {
Expand Down
12 changes: 9 additions & 3 deletions src/guisim/GUIVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,12 @@ GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, doub
RGBColor current = GLHelper::getColor();
RGBColor darker = current.changedBrightness(-51);
const double exaggeration = s.vehicleSize.getExaggeration(s);
const double totalLength = getVType().getLength();
double upscaleLength = exaggeration;
if (exaggeration > 1 && totalLength > 5) {
// reduce the length/width ratio because this is not usefull at high zoom
upscaleLength *= (5 + sqrt(totalLength - 5)) / totalLength;
}
defaultLength *= exaggeration;
if (exaggeration == 0) {
return;
Expand Down Expand Up @@ -664,9 +670,9 @@ GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, doub
glPushMatrix();
front = getPosition();
glTranslated(front.x(), front.y(), getType());
glRotated(angle, 0, 0, 1);
const double upscale = s.vehicleSize.getExaggeration(s);
glScaled(upscale, upscale, 1);
const double degAngle = RAD2DEG(getAngle() + M_PI / 2.);
glRotated(degAngle, 0, 0, 1);
glScaled(exaggeration, upscaleLength, 1);
glPushMatrix();
}

Expand Down

0 comments on commit 70667d1

Please sign in to comment.