mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
WIP [generator] Reduce detalisation of coastlines, glaciers and deserts
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -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,10 @@ 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"});
|
||||
bool const isLowDetail = (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)
|
||||
{
|
||||
@@ -171,10 +176,18 @@ public:
|
||||
/// @todo Probably, better to keep 3 zooms (skip trg0 with fallback to trg1)?
|
||||
if (isCoast)
|
||||
{
|
||||
// The adjustments make simplification zooms like {5, 6, 8, 10} instead of {3, 5, 7, 9}
|
||||
// pastk: make it {4, 6, 7, 9}
|
||||
//if (level <= scales::GetUpperWorldScale())
|
||||
// ++level;
|
||||
if (i == 0 || i == 1)
|
||||
++level;
|
||||
}
|
||||
if (!IsCountry() && isArea && isLowDetail)
|
||||
{
|
||||
// pastk: reduce detalisation of glaciers and deserts on World map
|
||||
if (level <= scales::GetUpperWorldScale())
|
||||
++level;
|
||||
if (i == 0)
|
||||
++level;
|
||||
--level;
|
||||
}
|
||||
|
||||
// Simplify and serialize geometry.
|
||||
|
||||
@@ -176,6 +176,7 @@ public:
|
||||
case feature::GeomType::Area:
|
||||
{
|
||||
/// @todo Initial area threshold to push area objects into World.mwm
|
||||
// TODO discard small glaciers and deserts?
|
||||
auto const & geometry = fb.GetOuterGeometry();
|
||||
if (GetPolygonArea(geometry.begin(), geometry.end()) < 0.0025)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user