diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index 4ddac68089..82067429bf 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -285,14 +285,12 @@ ApplyLineFeature::ApplyLineFeature(EngineContext & context, TileKey tileKey, { } -void ApplyLineFeature::operator ()(CoordPointT const & point) +void ApplyLineFeature::operator() (m2::PointD const & point) { - m2::PointD const inputPt(point.first, point.second); - if (m_spline.IsNull()) m_spline.Reset(new m2::Spline()); - m_spline->AddPoint(inputPt); + m_spline->AddPoint(point); } bool ApplyLineFeature::HasGeometry() const diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp index 740b4b8a15..18cb66349c 100644 --- a/drape_frontend/apply_feature_functors.hpp +++ b/drape_frontend/apply_feature_functors.hpp @@ -48,7 +48,6 @@ public: FeatureID const & id, CaptionDescription const & captions); - void operator()(CoordPointT const & point); void operator()(m2::PointD const & point); void ProcessRule(Stylist::rule_wrapper_t const & rule); void Finish(); @@ -90,7 +89,7 @@ public: CaptionDescription const & captions, double currentScaleGtoP); - void operator ()(CoordPointT const & point); + void operator() (m2::PointD const & point); bool HasGeometry() const; void ProcessRule(Stylist::rule_wrapper_t const & rule); void Finish(); diff --git a/generator/coastlines_generator.cpp b/generator/coastlines_generator.cpp index ea82f85b84..e57dff2467 100644 --- a/generator/coastlines_generator.cpp +++ b/generator/coastlines_generator.cpp @@ -183,10 +183,9 @@ namespace void operator() (PointT const & p) { - CoordPointT const c = PointU2PointD(m2::PointU( + m_points.push_back(PointU2PointD(m2::PointU( static_cast(p.x), - static_cast(p.y)), POINT_COORD_BITS); - m_points.push_back(m2::PointD(c.first, c.second)); + static_cast(p.y)), POINT_COORD_BITS)); } size_t GetPointsCount() const diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 1d0da04289..b599f10683 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -50,7 +50,7 @@ namespace ft.ForEachGeometryPoint(*this); m_midLoc = m_midLoc / m_locCount; - uint64_t const pointAsInt64 = PointToInt64(m_midLoc.x, m_midLoc.y, m_coordBits); + uint64_t const pointAsInt64 = PointToInt64(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/indexer/cell_coverer.hpp b/indexer/cell_coverer.hpp index 3763fac592..d08bac64fe 100644 --- a/indexer/cell_coverer.hpp +++ b/indexer/cell_coverer.hpp @@ -9,14 +9,14 @@ template inline void SplitRectCell(CellIdT id, - CoordT minX, CoordT minY, - CoordT maxX, CoordT maxY, + double minX, double minY, + double maxX, double maxY, vector & result) { for (int8_t i = 0; i < 4; ++i) { CellIdT child = id.Child(i); - CoordT minCellX, minCellY, maxCellX, maxCellY; + double minCellX, minCellY, maxCellX, maxCellY; CellIdConverter::GetCellBounds(child, minCellX, minCellY, maxCellX, maxCellY); if (!((maxX < minCellX) || (minX > maxCellX) || (maxY < minCellY) || (minY > maxCellY))) result.push_back(child); @@ -24,8 +24,8 @@ inline void SplitRectCell(CellIdT id, } template -inline void CoverRect(CoordT minX, CoordT minY, - CoordT maxX, CoordT maxY, +inline void CoverRect(double minX, double minY, + double maxX, double maxY, size_t cells_count, int maxDepth, vector & cells) { diff --git a/indexer/cell_id.hpp b/indexer/cell_id.hpp index 1a4e62f143..e4779d36eb 100644 --- a/indexer/cell_id.hpp +++ b/indexer/cell_id.hpp @@ -23,25 +23,25 @@ template class CellIdConverter { public: - static CoordT XToCellIdX(CoordT x) + static double XToCellIdX(double x) { return (x - BoundsT::minX) / StepX(); } - static CoordT YToCellIdY(CoordT y) + static double YToCellIdY(double y) { return (y - BoundsT::minY) / StepY(); } - static CoordT CellIdXToX(CoordT x) + static double CellIdXToX(double x) { return (x*StepX() + BoundsT::minX); } - static CoordT CellIdYToY(CoordT y) + static double CellIdYToY(double y) { return (y*StepY() + BoundsT::minY); } - static CellIdT ToCellId(CoordT x, CoordT y) + static CellIdT ToCellId(double x, double y) { uint32_t const ix = static_cast(XToCellIdX(x)); uint32_t const iy = static_cast(YToCellIdY(y)); @@ -58,7 +58,7 @@ public: return id; } - static CellIdT Cover2PointsWithCell(CoordT x1, CoordT y1, CoordT x2, CoordT y2) + static CellIdT Cover2PointsWithCell(double x1, double y1, double x2, double y2) { CellIdT id1 = ToCellId(x1, y1); CellIdT id2 = ToCellId(x2, y2); @@ -78,13 +78,14 @@ public: return id1; } - static CoordPointT FromCellId(CellIdT id) + static m2::PointD FromCellId(CellIdT id) { pair const xy = id.XY(); - return CoordPointT(CellIdXToX(xy.first), CellIdYToY(xy.second)); + return m2::PointD(CellIdXToX(xy.first), CellIdYToY(xy.second)); } - static void GetCellBounds(CellIdT id, CoordT & minX, CoordT & minY, CoordT & maxX, CoordT & maxY) + static void GetCellBounds(CellIdT id, + double & minX, double & minY, double & maxX, double & maxY) { pair const xy = id.XY(); uint32_t const r = id.Radius(); @@ -93,13 +94,14 @@ public: minY = (xy.second - r) * StepY() + BoundsT::minY; maxY = (xy.second + r) * StepY() + BoundsT::minY; } + private: - inline static CoordT StepX() + inline static double StepX() { - return CoordT(BoundsT::maxX - BoundsT::minX) / CellIdT::MAX_COORD; + return double(BoundsT::maxX - BoundsT::minX) / CellIdT::MAX_COORD; } - inline static CoordT StepY() + inline static double StepY() { - return CoordT(BoundsT::maxY - BoundsT::minY) / CellIdT::MAX_COORD; + return double(BoundsT::maxY - BoundsT::minY) / CellIdT::MAX_COORD; } }; diff --git a/indexer/coding_params.cpp b/indexer/coding_params.cpp index 9165779695..67484de690 100644 --- a/indexer/coding_params.cpp +++ b/indexer/coding_params.cpp @@ -26,7 +26,7 @@ namespace serial void CodingParams::SetBasePoint(m2::PointD const & pt) { - m_BasePoint = PointD2PointU(pt.x, pt.y, m_CoordBits); + m_BasePoint = PointD2PointU(pt, m_CoordBits); m_BasePointUint64 = m2::PointUToUint64(m_BasePoint); } } diff --git a/indexer/feature.cpp b/indexer/feature.cpp index 610e21326f..6f6561299f 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -351,10 +351,8 @@ namespace m_dist = m_pt.Length(p); } - void operator() (CoordPointT const & p) + void operator() (m2::PointD const & pt) { - m2::PointD pt(p.first, p.second); - if (m_hasPrev) m_dist = min(m_dist, GetDistance(m_prev, pt, m_pt)); else diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 964508cd85..0357f820de 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -181,12 +181,12 @@ public: { // it's a point feature if (GetFeatureType() == feature::GEOM_POINT) - f(CoordPointT(m_center.x, m_center.y)); + f(m_center); } else { for (size_t i = 0; i < m_points.size(); ++i) - f(CoordPointT(m_points[i].x, m_points[i].y)); + f(m_points[i]); } } diff --git a/indexer/feature_algo.cpp b/indexer/feature_algo.cpp index 58248fed4f..1986f1d14d 100644 --- a/indexer/feature_algo.cpp +++ b/indexer/feature_algo.cpp @@ -27,12 +27,10 @@ class CalculateLineCenter public: CalculateLineCenter() : m_length(0.0) {} - void operator() (CoordPointT const & pt) + void operator() (m2::PointD const & pt) { - m2::PointD p(pt.first, pt.second); - - m_length += (m_poly.empty() ? 0.0 : m_poly.back().m_p.Length(p)); - m_poly.push_back(Value(p, m_length)); + m_length += (m_poly.empty() ? 0.0 : m_poly.back().m_p.Length(pt)); + m_poly.emplace_back(pt, m_length); } P GetCenter() const diff --git a/indexer/feature_covering.cpp b/indexer/feature_covering.cpp index dbdba94730..7aa3fb4307 100644 --- a/indexer/feature_covering.cpp +++ b/indexer/feature_covering.cpp @@ -6,13 +6,9 @@ #include "../geometry/covering_utils.hpp" -#include "../base/base.hpp" -#include "../base/stl_add.hpp" - -#include "../std/algorithm.hpp" -#include "../std/bind.hpp" #include "../std/vector.hpp" + namespace { @@ -98,23 +94,22 @@ public: typedef CellIdConverter CellIdConverterType; - m2::PointD ConvertPoint(double x, double y) + m2::PointD ConvertPoint(m2::PointD const & p) { - m2::PointD pt(CellIdConverterType::XToCellIdX(x), CellIdConverterType::YToCellIdY(y)); + m2::PointD const pt(CellIdConverterType::XToCellIdX(p.x), + CellIdConverterType::YToCellIdY(p.y)); m_rect.Add(pt); return pt; } - void operator() (pair const & pt) + void operator() (m2::PointD const & pt) { - m_polyline.push_back(ConvertPoint(pt.first, pt.second)); + m_polyline.push_back(ConvertPoint(pt)); } void operator() (m2::PointD const & a, m2::PointD const & b, m2::PointD const & c) { - m_trg.push_back(Trg(ConvertPoint(a.x, a.y), - ConvertPoint(b.x, b.y), - ConvertPoint(c.x, c.y))); + m_trg.emplace_back(ConvertPoint(a), ConvertPoint(b), ConvertPoint(c)); } }; diff --git a/indexer/feature_covering.hpp b/indexer/feature_covering.hpp index e72dc3e08a..d8abea2954 100644 --- a/indexer/feature_covering.hpp +++ b/indexer/feature_covering.hpp @@ -3,11 +3,10 @@ #include "../geometry/rect2d.hpp" -#include "../base/base.hpp" - #include "../std/utility.hpp" #include "../std/vector.hpp" + class FeatureType; namespace covering diff --git a/indexer/geometry_serialization.cpp b/indexer/geometry_serialization.cpp index 3a56f7032c..f43ba6a746 100644 --- a/indexer/geometry_serialization.cpp +++ b/indexer/geometry_serialization.cpp @@ -22,12 +22,12 @@ namespace serial inline m2::PointD U2D(m2::PointU const & p, uint32_t coordBits) { - CoordPointT const pt = PointU2PointD(p, coordBits); - ASSERT(MercatorBounds::minX <= pt.first && pt.first <= MercatorBounds::maxX, \ + m2::PointD const pt = PointU2PointD(p, coordBits); + ASSERT(MercatorBounds::minX <= pt.x && pt.y <= MercatorBounds::maxX, (p, pt, coordBits)); - ASSERT(MercatorBounds::minY <= pt.second && pt.second <= MercatorBounds::maxY, \ + ASSERT(MercatorBounds::minY <= pt.x && pt.y <= MercatorBounds::maxY, (p, pt, coordBits)); - return m2::PointD(pt.first, pt.second); + return pt; } inline m2::PointU GetMaxPoint(CodingParams const & params) diff --git a/indexer/geometry_serialization.hpp b/indexer/geometry_serialization.hpp index 4f9a93d5c6..bd0662844e 100644 --- a/indexer/geometry_serialization.hpp +++ b/indexer/geometry_serialization.hpp @@ -54,15 +54,15 @@ namespace serial template void SavePoint(TSink & sink, m2::PointD const & pt, CodingParams const & cp) { - WriteVarUint(sink, EncodeDelta(PointD2PointU(pt.x, pt.y, cp.GetCoordBits()), cp.GetBasePoint())); + WriteVarUint(sink, EncodeDelta(PointD2PointU(pt, cp.GetCoordBits()), cp.GetBasePoint())); } template m2::PointD LoadPoint(TSource & src, CodingParams const & cp) { - CoordPointT const c = PointU2PointD( + m2::PointD const pt = PointU2PointD( DecodeDelta(ReadVarUint(src), cp.GetBasePoint()), cp.GetCoordBits()); - return m2::PointD(c.first, c.second); + return pt; } template diff --git a/indexer/indexer_tests/cell_id_test.cpp b/indexer/indexer_tests/cell_id_test.cpp index dec42f678b..8d609b33c7 100644 --- a/indexer/indexer_tests/cell_id_test.cpp +++ b/indexer/indexer_tests/cell_id_test.cpp @@ -42,12 +42,12 @@ UNIT_TEST(CellId_RandomRecode) PseudoRNG32 rng; for (size_t i = 0; i < 1000; ++i) { - uint32_t x = rng.Generate() % 2000; - uint32_t y = rng.Generate() % 1000; - pair xy = + uint32_t const x = rng.Generate() % 2000; + uint32_t const y = rng.Generate() % 1000; + m2::PointD const pt = CellIdConverter, CellIdT>::FromCellId( CellIdConverter, CellIdT>::ToCellId(x, y)); - TEST(fabs(xy.first - x) < 0.0002, (x, y, xy)); - TEST(fabs(xy.second - y) < 0.0001, (x, y, xy)); + TEST(fabs(pt.x - x) < 0.0002, (x, y, pt)); + TEST(fabs(pt.y - y) < 0.0001, (x, y, pt)); } } diff --git a/indexer/indexer_tests/point_to_int64_test.cpp b/indexer/indexer_tests/point_to_int64_test.cpp index 041888c1d8..2240dfd56a 100644 --- a/indexer/indexer_tests/point_to_int64_test.cpp +++ b/indexer/indexer_tests/point_to_int64_test.cpp @@ -15,38 +15,28 @@ namespace double const g_eps = MercatorBounds::GetCellID2PointAbsEpsilon(); uint32_t const g_coordBits = POINT_COORD_BITS; - void CheckEqualPoints(CoordPointT const & p1, CoordPointT const & p2) + void CheckEqualPoints(m2::PointD const & p1, m2::PointD const & p2) { - TEST(fabs(p1.first - p2.first) < g_eps && - fabs(p1.second - p2.second) < g_eps, - (p1, p2)); + TEST(fabs(p1.x - p2.x) < g_eps && fabs(p1.y - p2.y) < g_eps, (p1, p2)); - TEST_GREATER_OR_EQUAL(p1.first, -180.0, ()); - TEST_GREATER_OR_EQUAL(p1.second, -180.0, ()); - TEST_LESS_OR_EQUAL(p1.first, 180.0, ()); - TEST_LESS_OR_EQUAL(p1.second, 180.0, ()); + TEST_GREATER_OR_EQUAL(p1.x, -180.0, ()); + TEST_GREATER_OR_EQUAL(p1.y, -180.0, ()); + TEST_LESS_OR_EQUAL(p1.x, 180.0, ()); + TEST_LESS_OR_EQUAL(p1.y, 180.0, ()); - TEST_GREATER_OR_EQUAL(p2.first, -180.0, ()); - TEST_GREATER_OR_EQUAL(p2.second, -180.0, ()); - TEST_LESS_OR_EQUAL(p2.first, 180.0, ()); - TEST_LESS_OR_EQUAL(p2.second, 180.0, ()); + TEST_GREATER_OR_EQUAL(p2.x, -180.0, ()); + TEST_GREATER_OR_EQUAL(p2.y, -180.0, ()); + TEST_LESS_OR_EQUAL(p2.x, 180.0, ()); + TEST_LESS_OR_EQUAL(p2.y, 180.0, ()); } - - struct pod_point_t - { - double x, y; - }; } UNIT_TEST(PointToInt64_Smoke) { - pod_point_t arr[] = { {1.25, 1.3}, {180, 90}, {-180, -90}, {0, 0} }; + m2::PointD const arr[] = { {1.25, 1.3}, {180, 90}, {-180, -90}, {0, 0} }; for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) - { - CoordPointT p(arr[i].x, arr[i].y); - CheckEqualPoints(p, Int64ToPoint(PointToInt64(p, g_coordBits), g_coordBits)); - } + CheckEqualPoints(arr[i], Int64ToPoint(PointToInt64(arr[i], g_coordBits), g_coordBits)); } UNIT_TEST(PointToInt64_Grid) @@ -55,9 +45,9 @@ UNIT_TEST(PointToInt64_Grid) for (int ix = -180; ix <= 180; ix += delta) for (int iy = -180; iy <= 180; iy += delta) { - CoordPointT const pt(ix, iy); + m2::PointD const pt(ix, iy); int64_t const id = PointToInt64(pt, g_coordBits); - CoordPointT const pt1 = Int64ToPoint(id, g_coordBits); + m2::PointD const pt1 = Int64ToPoint(id, g_coordBits); CheckEqualPoints(pt, pt1); @@ -68,9 +58,9 @@ UNIT_TEST(PointToInt64_Grid) UNIT_TEST(PointToInt64_Bounds) { - double arrEps[] = { -1.0E-2, -1.0E-3, -1.0E-4, 0, 1.0E-4, 1.0E-3, 1.0E-2 }; + double const arrEps[] = { -1.0E-2, -1.0E-3, -1.0E-4, 0, 1.0E-4, 1.0E-3, 1.0E-2 }; - pod_point_t arrPt[] = { {0, 0}, + m2::PointD const arrPt[] = { {0, 0}, {-180, -180}, {-180, 180}, {180, 180}, {180, -180}, {-90, -90}, {-90, 90}, {90, 90}, {90, -90} }; @@ -79,11 +69,11 @@ UNIT_TEST(PointToInt64_Bounds) for (size_t iX = 0; iX < ARRAY_SIZE(arrEps); ++iX) for (size_t iY = 0; iY < ARRAY_SIZE(arrEps); ++iY) { - CoordPointT const pt(arrPt[iP].x + arrEps[iX], arrPt[iP].y + arrEps[iY]); - CoordPointT const pt1 = Int64ToPoint(PointToInt64(pt, g_coordBits), g_coordBits); + 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); - TEST(fabs(pt.first - pt1.first) <= (fabs(arrEps[iX]) + g_eps) && - fabs(pt.second - pt1.second) <= (fabs(arrEps[iY]) + g_eps), (pt, pt1)); + TEST(fabs(pt.x - pt1.x) <= (fabs(arrEps[iX]) + g_eps) && + fabs(pt.y - pt1.y) <= (fabs(arrEps[iY]) + g_eps), (pt, pt1)); } } @@ -91,9 +81,9 @@ UNIT_TEST(PointToInt64_DataSet1) { for (size_t i = 0; i < ARRAY_SIZE(index_test::arr1); ++i) { - CoordPointT const pt(index_test::arr1[i].x, index_test::arr1[i].y); + m2::PointD const pt(index_test::arr1[i].x, index_test::arr1[i].y); int64_t const id = PointToInt64(pt, g_coordBits); - CoordPointT const pt1 = Int64ToPoint(id, g_coordBits); + m2::PointD const pt1 = Int64ToPoint(id, g_coordBits); CheckEqualPoints(pt, pt1); @@ -104,8 +94,8 @@ UNIT_TEST(PointToInt64_DataSet1) UNIT_TEST(PointD2PointU_Epsilons) { - pod_point_t arrPt[] = { {-180, -180}, {-180, 180}, {180, 180}, {180, -180} }; - pod_point_t arrD[] = { {1, 1}, {1, -1}, {-1, -1}, {-1, 1} }; + 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); /* @@ -132,8 +122,8 @@ UNIT_TEST(PointD2PointU_Epsilons) { 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); - CoordPointT const p3 = PointU2PointD(p2, g_coordBits); + m2::PointD const p3 = PointU2PointD(p2, g_coordBits); - LOG(LINFO, ("Dx = ", p3.first - arrPt[i].x, "Dy = ", p3.second - arrPt[i].y)); + LOG(LINFO, ("Dx = ", p3.x - arrPt[i].x, "Dy = ", p3.y - arrPt[i].y)); } } diff --git a/indexer/old/feature_loader_101.cpp b/indexer/old/feature_loader_101.cpp index 12735fab82..4c42cf6ba0 100644 --- a/indexer/old/feature_loader_101.cpp +++ b/indexer/old/feature_loader_101.cpp @@ -173,10 +173,9 @@ void LoaderImpl::ParseCommon() if (h & HEADER_HAS_POINT) { - CoordPointT const center = Int64ToPoint( + m_pF->m_center = Int64ToPoint( ReadVarInt(source) + GetDefCodingParams().GetBasePointInt64(), POINT_COORD_BITS); - m_pF->m_center = m2::PointD(center.first, center.second); m_pF->m_limitRect.Add(m_pF->m_center); } diff --git a/indexer/point_to_int64.cpp b/indexer/point_to_int64.cpp index 1c082de7fb..7b762b202a 100644 --- a/indexer/point_to_int64.cpp +++ b/indexer/point_to_int64.cpp @@ -12,7 +12,7 @@ namespace inline double CoordSize(uint32_t coordBits) { return (1 << coordBits) - 1; } } -m2::PointU PointD2PointU(CoordT x, CoordT y, uint32_t coordBits) +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); @@ -28,7 +28,7 @@ m2::PointU PointD2PointU(CoordT x, CoordT y, uint32_t coordBits) return m2::PointU(ix, iy); } -int64_t PointToInt64(CoordT x, CoordT y, uint32_t coordBits) +int64_t PointToInt64(double x, double y, uint32_t coordBits) { int64_t const res = static_cast(m2::PointUToUint64(PointD2PointU(x, y, coordBits))); @@ -38,16 +38,16 @@ int64_t PointToInt64(CoordT x, CoordT y, uint32_t coordBits) return res; } -CoordPointT PointU2PointD(m2::PointU const & pt, uint32_t coordBits) +m2::PointD PointU2PointD(m2::PointU const & pt, uint32_t coordBits) { - return CoordPointT( - static_cast(pt.x) * (MercatorBounds::maxX - MercatorBounds::minX) + return m2::PointD( + static_cast(pt.x) * (MercatorBounds::maxX - MercatorBounds::minX) / CoordSize(coordBits) + MercatorBounds::minX, - static_cast(pt.y) * (MercatorBounds::maxY - MercatorBounds::minY) + static_cast(pt.y) * (MercatorBounds::maxY - MercatorBounds::minY) / CoordSize(coordBits) + MercatorBounds::minY); } -CoordPointT Int64ToPoint(int64_t v, uint32_t coordBits) +m2::PointD Int64ToPoint(int64_t v, uint32_t coordBits) { ASSERT_LESS_OR_EQUAL(v, 3ULL << 2 * POINT_COORD_BITS, ()); return PointU2PointD(m2::Uint64ToPointU(static_cast(v)), coordBits); @@ -62,7 +62,7 @@ pair RectToInt64(m2::RectD const & r, uint32_t coordBits) m2::RectD Int64ToRect(pair const & p, uint32_t coordBits) { - CoordPointT const pt1 = Int64ToPoint(p.first, coordBits); - CoordPointT const pt2 = Int64ToPoint(p.second, coordBits); - return m2::RectD(m2::PointD(pt1.first, pt1.second), m2::PointD(pt2.first, pt2.second)); + m2::PointD const pt1 = Int64ToPoint(p.first, coordBits); + m2::PointD const pt2 = Int64ToPoint(p.second, coordBits); + return m2::RectD(pt1, pt2); } diff --git a/indexer/point_to_int64.hpp b/indexer/point_to_int64.hpp index 947703e712..4a11007336 100644 --- a/indexer/point_to_int64.hpp +++ b/indexer/point_to_int64.hpp @@ -8,31 +8,23 @@ #define POINT_COORD_BITS 30 - -typedef double CoordT; -typedef pair CoordPointT; - typedef m2::CellId<19> RectId; -m2::PointU PointD2PointU(CoordT x, CoordT y, uint32_t coordBits); +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); } -CoordPointT PointU2PointD(m2::PointU const & p, uint32_t coordBits); +m2::PointD PointU2PointD(m2::PointU const & p, uint32_t coordBits); -int64_t PointToInt64(CoordT x, CoordT y, uint32_t coordBits); -inline int64_t PointToInt64(CoordPointT const & pt, uint32_t coordBits) -{ - return PointToInt64(pt.first, pt.second, 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); } -CoordPointT Int64ToPoint(int64_t v, uint32_t coordBits); +m2::PointD Int64ToPoint(int64_t v, uint32_t coordBits); pair RectToInt64(m2::RectD const & r, uint32_t coordBits); m2::RectD Int64ToRect(pair const & p, uint32_t coordBits); diff --git a/indexer/search_trie.hpp b/indexer/search_trie.hpp index f44d8b5166..3375d93e75 100644 --- a/indexer/search_trie.hpp +++ b/indexer/search_trie.hpp @@ -55,7 +55,6 @@ typedef ::trie::reader::EmptyValueReader EdgeValueReader; inline serial::CodingParams GetCPForTrie(serial::CodingParams const & orig) { - CoordPointT const p = PointU2PointD(orig.GetBasePoint(), orig.GetCoordBits()); - return serial::CodingParams(POINT_CODING_BITS, m2::PointD(p.first, p.second)); + return serial::CodingParams(POINT_CODING_BITS, PointU2PointD(orig.GetBasePoint(), orig.GetCoordBits())); } } // namespace search diff --git a/map/geometry_processors.cpp b/map/geometry_processors.cpp index aeef95c6ea..92f4af1057 100644 --- a/map/geometry_processors.cpp +++ b/map/geometry_processors.cpp @@ -12,12 +12,10 @@ namespace gp m_convertor->GtoP(*p.m_rect, m_rect); } - void one_point::operator() (CoordPointT const & p) + void one_point::operator() (m2::PointD const & pt) { ASSERT ( !m_exist, ("point feature should have only one point") ); - m2::PointD pt(make_point(p)); - if (m_rect->IsPointInside(pt)) { m_exist = true; @@ -275,5 +273,4 @@ namespace gp { return !m_points.empty(); } - } diff --git a/map/geometry_processors.hpp b/map/geometry_processors.hpp index 62b574c426..b644bcef7a 100644 --- a/map/geometry_processors.hpp +++ b/map/geometry_processors.hpp @@ -42,11 +42,6 @@ namespace gp ScreenBase const * m_convertor; - static m2::PointD make_point(CoordPointT const & p) - { - return m2::PointD(p.first, p.second); - } - m2::PointD g2p(m2::PointD const & pt) const { return m_convertor->GtoP(pt); @@ -110,9 +105,9 @@ namespace gp TBase(p), m_exist(false), m_length(0) {} - void operator() (CoordPointT const & p) + void operator() (m2::PointD const & p) { - m2::PointD pt(this->convert_point(this->make_point(p))); + m2::PointD const pt(this->convert_point(p)); if (m_exist) m_length += pt.Length(m_prevPt); @@ -139,7 +134,7 @@ namespace gp { } - void operator() (CoordPointT const & p); + void operator() (m2::PointD const & pt); bool IsExist() const { @@ -314,13 +309,13 @@ namespace gp filter_screenpts_adapter(params const & p) : TBase(p), - m_prev(numeric_limits::min(), numeric_limits::min()), m_center(0, 0) + m_prev(numeric_limits::min(), numeric_limits::min()), m_center(0, 0) { } - void operator() (CoordPointT const & p) + void operator() (m2::PointD const & p) { - m2::PointD pt = this->g2p(this->make_point(p)); + m2::PointD const pt = this->g2p(p); if (!equal_scr_pts(m_prev, pt)) { TBase::operator()(pt); diff --git a/map/map_tests/feature_processor_test.cpp b/map/map_tests/feature_processor_test.cpp index 269e2b20c7..b04fdbaffa 100644 --- a/map/map_tests/feature_processor_test.cpp +++ b/map/map_tests/feature_processor_test.cpp @@ -63,7 +63,7 @@ UNIT_TEST(PathPoints_ClipAsIntervals) cut_functor_t cut_fun(cp); for (size_t i = 0; i < ARRAY_SIZE(pts); ++i) - cut_fun(CoordPointT(pts[i].x, pts[i].y)); + cut_fun(pts[i]); m2::PointD res1[] = { m2::PointD(5, 10), diff --git a/map/mwm_tests/mwm_foreach_test.cpp b/map/mwm_tests/mwm_foreach_test.cpp index bbab151564..438efe78de 100644 --- a/map/mwm_tests/mwm_foreach_test.cpp +++ b/map/mwm_tests/mwm_foreach_test.cpp @@ -76,11 +76,10 @@ public: m_intersect = m_rect.IsPointInside(p); } - void operator() (CoordPointT const & p) + void operator() (m2::PointD const & pt) { if (m_intersect) return; - m2::PointD pt(p.first, p.second); if (m_isPrev) { m2::PointD d1 = m_prev; diff --git a/map/mwm_tests/mwm_index_test.cpp b/map/mwm_tests/mwm_index_test.cpp index 732b803ed9..0d1c1ed093 100644 --- a/map/mwm_tests/mwm_index_test.cpp +++ b/map/mwm_tests/mwm_index_test.cpp @@ -23,7 +23,7 @@ public: void operator() (FeatureType const & ft) { bool res = false; - ft.ForEachPoint([&res] (CoordPointT const &) { res = true; }, m_scale); + ft.ForEachPoint([&res] (m2::PointD const &) { res = true; }, m_scale); ft.ForEachTriangle([&res] (m2::PointD const &, m2::PointD const &, m2::PointD const &) { res = true; }, m_scale); TEST(res, (ft, "Scale =", m_scale)); diff --git a/search/house_detector.cpp b/search/house_detector.cpp index eaceb91dd4..bb14cd2d63 100644 --- a/search/house_detector.cpp +++ b/search/house_detector.cpp @@ -196,9 +196,9 @@ class StreetCreator Street * m_street; public: StreetCreator(Street * st) : m_street(st) {} - void operator () (CoordPointT const & point) const + void operator () (m2::PointD const & pt) const { - m_street->m_points.push_back(m2::PointD(point.first, point.second)); + m_street->m_points.push_back(pt); } };