diff -r 23f0afd1a323 -r f60f89147531 mapstorage.cc --- a/mapstorage.cc Thu Dec 08 14:16:08 2005 +0000 +++ b/mapstorage.cc Sat Dec 17 20:55:41 2005 +0000 @@ -1,16 +1,23 @@ #include "mapstorage.h" +#include "gui_writer.h" +#include "gui_reader.h" #include #include #include -MapStorage::MapStorage() : modified(false), file_name("") +MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false) { nodemap_storage["coordinates_x"] = new Graph::NodeMap(graph); coords.setXMap(*nodemap_storage["coordinates_x"]); nodemap_storage["coordinates_y"] = new Graph::NodeMap(graph); coords.setYMap(*nodemap_storage["coordinates_y"]); + edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap(graph); + arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]); + edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap(graph); + arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]); + nodemap_storage["id"] = new Graph::NodeMap(graph); edgemap_storage["id"] = new Graph::EdgeMap(graph); @@ -247,6 +254,7 @@ } greader.readEdgeMap(*it, *edgemap_storage[*it]); } + GuiReader gui_reader(greader, this); greader.run(); } catch (DataFormatError& error) { Gtk::MessageDialog mdialog(error.what()); @@ -283,6 +291,15 @@ } } + if (!arrow_pos_read_ok) + { + arrow_pos_read_ok = false; + for (EdgeIt e(graph); e != INVALID; ++e) + { + arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0); + } + } + // fill in the default values for the maps for (std::map*>::const_iterator it = nodemap_storage.begin(); it != nodemap_storage.end(); ++it) @@ -338,14 +355,19 @@ nodemap_storage.begin(); it != nodemap_storage.end(); ++it) { gwriter.writeNodeMap(it->first, *(it->second)); - //std::cout << "wrote " << it->first << " nodemap" << std::endl; } for (std::map*>::const_iterator it = edgemap_storage.begin(); it != edgemap_storage.end(); ++it) { - gwriter.writeEdgeMap(it->first, *(it->second)); - //std::cout << "wrote " << it->first << " edgemap" << std::endl; + if ((it->first != "arrow_pos_x") && + (it->first != "arrow_pos_y")) + { + gwriter.writeEdgeMap(it->first, *(it->second)); + } } + + GuiWriter gui_writer(gwriter, this); + gwriter.run(); } @@ -365,7 +387,9 @@ for (std::map*>::iterator it = edgemap_storage.begin(); it != edgemap_storage.end(); ++it) { - if (it->first != "id") + if ((it->first != "id") && + (it->first != "arrow_pos_x") && + (it->first != "arrow_pos_y")) { delete it->second; edgemap_storage.erase(it); @@ -387,3 +411,8 @@ file_name = ""; modified = false; } + +void MapStorage::ArrowPosReadOK() +{ + arrow_pos_read_ok = true; +}