Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2017-10-23 17:31:36 +0300
committerIlya Zverev <ilya@zverev.info>2017-10-24 17:01:06 +0300
commit32808283c7abab91684d14c7f7c6a7ab874ab446 (patch)
tree2f8a32d73f0a2c2b8e7841ef3bdedf5905c2771a /indexer/cities_boundaries_serdes.hpp
parent1453a18f1bbea5450c4b270fcb3075a7db1cb979 (diff)
Review fixes.
Diffstat (limited to 'indexer/cities_boundaries_serdes.hpp')
-rw-r--r--indexer/cities_boundaries_serdes.hpp45
1 files changed, 9 insertions, 36 deletions
diff --git a/indexer/cities_boundaries_serdes.hpp b/indexer/cities_boundaries_serdes.hpp
index 5c9d72a1d0..2525ce7a1f 100644
--- a/indexer/cities_boundaries_serdes.hpp
+++ b/indexer/cities_boundaries_serdes.hpp
@@ -86,30 +86,11 @@ public:
ASSERT_EQUAL(ps.size(), 4, ());
- size_t bestCurr = ps.size();
- double bestLength = -1;
- for (size_t curr = 0; curr < ps.size(); ++curr)
- {
- size_t const next = (curr + 1) % ps.size();
-
- auto const length = ps[curr].Length(ps[next]);
- if (length > bestLength)
- {
- bestCurr = curr;
- bestLength = length;
- }
- }
-
- CHECK(bestCurr != ps.size(), ());
- std::rotate(ps.begin(), ps.begin() + bestCurr, ps.end());
-
auto const us = ToU(ps);
(*this)(us[0]);
EncodeDelta(us[0], us[1]);
-
- uint64_t const width = us[3].Length(us[0]);
- WriteVarUint(m_sink, width);
+ EncodeDelta(us[0], us[3]);
}
void operator()(m2::DiamondBox const & dbox)
@@ -246,24 +227,16 @@ public:
void operator()(m2::CalipersBox & cbox)
{
- m2::PointU pivot;
- (*this)(pivot);
-
- std::vector<m2::PointU> points(4);
- points[0] = pivot;
- points[1] = DecodeDelta(pivot);
-
- auto const width = ReadVarUint<uint64_t>(m_source);
-
- auto r01 = m2::PointD(points[1] - points[0]);
- if (!r01.IsAlmostZero())
- r01 = r01.Normalize();
- auto const r21 = r01.Ort() * width;
+ std::vector<m2::PointU> us(4);
+ (*this)(us[0]);
+ us[1] = DecodeDelta(us[0]);
+ us[3] = DecodeDelta(us[0]);
- points[2] = points[1] + r21;
- points[3] = points[0] + r21;
+ auto ps = FromU(us);
+ auto const dp = ps[3] - ps[0];
+ ps[2] = ps[1] + dp;
- cbox = m2::CalipersBox(FromU(points));
+ cbox = m2::CalipersBox(ps);
}
void operator()(m2::DiamondBox & dbox)