238 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); |
238 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); |
239 |
239 |
240 // update coordinates |
240 // update coordinates |
241 mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y)); |
241 mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y)); |
242 |
242 |
243 // update id map |
|
244 (*mapstorage.nodemap_storage["id"])[active_node] = |
|
245 mapstorage.graph.id(active_node); |
|
246 |
|
247 // update all other maps |
243 // update all other maps |
248 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
244 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
249 mapstorage.nodemap_storage.begin(); it != |
245 mapstorage.nodemap_storage.begin(); it != |
250 mapstorage.nodemap_storage.end(); ++it) |
246 mapstorage.nodemap_storage.end(); ++it) |
251 { |
247 { |
252 if ((it->first != "id") && |
248 if ((it->first != "coordinates_x") && |
253 (it->first != "coordinates_x") && |
249 (it->first != "coordinates_y")) |
254 (it->first != "coordiantes_y")) |
|
255 { |
250 { |
256 (*(it->second))[active_node] = |
251 (*(it->second))[active_node] = |
257 mapstorage.nodemap_default[it->first]; |
252 mapstorage.nodemap_default[it->first]; |
258 } |
253 } |
259 } |
254 } |
|
255 // increment the id map's default value |
|
256 mapstorage.nodemap_default["id"] += 1.0; |
260 |
257 |
261 nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, |
258 nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, |
262 clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20); |
259 clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20); |
263 active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]); |
260 active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]); |
264 *(nodesmap[active_node]) << |
261 *(nodesmap[active_node]) << |
354 |
351 |
355 //creating new edge |
352 //creating new edge |
356 active_edge=mapstorage.graph.addEdge(active_node, |
353 active_edge=mapstorage.graph.addEdge(active_node, |
357 target_node); |
354 target_node); |
358 |
355 |
359 // update id map |
356 // update maps |
360 (*mapstorage.edgemap_storage["id"])[active_edge] = |
|
361 mapstorage.graph.id(active_edge); |
|
362 |
|
363 // update all other maps |
|
364 for (std::map<std::string, |
357 for (std::map<std::string, |
365 Graph::EdgeMap<double>*>::const_iterator it = |
358 Graph::EdgeMap<double>*>::const_iterator it = |
366 mapstorage.edgemap_storage.begin(); it != |
359 mapstorage.edgemap_storage.begin(); it != |
367 mapstorage.edgemap_storage.end(); ++it) |
360 mapstorage.edgemap_storage.end(); ++it) |
368 { |
361 { |
369 if (it->first != "id") |
362 (*(it->second))[active_edge] = |
370 { |
363 mapstorage.edgemap_default[it->first]; |
371 (*(it->second))[active_edge] = |
|
372 mapstorage.edgemap_default[it->first]; |
|
373 } |
|
374 } |
364 } |
|
365 // increment the id map's default value |
|
366 mapstorage.edgemap_default["id"] += 1.0; |
375 |
367 |
376 //calculating coordinates of new edge |
368 //calculating coordinates of new edge |
377 Gnome::Canvas::Points coos; |
369 Gnome::Canvas::Points coos; |
378 double x1, x2, y1, y2; |
370 double x1, x2, y1, y2; |
379 |
371 |