XMLFeature::GetCenter() returns ms::LatLon.

This commit is contained in:
Alex Zolotarev 2016-01-07 19:32:24 +03:00 committed by Sergey Yershov
parent ab2e44c370
commit 26b27734b2
2 changed files with 8 additions and 9 deletions

View file

@ -5,8 +5,6 @@
#include "base/string_utils.hpp"
#include "base/timer.hpp"
#include "geometry/mercator.hpp"
#include "std/set.hpp"
#include "std/unordered_set.hpp"
@ -32,20 +30,20 @@ pugi::xml_node FindTag(pugi::xml_document const & document, string const & key)
return document.select_node(("//tag[@k='" + key + "']").data()).node();
}
m2::PointD PointFromLatLon(pugi::xml_node const node)
ms::LatLon PointFromLatLon(pugi::xml_node const node)
{
double lat, lon;
if (!strings::to_double(node.attribute("lat").value(), lat))
ms::LatLon ll;
if (!strings::to_double(node.attribute("lat").value(), ll.lat))
{
MYTHROW(editor::XMLFeatureNoLatLonError,
("Can't parse lat attribute: " + string(node.attribute("lat").value())));
}
if (!strings::to_double(node.attribute("lon").value(), lon))
if (!strings::to_double(node.attribute("lon").value(), ll.lon))
{
MYTHROW(editor::XMLFeatureNoLatLonError,
("Can't parse lon attribute: " + string(node.attribute("lon").value())));
}
return MercatorBounds::FromLatLon(lat, lon);
return ll;
}
void ValidateNode(pugi::xml_node const & node)
@ -101,7 +99,7 @@ void XMLFeature::Save(ostream & ost) const
m_document.save(ost, " ", pugi::format_indent_attributes);
}
m2::PointD XMLFeature::GetCenter() const
ms::LatLon XMLFeature::GetCenter() const
{
return PointFromLatLon(GetRootNode());
}

View file

@ -1,5 +1,6 @@
#pragma once
#include "geometry/mercator.hpp"
#include "geometry/point2d.hpp"
#include "coding/multilang_utf8_string.hpp"
@ -41,7 +42,7 @@ public:
Type GetType() const;
m2::PointD GetCenter() const;
ms::LatLon GetCenter() const;
void SetCenter(m2::PointD const & mercatorCenter);
string GetName(string const & lang) const;