gui/gui_reader.cc
author deba
Mon, 15 May 2006 09:44:35 +0000
changeset 2082 626939628b4a
parent 1860 27a9a75b957b
permissions -rw-r--r--
Bug fix
ladanyi@1860
     1
#include "gui_reader.h"
ladanyi@1860
     2
#include "xml.h"
ladanyi@1860
     3
#include "mapstorage.h"
ladanyi@1860
     4
#include <lemon/xy.h>
ladanyi@1860
     5
#include <vector>
ladanyi@1860
     6
ladanyi@1860
     7
bool GuiReader::header(const std::string& line)
ladanyi@1860
     8
{
ladanyi@1860
     9
  std::istringstream ls(line);
ladanyi@1860
    10
  std::string head;
ladanyi@1860
    11
  ls >> head;
ladanyi@1860
    12
  return head == "@gui";
ladanyi@1860
    13
}
ladanyi@1860
    14
ladanyi@1860
    15
void GuiReader::read(std::istream& is)
ladanyi@1860
    16
{
ladanyi@1860
    17
  XmlIo x(is);
ladanyi@1860
    18
  std::map<int, xy<double> > m;
ladanyi@1860
    19
  x("arrow_pos", m);
ladanyi@1860
    20
ladanyi@1860
    21
  if ((int)m.size() != countEdges(mapstorage->graph)) return;
ladanyi@1860
    22
ladanyi@1860
    23
  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
ladanyi@1860
    24
  {
ladanyi@2063
    25
    int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e];
ladanyi@1860
    26
    mapstorage->arrow_pos.set(e, m[edgeid]);
ladanyi@1860
    27
  }
ladanyi@1860
    28
  mapstorage->ArrowPosReadOK();
ladanyi@1860
    29
}
ladanyi@1860
    30
ladanyi@1860
    31
GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
ladanyi@1860
    32
{
ladanyi@1860
    33
}