diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt index 34bcb0a..1a14566 100644 --- a/generator/CMakeLists.txt +++ b/generator/CMakeLists.txt @@ -21,7 +21,6 @@ set( feature_emitter_iface.hpp feature_generator.cpp feature_generator.hpp - feature_helpers.cpp feature_helpers.hpp feature_maker.cpp feature_maker.hpp diff --git a/generator/feature_helpers.cpp b/generator/feature_helpers.cpp deleted file mode 100644 index db4e668..0000000 --- a/generator/feature_helpers.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "generator/feature_helpers.hpp" - -#include "generator/feature_builder.hpp" - -#include "coding/point_coding.hpp" - -#include "base/stl_helpers.hpp" - -#include - -using namespace std; - -namespace feature -{ -CalculateMidPoints::CalculateMidPoints() - : CalculateMidPoints(static_cast(GetMinDrawableScale)) -{ } - -CalculateMidPoints::CalculateMidPoints(MinDrawableScalePolicy const & minDrawableScalePolicy) - : m_minDrawableScalePolicy{minDrawableScalePolicy} -{ } - -void CalculateMidPoints::operator()(FeatureBuilder const & ft, uint64_t pos) -{ - // Reset state. - m_midLoc = m2::PointD::Zero();; - m_locCount = 0; - - ft.ForEachGeometryPoint(*this); - ASSERT_NOT_EQUAL(m_locCount, 0, ()); - m_midLoc = m_midLoc / m_locCount; - - uint64_t const pointAsInt64 = PointToInt64Obsolete(m_midLoc, m_coordBits); - int const minScale = m_minDrawableScalePolicy(ft.GetTypesHolder(), ft.GetLimitRect()); - - /// May be invisible if it's small area object with [0-9] scales. - /// @todo Probably, we need to keep that objects if 9 scale (as we do in 17 scale). - if (minScale != -1) - { - uint64_t const order = (static_cast(minScale) << 59) | (pointAsInt64 >> 5); - m_vec.push_back(make_pair(order, pos)); - } -} - -bool CalculateMidPoints::operator()(m2::PointD const & p) -{ - m_midLoc += p; - m_midAll += p; - ++m_locCount; - ++m_allCount; - return true; -} - -m2::PointD CalculateMidPoints::GetCenter() const -{ - if (m_allCount == 0) - return {}; - - return m_midAll / m_allCount; -} - -void CalculateMidPoints::Sort() -{ - sort(m_vec.begin(), m_vec.end(), base::LessBy(&CellAndOffset::first)); -} -} // namespace feature diff --git a/generator/feature_helpers.hpp b/generator/feature_helpers.hpp index 0fe9bb5..a038a80 100644 --- a/generator/feature_helpers.hpp +++ b/generator/feature_helpers.hpp @@ -22,35 +22,6 @@ namespace feature { -class FeatureBuilder; - -class CalculateMidPoints -{ -public: - using CellAndOffset = std::pair; - using MinDrawableScalePolicy = std::function; - - CalculateMidPoints(); - CalculateMidPoints(MinDrawableScalePolicy const & minDrawableScalePolicy); - - void operator()(FeatureBuilder const & ft, uint64_t pos); - bool operator()(m2::PointD const & p); - - m2::PointD GetCenter() const; - std::vector const & GetVector() const { return m_vec; } - - void Sort(); - -private: - m2::PointD m_midLoc; - m2::PointD m_midAll; - size_t m_locCount = 0; - size_t m_allCount = 0; - uint8_t m_coordBits = serial::GeometryCodingParams().GetCoordBits(); - MinDrawableScalePolicy m_minDrawableScalePolicy; - std::vector m_vec; -}; - template inline bool ArePointsEqual(Point const & p1, Point const & p2) {