diff options
-rw-r--r-- | generator/feature_generator.cpp | 8 | ||||
-rw-r--r-- | generator/feature_sorter.cpp | 15 | ||||
-rw-r--r-- | indexer/classificator.cpp | 6 | ||||
-rw-r--r-- | indexer/classificator.hpp | 2 | ||||
-rw-r--r-- | indexer/feature.hpp | 10 | ||||
-rw-r--r-- | indexer/feature_visibility.cpp | 9 |
6 files changed, 32 insertions, 18 deletions
diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp index 3517929a74..35fc1d91f3 100644 --- a/generator/feature_generator.cpp +++ b/generator/feature_generator.cpp @@ -275,10 +275,7 @@ class MainFeaturesEmitter public: MainFeaturesEmitter(GenerateInfo const & info) { - { - static char const * path[] = { "natural", "coastline" }; - m_coastType = classif().GetTypeByPath(vector<string>(path, path + 2)); - } + m_coastType = classif().GetCoastType(); m_srcCoastsFile = info.m_tmpDir + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix; @@ -294,7 +291,8 @@ public: } else { - // 6 - is cell level for oceans covering + // 4-10 - level range for cells + // 20000 - max points count per feature m_coasts.reset(new CoastlineFeaturesGenerator(m_coastType, 4, 10, 20000)); m_coastsHolder.reset(new FeaturesCollector(m_srcCoastsFile)); diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 5b78ec9833..355554fd11 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -373,11 +373,9 @@ namespace feature } }; - void SimplifyPoints(points_t const & in, points_t & out, int level, - FeatureBuilder2 const & fb) + void SimplifyPoints(points_t const & in, points_t & out, int level, bool isCoast) { - int64_t dummy; - if ((level >= scales::GetUpperWorldScale()) && fb.GetCoastCell(dummy)) + if (level >= scales::GetUpperWorldScale() && isCoast) { // Note! Do such special simplification only for upper world level and countries levels. // There is no need for this simplification in small world levels. @@ -429,9 +427,12 @@ namespace feature int const level = m_header.GetScale(i); if (fb.IsDrawableInRange(i > 0 ? m_header.GetScale(i-1) + 1 : 0, level)) { + int64_t dummy; + bool const isCoast = fb.GetCoastCell(dummy); + // simplify and serialize geometry points_t points; - SimplifyPoints(holder.GetSourcePoints(), points, level, fb); + SimplifyPoints(holder.GetSourcePoints(), points, level, isCoast); if (isLine) holder.AddPoints(points, i); @@ -439,7 +440,7 @@ namespace feature if (isArea && holder.NeedProcessTriangles()) { // simplify and serialize triangles - bool const good = IsGoodArea(points, level); + bool const good = isCoast || IsGoodArea(points, level); // At this point we don't need last point equal to first. points.pop_back(); @@ -460,7 +461,7 @@ namespace feature { simplified.push_back(points_t()); - SimplifyPoints(*iH, simplified.back(), level, fb); + SimplifyPoints(*iH, simplified.back(), level, isCoast); if (!IsGoodArea(simplified.back(), level)) simplified.pop_back(); diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index c65500d667..d3b91fe2b1 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -500,6 +500,12 @@ uint32_t Classificator::GetTypeByPath(vector<string> const & path) const return type; } +uint32_t Classificator::GetCoastType() const +{ + char const * path[] = { "natural", "coastline" }; + return GetTypeByPath(vector<string>(path, path + 2)); +} + void Classificator::ReadTypesMapping(string const & buffer) { m_i2t.Load(buffer); diff --git a/indexer/classificator.hpp b/indexer/classificator.hpp index 806b27c7e2..37e2c95c5d 100644 --- a/indexer/classificator.hpp +++ b/indexer/classificator.hpp @@ -226,6 +226,8 @@ public: uint32_t GetIndexForType(uint32_t t) const { return m_t2i.GetIndex(t); } uint32_t GetTypeForIndex(uint32_t i) const { return m_i2t.GetType(i); } + uint32_t GetCoastType() const; + // Iterate for possible objects types //template <class ToDo> void ForEachType(ToDo toDo) //{ diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 45c5099c95..2179a4be56 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -101,9 +101,15 @@ public: size_t m_size; GetTypesFn() : m_size(0) {} - void operator() (uint32_t t) + + inline void operator() (uint32_t t) { m_types[m_size++] = t; } + + inline bool Has(uint32_t t) const { - m_types[m_size++] = t; + for (int i = 0; i < m_size; ++i) + if (m_types[i] == t) + return true; + return false; } }; diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index d5a51b76c6..6d7b816f04 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -242,14 +242,15 @@ bool IsDrawableLike(vector<uint32_t> const & types, FeatureGeoType ft) bool IsDrawableForIndex(FeatureBase const & f, int level) { - if (f.GetFeatureType() == feature::GEOM_AREA) - if (!scales::IsGoodForLevel(level, f.GetLimitRect())) - return false; + Classificator const & c = classif(); + static uint32_t const coastType = c.GetCoastType(); FeatureBase::GetTypesFn types; f.ForEachTypeRef(types); - Classificator const & c = classif(); + if (f.GetFeatureType() == feature::GEOM_AREA && !types.Has(coastType)) + if (!scales::IsGoodForLevel(level, f.GetLimitRect())) + return false; IsDrawableChecker doCheck(level); for (size_t i = 0; i < types.m_size; ++i) |