diff --git a/generator/hierarchy.cpp b/generator/hierarchy.cpp index 70a234522e..060042a506 100644 --- a/generator/hierarchy.cpp +++ b/generator/hierarchy.cpp @@ -10,10 +10,12 @@ #include "geometry/mercator.hpp" #include "geometry/rect2d.hpp" +#include "base/assert.hpp" #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include +#include #include #include #include @@ -59,6 +61,7 @@ double CalculateOverlapPercentage(std::vector const & lhs, std::vector coll; boost::geometry::intersection(lhs, rhs, coll); auto const min = std::min(boost::geometry::area(lhs), boost::geometry::area(rhs)); + CHECK_GREATER(min, 0.0, (min)); auto const binOp = [](double x, BoostPolygon const & y) { return x + boost::geometry::area(y); }; auto const sum = std::accumulate(std::cbegin(coll), std::cend(coll), 0.0, binOp); return sum * 100 / min; @@ -99,7 +102,7 @@ bool HierarchyPlace::Contains(HierarchyPlace const & smaller) const return Contains(smaller.GetCenter()); return smaller.GetArea() <= GetArea() && - CalculateOverlapPercentage(m_polygon, smaller.m_polygon) > 80.0; + CalculateOverlapPercentage(m_polygon, smaller.m_polygon) > 80.0; } bool HierarchyPlace::Contains(m2::PointD const & point) const @@ -184,8 +187,7 @@ std::vector HierarchyBuilder::ReadFeatures( std::vector fbs; ForEachFromDatRawFormat( dataFilename, [&](FeatureBuilder const & fb, uint64_t /* currPos */) { - if (m_getMainType(fb.GetTypes()) != ftype::GetEmptyValue() && - !fb.GetOsmIds().empty() && + if (m_getMainType(fb.GetTypes()) != ftype::GetEmptyValue() && !fb.GetOsmIds().empty() && (fb.IsPoint() || fb.IsArea())) { fbs.emplace_back(fb);