15 edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph); |
15 edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph); |
16 arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]); |
16 arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]); |
17 edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph); |
17 edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph); |
18 arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]); |
18 arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]); |
19 |
19 |
20 nodemap_storage["id"] = new Graph::NodeMap<double>(graph); |
20 nodemap_storage["label"] = new Graph::NodeMap<double>(graph); |
21 edgemap_storage["id"] = new Graph::EdgeMap<double>(graph); |
21 edgemap_storage["label"] = new Graph::EdgeMap<double>(graph); |
22 |
22 |
23 nodemap_default["id"] = 1.0; |
23 nodemap_default["label"] = 1.0; |
24 edgemap_default["id"] = 1.0; |
24 edgemap_default["label"] = 1.0; |
25 |
25 |
26 active_nodemaps.resize(NODE_PROPERTY_NUM); |
26 active_nodemaps.resize(NODE_PROPERTY_NUM); |
27 for(int i=0;i<NODE_PROPERTY_NUM;i++) |
27 for(int i=0;i<NODE_PROPERTY_NUM;i++) |
28 { |
28 { |
29 active_nodemaps[i]=""; |
29 active_nodemaps[i]=""; |
324 |
324 |
325 // fill in the default values for the maps |
325 // fill in the default values for the maps |
326 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
326 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
327 nodemap_storage.begin(); it != nodemap_storage.end(); ++it) |
327 nodemap_storage.begin(); it != nodemap_storage.end(); ++it) |
328 { |
328 { |
329 if ((it->first != "id") && |
329 if ((it->first != "label") && |
330 (it->first != "coordiantes_x") && |
330 (it->first != "coordiantes_x") && |
331 (it->first != "coordinates_y")) |
331 (it->first != "coordinates_y")) |
332 { |
332 { |
333 nodemap_default[it->first] = 0.0; |
333 nodemap_default[it->first] = 0.0; |
334 } |
334 } |
335 else if (it->first == "id") |
335 else if (it->first == "label") |
336 { |
336 { |
337 NodeIt n(graph); |
337 NodeIt n(graph); |
338 double max = (*nodemap_storage["id"])[n]; |
338 double max = (*nodemap_storage["label"])[n]; |
339 for (; n != INVALID; ++n) |
339 for (; n != INVALID; ++n) |
340 { |
340 { |
341 if ((*nodemap_storage["id"])[n] > max) |
341 if ((*nodemap_storage["label"])[n] > max) |
342 max = (*nodemap_storage["id"])[n]; |
342 max = (*nodemap_storage["label"])[n]; |
343 } |
343 } |
344 nodemap_default["id"] = max + 1.0; |
344 nodemap_default["label"] = max + 1.0; |
345 } |
345 } |
346 } |
346 } |
347 for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it = |
347 for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it = |
348 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) |
348 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) |
349 { |
349 { |
350 if (it->first != "id") |
350 if (it->first != "label") |
351 { |
351 { |
352 edgemap_default[it->first] = 0.0; |
352 edgemap_default[it->first] = 0.0; |
353 } |
353 } |
354 else |
354 else |
355 { |
355 { |
356 double max = std::numeric_limits<double>::min(); |
356 double max = std::numeric_limits<double>::min(); |
357 for (EdgeIt e(graph); e != INVALID; ++e) |
357 for (EdgeIt e(graph); e != INVALID; ++e) |
358 { |
358 { |
359 if ((*edgemap_storage["id"])[e] > max) |
359 if ((*edgemap_storage["label"])[e] > max) |
360 max = (*edgemap_storage["id"])[e]; |
360 max = (*edgemap_storage["label"])[e]; |
361 } |
361 } |
362 if (max > std::numeric_limits<double>::min()) |
362 if (max > std::numeric_limits<double>::min()) |
363 edgemap_default["id"] = max + 1.0; |
363 edgemap_default["label"] = max + 1.0; |
364 else |
364 else |
365 edgemap_default["id"] = 1.0; |
365 edgemap_default["label"] = 1.0; |
366 } |
366 } |
367 } |
367 } |
368 |
368 |
369 return 0; |
369 return 0; |
370 } |
370 } |
398 for (std::map<std::string, Graph::NodeMap<double>*>::iterator it = |
398 for (std::map<std::string, Graph::NodeMap<double>*>::iterator it = |
399 nodemap_storage.begin(); it != nodemap_storage.end(); ++it) |
399 nodemap_storage.begin(); it != nodemap_storage.end(); ++it) |
400 { |
400 { |
401 if ((it->first != "coordinates_x") && |
401 if ((it->first != "coordinates_x") && |
402 (it->first != "coordinates_y") && |
402 (it->first != "coordinates_y") && |
403 (it->first != "id")) |
403 (it->first != "label")) |
404 { |
404 { |
405 delete it->second; |
405 delete it->second; |
406 nodemap_storage.erase(it); |
406 nodemap_storage.erase(it); |
407 } |
407 } |
408 } |
408 } |
409 for (std::map<std::string, Graph::EdgeMap<double>*>::iterator it = |
409 for (std::map<std::string, Graph::EdgeMap<double>*>::iterator it = |
410 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) |
410 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) |
411 { |
411 { |
412 if ((it->first != "id") && |
412 if ((it->first != "label") && |
413 (it->first != "arrow_pos_x") && |
413 (it->first != "arrow_pos_x") && |
414 (it->first != "arrow_pos_y")) |
414 (it->first != "arrow_pos_y")) |
415 { |
415 { |
416 delete it->second; |
416 delete it->second; |
417 edgemap_storage.erase(it); |
417 edgemap_storage.erase(it); |
418 } |
418 } |
419 } |
419 } |
420 for (std::map<std::string, double>::iterator it = |
420 for (std::map<std::string, double>::iterator it = |
421 nodemap_default.begin(); it != nodemap_default.end(); ++it) |
421 nodemap_default.begin(); it != nodemap_default.end(); ++it) |
422 { |
422 { |
423 if (it->first != "id") |
423 if (it->first != "label") |
424 nodemap_default.erase(it); |
424 nodemap_default.erase(it); |
425 } |
425 } |
426 for (std::map<std::string, double>::iterator it = |
426 for (std::map<std::string, double>::iterator it = |
427 edgemap_default.begin(); it != edgemap_default.end(); ++it) |
427 edgemap_default.begin(); it != edgemap_default.end(); ++it) |
428 { |
428 { |
429 if (it->first != "id") |
429 if (it->first != "label") |
430 edgemap_default.erase(it); |
430 edgemap_default.erase(it); |
431 } |
431 } |
432 graph.clear(); |
432 graph.clear(); |
433 file_name = ""; |
433 file_name = ""; |
434 modified = false; |
434 modified = false; |