gui/mapstorage.cc
author athos
Tue, 20 Jun 2006 15:20:08 +0000
changeset 2102 eb73ab0e4c74
parent 2063 9535436aaa9f
permissions -rw-r--r--
Slight changes in doc.
ladanyi@1606
     1
#include "mapstorage.h"
ladanyi@1860
     2
#include "gui_writer.h"
ladanyi@1860
     3
#include "gui_reader.h"
alpar@1939
     4
#include <limits>
alpar@1939
     5
#include <cmath>
ladanyi@1645
     6
#include <gtkmm.h>
deba@1686
     7
ladanyi@1860
     8
MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false)
ladanyi@1442
     9
{
ladanyi@1606
    10
  nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph);
ladanyi@1606
    11
  coords.setXMap(*nodemap_storage["coordinates_x"]);
ladanyi@1606
    12
  nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
ladanyi@1606
    13
  coords.setYMap(*nodemap_storage["coordinates_y"]);
ladanyi@1606
    14
ladanyi@1860
    15
  edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph);
ladanyi@1860
    16
  arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]);
ladanyi@1860
    17
  edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph);
ladanyi@1860
    18
  arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]);
ladanyi@1860
    19
ladanyi@2063
    20
  nodemap_storage["label"] = new Graph::NodeMap<double>(graph);
ladanyi@2063
    21
  edgemap_storage["label"] = new Graph::EdgeMap<double>(graph);
ladanyi@1646
    22
ladanyi@2063
    23
  nodemap_default["label"] = 1.0;
ladanyi@2063
    24
  edgemap_default["label"] = 1.0;
hegyi@1837
    25
hegyi@1837
    26
  active_nodemaps.resize(NODE_PROPERTY_NUM);
hegyi@1837
    27
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@1837
    28
    {
hegyi@1837
    29
      active_nodemaps[i]="";
hegyi@1837
    30
    }
hegyi@1837
    31
hegyi@1837
    32
  active_edgemaps.resize(EDGE_PROPERTY_NUM);
hegyi@1837
    33
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@1837
    34
    {
hegyi@1837
    35
      active_edgemaps[i]="";
hegyi@1837
    36
    }
ladanyi@1606
    37
}
ladanyi@1606
    38
ladanyi@1606
    39
MapStorage::~MapStorage()
ladanyi@1606
    40
{
ladanyi@1606
    41
  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
ladanyi@1606
    42
      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
ladanyi@1606
    43
  {
ladanyi@1606
    44
    delete it->second;
ladanyi@1606
    45
  }
ladanyi@1606
    46
  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
ladanyi@1606
    47
      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
ladanyi@1606
    48
  {
ladanyi@1606
    49
    delete it->second;
ladanyi@1606
    50
  }
ladanyi@1606
    51
}
ladanyi@1442
    52
hegyi@1888
    53
int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap, double default_value)
ladanyi@1442
    54
{
hegyi@1888
    55
  std::cout << default_value << std::endl;
hegyi@1597
    56
  if( nodemap_storage.find(name) == nodemap_storage.end() )
hegyi@1597
    57
    {
hegyi@1597
    58
      nodemap_storage[name]=nodemap;
ladanyi@1645
    59
      // set the maps default value
ladanyi@1645
    60
      nodemap_default[name] = default_value;
hegyi@1878
    61
hegyi@1878
    62
      //announce changement in maps
hegyi@1878
    63
      signal_node_map.emit(name);
hegyi@1597
    64
      return 0;
hegyi@1597
    65
    }
hegyi@1597
    66
  return 1;
ladanyi@1442
    67
}
ladanyi@1442
    68
hegyi@1837
    69
void MapStorage::changeActiveMap(bool itisedge, int prop, std::string mapname)
hegyi@1837
    70
{
hegyi@1837
    71
  if(itisedge)
hegyi@1837
    72
    {
hegyi@1837
    73
      active_edgemaps[prop]=mapname;
hegyi@1837
    74
    }
hegyi@1837
    75
  else
hegyi@1837
    76
    {
hegyi@1837
    77
      active_nodemaps[prop]=mapname;
hegyi@1837
    78
    }
hegyi@1837
    79
  signal_prop.emit(itisedge, prop);
hegyi@1837
    80
}
hegyi@1837
    81
hegyi@1837
    82
std::string MapStorage::getActiveEdgeMap(int prop)
hegyi@1837
    83
{
hegyi@1837
    84
  return active_edgemaps[prop];
hegyi@1837
    85
}
hegyi@1837
    86
hegyi@1837
    87
std::string MapStorage::getActiveNodeMap(int prop)
hegyi@1837
    88
{
hegyi@1837
    89
  return active_nodemaps[prop];
hegyi@1837
    90
}
hegyi@1837
    91
hegyi@1837
    92
std::vector<std::string> MapStorage::getEdgeMapList()
hegyi@1837
    93
{
hegyi@1837
    94
  std::vector<std::string> eml;
hegyi@1837
    95
  eml.resize(edgemap_storage.size());
hegyi@1837
    96
  int i=0;
hegyi@1837
    97
  std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=beginOfEdgeMaps();
hegyi@1837
    98
  for(;emsi!=endOfEdgeMaps();emsi++)
hegyi@1837
    99
    {
hegyi@1837
   100
      eml[i]=(emsi->first);
hegyi@1837
   101
      i++;
hegyi@1837
   102
    }
hegyi@1837
   103
  return eml;
hegyi@1837
   104
}
hegyi@1837
   105
hegyi@1837
   106
std::vector<std::string> MapStorage::getNodeMapList()
hegyi@1837
   107
{
hegyi@1837
   108
  std::vector<std::string> nml;
hegyi@1837
   109
  nml.resize(nodemap_storage.size());
hegyi@1837
   110
  int i=0;
hegyi@1837
   111
  std::map< std::string,Graph::NodeMap<double> * >::iterator nmsi=beginOfNodeMaps();
hegyi@1837
   112
  for(;nmsi!=endOfNodeMaps();nmsi++)
hegyi@1837
   113
    {
hegyi@1837
   114
      nml[i]=(nmsi->first);
hegyi@1837
   115
      i++;
hegyi@1837
   116
    }
hegyi@1837
   117
  return nml;
hegyi@1837
   118
}
hegyi@1837
   119
hegyi@1837
   120
MapStorage::Signal_Prop MapStorage::signal_prop_ch()
hegyi@1837
   121
{
hegyi@1837
   122
  return signal_prop;
hegyi@1837
   123
}
hegyi@1837
   124
hegyi@1888
   125
int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value)
ladanyi@1442
   126
{
hegyi@1597
   127
  if( edgemap_storage.find(name) == edgemap_storage.end() )
hegyi@1597
   128
    {
hegyi@1597
   129
      edgemap_storage[name]=edgemap;
ladanyi@1645
   130
      // set the maps default value
ladanyi@1645
   131
      edgemap_default[name] = default_value;
hegyi@1878
   132
hegyi@1878
   133
      //announce changement in maps
hegyi@1878
   134
      signal_edge_map.emit(name);
hegyi@1597
   135
      return 0;
hegyi@1597
   136
    }
hegyi@1597
   137
  return 1;
ladanyi@1442
   138
}
ladanyi@1442
   139
ladanyi@1442
   140
double MapStorage::maxOfNodeMap(const std::string & name)
ladanyi@1442
   141
{
ladanyi@1442
   142
  double max=0;
ladanyi@1606
   143
  for (NodeIt j(graph); j!=INVALID; ++j)
ladanyi@1442
   144
  {
ladanyi@1442
   145
    if( (*nodemap_storage[name])[j]>max )
ladanyi@1442
   146
    {
ladanyi@1442
   147
      max=(*nodemap_storage[name])[j];
ladanyi@1442
   148
    }
ladanyi@1442
   149
  }
ladanyi@1442
   150
  return max;
ladanyi@1442
   151
}
ladanyi@1442
   152
ladanyi@1442
   153
double MapStorage::maxOfEdgeMap(const std::string & name)
ladanyi@1442
   154
{
ladanyi@1442
   155
  double max=0;
ladanyi@1606
   156
  for (EdgeIt j(graph); j!=INVALID; ++j)
ladanyi@1442
   157
  {
ladanyi@1442
   158
    if( (*edgemap_storage[name])[j]>max )
ladanyi@1442
   159
    {
ladanyi@1442
   160
      max=(*edgemap_storage[name])[j];
ladanyi@1442
   161
    }
ladanyi@1442
   162
  }
ladanyi@1442
   163
  return max;
ladanyi@1442
   164
}
ladanyi@1442
   165
ladanyi@1442
   166
double MapStorage::minOfNodeMap(const std::string & name)
ladanyi@1442
   167
{
ladanyi@1606
   168
  NodeIt j(graph);
hegyi@1617
   169
  double min;
hegyi@1617
   170
  if(j!=INVALID)
hegyi@1617
   171
    {
hegyi@1617
   172
      min=(*nodemap_storage[name])[j];
hegyi@1617
   173
    }
hegyi@1617
   174
  else
hegyi@1617
   175
    {
hegyi@1617
   176
      min=0;
hegyi@1617
   177
    }
ladanyi@1442
   178
  for (; j!=INVALID; ++j)
ladanyi@1442
   179
  {
ladanyi@1442
   180
    if( (*nodemap_storage[name])[j]<min )
ladanyi@1442
   181
    {
ladanyi@1442
   182
      min=(*nodemap_storage[name])[j];
ladanyi@1442
   183
    }
ladanyi@1442
   184
  }
ladanyi@1442
   185
  return min;
ladanyi@1442
   186
}
ladanyi@1442
   187
ladanyi@1442
   188
double MapStorage::minOfEdgeMap(const std::string & name)
ladanyi@1442
   189
{
ladanyi@1606
   190
  EdgeIt j(graph);
hegyi@1617
   191
  double min;
hegyi@1617
   192
  if(j!=INVALID)
hegyi@1617
   193
    {
hegyi@1617
   194
      min=(*edgemap_storage[name])[j];
hegyi@1617
   195
    }
hegyi@1617
   196
  else
hegyi@1617
   197
    {
hegyi@1617
   198
      min=0;
hegyi@1617
   199
    }
ladanyi@1606
   200
  for (EdgeIt j(graph); j!=INVALID; ++j)
ladanyi@1442
   201
  {
ladanyi@1442
   202
    if( (*edgemap_storage[name])[j]<min )
ladanyi@1442
   203
    {
ladanyi@1442
   204
      min=(*edgemap_storage[name])[j];
ladanyi@1442
   205
    }
ladanyi@1442
   206
  }
ladanyi@1442
   207
  return min;
ladanyi@1442
   208
}
ladanyi@1442
   209
ladanyi@1645
   210
int MapStorage::readFromFile(const std::string &filename)
ladanyi@1606
   211
{
ladanyi@1606
   212
  bool read_x = false;
ladanyi@1606
   213
  bool read_y = false;
ladanyi@1646
   214
  bool read_edge_id = false;
ladanyi@1606
   215
ladanyi@1606
   216
  try {
ladanyi@1606
   217
    LemonReader lreader(filename);
ladanyi@1606
   218
    ContentReader content(lreader);
ladanyi@1606
   219
    lreader.run();
ladanyi@1606
   220
ladanyi@1867
   221
    if (content.nodeSetNum() < 1)
ladanyi@1867
   222
    {
ladanyi@1867
   223
      Gtk::MessageDialog mdialog("No nodeset found in file.");
ladanyi@1867
   224
      mdialog.run();
ladanyi@1867
   225
      clear();
ladanyi@1867
   226
      return 1;
ladanyi@1867
   227
    }
ladanyi@1867
   228
ladanyi@1867
   229
    if (content.edgeSetNum() < 1)
ladanyi@1867
   230
    {
ladanyi@1867
   231
      Gtk::MessageDialog mdialog("No edgeset found in file.");
ladanyi@1867
   232
      mdialog.run();
ladanyi@1867
   233
      clear();
ladanyi@1867
   234
      return 1;
ladanyi@1867
   235
    }
ladanyi@1867
   236
ladanyi@1606
   237
    const std::vector<std::string>& nodeMapNames = content.nodeSetMaps(0);
ladanyi@1606
   238
    const std::vector<std::string>& edgeMapNames = content.edgeSetMaps(0);
ladanyi@1606
   239
ladanyi@1606
   240
    GraphReader<Graph> greader(filename, graph);
ladanyi@1606
   241
    for (std::vector<std::string>::const_iterator it = nodeMapNames.begin();
ladanyi@1606
   242
        it != nodeMapNames.end(); ++it)
ladanyi@1606
   243
    {
ladanyi@1606
   244
      if (*it == "coordinates_x")
ladanyi@1606
   245
      {
ladanyi@1606
   246
        read_x = true;
ladanyi@1606
   247
        //std::cout << "read X nodemap" << std::endl;
ladanyi@1606
   248
      }
ladanyi@1606
   249
      else if (*it == "coordinates_y")
ladanyi@1606
   250
      {
ladanyi@1606
   251
        read_y = true;
ladanyi@1606
   252
        //std::cout << "read Y nodemap" << std::endl;
ladanyi@1606
   253
      }
ladanyi@2063
   254
      else if (*it == "label")
ladanyi@1606
   255
      {
ladanyi@1606
   256
        //std::cout << "read id nodemap" << std::endl;
ladanyi@1606
   257
      }
ladanyi@1606
   258
      else
ladanyi@1606
   259
      {
ladanyi@1606
   260
        nodemap_storage[*it] = new Graph::NodeMap<double>(graph);
ladanyi@1606
   261
        //std::cout << "read " << *it << " nodemap" << std::endl;
ladanyi@1606
   262
      }
ladanyi@1606
   263
      greader.readNodeMap(*it, *nodemap_storage[*it]);
ladanyi@1606
   264
    }
ladanyi@1606
   265
    for (std::vector<std::string>::const_iterator it = edgeMapNames.begin();
ladanyi@1606
   266
        it != edgeMapNames.end(); ++it)
ladanyi@1606
   267
    {
ladanyi@2063
   268
      if (*it == "label")
ladanyi@1606
   269
      {
ladanyi@1606
   270
        //std::cout << "read id edgemap" << std::endl;
ladanyi@2065
   271
        read_edge_id = true;
ladanyi@1606
   272
      }
ladanyi@1606
   273
      else
ladanyi@1606
   274
      {
ladanyi@1606
   275
        edgemap_storage[*it] = new Graph::EdgeMap<double>(graph);
ladanyi@1606
   276
        //std::cout << "read " << *it << " edgemap" << std::endl;
ladanyi@1606
   277
      }
ladanyi@1606
   278
      greader.readEdgeMap(*it, *edgemap_storage[*it]);
ladanyi@1606
   279
    }
ladanyi@1860
   280
    GuiReader gui_reader(greader, this);
ladanyi@1606
   281
    greader.run();
ladanyi@1867
   282
  } catch (Exception& error) {
ladanyi@1708
   283
    Gtk::MessageDialog mdialog(error.what());
ladanyi@1606
   284
    mdialog.run();
ladanyi@1645
   285
    clear();
ladanyi@1645
   286
    return 1;
ladanyi@1606
   287
  }
ladanyi@1606
   288
ladanyi@1646
   289
  if (!read_edge_id)
ladanyi@1646
   290
  {
ladanyi@2063
   291
    edgemap_storage["label"] = new Graph::EdgeMap<double>(graph);
ladanyi@1646
   292
    int i = 1;
ladanyi@1646
   293
    for (EdgeIt e(graph); e != INVALID; ++e)
ladanyi@1646
   294
    {
ladanyi@2063
   295
      (*edgemap_storage["label"])[e] = i++;
ladanyi@1646
   296
    }
ladanyi@1646
   297
  }
ladanyi@1646
   298
ladanyi@1606
   299
  if (!read_x || !read_y)
ladanyi@1606
   300
  {
ladanyi@1606
   301
    int node_num = 0;
ladanyi@1606
   302
    for (NodeIt n(graph); n != INVALID; ++n)
ladanyi@1606
   303
    {
ladanyi@1606
   304
      node_num++;
ladanyi@1606
   305
    }
ladanyi@1606
   306
    const double pi = 3.142;
ladanyi@1606
   307
    double step = 2 * pi / (double) node_num;
ladanyi@1606
   308
    int i = 0;
ladanyi@1606
   309
    for (NodeIt n(graph); n != INVALID; ++n)
ladanyi@1606
   310
    {
deba@1686
   311
      nodemap_storage["coordinates_x"]->set(n, 250.0 * std::cos(i * step));
deba@1686
   312
      nodemap_storage["coordinates_y"]->set(n, 250.0 * std::sin(i * step));
ladanyi@1606
   313
      i++;
ladanyi@1606
   314
    }
ladanyi@1606
   315
  }
ladanyi@1645
   316
ladanyi@1860
   317
  if (!arrow_pos_read_ok)
ladanyi@1860
   318
  {
ladanyi@1860
   319
    arrow_pos_read_ok = false;
ladanyi@1860
   320
    for (EdgeIt e(graph); e != INVALID; ++e)
ladanyi@1860
   321
    {
ladanyi@1860
   322
      arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
ladanyi@1860
   323
    }
ladanyi@1860
   324
  }
ladanyi@1860
   325
ladanyi@1645
   326
  // fill in the default values for the maps
ladanyi@1645
   327
  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
ladanyi@1645
   328
      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
ladanyi@1645
   329
  {
ladanyi@2063
   330
    if ((it->first != "label") &&
ladanyi@1645
   331
        (it->first != "coordiantes_x") &&
ladanyi@1645
   332
        (it->first != "coordinates_y"))
ladanyi@1645
   333
    {
ladanyi@1645
   334
      nodemap_default[it->first] = 0.0;
ladanyi@1645
   335
    }
ladanyi@2063
   336
    else if (it->first == "label")
ladanyi@1646
   337
    {
ladanyi@1646
   338
      NodeIt n(graph);
ladanyi@2063
   339
      double max = (*nodemap_storage["label"])[n];
ladanyi@1646
   340
      for (; n != INVALID; ++n)
ladanyi@1646
   341
      {
ladanyi@2063
   342
        if ((*nodemap_storage["label"])[n] > max)
ladanyi@2063
   343
          max = (*nodemap_storage["label"])[n];
ladanyi@1646
   344
      }
ladanyi@2063
   345
      nodemap_default["label"] = max + 1.0;
ladanyi@1646
   346
    }
ladanyi@1645
   347
  }
ladanyi@1645
   348
  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
ladanyi@1645
   349
      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
ladanyi@1645
   350
  {
ladanyi@2063
   351
    if (it->first != "label")
ladanyi@1645
   352
    {
ladanyi@1645
   353
      edgemap_default[it->first] = 0.0;
ladanyi@1645
   354
    }
ladanyi@1646
   355
    else
ladanyi@1646
   356
    {
ladanyi@1649
   357
      double max = std::numeric_limits<double>::min();
ladanyi@1649
   358
      for (EdgeIt e(graph); e != INVALID; ++e)
ladanyi@1646
   359
      {
ladanyi@2063
   360
        if ((*edgemap_storage["label"])[e] > max)
ladanyi@2063
   361
          max = (*edgemap_storage["label"])[e];
ladanyi@1646
   362
      }
ladanyi@1649
   363
      if (max > std::numeric_limits<double>::min())
ladanyi@2063
   364
        edgemap_default["label"] = max + 1.0;
ladanyi@1649
   365
      else
ladanyi@2063
   366
        edgemap_default["label"] = 1.0;
ladanyi@1646
   367
    }
ladanyi@1645
   368
  }
ladanyi@1645
   369
ladanyi@2065
   370
  // filter loop edges
ladanyi@2065
   371
  for (EdgeIt e(graph); e != INVALID; ++e)
ladanyi@2065
   372
  {
ladanyi@2065
   373
    if (graph.source(e) == graph.target(e))
ladanyi@2065
   374
    {
ladanyi@2065
   375
      std::cerr << "Removed loop edge " << (*edgemap_storage["label"])[e]
ladanyi@2065
   376
        << " (from " << (*nodemap_storage["label"])[graph.source(e)]
ladanyi@2065
   377
        << ", to " << (*nodemap_storage["label"])[graph.target(e)] << ")."
ladanyi@2065
   378
        << std::endl;
ladanyi@2065
   379
ladanyi@2065
   380
      graph.erase(e);
ladanyi@2065
   381
    }
ladanyi@2065
   382
  }
ladanyi@2065
   383
ladanyi@1645
   384
  return 0;
ladanyi@1606
   385
}
ladanyi@1606
   386
ladanyi@1606
   387
void MapStorage::writeToFile(const std::string &filename)
ladanyi@1606
   388
{
ladanyi@1606
   389
  GraphWriter<Graph> gwriter(filename, graph);
ladanyi@1606
   390
ladanyi@1606
   391
  for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
ladanyi@1606
   392
      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
ladanyi@1606
   393
  {
ladanyi@1606
   394
    gwriter.writeNodeMap(it->first, *(it->second));
ladanyi@1606
   395
  }
ladanyi@1606
   396
  for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
ladanyi@1606
   397
      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
ladanyi@1606
   398
  {
ladanyi@1860
   399
    if ((it->first != "arrow_pos_x") &&
ladanyi@1860
   400
        (it->first != "arrow_pos_y"))
ladanyi@1860
   401
    {
ladanyi@1860
   402
      gwriter.writeEdgeMap(it->first, *(it->second));
ladanyi@1860
   403
    }
ladanyi@1606
   404
  }
ladanyi@1860
   405
ladanyi@1860
   406
  GuiWriter gui_writer(gwriter, this);
ladanyi@1860
   407
ladanyi@1606
   408
  gwriter.run();
ladanyi@1606
   409
}
ladanyi@1606
   410
ladanyi@1606
   411
void MapStorage::clear()
ladanyi@1606
   412
{
ladanyi@1606
   413
  for (std::map<std::string, Graph::NodeMap<double>*>::iterator it =
ladanyi@1606
   414
      nodemap_storage.begin(); it != nodemap_storage.end(); ++it)
ladanyi@1606
   415
  {
ladanyi@1606
   416
    if ((it->first != "coordinates_x") &&
ladanyi@1606
   417
        (it->first != "coordinates_y") &&
ladanyi@2063
   418
        (it->first != "label"))
ladanyi@1606
   419
    {
ladanyi@1606
   420
      delete it->second;
ladanyi@1606
   421
      nodemap_storage.erase(it);
ladanyi@1606
   422
    }
ladanyi@1606
   423
  }
ladanyi@1606
   424
  for (std::map<std::string, Graph::EdgeMap<double>*>::iterator it =
ladanyi@1606
   425
      edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
ladanyi@1606
   426
  {
ladanyi@2063
   427
    if ((it->first != "label") &&
ladanyi@1860
   428
        (it->first != "arrow_pos_x") &&
ladanyi@1860
   429
        (it->first != "arrow_pos_y"))
ladanyi@1606
   430
    {
ladanyi@1606
   431
      delete it->second;
ladanyi@1606
   432
      edgemap_storage.erase(it);
ladanyi@1606
   433
    }
ladanyi@1606
   434
  }
ladanyi@1645
   435
  for (std::map<std::string, double>::iterator it =
ladanyi@1645
   436
      nodemap_default.begin(); it != nodemap_default.end(); ++it)
ladanyi@1645
   437
  {
ladanyi@2063
   438
    if (it->first != "label")
ladanyi@1646
   439
      nodemap_default.erase(it);
ladanyi@1645
   440
  }
ladanyi@1645
   441
  for (std::map<std::string, double>::iterator it =
ladanyi@1645
   442
      edgemap_default.begin(); it != edgemap_default.end(); ++it)
ladanyi@1645
   443
  {
ladanyi@2063
   444
    if (it->first != "label")
ladanyi@1646
   445
      edgemap_default.erase(it);
ladanyi@1645
   446
  }
ladanyi@1606
   447
  graph.clear();
ladanyi@1606
   448
  file_name = "";
ladanyi@1606
   449
  modified = false;
ladanyi@1606
   450
}
ladanyi@1860
   451
ladanyi@1860
   452
void MapStorage::ArrowPosReadOK()
ladanyi@1860
   453
{
ladanyi@1860
   454
  arrow_pos_read_ok = true;
ladanyi@1860
   455
}
hegyi@1881
   456
hegyi@1881
   457
void MapStorage::mapChanged(bool itisedge, std::string mapname)
hegyi@1881
   458
{
hegyi@1881
   459
  if(itisedge)
hegyi@1881
   460
    {
hegyi@1881
   461
      for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@1881
   462
	{
hegyi@1881
   463
	  if(active_edgemaps[i]==mapname)
hegyi@1881
   464
	    {
hegyi@1881
   465
	      signal_prop.emit(itisedge, i);
hegyi@1881
   466
	    }
hegyi@1881
   467
	}
hegyi@1881
   468
    }
hegyi@1881
   469
  else
hegyi@1881
   470
    {
hegyi@1881
   471
      for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@1881
   472
	{
hegyi@1881
   473
	  if(active_nodemaps[i]==mapname)
hegyi@1881
   474
	    {
hegyi@1881
   475
	      signal_prop.emit(itisedge, i);
hegyi@1881
   476
	    }
hegyi@1881
   477
	}
hegyi@1881
   478
    }
hegyi@1881
   479
}