[174] | 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 | |
---|
[194] | 19 | #include <xml.h> |
---|
[150] | 20 | #include <lemon/dim2.h> |
---|
[98] | 21 | #include <vector> |
---|
| 22 | |
---|
[194] | 23 | #include <gui_writer.h> |
---|
| 24 | #include <mapstorage.h> |
---|
| 25 | |
---|
[98] | 26 | std::string GuiWriter::header() |
---|
| 27 | { |
---|
| 28 | return "@gui"; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | void GuiWriter::write(std::ostream& os) |
---|
| 32 | { |
---|
| 33 | XmlIo x(os); |
---|
[150] | 34 | std::map<int, XY > m; |
---|
[98] | 35 | for (EdgeIt e(mapstorage->graph); e != INVALID; ++e) |
---|
| 36 | { |
---|
[134] | 37 | int edgeid = (int)(*(mapstorage->edgemap_storage["label"]))[e]; |
---|
[98] | 38 | m[edgeid] = mapstorage->arrow_pos[e]; |
---|
| 39 | } |
---|
| 40 | x("arrow_pos", m); |
---|
[172] | 41 | |
---|
| 42 | std::map<int, std::string> nm; |
---|
| 43 | for(int i=0;i<NODE_PROPERTY_NUM;i++) |
---|
| 44 | { |
---|
| 45 | nm[i]=mapstorage->active_nodemaps[i]; |
---|
| 46 | } |
---|
| 47 | x("active_nodemaps", nm); |
---|
| 48 | |
---|
| 49 | std::map<int, std::string> em; |
---|
| 50 | for(int i=0;i<EDGE_PROPERTY_NUM;i++) |
---|
| 51 | { |
---|
| 52 | em[i]=mapstorage->active_edgemaps[i]; |
---|
| 53 | } |
---|
| 54 | x("active_edgemaps", em); |
---|
[177] | 55 | |
---|
| 56 | double attraction; |
---|
| 57 | double propulsation; |
---|
| 58 | int iteration; |
---|
| 59 | |
---|
| 60 | mapstorage->get_design_data(attraction, propulsation, iteration); |
---|
| 61 | |
---|
| 62 | x("redesign-attraction", attraction); |
---|
| 63 | x("redesign-propulsation", propulsation); |
---|
| 64 | x("redesign-iteration", iteration); |
---|
[98] | 65 | } |
---|
| 66 | |
---|
| 67 | GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms) |
---|
| 68 | { |
---|
| 69 | } |
---|