LCOV - code coverage report
Current view: top level - app/src/data/SUMO/Additionals - Poi.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 36 0.0 %
Date: 2023-08-17 16:45:52 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #include "data/SUMO/Additionals/Poi.hpp"
       2             : 
       3             : #include <rapidxml.hpp>
       4             : #include <rapidxml_utils.hpp>
       5             : 
       6             : #include "utils/stringify.hpp"
       7             : 
       8             : using namespace std;
       9             : using namespace rapidxml;
      10             : using namespace SUMO::Additionals;
      11             : using namespace utils::stringify;
      12             : 
      13           0 : Poi::Poi(const string &id_):
      14           0 :     id(id_) {}
      15             : 
      16           0 : void Poi::loadFromXMLNode(const rapidxml::xml_node<> &node) {
      17           0 :     xml_attribute<> *typeEl = node.first_attribute("type");
      18           0 :     if(typeEl) type = typeEl->value();
      19             : 
      20           0 :     xml_attribute<> *colorEl = node.first_attribute("color");
      21           0 :     if(colorEl) color = stringify<color::rgb<float>>::fromString(colorEl->value());
      22             : 
      23           0 :     xml_attribute<> *layerEl = node.first_attribute("layer");
      24           0 :     if(layerEl) layer = stringify<float>::fromString(layerEl->value());
      25             : 
      26           0 :     xml_attribute<> *xEl = node.first_attribute("x");
      27           0 :     xml_attribute<> *yEl = node.first_attribute("y");
      28           0 :     if(xEl && yEl) {
      29           0 :         posXY = Coord(
      30           0 :             stringify<float>::fromString(xEl->value()),
      31           0 :             stringify<float>::fromString(yEl->value())
      32           0 :         );
      33             :     }
      34             : 
      35           0 :     xml_attribute<> *lonEl = node.first_attribute("lon");
      36           0 :     xml_attribute<> *latEl = node.first_attribute("lat");
      37           0 :     if(lonEl && latEl) {
      38           0 :         posLonLat = Coord(
      39           0 :             stringify<float>::fromString(lonEl->value()),
      40           0 :             stringify<float>::fromString(latEl->value())
      41           0 :         );
      42             :     }
      43             : 
      44           0 :     xml_attribute<> *laneEl = node.first_attribute("lane");
      45           0 :     if(laneEl) lane = laneEl->value();
      46             : 
      47           0 :     xml_attribute<> *posEl = node.first_attribute("pos");
      48           0 :     if(posEl) pos = stringify<float>::fromString(posEl->value());
      49             : 
      50           0 :     xml_attribute<> *angleEl = node.first_attribute("angle");
      51           0 :     if(angleEl) angle = stringify<float>::fromString(angleEl->value());
      52             : 
      53           0 :     xml_attribute<> *imgFileEl = node.first_attribute("imgFile");
      54           0 :     if(imgFileEl) imgFile = imgFileEl->value();
      55             : 
      56           0 :     xml_attribute<> *widthEl = node.first_attribute("width");
      57           0 :     if(widthEl) width = stringify<float>::fromString(widthEl->value());
      58             : 
      59           0 :     xml_attribute<> *heightEl = node.first_attribute("height");
      60           0 :     if(heightEl) height = stringify<float>::fromString(heightEl->value());
      61           0 : }

Generated by: LCOV version 1.14