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:
-rw-r--r--coding/CMakeLists.txt5
-rw-r--r--coding/coding_tests/CMakeLists.txt15
-rw-r--r--coding/coding_tests/point_to_integer_test.cpp92
-rw-r--r--coding/coding_tests/pointd_to_pointu_tests.cpp50
-rw-r--r--coding/point_to_integer.cpp77
-rw-r--r--coding/point_to_integer.hpp48
-rw-r--r--coding/pointd_to_pointu.cpp61
-rw-r--r--coding/pointd_to_pointu.hpp17
-rw-r--r--coding/traffic.hpp2
-rw-r--r--drape_frontend/apply_feature_functors.hpp2
-rw-r--r--generator/coastlines_generator.cpp7
-rw-r--r--generator/feature_helpers.cpp4
-rw-r--r--generator/feature_helpers.hpp2
-rw-r--r--generator/feature_merger.cpp2
-rw-r--r--generator/generator_tests/coasts_test.cpp8
-rw-r--r--generator/generator_tests/feature_merger_test.cpp2
-rw-r--r--generator/generator_tests/triangles_tree_coding_test.cpp8
-rw-r--r--generator/geometry_holder.hpp2
-rw-r--r--generator/routing_index_generator.cpp7
-rw-r--r--generator/world_map_generator.hpp6
-rw-r--r--geometry/CMakeLists.txt1
-rw-r--r--geometry/geometry_tests/CMakeLists.txt1
-rw-r--r--geometry/geometry_tests/pointu_to_uint64_test.cpp28
-rw-r--r--geometry/pointu_to_uint64.hpp24
-rw-r--r--indexer/cell_id.hpp2
-rw-r--r--indexer/centers_table.cpp6
-rw-r--r--indexer/cities_boundaries_serdes.hpp9
-rw-r--r--indexer/coding_params.cpp14
-rw-r--r--indexer/coding_params.hpp4
-rw-r--r--indexer/data_header.cpp5
-rw-r--r--indexer/feature_covering.hpp3
-rw-r--r--indexer/feature_loader.cpp2
-rw-r--r--indexer/geometry_serialization.cpp10
-rw-r--r--indexer/geometry_serialization.hpp8
-rw-r--r--indexer/indexer_tests/geometry_coding_test.cpp37
-rw-r--r--indexer/indexer_tests/polyline_point_to_int64_test.cpp9
-rw-r--r--kml/visitors.hpp9
-rw-r--r--local_ads/statistics.cpp10
-rw-r--r--search/search_trie.hpp5
-rw-r--r--storage/country_polygon.hpp5
-rw-r--r--transit/transit_serdes.hpp9
-rw-r--r--ugc/serdes.hpp1
-rw-r--r--xcode/coding/coding.xcodeproj/project.pbxproj24
-rw-r--r--xcode/geometry/geometry.xcodeproj/project.pbxproj24
44 files changed, 370 insertions, 297 deletions
diff --git a/coding/CMakeLists.txt b/coding/CMakeLists.txt
index 50515fc1dc..f27d92d48d 100644
--- a/coding/CMakeLists.txt
+++ b/coding/CMakeLists.txt
@@ -11,8 +11,7 @@ include_directories(
set(
SRC
- ${OMIM_ROOT}/3party/expat/expat_impl.h
-
+ ${OMIM_ROOT}/3party/expat/expat_impl.h
base64.cpp
base64.hpp
bit_streams.hpp
@@ -58,6 +57,8 @@ set(
parse_xml.hpp
point_to_integer.cpp
point_to_integer.hpp
+ pointd_to_pointu.cpp
+ pointd_to_pointu.hpp
polymorph_reader.hpp
read_write_utils.hpp
reader.cpp
diff --git a/coding/coding_tests/CMakeLists.txt b/coding/coding_tests/CMakeLists.txt
index 39d629b7db..8e73fe4056 100644
--- a/coding/coding_tests/CMakeLists.txt
+++ b/coding/coding_tests/CMakeLists.txt
@@ -25,6 +25,7 @@ set(
multilang_utf8_string_test.cpp
png_decoder_test.cpp
point_to_integer_test.cpp
+ pointd_to_pointu_tests.cpp
reader_cache_test.cpp
reader_test.cpp
reader_test.hpp
@@ -48,4 +49,16 @@ set(
omim_add_test(${PROJECT_NAME} ${SRC})
-omim_link_libraries(${PROJECT_NAME} platform_tests_support platform coding base geometry minizip succinct stats_client ${Qt5Widgets_LIBRARIES} ${LIBZ})
+omim_link_libraries(
+ ${PROJECT_NAME}
+ platform_tests_support
+ platform
+ coding
+ base
+ geometry
+ minizip
+ succinct
+ stats_client
+ ${Qt5Widgets_LIBRARIES}
+ ${LIBZ}
+)
diff --git a/coding/coding_tests/point_to_integer_test.cpp b/coding/coding_tests/point_to_integer_test.cpp
index 6b871818b4..d7322532d7 100644
--- a/coding/coding_tests/point_to_integer_test.cpp
+++ b/coding/coding_tests/point_to_integer_test.cpp
@@ -1,22 +1,25 @@
#include "testing/testing.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "geometry/mercator.hpp"
#include "base/logging.hpp"
-#include "std/cmath.hpp"
-#include "std/utility.hpp"
+#include <cmath>
+
+using namespace std;
namespace
{
-double const g_eps = MercatorBounds::GetCellID2PointAbsEpsilon();
-uint32_t const g_coordBits = POINT_COORD_BITS;
+double const kEps = MercatorBounds::GetCellID2PointAbsEpsilon();
+uint32_t const kCoordBits = POINT_COORD_BITS;
+uint32_t const kBig = uint32_t{1} << 30;
void CheckEqualPoints(m2::PointD const & p1, m2::PointD const & p2)
{
- TEST(p1.EqualDxDy(p2, g_eps), (p1, p2));
+ TEST(p1.EqualDxDy(p2, kEps), (p1, p2));
TEST_GREATER_OR_EQUAL(p1.x, -180.0, ());
TEST_GREATER_OR_EQUAL(p1.y, -180.0, ());
@@ -28,34 +31,37 @@ void CheckEqualPoints(m2::PointD const & p1, m2::PointD const & p2)
TEST_LESS_OR_EQUAL(p2.x, 180.0, ());
TEST_LESS_OR_EQUAL(p2.y, 180.0, ());
}
-}
+} // namespace
-UNIT_TEST(PointToInt64_Smoke)
+UNIT_TEST(PointToInt64Obsolete_Smoke)
{
m2::PointD const arr[] = {{1.25, 1.3}, {180, 90}, {-180, -90}, {0, 0}};
for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
- CheckEqualPoints(arr[i], Int64ToPoint(PointToInt64(arr[i], g_coordBits), g_coordBits));
+ CheckEqualPoints(arr[i],
+ Int64ToPointObsolete(PointToInt64Obsolete(arr[i], kCoordBits), kCoordBits));
}
-UNIT_TEST(PointToInt64_Grid)
+UNIT_TEST(PointToInt64Obsolete_Grid)
{
int const delta = 5;
for (int ix = -180; ix <= 180; ix += delta)
+ {
for (int iy = -180; iy <= 180; iy += delta)
{
m2::PointD const pt(ix, iy);
- int64_t const id = PointToInt64(pt, g_coordBits);
- m2::PointD const pt1 = Int64ToPoint(id, g_coordBits);
+ int64_t const id = PointToInt64Obsolete(pt, kCoordBits);
+ m2::PointD const pt1 = Int64ToPointObsolete(id, kCoordBits);
CheckEqualPoints(pt, pt1);
- int64_t const id1 = PointToInt64(pt1, g_coordBits);
+ int64_t const id1 = PointToInt64Obsolete(pt1, kCoordBits);
TEST_EQUAL(id, id1, (pt, pt1));
}
+ }
}
-UNIT_TEST(PointToInt64_Bounds)
+UNIT_TEST(PointToInt64Obsolete_Bounds)
{
double const arrEps[] = {-1.0E-2, -1.0E-3, -1.0E-4, 0, 1.0E-4, 1.0E-3, 1.0E-2};
@@ -63,50 +69,44 @@ UNIT_TEST(PointToInt64_Bounds)
{-90, -90}, {-90, 90}, {90, 90}, {90, -90}};
for (size_t iP = 0; iP < ARRAY_SIZE(arrPt); ++iP)
+ {
for (size_t iX = 0; iX < ARRAY_SIZE(arrEps); ++iX)
+ {
for (size_t iY = 0; iY < ARRAY_SIZE(arrEps); ++iY)
{
m2::PointD const pt(arrPt[iP].x + arrEps[iX], arrPt[iP].y + arrEps[iY]);
- m2::PointD const pt1 = Int64ToPoint(PointToInt64(pt, g_coordBits), g_coordBits);
+ m2::PointD const pt1 =
+ Int64ToPointObsolete(PointToInt64Obsolete(pt, kCoordBits), kCoordBits);
- TEST(fabs(pt.x - pt1.x) <= (fabs(arrEps[iX]) + g_eps) &&
- fabs(pt.y - pt1.y) <= (fabs(arrEps[iY]) + g_eps),
+ TEST(fabs(pt.x - pt1.x) <= (fabs(arrEps[iX]) + kEps) &&
+ fabs(pt.y - pt1.y) <= (fabs(arrEps[iY]) + kEps),
(pt, pt1));
}
+ }
+ }
}
-UNIT_TEST(PointD2PointU_Epsilons)
+UNIT_TEST(PointUToUint64Obsolete_0)
{
- m2::PointD const arrPt[] = {{-180, -180}, {-180, 180}, {180, 180}, {180, -180}};
- m2::PointD const arrD[] = {{1, 1}, {1, -1}, {-1, -1}, {-1, 1}};
- size_t const count = ARRAY_SIZE(arrPt);
-
- /*
- double eps = 1.0;
- for (; true; eps = eps / 10.0)
- {
- size_t i = 0;
- for (; i < count; ++i)
- {
- m2::PointU p = PointD2PointU(arrPt[i].x, arrPt[i].y, g_coordBits);
- m2::PointU p1 = PointD2PointU(arrPt[i].x + arrD[i].x * eps,
- arrPt[i].y + arrD[i].y * eps,
- g_coordBits);
-
- if (p != p1) break;
- }
- if (i == count) break;
- }
+ TEST_EQUAL(0, PointUToUint64Obsolete(m2::PointU(0, 0)), ());
+ TEST_EQUAL(m2::PointU(0, 0), Uint64ToPointUObsolete(0), ());
+}
- LOG(LINFO, ("Epsilon = ", eps));
- */
+UNIT_TEST(PointUToUint64Obsolete_Interlaced)
+{
+ TEST_EQUAL(0xAAAAAAAAAAAAAAAAULL, PointUToUint64Obsolete(m2::PointU(0, 0xFFFFFFFF)), ());
+ TEST_EQUAL(0x5555555555555555ULL, PointUToUint64Obsolete(m2::PointU(0xFFFFFFFF, 0)), ());
+ TEST_EQUAL(0xAAAAAAAAAAAAAAA8ULL, PointUToUint64Obsolete(m2::PointU(0, 0xFFFFFFFE)), ());
+ TEST_EQUAL(0x5555555555555554ULL, PointUToUint64Obsolete(m2::PointU(0xFFFFFFFE, 0)), ());
+}
- for (size_t i = 0; i < count; ++i)
- {
- m2::PointU const p1 = PointD2PointU(arrPt[i].x, arrPt[i].y, g_coordBits);
- m2::PointU const p2(p1.x + arrD[i].x, p1.y + arrD[i].y);
- m2::PointD const p3 = PointU2PointD(p2, g_coordBits);
+UNIT_TEST(PointUToUint64Obsolete_1bit)
+{
+ TEST_EQUAL(2, PointUToUint64Obsolete(m2::PointU(0, 1)), ());
+ TEST_EQUAL(m2::PointU(0, 1), Uint64ToPointUObsolete(2), ());
+ TEST_EQUAL(1, PointUToUint64Obsolete(m2::PointU(1, 0)), ());
+ TEST_EQUAL(m2::PointU(1, 0), Uint64ToPointUObsolete(1), ());
- LOG(LINFO, ("Dx = ", p3.x - arrPt[i].x, "Dy = ", p3.y - arrPt[i].y));
- }
+ TEST_EQUAL(3ULL << 60, PointUToUint64Obsolete(m2::PointU(kBig, kBig)), ());
+ TEST_EQUAL((1ULL << 60) - 1, PointUToUint64Obsolete(m2::PointU(kBig - 1, kBig - 1)), ());
}
diff --git a/coding/coding_tests/pointd_to_pointu_tests.cpp b/coding/coding_tests/pointd_to_pointu_tests.cpp
new file mode 100644
index 0000000000..6b5c286d98
--- /dev/null
+++ b/coding/coding_tests/pointd_to_pointu_tests.cpp
@@ -0,0 +1,50 @@
+#include "testing/testing.hpp"
+
+#include "coding/pointd_to_pointu.hpp"
+
+#include "base/logging.hpp"
+
+#include <cmath>
+
+using namespace std;
+
+namespace
+{
+uint32_t const kCoordBits = POINT_COORD_BITS;
+} // namespace
+
+UNIT_TEST(PointDToPointU_Epsilons)
+{
+ m2::PointD const arrPt[] = {{-180, -180}, {-180, 180}, {180, 180}, {180, -180}};
+ m2::PointD const arrD[] = {{1, 1}, {1, -1}, {-1, -1}, {-1, 1}};
+ size_t const count = ARRAY_SIZE(arrPt);
+
+ /*
+ double eps = 1.0;
+ for (; true; eps = eps / 10.0)
+ {
+ size_t i = 0;
+ for (; i < count; ++i)
+ {
+ m2::PointU p = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits);
+ m2::PointU p1 = PointDToPointU(arrPt[i].x + arrD[i].x * eps,
+ arrPt[i].y + arrD[i].y * eps,
+ kCoordBits);
+
+ if (p != p1) break;
+ }
+ if (i == count) break;
+ }
+
+ LOG(LINFO, ("Epsilon = ", eps));
+ */
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ m2::PointU const p1 = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits);
+ m2::PointU const p2(p1.x + arrD[i].x, p1.y + arrD[i].y);
+ m2::PointD const p3 = PointUToPointD(p2, kCoordBits);
+
+ LOG(LINFO, ("Dx = ", p3.x - arrPt[i].x, "Dy = ", p3.y - arrPt[i].y));
+ }
+}
diff --git a/coding/point_to_integer.cpp b/coding/point_to_integer.cpp
index 002cf98b3d..b477b8d3ec 100644
--- a/coding/point_to_integer.cpp
+++ b/coding/point_to_integer.cpp
@@ -1,87 +1,52 @@
#include "coding/point_to_integer.hpp"
-#include "geometry/mercator.hpp"
-#include "geometry/pointu_to_uint64.hpp"
-
+#include "base/assert.hpp"
#include "base/bits.hpp"
-#include <algorithm>
-
-namespace
+int64_t PointToInt64Obsolete(double x, double y, uint32_t coordBits)
{
-inline double CoordSize(uint32_t coordBits) { return (1 << coordBits) - 1; }
-}
-
-m2::PointU PointD2PointU(double x, double y, uint32_t coordBits)
-{
- x = my::clamp(x, MercatorBounds::minX, MercatorBounds::maxX);
- y = my::clamp(y, MercatorBounds::minY, MercatorBounds::maxY);
-
- uint32_t const ix = static_cast<uint32_t>(0.5 +
- (x - MercatorBounds::minX) /
- (MercatorBounds::maxX - MercatorBounds::minX) *
- CoordSize(coordBits));
- uint32_t const iy = static_cast<uint32_t>(0.5 +
- (y - MercatorBounds::minY) /
- (MercatorBounds::maxY - MercatorBounds::minY) *
- CoordSize(coordBits));
-
- ASSERT_LESS_OR_EQUAL(ix, CoordSize(coordBits), ());
- ASSERT_LESS_OR_EQUAL(iy, CoordSize(coordBits), ());
-
- return m2::PointU(ix, iy);
-}
-
-int64_t PointToInt64(double x, double y, uint32_t coordBits)
-{
- int64_t const res = static_cast<int64_t>(m2::PointUToUint64(PointD2PointU(x, y, coordBits)));
+ int64_t const res = static_cast<int64_t>(PointUToUint64Obsolete(PointDToPointU(x, y, coordBits)));
ASSERT_LESS_OR_EQUAL(res, 3ULL << 2 * POINT_COORD_BITS, ());
ASSERT_GREATER_OR_EQUAL(res, 0, ("Highest bits of (ix, iy) are not used, so res should be > 0."));
return res;
}
-m2::PointD PointU2PointD(m2::PointU const & pt, uint32_t coordBits)
+int64_t PointToInt64Obsolete(m2::PointD const & pt, uint32_t coordBits)
{
- return m2::PointD(static_cast<double>(pt.x) * (MercatorBounds::maxX - MercatorBounds::minX) /
- CoordSize(coordBits) +
- MercatorBounds::minX,
- static_cast<double>(pt.y) * (MercatorBounds::maxY - MercatorBounds::minY) /
- CoordSize(coordBits) +
- MercatorBounds::minY);
+ return PointToInt64Obsolete(pt.x, pt.y, coordBits);
}
-m2::PointD Int64ToPoint(int64_t v, uint32_t coordBits)
+m2::PointD Int64ToPointObsolete(int64_t v, uint32_t coordBits)
{
ASSERT_LESS_OR_EQUAL(v, 3ULL << 2 * POINT_COORD_BITS, ());
- return PointU2PointD(m2::Uint64ToPointU(static_cast<uint64_t>(v)), coordBits);
+ return PointUToPointD(Uint64ToPointUObsolete(static_cast<uint64_t>(v)), coordBits);
}
-std::pair<int64_t, int64_t> RectToInt64(m2::RectD const & r, uint32_t coordBits)
+std::pair<int64_t, int64_t> RectToInt64Obsolete(m2::RectD const & r, uint32_t coordBits)
{
- int64_t const p1 = PointToInt64(r.minX(), r.minY(), coordBits);
- int64_t const p2 = PointToInt64(r.maxX(), r.maxY(), coordBits);
+ int64_t const p1 = PointToInt64Obsolete(r.minX(), r.minY(), coordBits);
+ int64_t const p2 = PointToInt64Obsolete(r.maxX(), r.maxY(), coordBits);
return std::make_pair(p1, p2);
}
-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)
{
- m2::PointD const pt1 = Int64ToPoint(p.first, coordBits);
- m2::PointD const pt2 = Int64ToPoint(p.second, coordBits);
+ m2::PointD const pt1 = Int64ToPointObsolete(p.first, coordBits);
+ m2::PointD const pt2 = Int64ToPointObsolete(p.second, coordBits);
return m2::RectD(pt1, pt2);
}
-uint32_t DoubleToUint32(double x, double min, double max, uint32_t coordBits)
+uint64_t PointUToUint64Obsolete(m2::PointU const & pt)
{
- ASSERT_GREATER_OR_EQUAL(coordBits, 1, ());
- ASSERT_LESS_OR_EQUAL(coordBits, 32, ());
- x = my::clamp(x, min, max);
- return static_cast<uint32_t>(0.5 + (x - min) / (max - min) * bits::GetFullMask(static_cast<uint8_t>(coordBits)));
+ uint64_t const res = bits::BitwiseMerge(pt.x, pt.y);
+ ASSERT_EQUAL(pt, Uint64ToPointUObsolete(res), ());
+ return res;
}
-double Uint32ToDouble(uint32_t x, double min, double max, uint32_t coordBits)
+m2::PointU Uint64ToPointUObsolete(int64_t v)
{
- ASSERT_GREATER_OR_EQUAL(coordBits, 1, ());
- ASSERT_LESS_OR_EQUAL(coordBits, 32, ());
- return min + static_cast<double>(x) * (max - min) / bits::GetFullMask(static_cast<uint8_t>(coordBits));
+ m2::PointU res;
+ bits::BitwiseSplit(v, res.x, res.y);
+ return res;
}
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);
diff --git a/coding/pointd_to_pointu.cpp b/coding/pointd_to_pointu.cpp
new file mode 100644
index 0000000000..6cc75da59c
--- /dev/null
+++ b/coding/pointd_to_pointu.cpp
@@ -0,0 +1,61 @@
+#include "coding/pointd_to_pointu.hpp"
+
+#include "geometry/mercator.hpp"
+
+#include "base/bits.hpp"
+#include "base/math.hpp"
+
+namespace
+{
+double CoordSize(uint32_t coordBits) { return (1 << coordBits) - 1; }
+} // namespace
+
+uint32_t DoubleToUint32(double x, double min, double max, uint32_t coordBits)
+{
+ ASSERT_GREATER_OR_EQUAL(coordBits, 1, ());
+ ASSERT_LESS_OR_EQUAL(coordBits, 32, ());
+ x = my::clamp(x, min, max);
+ return static_cast<uint32_t>(0.5 + (x - min) / (max - min) * bits::GetFullMask(static_cast<uint8_t>(coordBits)));
+}
+
+double Uint32ToDouble(uint32_t x, double min, double max, uint32_t coordBits)
+{
+ ASSERT_GREATER_OR_EQUAL(coordBits, 1, ());
+ ASSERT_LESS_OR_EQUAL(coordBits, 32, ());
+ return min + static_cast<double>(x) * (max - min) / bits::GetFullMask(static_cast<uint8_t>(coordBits));
+}
+
+m2::PointU PointDToPointU(double x, double y, uint32_t coordBits)
+{
+ x = my::clamp(x, MercatorBounds::minX, MercatorBounds::maxX);
+ y = my::clamp(y, MercatorBounds::minY, MercatorBounds::maxY);
+
+ uint32_t const ix = static_cast<uint32_t>(0.5 +
+ (x - MercatorBounds::minX) /
+ (MercatorBounds::maxX - MercatorBounds::minX) *
+ CoordSize(coordBits));
+ uint32_t const iy = static_cast<uint32_t>(0.5 +
+ (y - MercatorBounds::minY) /
+ (MercatorBounds::maxY - MercatorBounds::minY) *
+ CoordSize(coordBits));
+
+ ASSERT_LESS_OR_EQUAL(ix, CoordSize(coordBits), ());
+ ASSERT_LESS_OR_EQUAL(iy, CoordSize(coordBits), ());
+
+ return m2::PointU(ix, iy);
+}
+
+m2::PointU PointDToPointU(m2::PointD const & pt, uint32_t coordBits)
+{
+ return PointDToPointU(pt.x, pt.y, coordBits);
+}
+
+m2::PointD PointUToPointD(m2::PointU const & pt, uint32_t coordBits)
+{
+ return m2::PointD(static_cast<double>(pt.x) * (MercatorBounds::maxX - MercatorBounds::minX) /
+ CoordSize(coordBits) +
+ MercatorBounds::minX,
+ static_cast<double>(pt.y) * (MercatorBounds::maxY - MercatorBounds::minY) /
+ CoordSize(coordBits) +
+ MercatorBounds::minY);
+}
diff --git a/coding/pointd_to_pointu.hpp b/coding/pointd_to_pointu.hpp
new file mode 100644
index 0000000000..e5fd99a042
--- /dev/null
+++ b/coding/pointd_to_pointu.hpp
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "geometry/point2d.hpp"
+
+#include <cstdint>
+
+#define POINT_COORD_BITS 30
+
+uint32_t DoubleToUint32(double x, double min, double max, uint32_t coordBits);
+
+double Uint32ToDouble(uint32_t x, double min, double max, uint32_t coordBits);
+
+m2::PointU PointDToPointU(double x, double y, uint32_t coordBits);
+
+m2::PointU PointDToPointU(m2::PointD const & pt, uint32_t coordBits);
+
+m2::PointD PointUToPointD(m2::PointU const & p, uint32_t coordBits);
diff --git a/coding/traffic.hpp b/coding/traffic.hpp
index 216590b4da..86c638e19f 100644
--- a/coding/traffic.hpp
+++ b/coding/traffic.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/varint.hpp"
#include "coding/writer.hpp"
diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp
index 7878611e32..da857828f0 100644
--- a/drape_frontend/apply_feature_functors.hpp
+++ b/drape_frontend/apply_feature_functors.hpp
@@ -9,8 +9,6 @@
#include "indexer/ftypes_matcher.hpp"
#include "indexer/road_shields_parser.hpp"
-#include "coding/point_to_integer.hpp"
-
#include "geometry/point2d.hpp"
#include "geometry/polyline2d.hpp"
#include "geometry/spline.hpp"
diff --git a/generator/coastlines_generator.cpp b/generator/coastlines_generator.cpp
index 21ff7cf6bb..d479aae17c 100644
--- a/generator/coastlines_generator.cpp
+++ b/generator/coastlines_generator.cpp
@@ -1,7 +1,8 @@
#include "generator/coastlines_generator.hpp"
+
#include "generator/feature_builder.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "geometry/region2d/binary_operators.hpp"
@@ -34,7 +35,7 @@ namespace
inline PointT D2I(m2::PointD const & p)
{
- m2::PointU const pu = PointD2PointU(p, POINT_COORD_BITS);
+ m2::PointU const pu = PointDToPointU(p, POINT_COORD_BITS);
return PointT(static_cast<int32_t>(pu.x), static_cast<int32_t>(pu.y));
}
@@ -180,7 +181,7 @@ public:
void operator()(PointT const & p)
{
- m_points.push_back(PointU2PointD(
+ m_points.push_back(PointUToPointD(
m2::PointU(static_cast<uint32_t>(p.x), static_cast<uint32_t>(p.y)), POINT_COORD_BITS));
}
diff --git a/generator/feature_helpers.cpp b/generator/feature_helpers.cpp
index 9b1637ffa9..69166ff14b 100644
--- a/generator/feature_helpers.cpp
+++ b/generator/feature_helpers.cpp
@@ -4,6 +4,8 @@
#include "indexer/feature_visibility.hpp"
+#include "coding/point_to_integer.hpp"
+
#include "base/stl_helpers.hpp"
#include <algorithm>
@@ -22,7 +24,7 @@ void CalculateMidPoints::operator()(FeatureBuilder1 const & ft, uint64_t pos)
ASSERT_NOT_EQUAL(m_locCount, 0, ());
m_midLoc = m_midLoc / m_locCount;
- uint64_t const pointAsInt64 = PointToInt64(m_midLoc, m_coordBits);
+ uint64_t const pointAsInt64 = PointToInt64Obsolete(m_midLoc, m_coordBits);
int const minScale = feature::GetMinDrawableScale(ft.GetFeatureBase());
/// May be invisible if it's small area object with [0-9] scales.
diff --git a/generator/feature_helpers.hpp b/generator/feature_helpers.hpp
index 3a8817a3c5..77221bbc68 100644
--- a/generator/feature_helpers.hpp
+++ b/generator/feature_helpers.hpp
@@ -80,7 +80,7 @@ public:
private:
m2::RectD const & m_rect;
// 5.0E-7 is near with minimal epsilon when integer points are different
- // PointD2PointU(x, y) != PointD2PointU(x + m_eps, y + m_eps)
+ // PointDToPointU(x, y) != PointDToPointU(x + m_eps, y + m_eps)
double m_eps = 5.0E-7;
};
diff --git a/generator/feature_merger.cpp b/generator/feature_merger.cpp
index 37fbcd9e8b..2430b5b89a 100644
--- a/generator/feature_merger.cpp
+++ b/generator/feature_merger.cpp
@@ -117,7 +117,7 @@ double MergedFeatureBuilder1::GetPriority() const
FeatureMergeProcessor::key_t FeatureMergeProcessor::get_key(m2::PointD const & p)
{
- return PointToInt64(p, m_coordBits);
+ return PointToInt64Obsolete(p, m_coordBits);
}
FeatureMergeProcessor::FeatureMergeProcessor(uint32_t coordBits)
diff --git a/generator/generator_tests/coasts_test.cpp b/generator/generator_tests/coasts_test.cpp
index 309cf9a86a..009857f780 100644
--- a/generator/generator_tests/coasts_test.cpp
+++ b/generator/generator_tests/coasts_test.cpp
@@ -4,12 +4,14 @@
#include "generator/feature_generator.hpp"
#include "generator/feature_helpers.hpp"
+#include "coding/pointd_to_pointu.hpp"
+
+#include "geometry/cellid.hpp"
#include "geometry/mercator.hpp"
+
#include "indexer/cell_id.hpp"
#include "indexer/scales.hpp"
-#include "geometry/cellid.hpp"
-
#include "base/logging.hpp"
using namespace std;
@@ -18,7 +20,7 @@ namespace
{
inline m2::PointU D2I(double x, double y)
{
- return PointD2PointU(m2::PointD(x, y), POINT_COORD_BITS);
+ return PointDToPointU(m2::PointD(x, y), POINT_COORD_BITS);
}
}
diff --git a/generator/generator_tests/feature_merger_test.cpp b/generator/generator_tests/feature_merger_test.cpp
index 1a21f1624b..47d72b70fb 100644
--- a/generator/generator_tests/feature_merger_test.cpp
+++ b/generator/generator_tests/feature_merger_test.cpp
@@ -4,6 +4,8 @@
#include "indexer/classificator_loader.hpp"
+#include "coding/pointd_to_pointu.hpp"
+
namespace
{
typedef m2::PointD P;
diff --git a/generator/generator_tests/triangles_tree_coding_test.cpp b/generator/generator_tests/triangles_tree_coding_test.cpp
index 331497689d..c17cc95590 100644
--- a/generator/generator_tests/triangles_tree_coding_test.cpp
+++ b/generator/generator_tests/triangles_tree_coding_test.cpp
@@ -1,13 +1,14 @@
#include "generator/tesselator.hpp"
#include "indexer/geometry_serialization.hpp"
-#include "geometry/mercator.hpp"
#include "indexer/coding_params.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/writer.hpp"
+#include "geometry/mercator.hpp"
+
#include "testing/testing.hpp"
@@ -62,7 +63,8 @@ namespace
serial::TrianglesChainSaver saver(cp);
tesselator::PointsInfo points;
- m2::PointU (* D2U)(m2::PointD const &, uint32_t) = &PointD2PointU;
+
+ m2::PointU (*D2U)(m2::PointD const &, uint32_t) = &PointDToPointU;
info.GetPointsInfo(saver.GetBasePoint(), saver.GetMaxPoint(),
std::bind(D2U, std::placeholders::_1, cp.GetCoordBits()), points);
diff --git a/generator/geometry_holder.hpp b/generator/geometry_holder.hpp
index 44aab7b1bf..8d5606c422 100644
--- a/generator/geometry_holder.hpp
+++ b/generator/geometry_holder.hpp
@@ -186,7 +186,7 @@ private:
// points conversion
tesselator::PointsInfo points;
- m2::PointU (*D2U)(m2::PointD const &, uint32_t) = &PointD2PointU;
+ m2::PointU (*D2U)(m2::PointD const &, uint32_t) = &PointDToPointU;
info.GetPointsInfo(saver.GetBasePoint(), saver.GetMaxPoint(),
std::bind(D2U, std::placeholders::_1, cp.GetCoordBits()), points);
diff --git a/generator/routing_index_generator.cpp b/generator/routing_index_generator.cpp
index 468089bec9..161a38c9be 100644
--- a/generator/routing_index_generator.cpp
+++ b/generator/routing_index_generator.cpp
@@ -25,13 +25,14 @@
#include "indexer/feature.hpp"
#include "indexer/feature_processor.hpp"
-#include "geometry/point2d.hpp"
-
#include "coding/file_container.hpp"
#include "coding/file_name_utils.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
+#include "geometry/point2d.hpp"
+
#include "base/checked_cast.hpp"
#include "base/logging.hpp"
#include "base/osm_id.hpp"
@@ -139,7 +140,7 @@ private:
for (size_t i = 0; i < f.GetPointsCount(); ++i)
{
- uint64_t const locationKey = PointToInt64(f.GetPoint(i), POINT_COORD_BITS);
+ uint64_t const locationKey = PointToInt64Obsolete(f.GetPoint(i), POINT_COORD_BITS);
m_posToJoint[locationKey].AddPoint(RoadPoint(id, base::checked_cast<uint32_t>(i)));
}
}
diff --git a/generator/world_map_generator.hpp b/generator/world_map_generator.hpp
index 5fabbb4c4a..1ac1b4aca7 100644
--- a/generator/world_map_generator.hpp
+++ b/generator/world_map_generator.hpp
@@ -3,12 +3,14 @@
#include "generator/feature_merger.hpp"
#include "generator/generate_info.hpp"
+#include "indexer/scales.hpp"
+
+#include "coding/pointd_to_pointu.hpp"
+
#include "geometry/polygon.hpp"
#include "geometry/region2d.hpp"
#include "geometry/tree4d.hpp"
-#include "indexer/scales.hpp"
-
#include "base/logging.hpp"
#include "defines.hpp"
diff --git a/geometry/CMakeLists.txt b/geometry/CMakeLists.txt
index 7c42d28dde..308cf97e5c 100644
--- a/geometry/CMakeLists.txt
+++ b/geometry/CMakeLists.txt
@@ -35,7 +35,6 @@ set(
packer.cpp
packer.hpp
point2d.hpp
- pointu_to_uint64.hpp
polygon.hpp
polyline2d.hpp
rect2d.hpp
diff --git a/geometry/geometry_tests/CMakeLists.txt b/geometry/geometry_tests/CMakeLists.txt
index cadc7921bd..594287dfa5 100644
--- a/geometry/geometry_tests/CMakeLists.txt
+++ b/geometry/geometry_tests/CMakeLists.txt
@@ -26,7 +26,6 @@ set(
mercator_test.cpp
packer_test.cpp
point_test.cpp
- pointu_to_uint64_test.cpp
polygon_test.cpp
rect_test.cpp
region2d_binary_op_test.cpp
diff --git a/geometry/geometry_tests/pointu_to_uint64_test.cpp b/geometry/geometry_tests/pointu_to_uint64_test.cpp
deleted file mode 100644
index c890a17476..0000000000
--- a/geometry/geometry_tests/pointu_to_uint64_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "testing/testing.hpp"
-#include "geometry/pointu_to_uint64.hpp"
-
-UNIT_TEST(PointUToUint64_0)
-{
- TEST_EQUAL(0, m2::PointUToUint64(m2::PointU(0, 0)), ());
- TEST_EQUAL(m2::PointU(0, 0), m2::Uint64ToPointU(0), ());
-}
-
-UNIT_TEST(PointUToUint64_Interlaced)
-{
- TEST_EQUAL(0xAAAAAAAAAAAAAAAAULL, m2::PointUToUint64(m2::PointU(0, 0xFFFFFFFF)), ());
- TEST_EQUAL(0x5555555555555555ULL, m2::PointUToUint64(m2::PointU(0xFFFFFFFF, 0)), ());
- TEST_EQUAL(0xAAAAAAAAAAAAAAA8ULL, m2::PointUToUint64(m2::PointU(0, 0xFFFFFFFE)), ());
- TEST_EQUAL(0x5555555555555554ULL, m2::PointUToUint64(m2::PointU(0xFFFFFFFE, 0)), ());
-}
-
-UNIT_TEST(PointUToUint64_1bit)
-{
- TEST_EQUAL(2, m2::PointUToUint64(m2::PointU(0, 1)), ());
- TEST_EQUAL(m2::PointU(0, 1), m2::Uint64ToPointU(2), ());
- TEST_EQUAL(1, m2::PointUToUint64(m2::PointU(1, 0)), ());
- TEST_EQUAL(m2::PointU(1, 0), m2::Uint64ToPointU(1), ());
-
- TEST_EQUAL(3ULL << 60, m2::PointUToUint64(m2::PointU(1 << 30, 1 << 30)), ());
- TEST_EQUAL((1ULL << 60) - 1, m2::PointUToUint64(m2::PointU((1 << 30) - 1, (1 << 30) - 1)), ());
-}
-
diff --git a/geometry/pointu_to_uint64.hpp b/geometry/pointu_to_uint64.hpp
deleted file mode 100644
index 3ea17330cf..0000000000
--- a/geometry/pointu_to_uint64.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-#include "base/assert.hpp"
-#include "base/base.hpp"
-#include "base/bits.hpp"
-#include "geometry/point2d.hpp"
-
-namespace m2
-{
-
-inline PointU Uint64ToPointU(int64_t v)
-{
- PointU res;
- bits::BitwiseSplit(v, res.x, res.y);
- return res;
-}
-
-inline uint64_t PointUToUint64(PointU const & pt)
-{
- uint64_t const res = bits::BitwiseMerge(pt.x, pt.y);
- ASSERT_EQUAL(pt, Uint64ToPointU(res), ());
- return res;
-}
-
-} // namespace m2
diff --git a/indexer/cell_id.hpp b/indexer/cell_id.hpp
index b0380a8810..a182fbcfd0 100644
--- a/indexer/cell_id.hpp
+++ b/indexer/cell_id.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "coding/point_to_integer.hpp"
+#include "geometry/cellid.hpp"
#include "geometry/mercator.hpp"
#include "geometry/rect2d.hpp"
diff --git a/indexer/centers_table.cpp b/indexer/centers_table.cpp
index 4334e40872..0b863e190d 100644
--- a/indexer/centers_table.cpp
+++ b/indexer/centers_table.cpp
@@ -6,7 +6,7 @@
#include "coding/endianness.hpp"
#include "coding/file_container.hpp"
#include "coding/memory_region.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/succinct_mapper.hpp"
#include "coding/varint.hpp"
@@ -174,7 +174,7 @@ public:
}
}
- center = PointU2PointD(entry[offset], m_codingParams.GetCoordBits());
+ center = PointUToPointD(entry[offset], m_codingParams.GetCoordBits());
return true;
}
@@ -269,7 +269,7 @@ void CentersTableBuilder::Put(uint32_t featureId, m2::PointD const & center)
if (!m_ids.empty())
CHECK_LESS(m_ids.back(), featureId, ());
- m_centers.push_back(PointD2PointU(center, m_codingParams.GetCoordBits()));
+ m_centers.push_back(PointDToPointU(center, m_codingParams.GetCoordBits()));
m_ids.push_back(featureId);
}
diff --git a/indexer/cities_boundaries_serdes.hpp b/indexer/cities_boundaries_serdes.hpp
index 3346e53761..e42eb6e36a 100644
--- a/indexer/cities_boundaries_serdes.hpp
+++ b/indexer/cities_boundaries_serdes.hpp
@@ -6,7 +6,7 @@
#include "coding/bit_streams.hpp"
#include "coding/elias_coder.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/varint.hpp"
#include "coding/write_to_sink.hpp"
@@ -119,7 +119,10 @@ public:
}
private:
- m2::PointU ToU(m2::PointD const & p) const { return PointD2PointU(p, m_params.GetCoordBits()); }
+ m2::PointU ToU(m2::PointD const & p) const
+ {
+ return PointDToPointU(p, m_params.GetCoordBits());
+ }
std::vector<m2::PointU> ToU(std::vector<m2::PointD> const & ps) const
{
@@ -264,7 +267,7 @@ public:
private:
m2::PointD FromU(m2::PointU const & u) const
{
- return PointU2PointD(u, m_params.GetCoordBits());
+ return PointUToPointD(u, m_params.GetCoordBits());
}
std::vector<m2::PointD> FromU(std::vector<m2::PointU> const & us) const
diff --git a/indexer/coding_params.cpp b/indexer/coding_params.cpp
index 8f165e1bdb..f9d37783e1 100644
--- a/indexer/coding_params.cpp
+++ b/indexer/coding_params.cpp
@@ -1,16 +1,14 @@
#include "indexer/coding_params.hpp"
#include "coding/point_to_integer.hpp"
-
-#include "geometry/pointu_to_uint64.hpp"
-
+#include "coding/pointd_to_pointu.hpp"
namespace serial
{
CodingParams::CodingParams()
: m_BasePointUint64(0), m_CoordBits(POINT_COORD_BITS)
{
- m_BasePoint = m2::Uint64ToPointU(m_BasePointUint64);
+ m_BasePoint = Uint64ToPointUObsolete(m_BasePointUint64);
}
CodingParams::CodingParams(uint8_t coordBits, m2::PointD const & pt)
@@ -22,12 +20,12 @@ namespace serial
CodingParams::CodingParams(uint8_t coordBits, uint64_t basePointUint64)
: m_BasePointUint64(basePointUint64), m_CoordBits(coordBits)
{
- m_BasePoint = m2::Uint64ToPointU(m_BasePointUint64);
+ m_BasePoint = Uint64ToPointUObsolete(m_BasePointUint64);
}
void CodingParams::SetBasePoint(m2::PointD const & pt)
{
- m_BasePoint = PointD2PointU(pt, m_CoordBits);
- m_BasePointUint64 = m2::PointUToUint64(m_BasePoint);
+ m_BasePoint = PointDToPointU(pt, m_CoordBits);
+ m_BasePointUint64 = PointUToUint64Obsolete(m_BasePoint);
}
-}
+} // namespace serial
diff --git a/indexer/coding_params.hpp b/indexer/coding_params.hpp
index ecc285b6e5..b836b6a09c 100644
--- a/indexer/coding_params.hpp
+++ b/indexer/coding_params.hpp
@@ -1,9 +1,9 @@
#pragma once
+
#include "geometry/point2d.hpp"
#include "coding/varint.hpp"
-
namespace serial
{
class CodingParams
@@ -48,4 +48,4 @@ namespace serial
m2::PointU m_BasePoint;
uint8_t m_CoordBits;
};
-}
+} // namespace serial
diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp
index 32095e8e85..400fc001ab 100644
--- a/indexer/data_header.cpp
+++ b/indexer/data_header.cpp
@@ -6,6 +6,7 @@
#include "coding/file_container.hpp"
#include "coding/file_writer.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/varint.hpp"
#include "coding/write_to_sink.hpp"
@@ -33,12 +34,12 @@ namespace feature
m2::RectD const DataHeader::GetBounds() const
{
- return Int64ToRect(m_bounds, m_codingParams.GetCoordBits());
+ return Int64ToRectObsolete(m_bounds, m_codingParams.GetCoordBits());
}
void DataHeader::SetBounds(m2::RectD const & r)
{
- m_bounds = RectToInt64(r, m_codingParams.GetCoordBits());
+ m_bounds = RectToInt64Obsolete(r, m_codingParams.GetCoordBits());
}
pair<int, int> DataHeader::GetScaleRange() const
diff --git a/indexer/feature_covering.hpp b/indexer/feature_covering.hpp
index 52cb267c88..b933613c00 100644
--- a/indexer/feature_covering.hpp
+++ b/indexer/feature_covering.hpp
@@ -4,11 +4,10 @@
#include "indexer/cell_id.hpp"
#include "indexer/scales.hpp"
+#include "geometry/cellid.hpp"
#include "geometry/mercator.hpp"
#include "geometry/rect2d.hpp"
-#include "coding/point_to_integer.hpp"
-
#include "base/logging.hpp"
#include <cstdint>
diff --git a/indexer/feature_loader.cpp b/indexer/feature_loader.cpp
index 7b2fbdcef2..c5ea2f5149 100644
--- a/indexer/feature_loader.cpp
+++ b/indexer/feature_loader.cpp
@@ -4,8 +4,6 @@
#include "indexer/geometry_serialization.hpp"
#include "indexer/scales.hpp"
-#include "geometry/pointu_to_uint64.hpp"
-
#include "coding/byte_stream.hpp"
#include "coding/dd_vector.hpp"
diff --git a/indexer/geometry_serialization.cpp b/indexer/geometry_serialization.cpp
index 686763d78c..7893a4c07f 100644
--- a/indexer/geometry_serialization.cpp
+++ b/indexer/geometry_serialization.cpp
@@ -1,10 +1,10 @@
#include "indexer/geometry_serialization.hpp"
-#include "geometry/mercator.hpp"
+
#include "indexer/geometry_coding.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
-#include "geometry/pointu_to_uint64.hpp"
+#include "geometry/mercator.hpp"
#include "std/algorithm.hpp"
#include "std/bind.hpp"
@@ -18,12 +18,12 @@ namespace serial
{
inline m2::PointU D2U(m2::PointD const & p, uint32_t coordBits)
{
- return PointD2PointU(p, coordBits);
+ return PointDToPointU(p, coordBits);
}
inline m2::PointD U2D(m2::PointU const & p, uint32_t coordBits)
{
- m2::PointD const pt = PointU2PointD(p, coordBits);
+ m2::PointD const pt = PointUToPointD(p, coordBits);
ASSERT(MercatorBounds::minX <= pt.x && pt.y <= MercatorBounds::maxX,
(p, pt, coordBits));
ASSERT(MercatorBounds::minY <= pt.x && pt.y <= MercatorBounds::maxY,
diff --git a/indexer/geometry_serialization.hpp b/indexer/geometry_serialization.hpp
index fe38201c67..218ef209a0 100644
--- a/indexer/geometry_serialization.hpp
+++ b/indexer/geometry_serialization.hpp
@@ -6,7 +6,7 @@
#include "geometry/point2d.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/varint.hpp"
#include "coding/writer.hpp"
@@ -55,14 +55,14 @@ namespace serial
template <class TSink>
void SavePoint(TSink & sink, m2::PointD const & pt, CodingParams const & cp)
{
- WriteVarUint(sink, EncodeDelta(PointD2PointU(pt, cp.GetCoordBits()), cp.GetBasePoint()));
+ WriteVarUint(sink, EncodeDelta(PointDToPointU(pt, cp.GetCoordBits()), cp.GetBasePoint()));
}
template <class TSource>
m2::PointD LoadPoint(TSource & src, CodingParams const & cp)
{
- m2::PointD const pt = PointU2PointD(
- DecodeDelta(ReadVarUint<uint64_t>(src), cp.GetBasePoint()), cp.GetCoordBits());
+ m2::PointD const pt = PointUToPointD(DecodeDelta(ReadVarUint<uint64_t>(src), cp.GetBasePoint()),
+ cp.GetCoordBits());
return pt;
}
diff --git a/indexer/indexer_tests/geometry_coding_test.cpp b/indexer/indexer_tests/geometry_coding_test.cpp
index 251e65c1e8..f454e67c37 100644
--- a/indexer/indexer_tests/geometry_coding_test.cpp
+++ b/indexer/indexer_tests/geometry_coding_test.cpp
@@ -1,24 +1,22 @@
#include "testing/testing.hpp"
-#include "indexer/geometry_coding.hpp"
-#include "geometry/mercator.hpp"
#include "indexer/coding_params.hpp"
-
+#include "indexer/geometry_coding.hpp"
#include "indexer/indexer_tests/test_polylines.hpp"
-#include "geometry/geometry_tests/large_polygon.hpp"
-#include "geometry/distance.hpp"
-#include "geometry/simplification.hpp"
-
#include "coding/byte_stream.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/varint.hpp"
#include "coding/writer.hpp"
-#include "base/logging.hpp"
+#include "geometry/distance.hpp"
+#include "geometry/geometry_tests/large_polygon.hpp"
+#include "geometry/mercator.hpp"
+#include "geometry/simplification.hpp"
+#include "base/logging.hpp"
-typedef m2::PointU PU;
+using PU = m2::PointU;
UNIT_TEST(EncodeDelta)
{
@@ -80,6 +78,9 @@ UNIT_TEST(PredictPointsInPolyline3_90deg)
namespace
{
+m2::PointU D2U(m2::PointD const & p) { return PointDToPointU(p, POINT_COORD_BITS); }
+
+m2::PointU GetMaxPoint() { return D2U(m2::PointD(MercatorBounds::maxX, MercatorBounds::maxY)); }
void TestPolylineEncode(string testName,
vector<m2::PointU> const & points,
@@ -142,8 +143,7 @@ void TestEncodePolyline(string name, m2::PointU maxPoint, vector<m2::PointU> con
TestPolylineEncode(name + "2", points, maxPoint, &EncodePolylinePrev2, &DecodePolylinePrev2);
TestPolylineEncode(name + "3", points, maxPoint, &EncodePolylinePrev3, &DecodePolylinePrev3);
}
-
-}
+} // namespace
UNIT_TEST(EncodePolyline)
{
@@ -173,19 +173,6 @@ UNIT_TEST(EncodePolyline)
// see 476c1d1d125f0c2deb8c commit for special decode test
-namespace
-{
- inline m2::PointU D2U(m2::PointD const & p)
- {
- return PointD2PointU(p, POINT_COORD_BITS);
- }
-
- inline m2::PointU GetMaxPoint()
- {
- return D2U(m2::PointD(MercatorBounds::maxX, MercatorBounds::maxY));
- }
-}
-
UNIT_TEST(DecodeEncodePolyline_DataSet1)
{
size_t const count = ARRAY_SIZE(index_test::arr1);
diff --git a/indexer/indexer_tests/polyline_point_to_int64_test.cpp b/indexer/indexer_tests/polyline_point_to_int64_test.cpp
index ff0524fee1..e7665786d5 100644
--- a/indexer/indexer_tests/polyline_point_to_int64_test.cpp
+++ b/indexer/indexer_tests/polyline_point_to_int64_test.cpp
@@ -5,6 +5,7 @@
#include "indexer/cell_id.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "base/logging.hpp"
@@ -32,17 +33,17 @@ void CheckEqualPoints(m2::PointD const & p1, m2::PointD const & p2)
}
}
-UNIT_TEST(PointToInt64_DataSet1)
+UNIT_TEST(PointToInt64Obsolete_DataSet1)
{
for (size_t i = 0; i < ARRAY_SIZE(index_test::arr1); ++i)
{
m2::PointD const pt(index_test::arr1[i].x, index_test::arr1[i].y);
- int64_t const id = PointToInt64(pt, g_coordBits);
- m2::PointD const pt1 = Int64ToPoint(id, g_coordBits);
+ int64_t const id = PointToInt64Obsolete(pt, g_coordBits);
+ m2::PointD const pt1 = Int64ToPointObsolete(id, g_coordBits);
CheckEqualPoints(pt, pt1);
- int64_t const id1 = PointToInt64(pt1, g_coordBits);
+ int64_t const id1 = PointToInt64Obsolete(pt1, g_coordBits);
TEST_EQUAL(id, id1, (pt, pt1));
}
}
diff --git a/kml/visitors.hpp b/kml/visitors.hpp
index 28ecb51bb6..4f2d4647e5 100644
--- a/kml/visitors.hpp
+++ b/kml/visitors.hpp
@@ -3,6 +3,7 @@
#include "kml/types.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/text_storage.hpp"
#include "coding/varint.hpp"
@@ -227,7 +228,7 @@ public:
void operator()(m2::PointD const & pt, char const * /* name */ = nullptr)
{
- uint64_t const encoded = bits::ZigZagEncode(PointToInt64(pt, POINT_COORD_BITS));
+ uint64_t const encoded = bits::ZigZagEncode(PointToInt64Obsolete(pt, POINT_COORD_BITS));
WriteVarUint(m_sink, encoded);
}
@@ -285,7 +286,7 @@ public:
void operator()(m2::PointD const & pt, char const * /* name */ = nullptr)
{
- uint64_t const encoded = bits::ZigZagEncode(PointToInt64(pt, POINT_COORD_BITS));
+ uint64_t const encoded = bits::ZigZagEncode(PointToInt64Obsolete(pt, POINT_COORD_BITS));
WriteVarUint(m_sink, encoded);
}
@@ -398,7 +399,7 @@ public:
void operator()(m2::PointD & pt, char const * /* name */ = nullptr)
{
auto const v = ReadVarUint<uint64_t, Source>(m_source);
- pt = Int64ToPoint(bits::ZigZagDecode(v), POINT_COORD_BITS);
+ pt = Int64ToPointObsolete(bits::ZigZagDecode(v), POINT_COORD_BITS);
}
template <typename T>
@@ -460,7 +461,7 @@ public:
void operator()(m2::PointD & pt, char const * /* name */ = nullptr)
{
auto const v = ReadVarUint<uint64_t, Source>(m_source);
- pt = Int64ToPoint(bits::ZigZagDecode(v), POINT_COORD_BITS);
+ pt = Int64ToPointObsolete(bits::ZigZagDecode(v), POINT_COORD_BITS);
}
void operator()(double & d, char const * /* name */ = nullptr)
diff --git a/local_ads/statistics.cpp b/local_ads/statistics.cpp
index 2d2510f005..5a3df4d24f 100644
--- a/local_ads/statistics.cpp
+++ b/local_ads/statistics.cpp
@@ -9,6 +9,7 @@
#include "coding/file_name_utils.hpp"
#include "coding/file_writer.hpp"
#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
#include "coding/url_encode.hpp"
#include "coding/write_to_sink.hpp"
#include "coding/zlib.hpp"
@@ -158,9 +159,10 @@ std::list<local_ads::Event> ReadEvents(std::string const & fileName)
{
FileReader reader(fileName);
ReaderSource<FileReader> src(reader);
- ReadPackedData(src, [&result](local_ads::Statistics::PackedData && data, std::string const & countryId,
- int64_t mwmVersion, local_ads::Timestamp const & baseTimestamp) {
- auto const mercatorPt = Int64ToPoint(data.m_mercator, POINT_COORD_BITS);
+ ReadPackedData(src, [&result](local_ads::Statistics::PackedData && data,
+ std::string const & countryId, int64_t mwmVersion,
+ local_ads::Timestamp const & baseTimestamp) {
+ auto const mercatorPt = Int64ToPointObsolete(data.m_mercator, POINT_COORD_BITS);
result.emplace_back(static_cast<local_ads::EventType>(data.m_eventType), mwmVersion, countryId,
data.m_featureIndex, data.m_zoomLevel,
baseTimestamp + std::chrono::seconds(data.m_seconds),
@@ -318,7 +320,7 @@ std::list<Event> Statistics::WriteEvents(std::list<Event> & events, std::string
data.m_zoomLevel = event.m_zoomLevel;
data.m_eventType = static_cast<uint8_t>(event.m_type);
auto const mercatorPt = MercatorBounds::FromLatLon(event.m_latitude, event.m_longitude);
- data.m_mercator = PointToInt64(mercatorPt, POINT_COORD_BITS);
+ data.m_mercator = PointToInt64Obsolete(mercatorPt, POINT_COORD_BITS);
data.m_accuracy = event.m_accuracyInMeters;
WritePackedData(*writer, std::move(data));
}
diff --git a/search/search_trie.hpp b/search/search_trie.hpp
index b709a18071..ba9e75fb7c 100644
--- a/search/search_trie.hpp
+++ b/search/search_trie.hpp
@@ -2,7 +2,7 @@
#include "indexer/coding_params.hpp"
-#include "coding/point_to_integer.hpp"
+#include "coding/pointd_to_pointu.hpp"
namespace search
{
@@ -16,7 +16,6 @@ namespace trie
inline serial::CodingParams GetCodingParams(serial::CodingParams const & orig)
{
return serial::CodingParams(search::kPointCodingBits,
- PointU2PointD(orig.GetBasePoint(), orig.GetCoordBits()));
+ PointUToPointD(orig.GetBasePoint(), orig.GetCoordBits()));
}
-
} // namespace trie
diff --git a/storage/country_polygon.hpp b/storage/country_polygon.hpp
index 3d08630243..9b7cf2b34e 100644
--- a/storage/country_polygon.hpp
+++ b/storage/country_polygon.hpp
@@ -17,14 +17,15 @@ namespace storage
pair<int64_t, int64_t> r;
r.first = ReadVarInt<int64_t>(src);
r.second = ReadVarInt<int64_t>(src);
- p.m_rect = Int64ToRect(r, serial::CodingParams().GetCoordBits());
+ p.m_rect = Int64ToRectObsolete(r, serial::CodingParams().GetCoordBits());
}
template <class TSink> void Write(TSink & sink, CountryDef const & p)
{
rw::Write(sink, p.m_countryId);
- pair<int64_t, int64_t> const r = RectToInt64(p.m_rect, serial::CodingParams().GetCoordBits());
+ pair<int64_t, int64_t> const r =
+ RectToInt64Obsolete(p.m_rect, serial::CodingParams().GetCoordBits());
WriteVarInt(sink, r.first);
WriteVarInt(sink, r.second);
}
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;
}
}
diff --git a/ugc/serdes.hpp b/ugc/serdes.hpp
index 9d9c74f8a8..191bc18a6d 100644
--- a/ugc/serdes.hpp
+++ b/ugc/serdes.hpp
@@ -2,7 +2,6 @@
#include "ugc/types.hpp"
-#include "coding/point_to_integer.hpp"
#include "coding/read_write_utils.hpp"
#include "coding/reader.hpp"
#include "coding/varint.hpp"
diff --git a/xcode/coding/coding.xcodeproj/project.pbxproj b/xcode/coding/coding.xcodeproj/project.pbxproj
index 14fa59d783..1fc2e33107 100644
--- a/xcode/coding/coding.xcodeproj/project.pbxproj
+++ b/xcode/coding/coding.xcodeproj/project.pbxproj
@@ -22,6 +22,12 @@
3949172C1BAC3CAC002A8C4F /* libminizip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 394917281BAC3CAC002A8C4F /* libminizip.a */; };
3949172D1BAC3CAC002A8C4F /* libsuccinct.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 394917291BAC3CAC002A8C4F /* libsuccinct.a */; };
394917301BAC3CC9002A8C4F /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3949172F1BAC3CC9002A8C4F /* libz.tbd */; };
+ 395D1A89207BBA16001164A5 /* pointd_to_pointu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A87207BBA16001164A5 /* pointd_to_pointu.cpp */; };
+ 395D1A8A207BBA16001164A5 /* pointd_to_pointu.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 395D1A88207BBA16001164A5 /* pointd_to_pointu.hpp */; };
+ 395D1A95207BBF63001164A5 /* zlib_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A91207BBBAC001164A5 /* zlib_test.cpp */; };
+ 395D1A96207BBF63001164A5 /* pointd_to_pointu_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A8F207BBBA5001164A5 /* pointd_to_pointu_tests.cpp */; };
+ 395D1A97207BBF63001164A5 /* text_storage_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A8D207BBB9E001164A5 /* text_storage_tests.cpp */; };
+ 395D1A98207BBF63001164A5 /* bwt_coder_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A8B207BBB95001164A5 /* bwt_coder_tests.cpp */; };
39B2B97B1FB4692D00AB85A1 /* text_storage.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 39B2B97A1FB4692D00AB85A1 /* text_storage.hpp */; };
39B2B97D1FB4693500AB85A1 /* bwt_coder.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 39B2B97C1FB4693400AB85A1 /* bwt_coder.hpp */; };
39B2B97F1FB4693B00AB85A1 /* elias_coder.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 39B2B97E1FB4693B00AB85A1 /* elias_coder.hpp */; };
@@ -176,6 +182,12 @@
394917281BAC3CAC002A8C4F /* libminizip.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libminizip.a; path = "../../../omim-xcode-build/Debug/libminizip.a"; sourceTree = "<group>"; };
394917291BAC3CAC002A8C4F /* libsuccinct.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsuccinct.a; path = "../../../omim-xcode-build/Debug/libsuccinct.a"; sourceTree = "<group>"; };
3949172F1BAC3CC9002A8C4F /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
+ 395D1A87207BBA16001164A5 /* pointd_to_pointu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pointd_to_pointu.cpp; sourceTree = "<group>"; };
+ 395D1A88207BBA16001164A5 /* pointd_to_pointu.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pointd_to_pointu.hpp; sourceTree = "<group>"; };
+ 395D1A8B207BBB95001164A5 /* bwt_coder_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bwt_coder_tests.cpp; sourceTree = "<group>"; };
+ 395D1A8D207BBB9E001164A5 /* text_storage_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = text_storage_tests.cpp; sourceTree = "<group>"; };
+ 395D1A8F207BBBA5001164A5 /* pointd_to_pointu_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pointd_to_pointu_tests.cpp; sourceTree = "<group>"; };
+ 395D1A91207BBBAC001164A5 /* zlib_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = zlib_test.cpp; sourceTree = "<group>"; };
39B2B97A1FB4692D00AB85A1 /* text_storage.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = text_storage.hpp; sourceTree = "<group>"; };
39B2B97C1FB4693400AB85A1 /* bwt_coder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bwt_coder.hpp; sourceTree = "<group>"; };
39B2B97E1FB4693B00AB85A1 /* elias_coder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = elias_coder.hpp; sourceTree = "<group>"; };
@@ -342,6 +354,10 @@
394916901BAC3A5F002A8C4F /* coding_tests */ = {
isa = PBXGroup;
children = (
+ 395D1A91207BBBAC001164A5 /* zlib_test.cpp */,
+ 395D1A8F207BBBA5001164A5 /* pointd_to_pointu_tests.cpp */,
+ 395D1A8D207BBB9E001164A5 /* text_storage_tests.cpp */,
+ 395D1A8B207BBB95001164A5 /* bwt_coder_tests.cpp */,
67E8DB7A1BBC18720053C5BA /* libs */,
3D489BB71D3D217E0052AA38 /* elias_coder_test.cpp */,
6768181F1DC3ABD80094C0AC /* traffic_test.cpp */,
@@ -424,6 +440,8 @@
6753421D1A3F586300A0A8C3 /* coding */ = {
isa = PBXGroup;
children = (
+ 395D1A87207BBA16001164A5 /* pointd_to_pointu.cpp */,
+ 395D1A88207BBA16001164A5 /* pointd_to_pointu.hpp */,
6753422B1A3F588B00A0A8C3 /* base64.cpp */,
6753422C1A3F588B00A0A8C3 /* base64.hpp */,
6753422F1A3F588B00A0A8C3 /* bit_streams.hpp */,
@@ -557,6 +575,7 @@
675342961A3F588C00A0A8C3 /* dd_vector.hpp in Headers */,
675342C91A3F588C00A0A8C3 /* var_record_reader.hpp in Headers */,
675342991A3F588C00A0A8C3 /* endianness.hpp in Headers */,
+ 395D1A8A207BBA16001164A5 /* pointd_to_pointu.hpp in Headers */,
347F333C1C4540F0009758CC /* succinct_mapper.hpp in Headers */,
675342951A3F588C00A0A8C3 /* constants.hpp in Headers */,
454523B4202AEB21009275C1 /* serdes_json.hpp in Headers */,
@@ -679,6 +698,7 @@
67E8DB551BBC17490053C5BA /* base64_test.cpp in Sources */,
67E8DB5F1BBC17490053C5BA /* file_data_test.cpp in Sources */,
67E8DB6E1BBC17490053C5BA /* uri_test.cpp in Sources */,
+ 395D1A98207BBF63001164A5 /* bwt_coder_tests.cpp in Sources */,
67E8DB711BBC17490053C5BA /* var_record_reader_test.cpp in Sources */,
67E8DB5E1BBC17490053C5BA /* file_container_test.cpp in Sources */,
67E8DB6A1BBC17490053C5BA /* reader_writer_ops_test.cpp in Sources */,
@@ -686,6 +706,7 @@
3D489BC31D3D21AE0052AA38 /* elias_coder_test.cpp in Sources */,
67E8DB671BBC17490053C5BA /* png_decoder_test.cpp in Sources */,
394917201BAC3BE0002A8C4F /* testingmain.cpp in Sources */,
+ 395D1A96207BBF63001164A5 /* pointd_to_pointu_tests.cpp in Sources */,
45C108B81E9CFE7B000FE1F6 /* point_to_integer_test.cpp in Sources */,
67E8DB5D1BBC17490053C5BA /* endianness_test.cpp in Sources */,
3D489BC11D3D21A40052AA38 /* simple_dense_coding_test.cpp in Sources */,
@@ -709,7 +730,9 @@
67E8DB561BBC17490053C5BA /* bit_streams_test.cpp in Sources */,
67E8DB651BBC17490053C5BA /* mem_file_writer_test.cpp in Sources */,
67E8DB761BBC17490053C5BA /* zip_creator_test.cpp in Sources */,
+ 395D1A97207BBF63001164A5 /* text_storage_tests.cpp in Sources */,
67E8DB661BBC17490053C5BA /* multilang_utf8_string_test.cpp in Sources */,
+ 395D1A95207BBF63001164A5 /* zlib_test.cpp in Sources */,
67E8DB741BBC17490053C5BA /* varint_vector_test.cpp in Sources */,
67E8DB631BBC17490053C5BA /* huffman_test.cpp in Sources */,
67E8DB731BBC17490053C5BA /* varint_test.cpp in Sources */,
@@ -729,6 +752,7 @@
4563B062205909290057556D /* sha1.cpp in Sources */,
347F33371C4540F0009758CC /* compressed_bit_vector.cpp in Sources */,
3D74EF221F8F55740081202C /* csv_reader.cpp in Sources */,
+ 395D1A89207BBA16001164A5 /* pointd_to_pointu.cpp in Sources */,
6753429F1A3F588C00A0A8C3 /* file_reader.cpp in Sources */,
34A129D31DF99E43001B4531 /* zlib.cpp in Sources */,
676818201DC3ABD80094C0AC /* traffic_test.cpp in Sources */,
diff --git a/xcode/geometry/geometry.xcodeproj/project.pbxproj b/xcode/geometry/geometry.xcodeproj/project.pbxproj
index ecca79b1b3..6552e34586 100644
--- a/xcode/geometry/geometry.xcodeproj/project.pbxproj
+++ b/xcode/geometry/geometry.xcodeproj/project.pbxproj
@@ -14,6 +14,7 @@
345C55F61C93140A00B6783F /* clipping.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 345C55F41C93140A00B6783F /* clipping.hpp */; };
347F33701C454205009758CC /* triangle2d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347F336E1C454205009758CC /* triangle2d.cpp */; };
347F33711C454205009758CC /* triangle2d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 347F336F1C454205009758CC /* triangle2d.hpp */; };
+ 395D1A9B207BCD8D001164A5 /* convex_hull_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 395D1A99207BCD8A001164A5 /* convex_hull_tests.cpp */; };
39B2B9701FB4680500AB85A1 /* diamond_box.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 39B2B96E1FB4680500AB85A1 /* diamond_box.hpp */; };
39B2B9711FB4680500AB85A1 /* diamond_box.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39B2B96F1FB4680500AB85A1 /* diamond_box.cpp */; };
39B2B9731FB4681400AB85A1 /* line2d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 39B2B9721FB4681400AB85A1 /* line2d.hpp */; };
@@ -34,9 +35,6 @@
56D5456B1C74A46D00E3719C /* algorithm.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 56D545691C74A46D00E3719C /* algorithm.hpp */; };
56EB1ED01C6B6DF30022D831 /* segment2d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56EB1ECE1C6B6DF30022D831 /* segment2d.cpp */; };
56EB1ED11C6B6DF30022D831 /* segment2d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 56EB1ECF1C6B6DF30022D831 /* segment2d.hpp */; };
- 670F296A1BA9D3C200F2ABF4 /* equality.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F29291BA9D2E700F2ABF4 /* equality.hpp */; };
- 670F296C1BA9D3C200F2ABF4 /* large_polygon.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F292B1BA9D2E700F2ABF4 /* large_polygon.hpp */; };
- 670F297A1BA9D3C200F2ABF4 /* test_regions.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F29391BA9D2E700F2ABF4 /* test_regions.hpp */; };
670F29801BA9D42E00F2ABF4 /* testingmain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F297E1BA9D41E00F2ABF4 /* testingmain.cpp */; };
670F29831BA9D46F00F2ABF4 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 670F29811BA9D46F00F2ABF4 /* libbase.a */; };
670F29841BA9D46F00F2ABF4 /* libindexer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 670F29821BA9D46F00F2ABF4 /* libindexer.a */; };
@@ -52,7 +50,6 @@
670F298F1BAABDA600F2ABF4 /* latlon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F292C1BA9D2E700F2ABF4 /* latlon_test.cpp */; };
670F29901BAABDA600F2ABF4 /* packer_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F292D1BA9D2E700F2ABF4 /* packer_test.cpp */; };
670F29911BAABDA600F2ABF4 /* point_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F292E1BA9D2E700F2ABF4 /* point_test.cpp */; };
- 670F29921BAABDA600F2ABF4 /* pointu_to_uint64_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F292F1BA9D2E700F2ABF4 /* pointu_to_uint64_test.cpp */; };
670F29931BAABDA600F2ABF4 /* polygon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F29301BA9D2E700F2ABF4 /* polygon_test.cpp */; };
670F29941BAABDA600F2ABF4 /* rect_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F29311BA9D2E700F2ABF4 /* rect_test.cpp */; };
670F29951BAABDA600F2ABF4 /* region_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670F29321BA9D2E700F2ABF4 /* region_test.cpp */; };
@@ -80,7 +77,6 @@
675344C61A3F687400A0A8C3 /* packer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675344A91A3F687400A0A8C3 /* packer.cpp */; };
675344C71A3F687400A0A8C3 /* packer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AA1A3F687400A0A8C3 /* packer.hpp */; };
675344C81A3F687400A0A8C3 /* point2d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AB1A3F687400A0A8C3 /* point2d.hpp */; };
- 675344C91A3F687400A0A8C3 /* pointu_to_uint64.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AC1A3F687400A0A8C3 /* pointu_to_uint64.hpp */; };
675344CA1A3F687400A0A8C3 /* polygon.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AD1A3F687400A0A8C3 /* polygon.hpp */; };
675344CB1A3F687400A0A8C3 /* polyline2d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AE1A3F687400A0A8C3 /* polyline2d.hpp */; };
675344CC1A3F687400A0A8C3 /* rect_intersect.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675344AF1A3F687400A0A8C3 /* rect_intersect.hpp */; };
@@ -127,6 +123,7 @@
347F336F1C454205009758CC /* triangle2d.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = triangle2d.hpp; sourceTree = "<group>"; };
34AF87CD1DBE517700E5E7DC /* common-debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-debug.xcconfig"; path = "../common-debug.xcconfig"; sourceTree = "<group>"; };
34AF87CE1DBE517700E5E7DC /* common-release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../common-release.xcconfig"; sourceTree = "<group>"; };
+ 395D1A99207BCD8A001164A5 /* convex_hull_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = convex_hull_tests.cpp; sourceTree = "<group>"; };
39B2B96E1FB4680500AB85A1 /* diamond_box.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = diamond_box.hpp; sourceTree = "<group>"; };
39B2B96F1FB4680500AB85A1 /* diamond_box.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = diamond_box.cpp; sourceTree = "<group>"; };
39B2B9721FB4681400AB85A1 /* line2d.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = line2d.hpp; sourceTree = "<group>"; };
@@ -152,13 +149,10 @@
670F29261BA9D2E700F2ABF4 /* covering_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = covering_test.cpp; sourceTree = "<group>"; };
670F29271BA9D2E700F2ABF4 /* distance_on_sphere_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = distance_on_sphere_test.cpp; sourceTree = "<group>"; };
670F29281BA9D2E700F2ABF4 /* distance_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = distance_test.cpp; sourceTree = "<group>"; };
- 670F29291BA9D2E700F2ABF4 /* equality.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = equality.hpp; sourceTree = "<group>"; };
670F292A1BA9D2E700F2ABF4 /* intersect_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intersect_test.cpp; sourceTree = "<group>"; };
- 670F292B1BA9D2E700F2ABF4 /* large_polygon.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = large_polygon.hpp; sourceTree = "<group>"; };
670F292C1BA9D2E700F2ABF4 /* latlon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = latlon_test.cpp; sourceTree = "<group>"; };
670F292D1BA9D2E700F2ABF4 /* packer_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = packer_test.cpp; sourceTree = "<group>"; };
670F292E1BA9D2E700F2ABF4 /* point_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = point_test.cpp; sourceTree = "<group>"; };
- 670F292F1BA9D2E700F2ABF4 /* pointu_to_uint64_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pointu_to_uint64_test.cpp; sourceTree = "<group>"; };
670F29301BA9D2E700F2ABF4 /* polygon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = polygon_test.cpp; sourceTree = "<group>"; };
670F29311BA9D2E700F2ABF4 /* rect_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rect_test.cpp; sourceTree = "<group>"; };
670F29321BA9D2E700F2ABF4 /* region_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = region_test.cpp; sourceTree = "<group>"; };
@@ -168,7 +162,6 @@
670F29361BA9D2E700F2ABF4 /* segments_intersect_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = segments_intersect_test.cpp; sourceTree = "<group>"; };
670F29371BA9D2E700F2ABF4 /* simplification_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplification_test.cpp; sourceTree = "<group>"; };
670F29381BA9D2E700F2ABF4 /* spline_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = spline_test.cpp; sourceTree = "<group>"; };
- 670F29391BA9D2E700F2ABF4 /* test_regions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = test_regions.hpp; sourceTree = "<group>"; };
670F293A1BA9D2E700F2ABF4 /* transformations_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = transformations_test.cpp; sourceTree = "<group>"; };
670F293B1BA9D2E700F2ABF4 /* tree_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tree_test.cpp; sourceTree = "<group>"; };
670F293C1BA9D2E700F2ABF4 /* vector_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = vector_test.cpp; sourceTree = "<group>"; };
@@ -192,7 +185,6 @@
675344A91A3F687400A0A8C3 /* packer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = packer.cpp; sourceTree = "<group>"; };
675344AA1A3F687400A0A8C3 /* packer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = packer.hpp; sourceTree = "<group>"; };
675344AB1A3F687400A0A8C3 /* point2d.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = point2d.hpp; sourceTree = "<group>"; };
- 675344AC1A3F687400A0A8C3 /* pointu_to_uint64.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pointu_to_uint64.hpp; sourceTree = "<group>"; };
675344AD1A3F687400A0A8C3 /* polygon.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = polygon.hpp; sourceTree = "<group>"; };
675344AE1A3F687400A0A8C3 /* polyline2d.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = polyline2d.hpp; sourceTree = "<group>"; };
675344AF1A3F687400A0A8C3 /* rect_intersect.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = rect_intersect.hpp; sourceTree = "<group>"; };
@@ -239,6 +231,7 @@
670F29211BA9D25D00F2ABF4 /* geometry_tests */ = {
isa = PBXGroup;
children = (
+ 395D1A99207BCD8A001164A5 /* convex_hull_tests.cpp */,
45A2D9C51F7526FE003310A0 /* bounding_box_tests.cpp */,
45A2D9C61F7526FE003310A0 /* calipers_box_tests.cpp */,
45A2D9C71F7526FE003310A0 /* diamond_box_tests.cpp */,
@@ -252,16 +245,13 @@
670F29261BA9D2E700F2ABF4 /* covering_test.cpp */,
670F29271BA9D2E700F2ABF4 /* distance_on_sphere_test.cpp */,
670F29281BA9D2E700F2ABF4 /* distance_test.cpp */,
- 670F29291BA9D2E700F2ABF4 /* equality.hpp */,
670F292A1BA9D2E700F2ABF4 /* intersect_test.cpp */,
- 670F292B1BA9D2E700F2ABF4 /* large_polygon.hpp */,
670F292C1BA9D2E700F2ABF4 /* latlon_test.cpp */,
670F299F1BAAC61C00F2ABF4 /* libs */,
E92D8BD01C15AF9100A98D17 /* mercator_test.cpp */,
344A713E1F3DA08300B8DDB8 /* nearby_points_sweeper_test.cpp */,
670F292D1BA9D2E700F2ABF4 /* packer_test.cpp */,
670F292E1BA9D2E700F2ABF4 /* point_test.cpp */,
- 670F292F1BA9D2E700F2ABF4 /* pointu_to_uint64_test.cpp */,
670F29301BA9D2E700F2ABF4 /* polygon_test.cpp */,
670F29311BA9D2E700F2ABF4 /* rect_test.cpp */,
670F29321BA9D2E700F2ABF4 /* region_test.cpp */,
@@ -271,7 +261,6 @@
670F29361BA9D2E700F2ABF4 /* segments_intersect_test.cpp */,
670F29371BA9D2E700F2ABF4 /* simplification_test.cpp */,
670F29381BA9D2E700F2ABF4 /* spline_test.cpp */,
- 670F29391BA9D2E700F2ABF4 /* test_regions.hpp */,
670F297E1BA9D41E00F2ABF4 /* testingmain.cpp */,
670F293A1BA9D2E700F2ABF4 /* transformations_test.cpp */,
670F293B1BA9D2E700F2ABF4 /* tree_test.cpp */,
@@ -346,7 +335,6 @@
675344A91A3F687400A0A8C3 /* packer.cpp */,
675344AA1A3F687400A0A8C3 /* packer.hpp */,
675344AB1A3F687400A0A8C3 /* point2d.hpp */,
- 675344AC1A3F687400A0A8C3 /* pointu_to_uint64.hpp */,
675344AD1A3F687400A0A8C3 /* polygon.hpp */,
675344AE1A3F687400A0A8C3 /* polyline2d.hpp */,
675344AF1A3F687400A0A8C3 /* rect_intersect.hpp */,
@@ -412,7 +400,6 @@
347F33711C454205009758CC /* triangle2d.hpp in Headers */,
675344D71A3F687400A0A8C3 /* tree4d.hpp in Headers */,
675344CD1A3F687400A0A8C3 /* rect2d.hpp in Headers */,
- 675344C91A3F687400A0A8C3 /* pointu_to_uint64.hpp in Headers */,
675344CE1A3F687400A0A8C3 /* region2d.hpp in Headers */,
675344BE1A3F687400A0A8C3 /* any_rect2d.hpp in Headers */,
675344C21A3F687400A0A8C3 /* covering.hpp in Headers */,
@@ -507,6 +494,7 @@
45A2D9CD1F752707003310A0 /* bounding_box_tests.cpp in Sources */,
670F29911BAABDA600F2ABF4 /* point_test.cpp in Sources */,
670F29941BAABDA600F2ABF4 /* rect_test.cpp in Sources */,
+ 395D1A9B207BCD8D001164A5 /* convex_hull_tests.cpp in Sources */,
670F299A1BAABDA600F2ABF4 /* simplification_test.cpp in Sources */,
670F298A1BAABDA600F2ABF4 /* common_test.cpp in Sources */,
670F298D1BAABDA600F2ABF4 /* distance_test.cpp in Sources */,
@@ -516,7 +504,6 @@
670F299B1BAABDA600F2ABF4 /* spline_test.cpp in Sources */,
670F299C1BAABDA600F2ABF4 /* transformations_test.cpp in Sources */,
670F29951BAABDA600F2ABF4 /* region_test.cpp in Sources */,
- 670F29921BAABDA600F2ABF4 /* pointu_to_uint64_test.cpp in Sources */,
670F29891BAABDA600F2ABF4 /* cellid_test.cpp in Sources */,
670F29961BAABDA600F2ABF4 /* region2d_binary_op_test.cpp in Sources */,
670F299D1BAABDA600F2ABF4 /* tree_test.cpp in Sources */,
@@ -524,8 +511,6 @@
670F29991BAABDA600F2ABF4 /* segments_intersect_test.cpp in Sources */,
45A2D9D01F752710003310A0 /* line2d_tests.cpp in Sources */,
670F299E1BAABDA600F2ABF4 /* vector_test.cpp in Sources */,
- 670F296A1BA9D3C200F2ABF4 /* equality.hpp in Sources */,
- 670F296C1BA9D3C200F2ABF4 /* large_polygon.hpp in Sources */,
670F29981BAABDA600F2ABF4 /* screen_test.cpp in Sources */,
670F29801BA9D42E00F2ABF4 /* testingmain.cpp in Sources */,
670F298E1BAABDA600F2ABF4 /* intersect_test.cpp in Sources */,
@@ -536,7 +521,6 @@
670F298B1BAABDA600F2ABF4 /* covering_test.cpp in Sources */,
670F29931BAABDA600F2ABF4 /* polygon_test.cpp in Sources */,
670F298C1BAABDA600F2ABF4 /* distance_on_sphere_test.cpp in Sources */,
- 670F297A1BA9D3C200F2ABF4 /* test_regions.hpp in Sources */,
45A2D9D21F752727003310A0 /* clipping_test.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;