mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 10:37:07 +01:00
84dca7cccb
E5, what E3 left (editor-tracks-domain.md §9 "Migracja"): the //$r records were kept in the project file as a block a file; the switches among them which the domain can lay now become its turnouts when the map is first opened. - A switch or a double switch of the editor becomes a turnout where its record names a type of the catalogue (its type, rail, radius, ratio and a, b of an ordinary or a symmetric one; the first of the catalogue's order where a movable nose is the only difference, which the record doesn't keep), its start lies on a line made of an alignment within a centimetre and its direction along the line or against it, and its main track is bent as the record says the line is there (straight, or the radius within 5 %). It's laid into the line by the command insert_turnout, the hand of the record, with edit_policy::no_new_block: the old line may break the norms where nobody touched it, the turnout may add no BLOCK finding to it. - Its record goes on its own into the project with the main track of the turnout (as an //$h record keeps the line it became); the rest of the block stays as written, the comments with it, why each switch didn't become a turnout with it: a slip or a crossing (their records don't tell the side of the crossing track), a connection (the solver of the connections lays it anew), a lifted outer track, no type of the catalogue, no line under it, a bending other than the line's, or the reasons the command refused it for. A block none of whose switches became one is kept as before, with the reasons. Tests: U: an alignment of data/records with five //$r lines: two switches on its straight, along it and against it, to the left and to the right, made turnouts of their types at their starts (the structure whole, no reason); one beside the line, one of no type of the catalogue and a connection kept in the block with the comment, each with why; the two records each with the main track of its turnout; the project written and read back the same. The records of data/records and of the map of data/project/migration (no switch on a line) kept whole as before. Unit tests 1096 -> 1097.
77 lines
4.3 KiB
C++
77 lines
4.3 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/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "editor/project/projectFile.hpp"
|
|
#include "scene/scenelayers.h"
|
|
|
|
#include <filesystem>
|
|
#include <map>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
// The //$ lines of an old scenery taken into the project file when its map is first opened (editor-tracks-domain.md §9, §10): what the
|
|
// domain has a place for becomes its lines and nodes, the rest is kept as it was written; the lines stay in the scenery files, untouched.
|
|
//
|
|
// //$h an alignment designed: a line between two nodes, its vertices with their radii, transitions and cants, the shape of its
|
|
// transitions, its chainage at the start (the origin) and its speed as the class of the line. Not one the domain lays otherwise:
|
|
// a compound curve, two transitions with no arc between them, cant ramps of its own, a curve turning the longer way, a design kept
|
|
// for a part of its line, one the domain lays to another length. The ends of two lines at one place join at a node. The record is
|
|
// kept as it was, with the line it became: the points clicked, the old norms, the pieces, the fit have no place in the domain.
|
|
// //$p a grade line designed along such a line: its breaks with their vertical curves as the breaks of the line, the heights of its
|
|
// ends as those of the nodes. Not one with a break with no vertical curve, or along no line of an alignment. Kept as it was too.
|
|
// //$r a switch, a double switch of the editor on a line made of an alignment, of a type of the catalogue (its type, rail, radius, ratio,
|
|
// a and b), along the line or against it, bent as its record says the line is: a turnout laid into the line, as the command lays
|
|
// it, the norms not refusing what the old line breaks already; its record kept on its own with the main track of the turnout.
|
|
// Not a slip nor a crossing (their records don't tell the side of the crossing track), a connection (the solver of the
|
|
// connections lays it anew), a lifted one, one of no type of the catalogue or on no line: kept in the block of the file, why with it.
|
|
// //$k the kilometrage of the railway lines, //$t the tracks fitted, //$w the tracks sharing a grade line, //$b the objects bound to
|
|
// the tracks (E6), //$s the stations (E7): no place in the domain yet, kept as they were.
|
|
// //$c, //$o, //$z the camera, the orthophoto and the area of the downloads: what the editor keeps of itself in the scenery, not the
|
|
// track geometry; not taken.
|
|
namespace project
|
|
{
|
|
|
|
// the //$ lines of a scenery file by the letter of their mark, the mark taken off as the editor takes it (scene::node_layers::scan()):
|
|
// the lines other tools put after the same marks left out, those of the old letters of the marks under the new ones
|
|
std::map<char, std::vector<std::string>> marked_lines(std::string_view const Text);
|
|
|
|
struct marked_file
|
|
{
|
|
std::string file; // relative to the scenery folder
|
|
scene::layer_context context; // the placement in effect where the lines are, their coordinates are those of the file
|
|
std::map<char, std::vector<std::string>> lines;
|
|
};
|
|
|
|
struct migration
|
|
{
|
|
document project;
|
|
std::vector<std::string> notes; // what was kept as it was and why, the ends joined at the nodes
|
|
};
|
|
// the project of the //$ lines of the files, in the order of the files; the norms by place as given
|
|
migration migrate(std::vector<marked_file> const &Files, norms::area_map const &Areas = {});
|
|
|
|
// the files of the map (Map relative to the scenery folder, its includes followed) with their //$ lines and the placement in effect at
|
|
// their includes
|
|
std::vector<marked_file> marked_files(std::filesystem::path const &Folder, std::string const &Map);
|
|
|
|
struct opened
|
|
{
|
|
read_result project;
|
|
bool migrated{false}; // there was no project file: it was made of the //$ lines and written
|
|
std::vector<std::string> notes;
|
|
};
|
|
// the project of the map: its file read, or made of the //$ lines of the files of the map where there's none yet and written next to it;
|
|
// the scenery files aren't written
|
|
opened open_project(std::filesystem::path const &Folder, std::string const &Map, norms::area_map const &Areas = {});
|
|
|
|
} // namespace project
|