graph_displayer_canvas-event.cc
branchgui
changeset 64 7a32d528857f
parent 63 59768817442a
child 65 1b8e20c04704
     1.1 --- a/graph_displayer_canvas-event.cc	Tue Aug 23 07:36:09 2005 +0000
     1.2 +++ b/graph_displayer_canvas-event.cc	Tue Aug 23 15:57:12 2005 +0000
     1.3 @@ -240,23 +240,20 @@
     1.4        // update coordinates
     1.5        mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y));
     1.6  
     1.7 -      // update id map
     1.8 -      (*mapstorage.nodemap_storage["id"])[active_node] =
     1.9 -        mapstorage.graph.id(active_node);
    1.10 -
    1.11        // update all other maps
    1.12        for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
    1.13            mapstorage.nodemap_storage.begin(); it !=
    1.14            mapstorage.nodemap_storage.end(); ++it)
    1.15        {
    1.16 -        if ((it->first != "id") &&
    1.17 -            (it->first != "coordinates_x") &&
    1.18 -            (it->first != "coordiantes_y"))
    1.19 +        if ((it->first != "coordinates_x") &&
    1.20 +            (it->first != "coordinates_y"))
    1.21          {
    1.22            (*(it->second))[active_node] =
    1.23              mapstorage.nodemap_default[it->first];
    1.24          }
    1.25        }
    1.26 +      // increment the id map's default value
    1.27 +      mapstorage.nodemap_default["id"] += 1.0;
    1.28  
    1.29        nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
    1.30            clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
    1.31 @@ -356,22 +353,17 @@
    1.32                active_edge=mapstorage.graph.addEdge(active_node,
    1.33                    target_node);
    1.34  
    1.35 -              // update id map
    1.36 -              (*mapstorage.edgemap_storage["id"])[active_edge] = 
    1.37 -                mapstorage.graph.id(active_edge);
    1.38 - 
    1.39 -              // update all other maps
    1.40 +              // update maps
    1.41                for (std::map<std::string,
    1.42                    Graph::EdgeMap<double>*>::const_iterator it =
    1.43                    mapstorage.edgemap_storage.begin(); it !=
    1.44                    mapstorage.edgemap_storage.end(); ++it)
    1.45                {
    1.46 -                if (it->first != "id")
    1.47 -                {
    1.48 -                  (*(it->second))[active_edge] =
    1.49 -                    mapstorage.edgemap_default[it->first];
    1.50 -                }
    1.51 +                (*(it->second))[active_edge] =
    1.52 +                  mapstorage.edgemap_default[it->first];
    1.53                }
    1.54 +              // increment the id map's default value
    1.55 +              mapstorage.edgemap_default["id"] += 1.0;
    1.56  
    1.57                //calculating coordinates of new edge
    1.58                Gnome::Canvas::Points coos;