25 return std::stod(string_value);
30 std::numeric_limits<double>::quiet_NaN(),
31 std::numeric_limits<double>::quiet_NaN(),
34 std::vector<std::string> geo_ref_splitted;
37 for (
auto element: geo_ref_splitted) {
38 std::vector<std::string> geo_ref_key_value;
40 if (geo_ref_key_value.size() != 2u) {
44 if (geo_ref_key_value[0] ==
"+lat_0") {
45 result.latitude =
ParseDouble(geo_ref_key_value[1]);
46 }
else if (geo_ref_key_value[0] ==
"+lon_0") {
47 result.longitude =
ParseDouble(geo_ref_key_value[1]);
51 if (std::isnan(result.latitude) || std::isnan(result.longitude)) {
52 log_warning(
"cannot parse georeference: '" + geo_reference_string +
"'. Using default values.");
53 result.latitude = 42.0;
54 result.longitude = 2.0;
57 log_debug(
"map geo reference: latitude ", result.latitude,
", longitude ", result.longitude);
This file contains definitions of common data structures used in traffic manager. ...
PUGI__FN xpath_string string_value(const xpath_node &na, xpath_allocator *alloc)
static void log_debug(Args &&...)
static double ParseDouble(const std::string &string_value)
xml_node child(const char_t *name) const
void SetGeoReference(const geom::GeoLocation &geo_reference)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Split(Container &destination, const Range1T &str, const Range2T &separators)
static void log_warning(Args &&... args)
const char_t * child_value() const
static geom::GeoLocation ParseGeoReference(const std::string &geo_reference_string)