mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 10:27:32 +01:00
feat(editor): laid to the norms, a track laid on from an end gets its transition curves, into the arc, between the arcs of a compound curve and out to the straight
A track laid on from a free end in the PKP PLK laying, by a drag out of the end, by clicks from it or laid back onto it, starts from the curvature and the cant the end has. An arc turning the same way as the end is a compound curve: a transition of the norms ramps the curvature and the cant from the one arc into the other. From a straight the arc gets its entry transition, the arc then straight its exit one. Where the way is too short the transitions are cut and the cant lowered to what they ramp, and the readout says so; with no room at all the track is laid as before and the note says why. The curves traced on the orthophoto and the recommended values of a compound curve get the transitions between their arcs too. The free laying stays as it was.
This commit is contained in:
@@ -70,6 +70,21 @@ inline std::string speed_of(double const Radius, alignment::limits const &Limits
|
||||
return speed > 0.0 ? format(STR_C(" (up to %.0f km/h)"), speed) : std::string{};
|
||||
}
|
||||
|
||||
// the transition curves and the cant the norms put in a layout, a compound curve where it goes on from an arc turning the same way
|
||||
inline std::string eased_of(std::optional<alignment::lay_result> const &Eased)
|
||||
{
|
||||
if (false == Eased.has_value())
|
||||
return {};
|
||||
if (Eased->pieces.empty() || (Eased->entry <= 0.0 && Eased->exit <= 0.0))
|
||||
return Eased->note;
|
||||
auto text{Eased->compound ? format(STR_C("compound curve on from R %.0f m, a transition of %.0f m between the arcs"), Eased->from_radius, Eased->entry) : format(STR_C("transition curves %.0f / %.0f m"), Eased->entry, Eased->exit)};
|
||||
if (Eased->cant > 0.0)
|
||||
text += format(STR_C(" cant %.0f mm"), Eased->cant);
|
||||
if (false == Eased->note.empty())
|
||||
text += "\n" + Eased->note;
|
||||
return text;
|
||||
}
|
||||
|
||||
// the rise of the track from its start to its end, and the grades along it
|
||||
inline std::string vertical_of(std::vector<segment_data> const &Pieces)
|
||||
{
|
||||
@@ -106,17 +121,20 @@ inline std::string lines_of(std::vector<std::string> const &Texts)
|
||||
return text;
|
||||
}
|
||||
|
||||
inline std::string narrowed(editor_track::layout const Layout, double const Radius, double const Arc)
|
||||
{
|
||||
if ((Layout != editor_track::layout::arc_straight && Layout != editor_track::layout::straight_arc) || Arc == 0.0 || std::abs(Arc - Radius) < Radius * 0.01)
|
||||
return {};
|
||||
return format(STR_C("R %.0f m doesn't reach the cursor, the arc goes through it with R %.0f m"), Radius, Arc);
|
||||
}
|
||||
|
||||
inline std::string narrowed(std::vector<segment_data> const &Pieces, editor_track::layout const Layout, double const Radius)
|
||||
{
|
||||
if (Layout != editor_track::layout::arc_straight && Layout != editor_track::layout::straight_arc)
|
||||
return {};
|
||||
double sharpest{0.0};
|
||||
for (auto const &piece : Pieces)
|
||||
if (auto const radius{piece_plan_radius(piece)}; radius >= 0.5 && (sharpest == 0.0 || radius < sharpest))
|
||||
sharpest = radius;
|
||||
if (sharpest == 0.0 || sharpest >= Radius * 0.99)
|
||||
return {};
|
||||
return format(STR_C("R %.0f m doesn't reach the cursor, the arc goes through it with R %.0f m"), Radius, sharpest);
|
||||
return narrowed(Layout, Radius, sharpest > Radius ? 0.0 : sharpest);
|
||||
}
|
||||
|
||||
inline std::string describe(editor_track::straight const &Line)
|
||||
|
||||
Reference in New Issue
Block a user