diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2019-05-27 15:06:53 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-05-30 18:53:51 +0300 |
commit | b0868d6d3f371a2aff5db043b219906c95502a42 (patch) | |
tree | aeac2e18d7fdae208b0e2ee919afd19c356b6614 /generator | |
parent | c0fb90a4a8b1228144e564a1fd1734136201d549 (diff) |
[geometry] LatLon refactoring.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/booking_dataset.cpp | 6 | ||||
-rw-r--r-- | generator/booking_quality_check/booking_quality_check.cpp | 10 | ||||
-rw-r--r-- | generator/borders.cpp | 2 | ||||
-rw-r--r-- | generator/extract_addr/extract_addr.cpp | 4 | ||||
-rw-r--r-- | generator/geo_objects/geo_objects.cpp | 4 | ||||
-rw-r--r-- | generator/opentable_dataset.cpp | 4 | ||||
-rw-r--r-- | generator/popularity.cpp | 2 | ||||
-rw-r--r-- | generator/regions/node.cpp | 2 | ||||
-rw-r--r-- | generator/regions/to_string_policy.cpp | 4 | ||||
-rw-r--r-- | generator/restaurants_info/restaurants_info.cpp | 2 | ||||
-rw-r--r-- | generator/sponsored_object_base.hpp | 2 | ||||
-rw-r--r-- | generator/sponsored_object_storage.hpp | 6 | ||||
-rw-r--r-- | generator/srtm_parser.cpp | 20 | ||||
-rw-r--r-- | generator/towns_dumper.cpp | 2 |
14 files changed, 35 insertions, 35 deletions
diff --git a/generator/booking_dataset.cpp b/generator/booking_dataset.cpp index 2e7fe1aa10..64a81a88ce 100644 --- a/generator/booking_dataset.cpp +++ b/generator/booking_dataset.cpp @@ -25,8 +25,8 @@ BookingHotel::BookingHotel(std::string const & src) CLOG(LDEBUG, strings::to_uint(rec[FieldIndex(Fields::Id)], m_id.Get()), ()); // TODO(mgsergio): Use ms::LatLon. - CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Latitude)], m_latLon.lat), ()); - CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Longtitude)], m_latLon.lon), ()); + CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Latitude)], m_latLon.m_lat), ()); + CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Longtitude)], m_latLon.m_lon), ()); m_name = rec[FieldIndex(Fields::Name)]; m_address = rec[FieldIndex(Fields::Address)]; @@ -87,7 +87,7 @@ void BookingDataset::BuildObject(Object const & hotel, { FeatureBuilder1 fb; - fb.SetCenter(MercatorBounds::FromLatLon(hotel.m_latLon.lat, hotel.m_latLon.lon)); + fb.SetCenter(MercatorBounds::FromLatLon(hotel.m_latLon.m_lat, hotel.m_latLon.m_lon)); auto & metadata = fb.GetMetadata(); metadata.Set(feature::Metadata::FMD_SPONSORED_ID, strings::to_string(hotel.m_id.Get())); diff --git a/generator/booking_quality_check/booking_quality_check.cpp b/generator/booking_quality_check/booking_quality_check.cpp index ee3f2d93ff..075a3f6a18 100644 --- a/generator/booking_quality_check/booking_quality_check.cpp +++ b/generator/booking_quality_check/booking_quality_check.cpp @@ -69,7 +69,7 @@ string PrintBuilder(FeatureBuilder1 const & fb) s << "Address: " << address << '\t'; auto const center = MercatorBounds::ToLatLon(fb.GetKeyPoint()); - s << "lat: " << center.lat << " lon: " << center.lon << '\t'; + s << "lat: " << center.m_lat << " lon: " << center.m_lon << '\t'; if (fb.GetGeomType() == feature::GeomType::Point) s << "GeomType: Point"; @@ -229,8 +229,8 @@ void GenerateFactors(Dataset const & dataset, ost << "# " << PrintBuilder(feature) << endl; ost << "# " << object << endl; ost << "# URL: https://www.openstreetmap.org/?mlat=" - << object.m_latLon.lat << "&mlon=" << object.m_latLon.lon << "#map=18/" - << object.m_latLon.lat << "/" << object.m_latLon.lon << endl; + << object.m_latLon.m_lat << "&mlon=" << object.m_latLon.m_lon << "#map=18/" + << object.m_latLon.m_lat << "/" << object.m_latLon.m_lon << endl; } } @@ -281,8 +281,8 @@ void GenerateSample(Dataset const & dataset, outStream << "# " << PrintBuilder(fb) << endl; outStream << "# " << object << endl; outStream << "# URL: https://www.openstreetmap.org/?mlat=" - << object.m_latLon.lat << "&mlon=" << object.m_latLon.lon - << "#map=18/" << object.m_latLon.lat << "/" << object.m_latLon.lon << endl; + << object.m_latLon.m_lat << "&mlon=" << object.m_latLon.m_lon + << "#map=18/" << object.m_latLon.m_lat << "/" << object.m_latLon.m_lon << endl; } if (!sponsoredIndexes.empty()) outStream << endl << endl; diff --git a/generator/borders.cpp b/generator/borders.cpp index 0e39e831c0..c3e8283fd8 100644 --- a/generator/borders.cpp +++ b/generator/borders.cpp @@ -263,7 +263,7 @@ void UnpackBorders(string const & baseDir, string const & targetDir) for (auto p : points) { ms::LatLon const ll = MercatorBounds::ToLatLon(p); - poly << " " << scientific << ll.lon << " " << ll.lat << endl; + poly << " " << scientific << ll.m_lon << " " << ll.m_lat << endl; } poly << "END" << endl; } diff --git a/generator/extract_addr/extract_addr.cpp b/generator/extract_addr/extract_addr.cpp index a81d349fc8..56617d2a6c 100644 --- a/generator/extract_addr/extract_addr.cpp +++ b/generator/extract_addr/extract_addr.cpp @@ -52,8 +52,8 @@ void PrintFeature(FeatureBuilder1 const & fb, uint64_t) auto const center = MercatorBounds::ToLatLon(fb.GetKeyPoint()); auto coordinates = base::NewJSONArray(); - ToJSONArray(*coordinates, std::round(center.lon * kRoundDigits) / kRoundDigits); - ToJSONArray(*coordinates, std::round(center.lat * kRoundDigits) / kRoundDigits); + ToJSONArray(*coordinates, std::round(center.m_lon * kRoundDigits) / kRoundDigits); + ToJSONArray(*coordinates, std::round(center.m_lat * kRoundDigits) / kRoundDigits); auto geometry = base::NewJSONObject(); ToJSONObject(*geometry, "type", "Point"); ToJSONObject(*geometry, "coordinates", coordinates); diff --git a/generator/geo_objects/geo_objects.cpp b/generator/geo_objects/geo_objects.cpp index c6083eb894..4653ad7f32 100644 --- a/generator/geo_objects/geo_objects.cpp +++ b/generator/geo_objects/geo_objects.cpp @@ -55,8 +55,8 @@ void UpdateCoordinates(m2::PointD const & point, base::Json json) if (json_array_size(coordinates) == 2) { auto const latLon = MercatorBounds::ToLatLon(point); - json_array_set_new(coordinates, 0, ToJSON(latLon.lat).release()); - json_array_set_new(coordinates, 1, ToJSON(latLon.lon).release()); + json_array_set_new(coordinates, 0, ToJSON(latLon.m_lat).release()); + json_array_set_new(coordinates, 1, ToJSON(latLon.m_lon).release()); } } diff --git a/generator/opentable_dataset.cpp b/generator/opentable_dataset.cpp index 80cfaf2424..6cdbb801f0 100644 --- a/generator/opentable_dataset.cpp +++ b/generator/opentable_dataset.cpp @@ -25,8 +25,8 @@ OpentableRestaurant::OpentableRestaurant(std::string const & src) boost::replace_all_copy(src, "\t", "\\t"))); CLOG(LDEBUG, strings::to_uint(rec[FieldIndex(Fields::Id)], m_id.Get()), ()); - CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Latitude)], m_latLon.lat), ()); - CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Longtitude)], m_latLon.lon), ()); + CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Latitude)], m_latLon.m_lat), ()); + CLOG(LDEBUG, strings::to_double(rec[FieldIndex(Fields::Longtitude)], m_latLon.m_lon), ()); m_name = rec[FieldIndex(Fields::Name)]; m_address = rec[FieldIndex(Fields::Address)]; diff --git a/generator/popularity.cpp b/generator/popularity.cpp index ad6467b54c..887cb389c3 100644 --- a/generator/popularity.cpp +++ b/generator/popularity.cpp @@ -302,7 +302,7 @@ void WriteLines(std::vector<PopularityLine> const & lines, std::string const & o stream << *line.m_parent; auto const center = MercatorBounds::ToLatLon(line.m_center); - stream << ";" << center.lat << ";" << center.lon << ";" + stream << ";" << center.m_lat << ";" << center.m_lon << ";" << line.m_type << ";" << line.m_name << "\n"; } } diff --git a/generator/regions/node.cpp b/generator/regions/node.cpp index 909039004a..6d54bd7cb0 100644 --- a/generator/regions/node.cpp +++ b/generator/regions/node.cpp @@ -157,7 +157,7 @@ void PrintTree(Node::Ptr node, std::ostream & stream = std::cout, std::string pr << DebugPrint(d.GetId()) << ";" << (label ? label : "-") << ";" << static_cast<size_t>(d.GetRank()) - << ";[" << std::fixed << std::setprecision(7) << center.lat << "," << center.lon << "])" + << ";[" << std::fixed << std::setprecision(7) << center.m_lat << "," << center.m_lon << "])" << std::endl; for (size_t i = 0, size = children.size(); i < size; ++i) PrintTree(children[i], stream, prefix, i == size - 1); diff --git a/generator/regions/to_string_policy.cpp b/generator/regions/to_string_policy.cpp index a06bd680c4..c903dfb465 100644 --- a/generator/regions/to_string_policy.cpp +++ b/generator/regions/to_string_policy.cpp @@ -21,8 +21,8 @@ std::string JsonPolicy::ToString(NodePath const & path) const auto coordinates = base::NewJSONArray(); auto const tmpCenter = main.GetCenter(); auto const center = MercatorBounds::ToLatLon({tmpCenter.get<0>(), tmpCenter.get<1>()}); - ToJSONArray(*coordinates, center.lat); - ToJSONArray(*coordinates, center.lon); + ToJSONArray(*coordinates, center.m_lat); + ToJSONArray(*coordinates, center.m_lon); ToJSONObject(*geometry, "coordinates", coordinates); auto localeEn = base::NewJSONObject(); diff --git a/generator/restaurants_info/restaurants_info.cpp b/generator/restaurants_info/restaurants_info.cpp index ec6b954dc2..8878dd0199 100644 --- a/generator/restaurants_info/restaurants_info.cpp +++ b/generator/restaurants_info/restaurants_info.cpp @@ -62,7 +62,7 @@ void DumpRestaurants(std::vector<FeatureBuilder1> const & features, std::ostream auto const center = MercatorBounds::ToLatLon(f.GetKeyPoint()); out << defaultName << '\t' << strings::JoinStrings(translations, '|') << '\t' - << center.lat << ' ' << center.lon << '\t' << DebugPrint(f.GetGeomType()) << "\n"; + << center.m_lat << ' ' << center.m_lon << '\t' << DebugPrint(f.GetGeomType()) << "\n"; } } } // namespace diff --git a/generator/sponsored_object_base.hpp b/generator/sponsored_object_base.hpp index e2c273543e..356632c9ab 100644 --- a/generator/sponsored_object_base.hpp +++ b/generator/sponsored_object_base.hpp @@ -45,7 +45,7 @@ inline std::ostream & operator<<(std::ostream & s, SponsoredObjectBase const & h { s << std::fixed << std::setprecision(7); s << "Id: " << h.m_id << "\t Name: " << h.m_name << "\t Address: " << h.m_address - << "\t lat: " << h.m_latLon.lat << " lon: " << h.m_latLon.lon; + << "\t lat: " << h.m_latLon.m_lat << " lon: " << h.m_latLon.m_lon; return s; } } // namespace generator diff --git a/generator/sponsored_object_storage.hpp b/generator/sponsored_object_storage.hpp index a04e395226..91d39c5754 100644 --- a/generator/sponsored_object_storage.hpp +++ b/generator/sponsored_object_storage.hpp @@ -124,8 +124,8 @@ public: for (auto const & item : m_objects) { auto const & object = item.second; - Box b(Point(object.m_latLon.lat, object.m_latLon.lon), - Point(object.m_latLon.lat, object.m_latLon.lon)); + Box b(Point(object.m_latLon.m_lat, object.m_latLon.m_lon), + Point(object.m_latLon.m_lat, object.m_latLon.m_lon)); m_rtree.insert(make_pair(b, object.m_id)); } } @@ -149,7 +149,7 @@ public: namespace bgi = boost::geometry::index; std::vector<ObjectId> indexes; - for_each(bgi::qbegin(m_rtree, bgi::nearest(Point(latLon.lat, latLon.lon), + for_each(bgi::qbegin(m_rtree, bgi::nearest(Point(latLon.m_lat, latLon.m_lon), static_cast<unsigned>(m_maxSelectedElements))), bgi::qend(m_rtree), [this, &latLon, &indexes](Value const & v) { auto const & object = GetObjectById(v.second); diff --git a/generator/srtm_parser.cpp b/generator/srtm_parser.cpp index 7ecb577a7c..33e3055249 100644 --- a/generator/srtm_parser.cpp +++ b/generator/srtm_parser.cpp @@ -89,10 +89,10 @@ feature::TAltitude SrtmTile::GetHeight(ms::LatLon const & coord) if (!IsValid()) return feature::kInvalidAltitude; - double ln = coord.lon - static_cast<int>(coord.lon); + double ln = coord.m_lon - static_cast<int>(coord.m_lon); if (ln < 0) ln += 1; - double lt = coord.lat - static_cast<int>(coord.lat); + double lt = coord.m_lat - static_cast<int>(coord.m_lat); if (lt < 0) lt += 1; lt = 1 - lt; // from North to South @@ -110,29 +110,29 @@ feature::TAltitude SrtmTile::GetHeight(ms::LatLon const & coord) std::string SrtmTile::GetBase(ms::LatLon coord) { std::ostringstream ss; - if (coord.lat < 0) + if (coord.m_lat < 0) { ss << "S"; - coord.lat *= -1; - coord.lat += 1; + coord.m_lat *= -1; + coord.m_lat += 1; } else { ss << "N"; } - ss << std::setw(2) << std::setfill('0') << static_cast<int>(coord.lat); + ss << std::setw(2) << std::setfill('0') << static_cast<int>(coord.m_lat); - if (coord.lon < 0) + if (coord.m_lon < 0) { ss << "W"; - coord.lon *= -1; - coord.lon += 1; + coord.m_lon *= -1; + coord.m_lon += 1; } else { ss << "E"; } - ss << std::setw(3) << static_cast<int>(coord.lon); + ss << std::setw(3) << static_cast<int>(coord.m_lon); return ss.str(); } diff --git a/generator/towns_dumper.cpp b/generator/towns_dumper.cpp index 9e96f9a666..a1aeb1581d 100644 --- a/generator/towns_dumper.cpp +++ b/generator/towns_dumper.cpp @@ -108,6 +108,6 @@ void TownsDumper::Dump(std::string const & filePath) for (auto const & record : m_records) { std::string const isCapital = record.capital ? "t" : "f"; - stream << record.point.lat << ";" << record.point.lon << ";" << record.id << ";" << isCapital << std::endl; + stream << record.point.m_lat << ";" << record.point.m_lon << ";" << record.id << ";" << isCapital << std::endl; } } |