Skip to content

Commit

Permalink
Small refactoring of MSTrainHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoueraud87 authored and behrisch committed Feb 19, 2024
1 parent 98e67f4 commit 386be62
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/guisim/GUIVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ GUIVehicle::drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool
Position front, back;
double angle = 0.0;
double curCLength = trainHelper.getFirstCarriageLength();
std::vector<MSTrainHelper::Carriage*> carriages = trainHelper.getCarriages();
const std::vector<MSTrainHelper::Carriage*>& carriages = trainHelper.getCarriages();
for (int i = 0; i < numCarriages; ++i) {
front = carriages[i]->front;
back = carriages[i]->back;
Expand Down
22 changes: 1 addition & 21 deletions src/microsim/MSTrainHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,6 @@ class MSTrainHelper {
return myUpscaleLength;
}

inline double getLocomotiveLength(void) const {
return myLocomotiveLength;
}

inline double getDefaultLength(void) const {
return myDefaultLength;
}

inline double getCarriageGap(void) const {
return myCarriageGap;
}

inline double getLength(void) const {
return myLength;
}

inline double getHalfWidth(void) const {
return myHalfWidth;
}
Expand All @@ -80,10 +64,6 @@ class MSTrainHelper {
return myNumCarriages;
}

inline double getCarriageLengthWithGap(void) const {
return myCarriageLengthWithGap;
}

inline double getCarriageLength(void) const {
return myCarriageLength;
}
Expand Down Expand Up @@ -114,7 +94,7 @@ class MSTrainHelper {
std::vector<Position> doors;
};

inline std::vector<Carriage*> getCarriages(void) const {
inline const std::vector<Carriage*>& getCarriages(void) const {
return myCarriages;
}

Expand Down
2 changes: 1 addition & 1 deletion src/microsim/transportables/MSPModel_JuPedSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
std::vector<GEOSGeometry*> rampPolygons;
for (const MSVehicle* train : allStoppedTrains) {
const MSTrainHelper trainHelper(train);
const std::vector<MSTrainHelper::Carriage*> carriages = trainHelper.getCarriages();
const std::vector<MSTrainHelper::Carriage*>& carriages = trainHelper.getCarriages();
for (const MSTrainHelper::Carriage* carriage : carriages) {
Position dir = carriage->front - carriage->back;
if (dir.length2D() == 0.0) {
Expand Down

0 comments on commit 386be62

Please sign in to comment.