COIN-OR::LEMON - Graph Library

source: glemon-0.x/gui_writer.cc @ 172:fc1e478697d3

Last change on this file since 172:fc1e478697d3 was 172:fc1e478697d3, checked in by Hegyi Péter, 18 years ago

Currently visualized map can be saved and loaded from file.

File size: 849 bytes
Line 
1#include "gui_writer.h"
2#include "xml.h"
3#include "mapstorage.h"
4#include <lemon/dim2.h>
5#include <vector>
6
7std::string GuiWriter::header()
8{
9  return "@gui";
10}
11
12void 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
38GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
39{
40}
Note: See TracBrowser for help on using the repository browser.