diff --git a/generator/borders.hpp b/generator/borders.hpp index 8ad88c921f..c8aaf21881 100644 --- a/generator/borders.hpp +++ b/generator/borders.hpp @@ -1,5 +1,7 @@ #pragma once +#include "generator/feature_builder.hpp" + #include "storage/storage_defines.hpp" #include "coding/geometry_coding.hpp" @@ -71,9 +73,6 @@ public: }); } - // TODO(maksimandrianov): Remove it, after removing Polygonizer class. - mutable int32_t m_index = -1; - private: std::string m_name; RegionsContainer m_regions; @@ -101,12 +100,6 @@ public: }); } - // TODO(maksimandrianov): Remove it, after removing Polygonizer class. - void Add(CountryPolygons const & country, m2::RectD const & rect) - { - m_regionsTree.Add(country, rect); - } - CountryPolygons const & GetRegionByName(std::string const & name) const { ASSERT(HasRegionByName(name), ()); diff --git a/generator/coastlines_generator.hpp b/generator/coastlines_generator.hpp index ed84f564fa..249cf7622d 100644 --- a/generator/coastlines_generator.hpp +++ b/generator/coastlines_generator.hpp @@ -3,6 +3,7 @@ #include "generator/feature_merger.hpp" #include "indexer/cell_id.hpp" +#include "indexer/ftypes_matcher.hpp" #include "geometry/tree4d.hpp" #include "geometry/region2d.hpp" @@ -24,7 +25,7 @@ class CoastlineFeaturesGenerator uint32_t m_coastType; public: - CoastlineFeaturesGenerator(uint32_t coastType); + CoastlineFeaturesGenerator(uint32_t coastType = ftypes::IsCoastlineChecker::Instance().GetCoastlineType()); void AddRegionToTree(feature::FeatureBuilder const & fb); diff --git a/generator/feature_merger.cpp b/generator/feature_merger.cpp index 516e27665d..52ca3f40b1 100644 --- a/generator/feature_merger.cpp +++ b/generator/feature_merger.cpp @@ -10,20 +10,20 @@ using namespace feature; -MergedFeatureBuilder1::MergedFeatureBuilder1(FeatureBuilder const & fb) +MergedFeatureBuilder::MergedFeatureBuilder(FeatureBuilder const & fb) : FeatureBuilder(fb), m_isRound(false) { m_params.FinishAddingTypes(); } -void MergedFeatureBuilder1::SetRound() +void MergedFeatureBuilder::SetRound() { m_isRound = true; m_roundBounds[0] = m_roundBounds[1] = GetOuterGeometry(); } -void MergedFeatureBuilder1::AppendFeature(MergedFeatureBuilder1 const & fb, bool fromBegin, bool toBack) +void MergedFeatureBuilder::AppendFeature(MergedFeatureBuilder const & fb, bool fromBegin, bool toBack) { // Also merge Osm IDs for debugging m_osmIds.insert(m_osmIds.end(), fb.m_osmIds.begin(), fb.m_osmIds.end()); @@ -77,12 +77,12 @@ void MergedFeatureBuilder1::AppendFeature(MergedFeatureBuilder1 const & fb, bool } } -bool MergedFeatureBuilder1::EqualGeometry(MergedFeatureBuilder1 const & fb) const +bool MergedFeatureBuilder::EqualGeometry(MergedFeatureBuilder const & fb) const { return (GetOuterGeometry() == fb.GetOuterGeometry()); } -std::pair MergedFeatureBuilder1::GetKeyPoint(size_t i) const +std::pair MergedFeatureBuilder::GetKeyPoint(size_t i) const { // 1. check first rounds size_t sz = m_roundBounds[0].size(); @@ -106,12 +106,12 @@ std::pair MergedFeatureBuilder1::GetKeyPoint(size_t i) const return std::make_pair(LastPoint(), true); } -size_t MergedFeatureBuilder1::GetKeyPointsCount() const +size_t MergedFeatureBuilder::GetKeyPointsCount() const { return m_roundBounds[0].size() + m_roundBounds[1].size() + 2; } -double MergedFeatureBuilder1::GetPriority() const +double MergedFeatureBuilder::GetPriority() const { PointSeq const & poly = GetOuterGeometry(); @@ -134,10 +134,10 @@ FeatureMergeProcessor::FeatureMergeProcessor(uint32_t coordBits) void FeatureMergeProcessor::operator() (FeatureBuilder const & fb) { - this->operator() (new MergedFeatureBuilder1(fb)); + this->operator() (new MergedFeatureBuilder(fb)); } -void FeatureMergeProcessor::operator() (MergedFeatureBuilder1 * p) +void FeatureMergeProcessor::operator() (MergedFeatureBuilder * p) { key_t const k1 = get_key(p->FirstPoint()); key_t const k2 = get_key(p->LastPoint()); @@ -154,12 +154,12 @@ void FeatureMergeProcessor::operator() (MergedFeatureBuilder1 * p) } } -void FeatureMergeProcessor::Insert(m2::PointD const & pt, MergedFeatureBuilder1 * p) +void FeatureMergeProcessor::Insert(m2::PointD const & pt, MergedFeatureBuilder * p) { m_map[get_key(pt)].push_back(p); } -void FeatureMergeProcessor::Remove(key_t key, MergedFeatureBuilder1 const * p) +void FeatureMergeProcessor::Remove(key_t key, MergedFeatureBuilder const * p) { map_t::iterator i = m_map.find(key); if (i != m_map.end()) @@ -170,7 +170,7 @@ void FeatureMergeProcessor::Remove(key_t key, MergedFeatureBuilder1 const * p) } } -void FeatureMergeProcessor::Remove(MergedFeatureBuilder1 const * p) +void FeatureMergeProcessor::Remove(MergedFeatureBuilder const * p) { key_t const k1 = get_key(p->FirstPoint()); key_t const k2 = get_key(p->LastPoint()); @@ -193,7 +193,7 @@ void FeatureMergeProcessor::DoMerge(FeatureEmitterIFace & emitter) // Get any starting feature. vector_t & vS = m_map.begin()->second; CHECK(!vS.empty(), ()); - MergedFeatureBuilder1 * p = vS.front(); // may be 'back' is better + MergedFeatureBuilder * p = vS.front(); // may be 'back' is better // Remove next processing type. If it's a last type - remove from map. uint32_t type; @@ -205,7 +205,7 @@ void FeatureMergeProcessor::DoMerge(FeatureEmitterIFace & emitter) } // We will merge to the copy of p. - MergedFeatureBuilder1 curr(*p); + MergedFeatureBuilder curr(*p); curr.SetType(type); // Iterate through key points while merging. @@ -215,14 +215,14 @@ void FeatureMergeProcessor::DoMerge(FeatureEmitterIFace & emitter) std::pair const pt = curr.GetKeyPoint(ind++); map_t::const_iterator it = m_map.find(get_key(pt.first)); - MergedFeatureBuilder1 * pp = 0; + MergedFeatureBuilder * pp = 0; if (it != m_map.end()) { // Find best feature to continue. double bestPr = -1.0; for (size_t i = 0; i < it->second.size(); ++i) { - MergedFeatureBuilder1 * pTest = it->second[i]; + MergedFeatureBuilder * pTest = it->second[i]; if (pTest->HasType(type)) { double const pr = pTest->GetPriority(); @@ -306,9 +306,9 @@ void FeatureTypesProcessor::SetMappingTypes(char const * arr1[2], char const * a m_mapping[GetType(arr1, 2)] = GetType(arr2, 2); } -MergedFeatureBuilder1 * FeatureTypesProcessor::operator() (FeatureBuilder const & fb) +MergedFeatureBuilder * FeatureTypesProcessor::operator() (FeatureBuilder const & fb) { - MergedFeatureBuilder1 * p = new MergedFeatureBuilder1(fb); + MergedFeatureBuilder * p = new MergedFeatureBuilder(fb); p->ForEachChangeTypes(do_change_types(*this)); diff --git a/generator/feature_merger.hpp b/generator/feature_merger.hpp index c75abc7312..b29f98e5ff 100644 --- a/generator/feature_merger.hpp +++ b/generator/feature_merger.hpp @@ -9,24 +9,24 @@ #include /// Feature builder class that used while feature type processing and merging. -class MergedFeatureBuilder1 : public feature::FeatureBuilder +class MergedFeatureBuilder : public feature::FeatureBuilder { bool m_isRound; PointSeq m_roundBounds[2]; public: - MergedFeatureBuilder1() : m_isRound(false) {} - MergedFeatureBuilder1(feature::FeatureBuilder const & fb); + MergedFeatureBuilder() : m_isRound(false) {} + MergedFeatureBuilder(feature::FeatureBuilder const & fb); void SetRound(); bool IsRound() const { return m_isRound; } void ZeroParams() { m_params.MakeZero(); } - void AppendFeature(MergedFeatureBuilder1 const & fb, bool fromBegin, bool toBack); + void AppendFeature(MergedFeatureBuilder const & fb, bool fromBegin, bool toBack); - bool EqualGeometry(MergedFeatureBuilder1 const & fb) const; + bool EqualGeometry(MergedFeatureBuilder const & fb) const; inline bool NotEmpty() const { return !GetOuterGeometry().empty(); } @@ -60,20 +60,20 @@ class FeatureMergeProcessor typedef int64_t key_t; key_t get_key(m2::PointD const & p); - MergedFeatureBuilder1 m_last; + MergedFeatureBuilder m_last; - typedef std::vector vector_t; + typedef std::vector vector_t; typedef std::map map_t; map_t m_map; - void Insert(m2::PointD const & pt, MergedFeatureBuilder1 * p); + void Insert(m2::PointD const & pt, MergedFeatureBuilder * p); - void Remove(key_t key, MergedFeatureBuilder1 const * p); - inline void Remove1(m2::PointD const & pt, MergedFeatureBuilder1 const * p) + void Remove(key_t key, MergedFeatureBuilder const * p); + inline void Remove1(m2::PointD const & pt, MergedFeatureBuilder const * p) { Remove(get_key(pt), p); } - void Remove(MergedFeatureBuilder1 const * p); + void Remove(MergedFeatureBuilder const * p); uint8_t m_coordBits; @@ -81,7 +81,7 @@ public: FeatureMergeProcessor(uint32_t coordBits); void operator() (feature::FeatureBuilder const & fb); - void operator() (MergedFeatureBuilder1 * p); + void operator() (MergedFeatureBuilder * p); void DoMerge(FeatureEmitterIFace & emitter); }; @@ -115,7 +115,7 @@ public: m_dontNormalize.insert(GetType(arr, N)); } - MergedFeatureBuilder1 * operator() (feature::FeatureBuilder const & fb); + MergedFeatureBuilder * operator() (feature::FeatureBuilder const & fb); }; namespace feature