mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 01:07:28 +01:00
Catenary editor: Iet-107 zigzag, span counter and step, cantilever swaps, movable anchors
This commit is contained in:
@@ -2198,6 +2198,8 @@ class editor_mode : public application_mode, private editor_track::observer
|
||||
bool catenary_on_key(int const Key, int const Action, int const Mods); // true: the key was used by the tool
|
||||
std::string catenary_mode_name() const;
|
||||
void catenary_key_hints(std::vector<key_hint> &Hints) const;
|
||||
// the digits typed are the span of the next pole from the last one
|
||||
bool catenary_takes_typed() const;
|
||||
// the page of the catenary field of work: 0 poles, 1 gantries, 2 wires
|
||||
int catenary_page();
|
||||
void catenary_choose_page(int const Page);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "world/catenary_suspension.h"
|
||||
#include "world/catenary_cantilever.h"
|
||||
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -99,6 +100,7 @@ struct catenary_editor
|
||||
int chain_selected{-1}; // the chain shown in the panel
|
||||
int connect_from{-1}; // hanging the wires on from this suspension: the next poles clicked get the spans
|
||||
int umbrella_from{-1}; // an umbrella from this suspension: the next LMB by a track puts the second cantilever on its pole (or drop)
|
||||
int anchor_cantilever{-1}; // a cantilever on the pole of this anchor: the next LMB by a track puts it there
|
||||
int anchor_pick{-1}; // anchoring this chain to an existing pole: the next pole clicked carries the tensioning device
|
||||
bool anchor_pick_start{false}; // ... at the start of the chain, otherwise at its end
|
||||
bool anchor_pick_contact{false}; // ... the contact wires only (anchored apart from the messenger)
|
||||
@@ -132,7 +134,7 @@ struct catenary_editor
|
||||
int shift_group{0}; // the undo group of the distance of a mast being dragged; 0: the next change opens one
|
||||
float gantry_face{2.50f}; // from the axis of the track to the face of the mast (towards the track)
|
||||
char gantry_skin[128]{}; // the replaceable texture of the masts, the beam and the drops
|
||||
int dragging{0}; // 1: the selected pole along the track, 2: the selected gantry along the track
|
||||
int dragging{0}; // 1: the selected pole along the track, 2: the selected gantry along the track, 3: the selected anchor along the track
|
||||
glm::vec2 pressed{0.f};
|
||||
glm::dvec3 drag_start{0.0}; // the point of the ground the drag started at
|
||||
std::vector<std::pair<std::size_t, catenary::gantry>> drag_group; // the spans of the dragged gantry as they were when the drag started
|
||||
@@ -150,10 +152,96 @@ struct catenary_editor
|
||||
int catalog_card{0};
|
||||
int page{0}; // the page of the catenary field of work: 0 poles, 1 gantries, 2 wires
|
||||
int gantry_hang{0}; // the next cantilevers on the selected gantry: 0 on drops of the beam, 1 straight on its masts
|
||||
// the staggers of the next poles by Iet-107 of PKP PLK (4.6.4, 7.4.2): on a straight the other side of the track axis than
|
||||
// the pole before (the full cycle in two spans), on a curve to its outside; the values by the speed of the line
|
||||
bool zigzag{true};
|
||||
int speed_class{0}; // 0: V <= 160 km/h, 1: V > 160 km/h
|
||||
float zigzag_straight{0.30f}; // m, either side of the track axis
|
||||
float zigzag_curve{0.30f}; // m, to the outside of the curve
|
||||
bool zigzag_flip{false}; // X: the next pole goes the same way as the one before (a swap of the short and the long cantilever)
|
||||
// the span of the next pole from the last one: 0 where the cursor is, 1 the recommended one, 2 the length set here
|
||||
int span_step{0};
|
||||
float span_length{60.0f};
|
||||
bool show_staggers{true}; // the staggers written at the poles of the selected chain
|
||||
std::optional<int> bend_user; // "cards for" as the user had it before a pole was selected (the pole's own while it is)
|
||||
};
|
||||
catenary_tool m_catenary;
|
||||
void catenary_scan();
|
||||
bool catenary_spot_at(TTrack &Track, int const Path, glm::dvec3 const &Point, glm::dvec3 const &Cursor, int const Side, catenary_spot &Spot) const;
|
||||
// Placing: the spot of a new pole, which takes the zigzag proposed after the last pole and the step of the span
|
||||
bool catenary_spot_at(TTrack &Track, int const Path, glm::dvec3 const &Point, glm::dvec3 const &Cursor, int const Side, catenary_spot &Spot, bool const Placing = false) const;
|
||||
// the zigzag (Iet-107): the largest staggers allowed for the speed of the line, and those the next poles get
|
||||
double zigzag_limit(bool const Curve) const;
|
||||
double zigzag_stagger(bool const Curve) const;
|
||||
// the curve stagger the spans are checked with: Iet-107 or the catalogue (card 0008)
|
||||
double span_curve_stagger() const;
|
||||
// the network type chosen in the panel
|
||||
std::string panel_network() const;
|
||||
// the longest span of the network allowed on a curve of this radius (0: straight): the table of the network
|
||||
// (traction_layout.txt), above 160 km/h no more than 62 +4 m (Iet-107 7.4.3.1), on a curve the wires tangent to the track
|
||||
// axis in the middle of the span (3.4.4.4); 0 when nothing is known
|
||||
double span_limit_at(std::string const &Network, double const Radius) const;
|
||||
// the span the step "recommended" puts the next pole at: the nominal one (62 m above 160 km/h), no longer than allowed
|
||||
// there and than 10 % over the span before (4.6.1.2); 0 when nothing is known
|
||||
double span_recommended(double const Radius) const;
|
||||
// the digits typed are the span of the next pole
|
||||
bool typed_span() const;
|
||||
// the wires towards the pole for the next pole at this spot by the zigzag: the other side of the track axis than the last pole
|
||||
// (or the same with zigzag_flip); none when there's no last pole near
|
||||
std::optional<bool> zigzag_toward(catenary_spot const &Spot) const;
|
||||
// the offset of the wires of the suspension from the axis of its track (with the lean of a superelevated track), + towards its pole
|
||||
bool stagger_of(std::size_t const Index, double &Offset) const;
|
||||
// the same, as a side of the axis: + on the right of Right
|
||||
bool lateral_of(std::size_t const Index, glm::dvec2 const &Right, double &Lateral) const;
|
||||
// the span the next pole gets from the last one by the step or the digits typed (0: where the cursor is), at a radius there
|
||||
double span_step_length(double const Radius) const;
|
||||
// the place of the next pole moved along the track (this one or one joined to it) to the span wanted from the last pole;
|
||||
// false: no step, or no such place near the cursor
|
||||
bool catenary_snap_span(TTrack *&Track, int &Path, double &Parameter) const;
|
||||
// the last pole, if it's close enough to go on from (a span of a chain)
|
||||
catenary::suspension const *last_pole_near(glm::dvec3 const &Point) const;
|
||||
// the span ending at the last pole in its chain (0 when it's the first one)
|
||||
double last_span() const;
|
||||
// the settings of the panel which make a cantilever, kept while one pole is composed with its own
|
||||
struct panel_settings
|
||||
{
|
||||
int pole{0}, execution{1}, catalog_card{0}, bend{0};
|
||||
bool swinging{true}, insulators25{false}, toward{true};
|
||||
std::string catalog_kind, catalog_group, catalog_family;
|
||||
float stagger{0.30f}, height{5.60f}, system_height{0.0f}, clearance{2.50f};
|
||||
};
|
||||
panel_settings panel_save() const;
|
||||
void panel_restore(panel_settings const &Settings);
|
||||
// the panel takes the settings of the suspension (its pole, card group, execution, height of the wires ...)
|
||||
void catenary_take_settings(std::size_t const Index);
|
||||
// the suspension gets another stagger, its pole and the rest of it stay; Group: the undo group. false: no card for it
|
||||
bool catenary_restagger(std::size_t const Index, double const Stagger, bool const Toward, bool const Curve, int const Group);
|
||||
// the track bends at the spot enough for the cards of a curve (table 0007)
|
||||
static bool track_curve(catenary_spot const &Spot);
|
||||
// X: the selected pole the other way (short cantilever <-> long one), or the next pole the other way than the zigzag proposes
|
||||
void catenary_flip();
|
||||
// the poles of the chain from position From on get the zigzag of Iet-107: the first of them keeps its side (or goes the other
|
||||
// way with Flip), the next ones in turn on a straight, outwards on a curve
|
||||
void catenary_zigzag_chain(std::size_t const Chain, std::size_t const From, bool const Flip);
|
||||
// the check of a chain by Iet-107: staggers, the cycle of the zigzag, the wires in the middle of the spans, the spans and the
|
||||
// section; cached until the chain or the settings change
|
||||
struct chain_issue
|
||||
{
|
||||
std::size_t pole{std::numeric_limits<std::size_t>::max()}; // the suspension it's about; max: the whole chain
|
||||
std::string text;
|
||||
bool error{false};
|
||||
};
|
||||
struct chain_report
|
||||
{
|
||||
std::size_t signature{0};
|
||||
double length{0.0};
|
||||
double shortest{0.0}, longest{0.0};
|
||||
std::vector<chain_issue> issues;
|
||||
std::vector<std::pair<std::size_t, double>> staggers; // the stagger at each pole, + towards its pole
|
||||
};
|
||||
mutable std::map<std::size_t, chain_report> m_chain_reports;
|
||||
chain_report const &catenary_chain_report(std::size_t const Chain) const;
|
||||
void render_catenary_zigzag_ui();
|
||||
void render_catenary_chain_report(std::size_t const Chain);
|
||||
// a pole of this type can't stand there: its group doesn't stand by switches and a switch is by it
|
||||
bool catenary_switch_error(std::string const &Pole, glm::dvec3 const &Foot, TTrack const *Track) const;
|
||||
bool catenary_switch_error(std::size_t const Index) const; // of a placed pole, remembered until it moves or changes type
|
||||
@@ -173,6 +261,8 @@ struct catenary_editor
|
||||
void catenary_compose(catenary_spot &Spot, double const Clearance, double const Stagger, bool const Toward, std::string const &Pole = {}) const;
|
||||
bool catenary_on_mast(catenary::gantry const &Gantry, double const Stagger, catenary_spot &Spot) const;
|
||||
catenary_spot const *catenary_spot_of(std::size_t const Index);
|
||||
// the same from the const paths (the overlay): the places are a cache filled on demand
|
||||
catenary_spot const *catenary_spot_view(std::size_t const Index) const { return const_cast<catenary_editor *>(this)->catenary_spot_of(Index); }
|
||||
int catenary_hit() const;
|
||||
int catenary_span_hit() const;
|
||||
void catenary_press(track_intent const &Intent);
|
||||
@@ -185,6 +275,11 @@ struct catenary_editor
|
||||
// be put there (Spot.problem says why when Spot.card is 0)
|
||||
bool catenary_umbrella_spot(TTrack &Track, int Path, catenary_spot &Spot);
|
||||
void catenary_umbrella_place(catenary_spot const &Spot);
|
||||
// a cantilever on the pole of the anchor tool.anchor_cantilever, to this track; false when it can't be put there (Spot.problem
|
||||
// says why when Spot.card is 0)
|
||||
bool catenary_anchor_cantilever_spot(TTrack &Track, int Path, catenary_spot &Spot) const;
|
||||
// the cantilever goes on the anchor pole, the anchor goes onto its pole (on <name>)
|
||||
void catenary_anchor_cantilever_place(catenary_spot const &Spot);
|
||||
// the two cantilevers of the umbrella of this suspension become separate ones
|
||||
void catenary_umbrella_break(std::size_t Index);
|
||||
// a cantilever of an umbrella or of spread cantilevers: composed with its pole (and its console mount) where they are
|
||||
@@ -223,7 +318,21 @@ struct catenary_editor
|
||||
// the selected gantry (all its spans and what hangs on them) moved in the plan
|
||||
void catenary_gantry_shift(glm::dvec2 const &Shift);
|
||||
// the place of the first mast at Axis from the axis of the track nearest to Point, on the side of Point; false: no track near
|
||||
bool catenary_along_track(glm::dvec3 const &Point, double const Axis, glm::dvec3 &Place) const;
|
||||
// Rail: the height of the rail heads of that track there
|
||||
bool catenary_along_track(glm::dvec3 const &Point, double const Axis, glm::dvec3 &Place, double *Rail = nullptr) const;
|
||||
// the track a new pole goes by: the one under the cursor, or the nearest one within reach of the place on the ground under
|
||||
// the cursor (the pole is put where it stands, not on the axis of the track); found again each frame by catenary_intent()
|
||||
struct place_target
|
||||
{
|
||||
TTrack *track{nullptr};
|
||||
int path{0};
|
||||
glm::dvec3 point{0.0}; // on the axis of the track, nearest to the cursor
|
||||
glm::dvec3 cursor{0.0}; // the place under the cursor at the height of the track
|
||||
};
|
||||
place_target m_target;
|
||||
bool catenary_find_target(place_target &Target) const;
|
||||
// the anchor selected in the view moved with the cursor, along the track at the distance its pole has from it
|
||||
void catenary_anchor_drag();
|
||||
bool catenary_on_gantry(catenary_spot &Spot);
|
||||
void catenary_drag_update();
|
||||
// the selected gantry anew: another beam, masts, turned around its middle (degrees), or square to the nearest track
|
||||
|
||||
@@ -913,6 +913,8 @@ char const *editor_mode::typed_meaning() const
|
||||
return "type the turn in degrees, + to the right";
|
||||
if (m_lay.active && false == m_lay.points.empty())
|
||||
return "type the length of the next leg, Enter adds the point";
|
||||
if (m_track_tab == track_tab::catenary && catenary_takes_typed())
|
||||
return "type the span from the last pole, LMB by the track places the pole there";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user