mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 21:29:19 +02:00
The editor branch was written against headers and the PCH, both of which this
branch has done away with, so its own files were ported rather than merged: the
five headers it added are now interface units and their .cpp files module
implementation units.
- editor/{puwg1992,polandmap,turnouts,orthophoto} become eu07.editor.* modules,
application/planpanel becomes eu07.application.planpanel. The plan tool keeps
to its own module rather than joining the eu07.simcore partitions: it stands on
the editor's libraries and eu07.application.uilayer, not on the simulation core,
so :editoruilayer can export import it without a cycle.
- glm arrives by import eu07.glm, never by include, as the rest of the tree does.
maj0sted is header-only and glm-free, so its headers stay includes in the global
module fragment - every unit that names those types includes them itself, since
a global fragment is not visible across units.
- the one textual conflict was :editoruilayer's include block against this
branch's imports; resolved this branch's way plus the planpanel import.
Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF) and starts into the editor on
empty ground with -editor alone.
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
module;
|
|
#include <algorithm>
|
|
|
|
module eu07.editor.polandmap;
|
|
import eu07.glm;
|
|
import eu07.editor.puwg1992;
|
|
|
|
/*
|
|
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/.
|
|
*/
|
|
|
|
namespace editor
|
|
{
|
|
|
|
namespace
|
|
{
|
|
|
|
// the country's corners in degrees, wide enough to hold all of it: the Odra in the west, the Bug in
|
|
// the east, the Tatras in the south and the coast in the north
|
|
double const kSouthLatitude = 49.00;
|
|
double const kNorthLatitude = 54.90;
|
|
double const kWestLongitude = 14.10;
|
|
double const kEastLongitude = 24.20;
|
|
|
|
} // namespace
|
|
|
|
void poland_extent(glm::dvec2 &Min, glm::dvec2 &Max)
|
|
{
|
|
// the projection is not axis-aligned with the graticule, so the extremes come from projecting
|
|
// all four corners and taking the outermost values
|
|
auto const sw = puwg1992(kSouthLatitude, kWestLongitude);
|
|
auto const se = puwg1992(kSouthLatitude, kEastLongitude);
|
|
auto const nw = puwg1992(kNorthLatitude, kWestLongitude);
|
|
auto const ne = puwg1992(kNorthLatitude, kEastLongitude);
|
|
|
|
Min = {std::min({sw.x, se.x, nw.x, ne.x}), std::min({sw.y, se.y, nw.y, ne.y})};
|
|
Max = {std::max({sw.x, se.x, nw.x, ne.x}), std::max({sw.y, se.y, nw.y, ne.y})};
|
|
}
|
|
|
|
} // namespace editor
|