mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 23:07:38 +01:00
feat(editor): a measuring tape in the track mode, M: the distance, the difference of height, the grade and the azimuth between two clicks
M in any tab of the track mode turns the tape on: a click puts its start, the next one its end, at a free end, on the axis of the track under the cursor or else on the ground. The readout at the cursor gives the distance in plan and in space, the difference of height and the grade between them and the azimuth, while the second point follows the cursor and once it's put; a further click starts a new measure, M or Esc puts the tape away. Self-test command tape.
This commit is contained in:
@@ -396,6 +396,23 @@ editor_mode::selftest_result editor_mode::selftest_track(std::string const &comm
|
||||
WriteLog(format("SELFTEST vprofile zone %.3f %.3f %s", zone.from, zone.to, zone.name.c_str()));
|
||||
return selftest_result::handled;
|
||||
}
|
||||
if (command == "tape")
|
||||
{
|
||||
// the measure between two points on the ground, as two clicks of the measuring tape take it
|
||||
std::vector<glm::dvec3> points;
|
||||
for (glm::dvec3 point{0.0, 5000.0, 0.0}; words >> point.x >> point.z;)
|
||||
points.push_back(point);
|
||||
std::vector<char> found;
|
||||
auto const heights{ground_heights(points, true, &found)};
|
||||
for (std::size_t i = 0; i < points.size(); ++i)
|
||||
points[i].y = found[i] != 0 ? heights[i] : 0.0;
|
||||
m_tape = {true, points, points.empty() ? glm::dvec3{0.0} : points.back()};
|
||||
auto readout{tape_readout()};
|
||||
std::replace(readout.begin(), readout.end(), '\n', '|');
|
||||
WriteLog("SELFTEST tape: " + readout);
|
||||
m_tape = {};
|
||||
return selftest_result::handled;
|
||||
}
|
||||
if (command == "trackcolours")
|
||||
{
|
||||
int colouring{0};
|
||||
|
||||
Reference in New Issue
Block a user