[generator] Reduce glaciers and deserts detalisation on World map

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-09-04 18:23:06 +07:00
parent 9e38cff708
commit 0176b63ae3
2 changed files with 9 additions and 0 deletions

View File

@@ -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<int>(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

View File

@@ -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;