gui/gui_reader.cc
author deba
Wed, 01 Mar 2006 10:25:30 +0000
changeset 1991 d7442141d9ef
child 2063 9535436aaa9f
permissions -rw-r--r--
The graph adadptors can be alteration observed.
In most cases it uses the adapted graph alteration notifiers.
Only special case is now the UndirGraphAdaptor, where
we have to proxy the signals from the graph.

The SubBidirGraphAdaptor is removed, because it doest not
gives more feature than the EdgeSubGraphAdaptor<UndirGraphAdaptor<Graph>>.

The ResGraphAdaptor is based on this composition.
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
}