gui_writer.cc
author hegyi
Mon, 30 Oct 2006 13:08:04 +0000
changeset 176 9fc3d5170b24
parent 172 fc1e478697d3
child 177 40f3006fba2e
permissions -rw-r--r--
Showed map is loaded even if ArrowPos not.
alpar@174
     1
/* -*- C++ -*-
alpar@174
     2
 *
alpar@174
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@174
     4
 *
alpar@174
     5
 * Copyright (C) 2003-2006
alpar@174
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@174
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@174
     8
 *
alpar@174
     9
 * Permission to use, modify and distribute this software is granted
alpar@174
    10
 * provided that this copyright notice appears in all copies. For
alpar@174
    11
 * precise terms see the accompanying LICENSE file.
alpar@174
    12
 *
alpar@174
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@174
    14
 * express or implied, and with no claim as to its suitability for any
alpar@174
    15
 * purpose.
alpar@174
    16
 *
alpar@174
    17
 */
alpar@174
    18
ladanyi@98
    19
#include "gui_writer.h"
ladanyi@98
    20
#include "xml.h"
ladanyi@98
    21
#include "mapstorage.h"
hegyi@150
    22
#include <lemon/dim2.h>
ladanyi@98
    23
#include <vector>
ladanyi@98
    24
ladanyi@98
    25
std::string GuiWriter::header()
ladanyi@98
    26
{
ladanyi@98
    27
  return "@gui";
ladanyi@98
    28
}
ladanyi@98
    29
ladanyi@98
    30
void GuiWriter::write(std::ostream& os)
ladanyi@98
    31
{
ladanyi@98
    32
  XmlIo x(os);
hegyi@150
    33
  std::map<int, XY > m;
ladanyi@98
    34
  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
ladanyi@98
    35
  {
ladanyi@134
    36
    int edgeid = (int)(*(mapstorage->edgemap_storage["label"]))[e];
ladanyi@98
    37
    m[edgeid] = mapstorage->arrow_pos[e];
ladanyi@98
    38
  }
ladanyi@98
    39
  x("arrow_pos", m);
hegyi@172
    40
hegyi@172
    41
  std::map<int, std::string> nm;
hegyi@172
    42
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@172
    43
    {
hegyi@172
    44
      nm[i]=mapstorage->active_nodemaps[i];
hegyi@172
    45
    }
hegyi@172
    46
  x("active_nodemaps", nm);
hegyi@172
    47
hegyi@172
    48
  std::map<int, std::string> em;
hegyi@172
    49
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@172
    50
    {
hegyi@172
    51
      em[i]=mapstorage->active_edgemaps[i];
hegyi@172
    52
    }
hegyi@172
    53
  x("active_edgemaps", em);
ladanyi@98
    54
}
ladanyi@98
    55
ladanyi@98
    56
GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
ladanyi@98
    57
{
ladanyi@98
    58
}