diff options
author | Maxim Pimenov <m@maps.me> | 2018-04-09 14:27:33 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2018-04-10 14:31:32 +0300 |
commit | 8651b85289754a09b662e0412b5cae172284c3be (patch) | |
tree | 08d176fad5682b2b54397c3066b5cc553846b4c5 /transit | |
parent | 9666660b84740e6bbe0585e59fccd1347c4c793f (diff) |
[coding] [geometry] Deprecated PointToInt.
For some reason we have been using bitwise merge to store
a pair of 32-bit unsigned integer coordinates. Since the
width of the coordinates is fixed and storage in general
has nothing to do with the Z-order curve where bitwise
merge is appropriate, this commit marks this method of
storage as obsolete (and effectively deprecated).
The functions to convert between PointD and PointU are
still serviceable. Their usage is slightly refactored.
Diffstat (limited to 'transit')
-rw-r--r-- | transit/transit_serdes.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/transit/transit_serdes.hpp b/transit/transit_serdes.hpp index faeaf77ae4..45d54f9d00 100644 --- a/transit/transit_serdes.hpp +++ b/transit/transit_serdes.hpp @@ -7,6 +7,7 @@ #include "geometry/point2d.hpp" #include "coding/point_to_integer.hpp" +#include "coding/pointd_to_pointu.hpp" #include "coding/read_write_utils.hpp" #include "coding/reader.hpp" #include "coding/varint.hpp" @@ -80,7 +81,7 @@ public: void operator()(m2::PointD const & p, char const * /* name */ = nullptr) { - WriteVarInt(m_sink, PointToInt64(p, POINT_COORD_BITS)); + WriteVarInt(m_sink, PointToInt64Obsolete(p, POINT_COORD_BITS)); } void operator()(std::vector<m2::PointD> const & vs, char const * /* name */ = nullptr) @@ -90,7 +91,7 @@ public: m2::PointU lastEncodedPoint; for (auto const & p : vs) { - m2::PointU const pointU = PointD2PointU(p, POINT_COORD_BITS); + m2::PointU const pointU = PointDToPointU(p, POINT_COORD_BITS); WriteVarUint(m_sink, EncodeDelta(pointU, lastEncodedPoint)); lastEncodedPoint = pointU; } @@ -212,7 +213,7 @@ public: void operator()(m2::PointD & p, char const * /* name */ = nullptr) { - p = Int64ToPoint(ReadVarInt<int64_t, Source>(m_source), POINT_COORD_BITS); + p = Int64ToPointObsolete(ReadVarInt<int64_t, Source>(m_source), POINT_COORD_BITS); } void operator()(Edge::WrappedEdgeId & id, char const * /* name */ = nullptr) @@ -290,7 +291,7 @@ public: for (auto & p : vs) { m2::PointU const pointU = DecodeDelta(ReadVarUint<uint64_t, Source>(m_source), lastDecodedPoint); - p = PointU2PointD(pointU, POINT_COORD_BITS); + p = PointUToPointD(pointU, POINT_COORD_BITS); lastDecodedPoint = pointU; } } |