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:
Diffstat (limited to 'coding/point_to_integer.hpp')
-rw-r--r--coding/point_to_integer.hpp48
1 files changed, 30 insertions, 18 deletions
diff --git a/coding/point_to_integer.hpp b/coding/point_to_integer.hpp
index afd46b90d6..923ab971d4 100644
--- a/coding/point_to_integer.hpp
+++ b/coding/point_to_integer.hpp
@@ -1,31 +1,43 @@
#pragma once
-#include "geometry/cellid.hpp"
+#include "coding/pointd_to_pointu.hpp"
+
+#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
+#include <cstdint>
#include <utility>
-#define POINT_COORD_BITS 30
+// All functions in this file are deprecated and are left
+// only for backward compatibility.
+//
+// Their intention was to store a point with unsigned 32-bit integer
+// coordinates to a signed or to an unsigned 64-bit integer by interleaving the
+// bits of the point's coordinates.
+//
+// A possible reason for interleaving is to lower the number of bytes
+// needed by the varint encoding, at least if the coordinates are of the
+// same order of magnitude. However, this is hard to justify:
+// 1. We have no reason to expect the coordinates to be of the same order.
+// 2. If you need to serialize a point, doing it separately
+// for each coordinate is almost always a better option.
+// 3. If you need to temporarily store the point as an uint,
+// you do not need the complexity of interleaving.
+//
+// Another possible reason to interleave bits of x and y arises
+// when implementing the Z-order curve but we have this
+// written elsewhere (see geometry/cellid.hpp).
-m2::PointU PointD2PointU(double x, double y, uint32_t coordBits);
-inline m2::PointU PointD2PointU(m2::PointD const & pt, uint32_t coordBits)
-{
- return PointD2PointU(pt.x, pt.y, coordBits);
-}
+int64_t PointToInt64Obsolete(double x, double y, uint32_t coordBits);
-m2::PointD PointU2PointD(m2::PointU const & p, uint32_t coordBits);
+int64_t PointToInt64Obsolete(m2::PointD const & pt, uint32_t coordBits);
-int64_t PointToInt64(double x, double y, uint32_t coordBits);
-inline int64_t PointToInt64(m2::PointD const & pt, uint32_t coordBits)
-{
- return PointToInt64(pt.x, pt.y, coordBits);
-}
+m2::PointD Int64ToPointObsolete(int64_t v, uint32_t coordBits);
-m2::PointD Int64ToPoint(int64_t v, uint32_t coordBits);
+std::pair<int64_t, int64_t> RectToInt64Obsolete(m2::RectD const & r, uint32_t coordBits);
-std::pair<int64_t, int64_t> RectToInt64(m2::RectD const & r, uint32_t coordBits);
-m2::RectD Int64ToRect(std::pair<int64_t, int64_t> const & p, uint32_t coordBits);
+m2::RectD Int64ToRectObsolete(std::pair<int64_t, int64_t> const & p, uint32_t coordBits);
-uint32_t DoubleToUint32(double x, double min, double max, uint32_t coordBits);
+uint64_t PointUToUint64Obsolete(m2::PointU const & pt);
-double Uint32ToDouble(uint32_t x, double min, double max, uint32_t coordBits);
+m2::PointU Uint64ToPointUObsolete(int64_t v);