gui_writer.cc
author hegyi
Wed, 25 Oct 2006 13:21:24 +0000
changeset 172 fc1e478697d3
parent 150 86273bfe0e4d
child 174 95872af46fc4
permissions -rw-r--r--
Currently visualized map can be saved and loaded from file.
     1 #include "gui_writer.h"
     2 #include "xml.h"
     3 #include "mapstorage.h"
     4 #include <lemon/dim2.h>
     5 #include <vector>
     6 
     7 std::string GuiWriter::header()
     8 {
     9   return "@gui";
    10 }
    11 
    12 void GuiWriter::write(std::ostream& os)
    13 {
    14   XmlIo x(os);
    15   std::map<int, XY > m;
    16   for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
    17   {
    18     int edgeid = (int)(*(mapstorage->edgemap_storage["label"]))[e];
    19     m[edgeid] = mapstorage->arrow_pos[e];
    20   }
    21   x("arrow_pos", m);
    22 
    23   std::map<int, std::string> nm;
    24   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    25     {
    26       nm[i]=mapstorage->active_nodemaps[i];
    27     }
    28   x("active_nodemaps", nm);
    29 
    30   std::map<int, std::string> em;
    31   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    32     {
    33       em[i]=mapstorage->active_edgemaps[i];
    34     }
    35   x("active_edgemaps", em);
    36 }
    37 
    38 GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
    39 {
    40 }