gui_reader.cc
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
branchgui
changeset 108 bf355fd6563e
child 134 82e19031c319
permissions -rw-r--r--
Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
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@98
    25
    int edgeid = (int)(*mapstorage->edgemap_storage["id"])[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
}