mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 13:19:20 +02:00
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.
76 lines
2.0 KiB
C++
76 lines
2.0 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.plan_join;
|
|
export import eu07.editor.plan_segment;
|
|
export import eu07.editor.plan_model;
|
|
export import eu07.editor.plan_solution;
|
|
|
|
export {
|
|
|
|
// TYMCZASOWA ZASLEPKA. Modul scalania koncow (plan_join / join_ends) nie zostal nigdy
|
|
// zacommitowany: commit 4ddfeb02 dopisal `src/editor/join.cpp` do CMakeLists i `#include` w
|
|
// planpanel.cpp, ale samych plikow nie ma ani w drzewie, ani w historii, ani w stashach. Bez
|
|
// tego naglowka i join.cpp branch sie nie kompiluje wcale. Ta zaslepka odtwarza dokladnie to
|
|
// API, ktorego uzywa panel planu, i mowi "niedostepne" - zeby reszta edytora dala sie uruchomic.
|
|
// Do zastapienia prawdziwym rozwiazaniem geometrii (luk-prosta-luk) i chirurgia dokumentu.
|
|
|
|
|
|
|
|
namespace editor::plan {
|
|
|
|
/// Co stanelo miedzy dwoma koncami.
|
|
enum class JoinKind {
|
|
None,
|
|
Straight,
|
|
Arc,
|
|
ArcLineArc,
|
|
ArcArc,
|
|
};
|
|
|
|
[[nodiscard]] const char* join_kind_name(JoinKind kind);
|
|
|
|
/// Czym wolno gietc to, co lezy miedzy koncami.
|
|
struct JoinSettings {
|
|
double radius{300.0};
|
|
};
|
|
|
|
/// Propozycja, przed tknieciem dokumentu.
|
|
struct JoinPlan {
|
|
bool ok{false};
|
|
std::string why{};
|
|
JoinKind kind{JoinKind::None};
|
|
std::vector<Element> elements{};
|
|
double tightest{0.0};
|
|
};
|
|
|
|
[[nodiscard]] JoinPlan plan_join(const geometry::Pose& leaving,
|
|
const geometry::Pose& arriving,
|
|
const JoinSettings& settings);
|
|
|
|
/// Co scalenie kosztowalo.
|
|
struct JoinReport {
|
|
bool ok{false};
|
|
std::string why{};
|
|
JoinPlan join{};
|
|
int fused{0};
|
|
int turnouts{0};
|
|
bool reversed{false};
|
|
};
|
|
|
|
[[nodiscard]] JoinReport join_ends(Document& document, const Solution& solution, TrackId a,
|
|
int a_end, TrackId b, int b_end, const JoinSettings& settings);
|
|
|
|
} // namespace editor::plan
|
|
|
|
} // export
|