mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-04 14:55:52 +01:00
feat(editor): the download area drawn on the topo map: a polygon is the boundary of what the editor downloads, the orthophoto and the terrain model alike. Drawn from the settings of the orthophoto (Download area, Draw on the map, the top view on): a click puts a point, a point dragged moves, Shift+click removes it, Backspace takes the last one back, Enter closes the area, Esc gives up; it's kept in the scenery as //$a lines in PUWG 1992, so it stays on the ground when the origin moves. Inside it everything the settings ask for, the standard imagery, the 4K one where it's ticked and covers the place, the squares of the terrain model where the scenery has its terrain, goes to the disk cache in the background, nothing decoded nor uploaded, only while no tile around the camera waits and not while the scenery is driven, with its progress, Pause and Retry under it; outside it nothing is asked for, around the camera, along the tracks or ahead of the laying, nor shown. The workers of the orthophoto are 8, at most 3 of them on the tiles around the camera, each holding an image decoded, the rest downloading the area. The 4K tiles: an image the tile no longer wants once it comes, as a 4K one asked for before the camera moved on, isn't uploaded (the 64 MB and the mipmaps of it), nor decoded where a newer job of the tile waits; no two jobs of one tile run at once; a standard tile coming blank twice is remembered by a .blank file, not downloaded again on each return; a 4K tile is uploaded only in a frame with no other upload. Selftests orthoarea, orthostats, orthohires, orthoareapause; unit tests of the tiles a triangle, a concave polygon, a thin band and a polygon about a corner touch (geometry::squares_in, square_touches)
This commit is contained in:
@@ -59,6 +59,18 @@ class editor_nmt
|
||||
void clear();
|
||||
// whether this build can fetch from the service at all
|
||||
static bool can_download();
|
||||
// the squares touching the polygon of PUWG 1992 (easting, northing) put into the disk cache in the background, while no
|
||||
// square is asked for; none of them kept in the memory. Empty: none
|
||||
void prefetch(std::vector<glm::dvec2> const &Polygon);
|
||||
void prefetch_paused(bool const Paused);
|
||||
// of the squares of the polygon: in the disk cache, all of them, failed
|
||||
struct prefetch_state
|
||||
{
|
||||
int cached{0};
|
||||
int total{0};
|
||||
int failed{0};
|
||||
};
|
||||
prefetch_state prefetched() const;
|
||||
|
||||
// side of a square of the grid, m
|
||||
static double constexpr square_size{500.0};
|
||||
@@ -93,4 +105,13 @@ class editor_nmt
|
||||
double m_north{0.0};
|
||||
double m_east{0.0};
|
||||
bool m_stop{false};
|
||||
// the squares of the download area for the disk cache
|
||||
std::vector<key> m_prefetch;
|
||||
std::size_t m_prefetch_next{0};
|
||||
std::set<key> m_prefetch_cached;
|
||||
std::set<key> m_prefetch_failed;
|
||||
std::uint32_t m_prefetch_generation{0};
|
||||
bool m_prefetch_paused{false};
|
||||
void start_workers(); // under the lock
|
||||
std::string file_of(key const &Key) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user