Skip to content

Commit

Permalink
fix #14403
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Feb 24, 2024
1 parent 035aafe commit c7cce1b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/guisim/GUIVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <bitset>
#include <utils/common/MsgHandler.h>
#include <utils/common/StringUtils.h>
#include <utils/common/StringTokenizer.h>
#include <utils/vehicle/SUMOVehicleParameter.h>
#include <utils/emissions/PollutantsInterface.h>
#include <utils/geom/GeomHelper.h>
Expand Down Expand Up @@ -371,7 +372,17 @@ GUIVehicle::drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool
glTranslated(front.x(), front.y(), getType());
glRotated(angle, 0, 0, 1);
double halfWidth = trainHelper.getHalfWidth();
if (!asImage || !GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(s, getVType().getImgFile(), this, getVType().getWidth() * exaggeration, curCLength)) {
std::string imgFile = getVType().getImgFile();
if (asImage && i != trainHelper.getFirstCarriageNo()) {
if (getVType().getParameter().hasParameter("carriageImages")) {
std::vector<std::string> imgFiles = StringTokenizer(getVType().getParameter().getParameter("carriageImages", "")).getVector();
if (imgFiles.size() > 0) {
const int carIndex = trainHelper.isReversed() ? numCarriages - i : i;
imgFile = imgFiles[MIN2((int)imgFiles.size() - 1, carIndex - 1)];
}
}
}
if (!asImage || !GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(s, imgFile, this, getVType().getWidth() * exaggeration, curCLength)) {
switch (getVType().getGuiShape()) {
case SUMOVehicleShape::TRUCK_SEMITRAILER:
case SUMOVehicleShape::TRUCK_1TRAILER:
Expand Down

0 comments on commit c7cce1b

Please sign in to comment.