/* -*- C++ -*- * * This file is a part of LEMON, a generic C++ optimization library * * Copyright (C) 2003-2006 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ #include "gui_reader.h" #include "xml.h" #include "mapstorage.h" #include #include bool GuiReader::header(const std::string& line) { std::istringstream ls(line); std::string head; ls >> head; return head == "@gui"; } void GuiReader::read(std::istream& is) { XmlIo x(is); std::map m; x("arrow_pos", m); if ((int)m.size() == countEdges(mapstorage->graph)) { for (EdgeIt e(mapstorage->graph); e != INVALID; ++e) { int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e]; mapstorage->arrow_pos.set(e, m[edgeid]); } mapstorage->ArrowPosReadOK(); } std::map nm; x("active_nodemaps", nm); for(int i=0;ichangeActiveMap(false, i, nm[i]); } std::map em; x("active_edgemaps", em); for(int i=0;ichangeActiveMap(true, i, em[i]); } double attraction; double propulsation; int iteration; x("redesign-attraction", attraction); x("redesign-propulsation", propulsation); x("redesign-iteration", iteration); mapstorage->set_attraction(attraction); mapstorage->set_propulsation(propulsation); mapstorage->set_iteration(iteration); mapstorage->redesign_data_changed(); } GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms) { }