mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-20 23:23:30 +02:00
- editorNmt: squares of 500 m of the NMT at 1 m from the WCS service of geoportal.gov.pl, as GeoTIFF, fetched in the background, kept in editor/cache/nmt and sampled in the coordinates of the scenery, placed as its orthophoto is - the terrain panel's Terrain model section: Fit to the tracks moves the model up or down by the median of the differences to the formation of the tracks (Biała Podlaska, built at 0: -145.73 m, 0.28 m around it); Along the tracks and Around the camera make the chunks as the model comes in; each path gets its formation and slopes 1:1.5 as a modifier of the terrain, laid over each other into one corridor, bridges and tunnels keep the model; the orthophoto is turned on and laid onto the new ground - the http client of the orthophoto in editorHttp, shared; fill_from_nearest in editormodeshared.h - after the generator of Hirek (MaszynaTerrainGenerator): the WCS requests, the cache of squares, the corridor by envelopes - self-tests nmtfit, nmtmake, nmtwait
55 lines
1.5 KiB
C++
55 lines
1.5 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 <deque>
|
|
#include <vector>
|
|
|
|
#include "imgui/imgui.h"
|
|
#include "utilities/translation.h"
|
|
|
|
float constexpr kDragPixels{5.0f};
|
|
|
|
inline void item_tooltip(char const *Text)
|
|
{
|
|
if (ImGui::IsItemHovered())
|
|
ImGui::SetTooltip("%s", STR_C(Text));
|
|
}
|
|
|
|
// grid points without a height (or another value) take the one of the nearest point which has it (by steps along the grid)
|
|
template <typename Value_> inline void fill_from_nearest(std::vector<Value_> &Heights, std::vector<char> &Found, std::size_t const Side)
|
|
{
|
|
std::deque<std::size_t> queue;
|
|
for (std::size_t index = 0; index < Found.size(); ++index)
|
|
if (Found[index] != 0)
|
|
queue.push_back(index);
|
|
while (false == queue.empty())
|
|
{
|
|
auto const index = queue.front();
|
|
queue.pop_front();
|
|
auto const ix = index % Side, iz = index / Side;
|
|
auto const visit = [&](std::size_t const Next) {
|
|
if (Found[Next] != 0)
|
|
return;
|
|
Found[Next] = 1;
|
|
Heights[Next] = Heights[index];
|
|
queue.push_back(Next);
|
|
};
|
|
if (ix > 0)
|
|
visit(index - 1);
|
|
if (ix + 1 < Side)
|
|
visit(index + 1);
|
|
if (iz > 0)
|
|
visit(index - Side);
|
|
if (iz + 1 < Side)
|
|
visit(index + Side);
|
|
}
|
|
}
|