COIN-OR::LEMON - Graph Library

source: glemon-0.x/gui_writer.cc @ 193:2a9a5d7f1a16

Last change on this file since 193:2a9a5d7f1a16 was 177:40f3006fba2e, checked in by Hegyi Péter, 17 years ago

Redesign parameters can now be saved and loaded.

File size: 1.7 KB
Line 
1/* -*- C++ -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library
4 *
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 *
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
12 *
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
15 * purpose.
16 *
17 */
18
19#include "gui_writer.h"
20#include "xml.h"
21#include "mapstorage.h"
22#include <lemon/dim2.h>
23#include <vector>
24
25std::string GuiWriter::header()
26{
27  return "@gui";
28}
29
30void GuiWriter::write(std::ostream& os)
31{
32  XmlIo x(os);
33  std::map<int, XY > m;
34  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
35  {
36    int edgeid = (int)(*(mapstorage->edgemap_storage["label"]))[e];
37    m[edgeid] = mapstorage->arrow_pos[e];
38  }
39  x("arrow_pos", m);
40
41  std::map<int, std::string> nm;
42  for(int i=0;i<NODE_PROPERTY_NUM;i++)
43    {
44      nm[i]=mapstorage->active_nodemaps[i];
45    }
46  x("active_nodemaps", nm);
47
48  std::map<int, std::string> em;
49  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
50    {
51      em[i]=mapstorage->active_edgemaps[i];
52    }
53  x("active_edgemaps", em);
54
55  double attraction;
56  double propulsation;
57  int iteration;
58
59  mapstorage->get_design_data(attraction, propulsation, iteration);
60
61  x("redesign-attraction", attraction);
62  x("redesign-propulsation", propulsation);
63  x("redesign-iteration", iteration);
64}
65
66GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
67{
68}
Note: See TracBrowser for help on using the repository browser.