Changeset 1860:27a9a75b957b in lemon-0.x for gui/mapstorage.cc
- Timestamp:
- 12/17/05 21:55:41 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2432
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/mapstorage.cc
r1837 r1860 1 1 #include "mapstorage.h" 2 #include "gui_writer.h" 3 #include "gui_reader.h" 2 4 #include <gtkmm.h> 3 5 #include <cmath> … … 5 7 #include <cmath> 6 8 7 MapStorage::MapStorage() : modified(false), file_name("") 9 MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false) 8 10 { 9 11 nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph); … … 11 13 nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph); 12 14 coords.setYMap(*nodemap_storage["coordinates_y"]); 15 16 edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph); 17 arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]); 18 edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph); 19 arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]); 13 20 14 21 nodemap_storage["id"] = new Graph::NodeMap<double>(graph); … … 248 255 greader.readEdgeMap(*it, *edgemap_storage[*it]); 249 256 } 257 GuiReader gui_reader(greader, this); 250 258 greader.run(); 251 259 } catch (DataFormatError& error) { … … 284 292 } 285 293 294 if (!arrow_pos_read_ok) 295 { 296 arrow_pos_read_ok = false; 297 for (EdgeIt e(graph); e != INVALID; ++e) 298 { 299 arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0); 300 } 301 } 302 286 303 // fill in the default values for the maps 287 304 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = … … 339 356 { 340 357 gwriter.writeNodeMap(it->first, *(it->second)); 341 //std::cout << "wrote " << it->first << " nodemap" << std::endl;342 358 } 343 359 for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it = 344 360 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) 345 361 { 346 gwriter.writeEdgeMap(it->first, *(it->second)); 347 //std::cout << "wrote " << it->first << " edgemap" << std::endl; 348 } 362 if ((it->first != "arrow_pos_x") && 363 (it->first != "arrow_pos_y")) 364 { 365 gwriter.writeEdgeMap(it->first, *(it->second)); 366 } 367 } 368 369 GuiWriter gui_writer(gwriter, this); 370 349 371 gwriter.run(); 350 372 } … … 366 388 edgemap_storage.begin(); it != edgemap_storage.end(); ++it) 367 389 { 368 if (it->first != "id") 390 if ((it->first != "id") && 391 (it->first != "arrow_pos_x") && 392 (it->first != "arrow_pos_y")) 369 393 { 370 394 delete it->second; … … 388 412 modified = false; 389 413 } 414 415 void MapStorage::ArrowPosReadOK() 416 { 417 arrow_pos_read_ok = true; 418 }
Note: See TracChangeset
for help on using the changeset viewer.