17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 14:29:20 +02:00
Files
maszyna/editor/turnouts.cppm
maj00r 321c9dd7ab Editor: fold the plan library into the tree as modules, drop its own name
The track layout library came in as a subproject of its own -- its own
CMakeLists, its own install and export rules, its own include tree -- which only
made the build harder to follow now that everything else is a module. It is part
of the editor, so it lives where the editor lives.

- editor/plan_*.cppm / plan_*.cpp: the fifteen interface units and twelve
  implementation units, flat in editor/ beside editorTerrain and orthophoto, with
  the plan_ prefix keeping them clear of what was already there (editor/turnouts
  is the preset catalogue, so the geometry is plan_turnout_geometry).
- modules are named eu07.editor.plan_*, like every other module in the tree.
- namespaces move under the editor's own: editor::plan, editor::plan::geometry,
  ::io, ::render. The library's old name is gone from the sources and the docs.
- every moved file carries the MPL header the rest of the tree carries; it had
  none. version.hpp went with the subproject: macros only, and unused.
- the umbrella header is dropped -- nothing imported it.
- the unit tests survive the fold: editor/tests, behind EU07_EDITOR_PLAN_TESTS
  (off by default), compiles the interfaces a second time into a small library of
  its own, because a test can only import modules from a target it links and
  linking the game would drag the whole simulator in. The code under test needs
  nothing but a compiler. 7/7 pass.
- a switch may now be written with two dashes as well: --editor beside -editor.

Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF); -editor and --editor both come
up in the editor on empty ground.
2026-09-13 13:31:01 +02:00

53 lines
1.8 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <string>
#include <vector>
export module eu07.editor.turnouts;
export {
namespace editor
{
// one piece of a preset's diverging path, in catalogue order from PR. mirrors
// editor::plan::TurnoutPieceSpec so this header stays free of the library
struct turnout_preset_piece
{
int part; // 0 przediglicowy, 1 iglica, 2 luk, 3 krzyzownicowa
double length; // metres, always explicit - nothing here is fitted
double radius_start; // metres; 0 = straight
double radius_end; // metres; different from radius_start = clothoid
double turn_in; // kat nagiecia iglicy (beta), radians; 0 = tangent to the stock rail
};
// a standard turnout template: its designation, the catalogue numbers the laid path is
// checked against (skos 1:n and the length PR->KR along the through track), the pieces it
// is laid from, and the two blade dimensions that place its real, cut tip
struct turnout_preset
{
std::string name;
double crossing_n; // skos 1:n
double length; // catalogue length: a + b, the two tangent legs of the drawing, metres
double tip_thickness; // grubosc iglicy na koncu zestruganego dzioba (u), metres
double nose; // dziob iglicy: zestrugana dlugosc od ostrza (d), metres
double railtop_width; // szerokosc glowki szyny (w), metres
std::vector<turnout_preset_piece> pieces;
};
// typical Polish turnouts (rozjazdy zwyczajne). the (skos, R) pairs are the recognised
// standard; confirm the piece lengths and the blade against Id-1
std::vector<turnout_preset> const &turnout_presets();
} // namespace editor
} // export