mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 14:16:48 +01:00
fef7eaac11
The consistency pass of the editor's interface after its first steps (P2 of the plan of the editor's interface):
- One card for the tool in use in every field of work. The card of the track tools (its icon, name, family and key, what
the tool is for, the mouse and the keys drawing its gestures, the link to all the shortcuts) is a component of its own,
render_tool_card, fed by the tracks as before and now by the surroundings, the roads and the terrain: their tools, kept in
one table each with their icons, keys, tooltips and gestures for the toolbar and the card, had a plain heading and a line
of keys or a few rows of gestures there. The tool options of the surroundings are headed by the field of work as the
others are. The card is folded to its title row unless the user opened it, for all the tools: what the tool is for shows
over the title, a click opens the gestures, which are in the strip under the view of the tracks as well. Kept with the
settings of the editor under the key tool_card_folded, so the open card the tracks had by default before stays behind.
- One layout of the fields: the name on the left, the field on the right (begin_fields and field_row, as in the inspector of
the tracks) in the inspector of the surroundings (the name, the position, the rotation, the scale), Weather and time,
Change history, the settings of the orthophoto and the settings of the editor. The square buttons of the download area go
on to the next line at the edge, the last one was cut off.
- Windows of their own, which don't hide the inspector: Editor settings, Weather and time and the orthophoto settings float
over the view, opened in its top left corner below the rows of the tools and kept between them and the status line, as
the window of a lesson is. They were tabs over the inspector, and the orthophoto settings unfolded inside the layers; Map >
Orthophoto settings..., the button of the terrain tools and the button in the layers open the window now.
- One list of the objects of the scenery: Windows > Scene Hierarchy, a plain list of the same nodes, is gone; Windows >
Scene opens the Scene tab (by layer and group, with the filter) and brings it forward when it lies behind the layers.
- One name for each thing, in the menus, the toolbar, the panels, the tutorial and F1: the orthophoto ("Ortofotomapa
(zdjęcia lotnicze z geoportal.gov.pl)" where it's introduced, "ortofotomapa" in the rest, for "zdjęcia lotnicze",
"ortofoto" and "zdjęcie"), the terrain model ("Teren z map (NMT)" for "Prawdziwy teren z map", "model terenu", "prawdziwy
teren", "Teren z NMT"), the plan tool ("Plan", the lesson "Correcting a curve" and the section of F1 "Plan of a curve"
before), the area fill (the terrain's "Fill" is "Area fill" as in the surroundings, with the icon of it, Water without).
The texts of the laying, whose panel is to be redone, are left as they are.
- The node bank: a model clicked with the select tool of the surroundings arms the insert tool with it (the click did
nothing before), the random model of a set is left off then. A model inserted where there's no ground under the cursor
stands at the height 0 where the cursor points, or in front of the camera when it points above the horizon, and the
status says where; it stood at the point the renderer last had under the cursor, out of sight. The search field of the
bank has no name beside it, which was cut to its first letter.
- The settings in one place: Editor settings holds the movement and the speed of the camera (as View > Camera speed), the
gizmo and the colours, the terrain made of the terrain model by itself (as in the layers and the download area) and the
maximum placement distance (as in Change history).
- F1 and the menus: Esc closes the window of the shortcuts, before anything else; the window stays in the work area as the
window of a lesson; the menus are opaque, the windows under them showed through.
- What the first steps left: with an empty scenery the panel in the middle of the view gives way to the inspector, which
says the same with the button of the lay tool and the first steps; it's drawn only while the inspector isn't seen. A
switch whose speed limits its diverging track alone shows that speed under its empty speed field ("The diverging track
40 km/h, the main one no limit"), read only; the field alone said no limit.
- Self-tests: the command bankpick, the expectations tool, window and selected, the cases c_1_bank_card_arms_insert and
c_2_esc_closes_shortcuts.
lang/editor_pl.po: the Polish of the new texts (the cards of the tools, the windows, the fields, the notices), the entries of
the texts renamed given their new English, those no longer used taken out, and the names unified in the Polish of the
orthophoto and of the terrain model.
161 lines
6.7 KiB
C++
161 lines
6.7 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
class editorSettings
|
|
{
|
|
public:
|
|
// camera movement key scheme in the editor
|
|
enum class movement_scheme
|
|
{
|
|
wsad, // new default: W/S/A/D + E/Q
|
|
legacy // old scheme: arrows + Page Up/Down
|
|
};
|
|
|
|
editorSettings() = default;
|
|
|
|
bool load();
|
|
bool save();
|
|
|
|
movement_scheme movement() const { return m_movement; }
|
|
void movement(movement_scheme scheme) { m_movement = scheme; }
|
|
|
|
// geoportal orthophoto layer (editor_orthophoto), how it's shown and whether it's on; the origin is kept per scenery, and the
|
|
// scenery keeps it too
|
|
struct orthophoto_settings
|
|
{
|
|
int radius{2};
|
|
float height{0.0f};
|
|
float opacity{0.6f};
|
|
int year{0};
|
|
bool hires{false};
|
|
bool drape{true};
|
|
float lift{0.05f};
|
|
bool in_scene{false};
|
|
// turned on or off by the user, for every scenery; none chosen yet: as the scenery keeps it, or the terrain model turns it on
|
|
std::optional<bool> on;
|
|
};
|
|
orthophoto_settings &orthophoto() { return m_orthophoto; }
|
|
// PUWG 1992 northing/easting of the scenery's (0,0,0) point; false when none was stored
|
|
bool orthophoto_origin(std::string const &Scenery, double &North, double &East) const;
|
|
void orthophoto_origin(std::string const &Scenery, double North, double East);
|
|
// the WMS layers the user added under the scenery, over the orthophoto, the top one first: the address of the service, the
|
|
// layers asked of it, its title and terms as its capabilities gave them. Kept with the editor, not with the scenery
|
|
struct wms_layer
|
|
{
|
|
std::string url;
|
|
std::string layers;
|
|
std::string title;
|
|
std::string terms;
|
|
float opacity{0.8f};
|
|
bool visible{true};
|
|
};
|
|
std::vector<wms_layer> &wms_layers() { return m_wms_layers; }
|
|
|
|
double platform_edge() const { return m_platform_edge; }
|
|
void platform_edge(double Distance) { m_platform_edge = Distance; }
|
|
double signal_offset() const { return m_signal_offset; }
|
|
void signal_offset(double Distance) { m_signal_offset = Distance; }
|
|
// look of the plates drawn for the signals: 0 plain, 1 toned, 2 aged
|
|
int signal_plate_look() const { return m_signal_plate_look; }
|
|
void signal_plate_look(int Look) { m_signal_plate_look = Look; }
|
|
|
|
// node bank: cards with the previews of the models or a list, and the size of the cards in pixels
|
|
bool nodebank_previews() const { return m_nodebank_previews; }
|
|
void nodebank_previews(bool Previews) { m_nodebank_previews = Previews; }
|
|
int nodebank_card() const { return m_nodebank_card; }
|
|
void nodebank_card(int Size) { m_nodebank_card = Size; }
|
|
|
|
// colours of the editor: 0 green, as the rest of the simulator; 1 amber
|
|
int palette() const { return m_palette; }
|
|
void palette(int Palette) { m_palette = Palette; }
|
|
|
|
// the tutorial (Help > Tutorial) opens by itself when an editor session starts
|
|
bool first_steps() const { return m_first_steps; }
|
|
void first_steps(bool Show) { m_first_steps = Show; }
|
|
// a scenery begun with no terrain is offered the terrain model as the first track is laid
|
|
bool terrain_offer() const { return m_terrain_offer; }
|
|
void terrain_offer(bool Offer) { m_terrain_offer = Offer; }
|
|
// a track laid and hidden in the ground is told of, with the way to fit the ground to it
|
|
bool terrain_buried_ask() const { return m_terrain_buried_ask; }
|
|
void terrain_buried_ask(bool Ask) { m_terrain_buried_ask = Ask; }
|
|
// the terrain of the terrain model made under the tracks as they're laid, around the cursor from the first point placed
|
|
bool terrain_while_laying() const { return m_terrain_while_laying; }
|
|
void terrain_while_laying(bool const Make) { m_terrain_while_laying = Make; }
|
|
// the terrain model in the terrain panel: the band along the tracks it's loaded in, m; the chunks along a side of the square
|
|
// made around the camera; the formation and the slopes made along the tracks; the terrain following the tracks edited; the
|
|
// terrain made from the model around the camera within the download area, in the background
|
|
struct terrain_model_settings
|
|
{
|
|
double band{300.0};
|
|
int around{4};
|
|
bool shape{true};
|
|
bool follow{true};
|
|
bool area{true};
|
|
};
|
|
terrain_model_settings &terrain_model() { return m_terrain_model; }
|
|
// the height offset of the terrain model to the tracks of the scenery, and whether it was fitted to them; false when none was stored
|
|
bool terrain_model_offset(std::string const &Scenery, double &Offset, bool &Fitted) const;
|
|
void terrain_model_offset(std::string const &Scenery, double Offset, bool Fitted);
|
|
bool track_tools_more() const { return m_track_tools_more; }
|
|
void track_tools_more(bool Show) { m_track_tools_more = Show; }
|
|
// the card of the tool in use folded to its title row, for all the tools of all the fields of work
|
|
bool tool_card_folded() const { return m_tool_card_folded; }
|
|
void tool_card_folded(bool const Folded) { m_tool_card_folded = Folded; }
|
|
// the ballast of the railway drawn in the top view
|
|
int top_tracks() const { return m_top_tracks; }
|
|
void top_tracks(int const Tracks) { m_top_tracks = Tracks; }
|
|
std::uint32_t top_rails() const { return m_top_rails; }
|
|
void top_rails(std::uint32_t const Colour) { m_top_rails = Colour; }
|
|
// the heights of the tracks laid on the ground: fitted to it as the tracks go onto the terrain, the points clicked on it with
|
|
// even grades between them, level
|
|
enum class lay_heights
|
|
{
|
|
fitted,
|
|
points,
|
|
level
|
|
};
|
|
lay_heights heights() const { return m_heights; }
|
|
void heights(lay_heights Heights) { m_heights = Heights; }
|
|
// the free camera: its speed, how many times faster Ctrl makes it, and in the top view as fast as the view is zoomed
|
|
struct camera_settings
|
|
{
|
|
double speed{1.0};
|
|
double fast{30.0};
|
|
bool zoomed{false}; // off as the editor was before: "As it was" means it
|
|
};
|
|
camera_settings &camera() { return m_camera; }
|
|
|
|
private:
|
|
movement_scheme m_movement{movement_scheme::wsad};
|
|
orthophoto_settings m_orthophoto;
|
|
camera_settings m_camera;
|
|
std::map<std::string, std::pair<double, double>> m_orthophoto_origins;
|
|
std::vector<wms_layer> m_wms_layers;
|
|
double m_platform_edge{1.725};
|
|
double m_signal_offset{2.25};
|
|
int m_signal_plate_look{1};
|
|
bool m_nodebank_previews{true};
|
|
int m_nodebank_card{96};
|
|
int m_palette{0};
|
|
bool m_first_steps{true};
|
|
bool m_terrain_offer{true};
|
|
bool m_terrain_buried_ask{true};
|
|
bool m_track_tools_more{false};
|
|
bool m_tool_card_folded{true};
|
|
bool m_terrain_while_laying{true};
|
|
terrain_model_settings m_terrain_model;
|
|
std::map<std::string, std::pair<double, bool>> m_terrain_model_offsets;
|
|
int m_top_tracks{0}; // the railway in the top view: whole, without the ballast, the rails alone
|
|
std::uint32_t m_top_rails{0xffff6e28}; // colour of the rails alone, as ImGui keeps it: ABGR
|
|
lay_heights m_heights{lay_heights::points};
|
|
};
|
|
|
|
// global editor settings instance
|
|
extern editorSettings EditorSettings;
|