gui/gui_reader.cc
changeset 1860 27a9a75b957b
child 2063 9535436aaa9f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gui/gui_reader.cc	Sat Dec 17 20:55:41 2005 +0000
     1.3 @@ -0,0 +1,33 @@
     1.4 +#include "gui_reader.h"
     1.5 +#include "xml.h"
     1.6 +#include "mapstorage.h"
     1.7 +#include <lemon/xy.h>
     1.8 +#include <vector>
     1.9 +
    1.10 +bool GuiReader::header(const std::string& line)
    1.11 +{
    1.12 +  std::istringstream ls(line);
    1.13 +  std::string head;
    1.14 +  ls >> head;
    1.15 +  return head == "@gui";
    1.16 +}
    1.17 +
    1.18 +void GuiReader::read(std::istream& is)
    1.19 +{
    1.20 +  XmlIo x(is);
    1.21 +  std::map<int, xy<double> > m;
    1.22 +  x("arrow_pos", m);
    1.23 +
    1.24 +  if ((int)m.size() != countEdges(mapstorage->graph)) return;
    1.25 +
    1.26 +  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
    1.27 +  {
    1.28 +    int edgeid = (int)(*mapstorage->edgemap_storage["id"])[e];
    1.29 +    mapstorage->arrow_pos.set(e, m[edgeid]);
    1.30 +  }
    1.31 +  mapstorage->ArrowPosReadOK();
    1.32 +}
    1.33 +
    1.34 +GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
    1.35 +{
    1.36 +}