From 0176b63ae30f9cda5b7cb8cf8235a81cc4ed3282 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Thu, 4 Sep 2025 18:23:06 +0700 Subject: [PATCH] [generator] Reduce glaciers and deserts detalisation on World map Signed-off-by: Konstantin Pastbin --- generator/feature_sorter.cpp | 8 ++++++++ generator/world_map_generator.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 13f7ee080..7747cf427 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -11,6 +11,7 @@ #include "routing/routing_helpers.hpp" +#include "indexer/classificator.hpp" #include "indexer/dat_section_header.hpp" #include "indexer/feature_impl.hpp" #include "indexer/scales.hpp" @@ -157,6 +158,11 @@ public: Polygons const & polys = fb.GetGeometry(); bool const isCoast = fb.IsCoastCell(); + static uint32_t const desertType = classif().GetTypeByPath({"natural", "desert"}); + static uint32_t const glacierType = classif().GetTypeByPath({"natural", "glacier"}); + // Reduce detalisation of glaciers and deserts on World map. + bool const isLowDetail = !IsCountry() && isArea && (fb.HasType(desertType, 2) || fb.HasType(glacierType, 2)); + int const scalesStart = static_cast(m_header.GetScalesCount()) - 1; for (int i = scalesStart; i >= 0; --i) { @@ -176,6 +182,8 @@ public: if (i == 0) ++level; } + if (isLowDetail && (level <= scales::GetUpperWorldScale())) + --level; // Simplify and serialize geometry. // The same line simplification algo is used both for lines diff --git a/generator/world_map_generator.hpp b/generator/world_map_generator.hpp index 37d85285a..5f3fabcfa 100644 --- a/generator/world_map_generator.hpp +++ b/generator/world_map_generator.hpp @@ -176,6 +176,7 @@ public: case feature::GeomType::Area: { /// @todo Initial area threshold to push area objects into World.mwm + /// @todo(pastk) Apply an older lower detail threshold of 0.01 to glaciers, deserts and coastlines (islets) auto const & geometry = fb.GetOuterGeometry(); if (GetPolygonArea(geometry.begin(), geometry.end()) < 0.0025) return false;