gui_reader.cc
author hegyi
Tue, 19 Sep 2006 07:43:55 +0000
changeset 149 930e838ad5b6
parent 98 f60f89147531
child 150 86273bfe0e4d
permissions -rw-r--r--
Node and edge editor button are the same furthermore.
ladanyi@98
     1
#include "gui_reader.h"
ladanyi@98
     2
#include "xml.h"
ladanyi@98
     3
#include "mapstorage.h"
ladanyi@98
     4
#include <lemon/xy.h>
ladanyi@98
     5
#include <vector>
ladanyi@98
     6
ladanyi@98
     7
bool GuiReader::header(const std::string& line)
ladanyi@98
     8
{
ladanyi@98
     9
  std::istringstream ls(line);
ladanyi@98
    10
  std::string head;
ladanyi@98
    11
  ls >> head;
ladanyi@98
    12
  return head == "@gui";
ladanyi@98
    13
}
ladanyi@98
    14
ladanyi@98
    15
void GuiReader::read(std::istream& is)
ladanyi@98
    16
{
ladanyi@98
    17
  XmlIo x(is);
ladanyi@98
    18
  std::map<int, xy<double> > m;
ladanyi@98
    19
  x("arrow_pos", m);
ladanyi@98
    20
ladanyi@98
    21
  if ((int)m.size() != countEdges(mapstorage->graph)) return;
ladanyi@98
    22
ladanyi@98
    23
  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
ladanyi@98
    24
  {
ladanyi@134
    25
    int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e];
ladanyi@98
    26
    mapstorage->arrow_pos.set(e, m[edgeid]);
ladanyi@98
    27
  }
ladanyi@98
    28
  mapstorage->ArrowPosReadOK();
ladanyi@98
    29
}
ladanyi@98
    30
ladanyi@98
    31
GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
ladanyi@98
    32
{
ladanyi@98
    33
}