gui/gui_reader.cc
author deba
Thu, 26 Jan 2006 17:18:12 +0000
changeset 1911 c925a077cf73
child 2063 9535436aaa9f
permissions -rw-r--r--
The pre BpUGraph concept
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@1860
    25
    int edgeid = (int)(*mapstorage->edgemap_storage["id"])[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
}