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 /editor | |
parent | c0fb90a4a8b1228144e564a1fd1734136201d549 (diff) |
[geometry] LatLon refactoring.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/changeset_wrapper.cpp | 6 | ||||
-rw-r--r-- | editor/editor_notes.cpp | 10 | ||||
-rw-r--r-- | editor/osm_editor.cpp | 2 | ||||
-rw-r--r-- | editor/server_api.cpp | 6 | ||||
-rw-r--r-- | editor/xml_feature.cpp | 8 |
5 files changed, 16 insertions, 16 deletions
diff --git a/editor/changeset_wrapper.cpp b/editor/changeset_wrapper.cpp index ed64dcfc7a..e9b9caaba2 100644 --- a/editor/changeset_wrapper.cpp +++ b/editor/changeset_wrapper.cpp @@ -29,7 +29,7 @@ m2::RectD GetBoundingRect(vector<m2::PointD> const & geometry) for (auto const & p : geometry) { auto const latLon = MercatorBounds::ToLatLon(p); - rect.Add({latLon.lon, latLon.lat}); + rect.Add({latLon.m_lon, latLon.m_lat}); } return rect; } @@ -132,7 +132,7 @@ ChangesetWrapper::~ChangesetWrapper() void ChangesetWrapper::LoadXmlFromOSM(ms::LatLon const & ll, pugi::xml_document & doc, double radiusInMeters) { - auto const response = m_api.GetXmlFeaturesAtLatLon(ll.lat, ll.lon, radiusInMeters); + auto const response = m_api.GetXmlFeaturesAtLatLon(ll.m_lat, ll.m_lon, radiusInMeters); if (response.first != OsmOAuth::HTTP::OK) MYTHROW(HttpErrorException, ("HTTP error", response, "with GetXmlFeaturesAtLatLon", ll)); @@ -145,7 +145,7 @@ void ChangesetWrapper::LoadXmlFromOSM(ms::LatLon const & ll, pugi::xml_document void ChangesetWrapper::LoadXmlFromOSM(ms::LatLon const & min, ms::LatLon const & max, pugi::xml_document & doc) { - auto const response = m_api.GetXmlFeaturesInRect(min.lat, min.lon, max.lat, max.lon); + auto const response = m_api.GetXmlFeaturesInRect(min.m_lat, min.m_lon, max.m_lat, max.m_lon); if (response.first != OsmOAuth::HTTP::OK) MYTHROW(HttpErrorException, ("HTTP error", response, "with GetXmlFeaturesInRect", min, max)); diff --git a/editor/editor_notes.cpp b/editor/editor_notes.cpp index 5056a82bb7..4a7f46ea9f 100644 --- a/editor/editor_notes.cpp +++ b/editor/editor_notes.cpp @@ -39,11 +39,11 @@ bool LoadFromXml(pugi::xml_document const & xml, std::list<editor::Note> & notes auto const node = xNode.node(); auto const lat = node.attribute("lat"); - if (!lat || !strings::to_double(lat.value(), latLon.lat)) + if (!lat || !strings::to_double(lat.value(), latLon.m_lat)) continue; auto const lon = node.attribute("lon"); - if (!lon || !strings::to_double(lon.value(), latLon.lon)) + if (!lon || !strings::to_double(lon.value(), latLon.m_lon)) continue; auto const text = node.attribute("text"); @@ -66,9 +66,9 @@ void SaveToXml(std::list<editor::Note> const & notes, pugi::xml_document & xml, auto node = root.append_child("note"); node.append_attribute("lat") = - strings::to_string_dac(note.m_point.lat, kDigitsAfterComma).data(); + strings::to_string_dac(note.m_point.m_lat, kDigitsAfterComma).data(); node.append_attribute("lon") = - strings::to_string_dac(note.m_point.lon, kDigitsAfterComma).data(); + strings::to_string_dac(note.m_point.m_lon, kDigitsAfterComma).data(); node.append_attribute("text") = note.m_note.data(); } } @@ -144,7 +144,7 @@ void Notes::CreateNote(ms::LatLon const & latLon, std::string const & text) return; } - if (!MercatorBounds::ValidLat(latLon.lat) || !MercatorBounds::ValidLon(latLon.lon)) + if (!MercatorBounds::ValidLat(latLon.m_lat) || !MercatorBounds::ValidLon(latLon.m_lon)) { LOG(LWARNING, ("A note attached to a wrong latLon", latLon)); return; diff --git a/editor/osm_editor.cpp b/editor/osm_editor.cpp index b2f3351ddd..23dfd66b71 100644 --- a/editor/osm_editor.cpp +++ b/editor/osm_editor.cpp @@ -814,7 +814,7 @@ void Editor::UploadChanges(string const & key, string const & secret, ChangesetT {"our", ourDebugFeatureString}, {"mwm", fti.m_object.GetID().GetMwmName()}, {"mwm_version", strings::to_string(fti.m_object.GetID().GetMwmVersion())}}, - alohalytics::Location::FromLatLon(ll.lat, ll.lon)); + alohalytics::Location::FromLatLon(ll.m_lat, ll.m_lon)); } GetPlatform().RunTask(Platform::Thread::Gui, diff --git a/editor/server_api.cpp b/editor/server_api.cpp index 26149aeaab..4689ed7ceb 100644 --- a/editor/server_api.cpp +++ b/editor/server_api.cpp @@ -122,8 +122,8 @@ void ServerApi06::CloseChangeSet(uint64_t changesetId) const uint64_t ServerApi06::CreateNote(ms::LatLon const & ll, std::string const & message) const { CHECK(!message.empty(), ("Note content should not be empty.")); - std::string const params = "?lat=" + strings::to_string_dac(ll.lat, 7) + - "&lon=" + strings::to_string_dac(ll.lon, 7) + + std::string const params = "?lat=" + strings::to_string_dac(ll.m_lat, 7) + + "&lon=" + strings::to_string_dac(ll.m_lon, 7) + "&text=" + UrlEncode(message + " #mapsme"); OsmOAuth::Response const response = m_auth.Request("/notes" + params, "POST"); if (response.first != OsmOAuth::HTTP::OK) @@ -200,7 +200,7 @@ OsmOAuth::Response ServerApi06::GetXmlFeaturesAtLatLon(double lat, double lon, d OsmOAuth::Response ServerApi06::GetXmlFeaturesAtLatLon(ms::LatLon const & ll, double radiusInMeters) const { - return GetXmlFeaturesAtLatLon(ll.lat, ll.lon, radiusInMeters); + return GetXmlFeaturesAtLatLon(ll.m_lat, ll.m_lon, radiusInMeters); } } // namespace osm diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp index 48eeab5cbc..cc8153cbe8 100644 --- a/editor/xml_feature.cpp +++ b/editor/xml_feature.cpp @@ -40,12 +40,12 @@ pugi::xml_node FindTag(pugi::xml_document const & document, string const & key) ms::LatLon GetLatLonFromNode(pugi::xml_node const & node) { ms::LatLon ll; - if (!strings::to_double(node.attribute("lat").value(), ll.lat)) + if (!strings::to_double(node.attribute("lat").value(), ll.m_lat)) { MYTHROW(editor::NoLatLon, ("Can't parse lat attribute:", string(node.attribute("lat").value()))); } - if (!strings::to_double(node.attribute("lon").value(), ll.lon)) + if (!strings::to_double(node.attribute("lon").value(), ll.m_lon)) { MYTHROW(editor::NoLatLon, ("Can't parse lon attribute:", string(node.attribute("lon").value()))); @@ -203,8 +203,8 @@ ms::LatLon XMLFeature::GetCenter() const void XMLFeature::SetCenter(ms::LatLon const & ll) { ASSERT_EQUAL(GetType(), Type::Node, ()); - SetAttribute("lat", strings::to_string_dac(ll.lat, kLatLonTolerance)); - SetAttribute("lon", strings::to_string_dac(ll.lon, kLatLonTolerance)); + SetAttribute("lat", strings::to_string_dac(ll.m_lat, kLatLonTolerance)); + SetAttribute("lon", strings::to_string_dac(ll.m_lon, kLatLonTolerance)); } void XMLFeature::SetCenter(m2::PointD const & mercatorCenter) |