gui/graph_displayer_canvas-event.cc
changeset 1612 64f983f5a7d5
parent 1599 c2f95eac652b
child 1614 350c1d8bb7cc
equal deleted inserted replaced
16:5010eb6a9836 17:29e29f714e19
     1 #include <graph_displayer_canvas.h>
     1 #include "graph_displayer_canvas.h"
     2 #include <broken_edge.h>
     2 #include "broken_edge.h"
     3 #include <math.h>
     3 #include <math.h>
     4 
     4 
     5 
     5 
     6 bool GraphDisplayerCanvas::on_expose_event(GdkEventExpose *event)
     6 bool GraphDisplayerCanvas::on_expose_event(GdkEventExpose *event)
     7 {
     7 {
    97       //we mark the location of the event to be able to calculate parameters of dragging
    97       //we mark the location of the event to be able to calculate parameters of dragging
    98       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    98       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    99 
    99 
   100       active_item=(get_item_at(clicked_x, clicked_y));
   100       active_item=(get_item_at(clicked_x, clicked_y));
   101       active_node=INVALID;
   101       active_node=INVALID;
   102       for (NodeIt i(g); i!=INVALID; ++i)
   102       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   103 	{
   103 	{
   104 	  if(nodesmap[i]==active_item)
   104 	  if(nodesmap[i]==active_item)
   105 	    {
   105 	    {
   106 	      active_node=i;
   106 	      active_node=i;
   107 	    }
   107 	    }
   123       break;
   123       break;
   124     case GDK_MOTION_NOTIFY:
   124     case GDK_MOTION_NOTIFY:
   125       //we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
   125       //we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
   126       if(active_node!=INVALID)
   126       if(active_node!=INVALID)
   127       {
   127       {
       
   128         mapstorage.modified = true;
       
   129         mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y));
   128 	//new coordinates will be the old values,
   130 	//new coordinates will be the old values,
   129 	//because the item will be moved to the
   131 	//because the item will be moved to the
   130 	//new coordinate therefore the new movement
   132 	//new coordinate therefore the new movement
   131 	//has to be calculated from here
   133 	//has to be calculated from here
   132 
   134 
   145         clicked_y=new_y;
   147         clicked_y=new_y;
   146 
   148 
   147 	//all the edges connected to the moved point has to be redrawn
   149 	//all the edges connected to the moved point has to be redrawn
   148         EdgeIt ei;
   150         EdgeIt ei;
   149 
   151 
   150         g.firstOut(ei,active_node);
   152         mapstorage.graph.firstOut(ei,active_node);
   151 
   153 
   152         for(;ei!=INVALID;g.nextOut(ei))
   154         for(;ei!=INVALID;mapstorage.graph.nextOut(ei))
   153         {
   155         {
   154             Gnome::Canvas::Points coos;
   156             Gnome::Canvas::Points coos;
   155             double x1, x2, y1, y2;
   157             double x1, x2, y1, y2;
   156 
   158 
   157             nodesmap[g.source(ei)]->get_bounds(x1, y1, x2, y2);
   159             nodesmap[mapstorage.graph.source(ei)]->get_bounds(x1, y1, x2, y2);
   158             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   160             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   159 
   161 
   160             nodesmap[g.target(ei)]->get_bounds(x1, y1, x2, y2);
   162             nodesmap[mapstorage.graph.target(ei)]->get_bounds(x1, y1, x2, y2);
   161             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   163             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   162 
   164 
   163 	    if(isbutton==3)
   165 	    if(isbutton==3)
   164 	      {
   166 	      {
   165 		edgesmap[ei]->setPoints(coos);
   167 		edgesmap[ei]->setPoints(coos);
   174 	    text_pos+=(xy<double>(10,10));
   176 	    text_pos+=(xy<double>(10,10));
   175 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
   177 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
   176 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
   178 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
   177         }
   179         }
   178 
   180 
   179         g.firstIn(ei,active_node);
   181         mapstorage.graph.firstIn(ei,active_node);
   180         for(;ei!=INVALID;g.nextIn(ei))
   182         for(;ei!=INVALID;mapstorage.graph.nextIn(ei))
   181         {
   183         {
   182             Gnome::Canvas::Points coos;
   184             Gnome::Canvas::Points coos;
   183             double x1, x2, y1, y2;
   185             double x1, x2, y1, y2;
   184 
   186 
   185             nodesmap[g.source(ei)]->get_bounds(x1, y1, x2, y2);
   187             nodesmap[mapstorage.graph.source(ei)]->get_bounds(x1, y1, x2, y2);
   186             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   188             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   187 
   189 
   188             nodesmap[g.target(ei)]->get_bounds(x1, y1, x2, y2);
   190             nodesmap[mapstorage.graph.target(ei)]->get_bounds(x1, y1, x2, y2);
   189             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   191             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   190 
   192 
   191 	    if(isbutton==3)
   193 	    if(isbutton==3)
   192 	      {
   194 	      {
   193 		edgesmap[ei]->setPoints(coos);
   195 		edgesmap[ei]->setPoints(coos);
   217       //draw the new node in red at the clicked place
   219       //draw the new node in red at the clicked place
   218     case GDK_2BUTTON_PRESS:
   220     case GDK_2BUTTON_PRESS:
   219       //std::cout << "double click" << std::endl;
   221       //std::cout << "double click" << std::endl;
   220       break;
   222       break;
   221     case GDK_BUTTON_PRESS:
   223     case GDK_BUTTON_PRESS:
       
   224       mapstorage.modified = true;
       
   225 
   222       isbutton=1;
   226       isbutton=1;
   223 
   227 
   224       active_node=NodeIt(g,g.addNode());
   228       active_node=NodeIt(mapstorage.graph,mapstorage.graph.addNode());
   225 
   229 
   226       //initiating values corresponding to new node in maps
   230       //initiating values corresponding to new node in maps
   227 
   231 
   228       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   232       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   229 
   233 
   230       nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
   234       mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y));
       
   235       (*mapstorage.nodemap_storage["id"])[active_node] =
       
   236         mapstorage.graph.id(active_node);
       
   237 
       
   238       nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
       
   239         clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
   231       active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
   240       active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
   232       *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
   241       *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
   233       *(nodesmap[active_node]) << Gnome::Canvas::Properties::outline_color("black");
   242       *(nodesmap[active_node]) << Gnome::Canvas::Properties::outline_color("black");
   234       (nodesmap[active_node])->show();
   243       (nodesmap[active_node])->show();
   235 
   244 
   236       nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph, clicked_x+node_property_defaults[N_RADIUS]+5, clicked_y+node_property_defaults[N_RADIUS]+5, "");
   245       nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph,
       
   246         clicked_x+node_property_defaults[N_RADIUS]+5,
       
   247         clicked_y+node_property_defaults[N_RADIUS]+5, "");
   237       nodetextmap[active_node]->property_fill_color().set_value("darkblue");
   248       nodetextmap[active_node]->property_fill_color().set_value("darkblue");
   238 
   249 
   239       mapwin->updateNode(active_node);
   250       mapwin.updateNode(active_node);
   240 
   251 
   241       break;
   252       break;
   242 
   253 
   243       //move the new node
   254       //move the new node
   244     case GDK_MOTION_NOTIFY:
   255     case GDK_MOTION_NOTIFY:
   298 
   309 
   299 	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   310 	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   300 
   311 
   301 	      active_item=(get_item_at(clicked_x, clicked_y));
   312 	      active_item=(get_item_at(clicked_x, clicked_y));
   302 	      active_node=INVALID;
   313 	      active_node=INVALID;
   303 	      for (NodeIt i(g); i!=INVALID; ++i)
   314 	      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   304 		{
   315 		{
   305 		  if(nodesmap[i]==active_item)
   316 		  if(nodesmap[i]==active_item)
   306 		    {
   317 		    {
   307 		      active_node=i;
   318 		      active_node=i;
   308 		    }
   319 		    }
   327 	  else
   338 	  else
   328 	    {
   339 	    {
   329 	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   340 	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   330 	      target_item=(get_item_at(clicked_x, clicked_y));
   341 	      target_item=(get_item_at(clicked_x, clicked_y));
   331 	      Graph::NodeIt target_node=INVALID;
   342 	      Graph::NodeIt target_node=INVALID;
   332 	      for (NodeIt i(g); i!=INVALID; ++i)
   343 	      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   333 		{
   344 		{
   334 		  if(nodesmap[i]==target_item)
   345 		  if(nodesmap[i]==target_item)
   335 		    {
   346 		    {
   336 		      target_node=i;
   347 		      target_node=i;
   337 		    }
   348 		    }
   339 	      //the clicked item is a node, the edge can be drawn
   350 	      //the clicked item is a node, the edge can be drawn
   340 	      if(target_node!=INVALID)
   351 	      if(target_node!=INVALID)
   341 		{
   352 		{
   342 		  if(target_node!=active_node)		
   353 		  if(target_node!=active_node)		
   343 		    {
   354 		    {
       
   355           mapstorage.modified = true;
       
   356 
   344 		      *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
   357 		      *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
   345 
   358 
   346 		      //creating new edge
   359 		      //creating new edge
   347 		      active_edge=EdgeIt(g,g.addEdge(active_node, target_node));
   360 		      active_edge=EdgeIt(mapstorage.graph,mapstorage.graph.addEdge(active_node, target_node));
   348 
   361 
   349 		      //initiating values corresponding to new edge in maps
   362 		      //initiating values corresponding to new edge in maps
   350 		      mapstorage.initMapsForEdge(active_edge);
   363 		      mapstorage.initMapsForEdge(active_edge);
       
   364                       (*mapstorage.edgemap_storage["id"])[active_edge] = mapstorage.graph.id(active_edge);
   351 	  
   365 	  
   352 		      //calculating coordinates of new edge
   366 		      //calculating coordinates of new edge
   353 		      Gnome::Canvas::Points coos;
   367 		      Gnome::Canvas::Points coos;
   354 		      double x1, x2, y1, y2;
   368 		      double x1, x2, y1, y2;
   355 	  
   369 	  
   374 
   388 
   375 		      edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
   389 		      edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
   376 		      edgetextmap[active_edge]->property_fill_color().set_value("darkgreen");
   390 		      edgetextmap[active_edge]->property_fill_color().set_value("darkgreen");
   377 
   391 
   378 		      //updating its properties
   392 		      //updating its properties
   379 		      mapwin->updateEdge(active_edge);
   393 		      mapwin.updateEdge(active_edge);
   380 		    }
   394 		    }
   381 		  else
   395 		  else
   382 		    {
   396 		    {
   383 		      target_node=INVALID;
   397 		      target_node=INVALID;
   384 		      std::cerr << "Loop edge is not yet implemented!" << std::endl;
   398 		      std::cerr << "Loop edge is not yet implemented!" << std::endl;
   427       //finding the clicked items
   441       //finding the clicked items
   428       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   442       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   429       active_item=(get_item_at(clicked_x, clicked_y));
   443       active_item=(get_item_at(clicked_x, clicked_y));
   430       active_node=INVALID;
   444       active_node=INVALID;
   431       active_edge=INVALID;
   445       active_edge=INVALID;
   432 
       
   433       //was it a node?
   446       //was it a node?
   434       for (NodeIt i(g); i!=INVALID; ++i)
   447       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   435 	{
   448 	{
   436 	  if(nodesmap[i]==active_item)
   449 	  if(nodesmap[i]==active_item)
   437 	    {
   450 	    {
   438 	      active_node=i;
   451 	      active_node=i;
   439 	    }
   452 	    }
   440 	}
   453 	}
   441       //or was it an edge?
   454       //or was it an edge?
   442       if(active_node==INVALID)
   455       if(active_node==INVALID)
   443 	{
   456 	{
   444 	  for (EdgeIt i(g); i!=INVALID; ++i)
   457 	  for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   445 	    {
   458 	    {
   446 	      if(edgesmap[i]==active_item)
   459 	      if(edgesmap[i]==active_item)
   447 		{
   460 		{
   448 		  active_edge=i;
   461 		  active_edge=i;
   449 		}
   462 		}
   465 	  if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
   478 	  if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
   466 	    {
   479 	    {
   467 	      //a node was found
   480 	      //a node was found
   468 	      if(active_node!=INVALID)
   481 	      if(active_node!=INVALID)
   469 		{
   482 		{
       
   483                   mapstorage.modified = true;
   470 
   484 
   471 		  //collecting edges to delete
   485 		  //collecting edges to delete
   472 		  EdgeIt e;
   486 		  EdgeIt e;
   473 		  std::set<Graph::Edge> edges_to_delete;
   487 		  std::set<Graph::Edge> edges_to_delete;
   474 
   488 
   475 		  g.firstOut(e,active_node);
   489 		  mapstorage.graph.firstOut(e,active_node);
   476 		  for(;e!=INVALID;g.nextOut(e))
   490 		  for(;e!=INVALID;mapstorage.graph.nextOut(e))
   477 		    {
   491 		    {
   478 		      edges_to_delete.insert(e);
   492 		      edges_to_delete.insert(e);
   479 		    }
   493 		    }
   480 
   494 
   481 		  g.firstIn(e,active_node);
   495 		  mapstorage.graph.firstIn(e,active_node);
   482 		  for(;e!=INVALID;g.nextIn(e))
   496 		  for(;e!=INVALID;mapstorage.graph.nextIn(e))
   483 		    {
   497 		    {
   484 		      edges_to_delete.insert(e);
   498 		      edges_to_delete.insert(e);
   485 		    }
   499 		    }
   486 
   500 
   487 		  //deleting collected edges
   501 		  //deleting collected edges
   543 	    //for determine, whether it was an edge
   557 	    //for determine, whether it was an edge
   544 	    Graph::EdgeIt clicked_edge=INVALID;
   558 	    Graph::EdgeIt clicked_edge=INVALID;
   545 
   559 
   546 	    //find the activated item between texts
   560 	    //find the activated item between texts
   547 	    active_item=(get_item_at(e->button.x, e->button.y));
   561 	    active_item=(get_item_at(e->button.x, e->button.y));
   548 	    for (EdgeIt i(g); i!=INVALID; ++i)
   562 	    for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   549 	      {
   563 	      {
   550 		if(edgetextmap[i]==active_item)
   564 		if(edgetextmap[i]==active_item)
   551 		  {
   565 		  {
   552 		    clicked_edge=i;
   566 		    clicked_edge=i;
   553 		  }
   567 		  }
   557 	    if(clicked_edge==INVALID)
   571 	    if(clicked_edge==INVALID)
   558 	      {
   572 	      {
   559 		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   573 		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   560 		active_item=(get_item_at(clicked_x, clicked_y));
   574 		active_item=(get_item_at(clicked_x, clicked_y));
   561 
   575 
   562 		for (EdgeIt i(g); i!=INVALID; ++i)
   576 		for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   563 		  {
   577 		  {
   564 		    //at the same time only one can be active
   578 		    //at the same time only one can be active
   565 		    if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
   579 		    if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
   566 		      {
   580 		      {
   567 			clicked_edge=i;
   581 			clicked_edge=i;
   661 	    //for determine, whether it was a node
   675 	    //for determine, whether it was a node
   662 	    Graph::NodeIt clicked_node=INVALID;
   676 	    Graph::NodeIt clicked_node=INVALID;
   663 
   677 
   664 	    //find the activated item between texts
   678 	    //find the activated item between texts
   665 	    active_item=(get_item_at(e->button.x, e->button.y));
   679 	    active_item=(get_item_at(e->button.x, e->button.y));
   666 	    for (NodeIt i(g); i!=INVALID; ++i)
   680 	    for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   667 	      {
   681 	      {
   668 		//at the same time only one can be active
   682 		//at the same time only one can be active
   669 		if(nodetextmap[i]==active_item)
   683 		if(nodetextmap[i]==active_item)
   670 		  {
   684 		  {
   671 		    clicked_node=i;
   685 		    clicked_node=i;
   676 	    if(clicked_node==INVALID)
   690 	    if(clicked_node==INVALID)
   677 	      {
   691 	      {
   678 		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   692 		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   679 		active_item=(get_item_at(clicked_x, clicked_y));
   693 		active_item=(get_item_at(clicked_x, clicked_y));
   680 
   694 
   681 		for (NodeIt i(g); i!=INVALID; ++i)
   695 		for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   682 		  {
   696 		  {
   683 		    //at the same time only one can be active
   697 		    //at the same time only one can be active
   684 		    if(nodesmap[i]==active_item)
   698 		    if(nodesmap[i]==active_item)
   685 		      {
   699 		      {
   686 			clicked_node=i;
   700 			clicked_node=i;
   801 		    switch(actual_tool)
   815 		    switch(actual_tool)
   802 		      {
   816 		      {
   803 		      case EDGE_MAP_EDIT:
   817 		      case EDGE_MAP_EDIT:
   804 			edgetextmap[active_edge]->property_text().set_value(ostr.str());
   818 			edgetextmap[active_edge]->property_text().set_value(ostr.str());
   805 			(*(mapstorage.edgemap_storage)[edgemap_to_edit])[active_edge]=mapvalue_d;
   819 			(*(mapstorage.edgemap_storage)[edgemap_to_edit])[active_edge]=mapvalue_d;
   806 			mapwin->updateEdge(active_edge);
   820 			mapwin.updateEdge(active_edge);
   807 			break;
   821 			break;
   808 		      case NODE_MAP_EDIT:
   822 		      case NODE_MAP_EDIT:
   809 			nodetextmap[active_node]->property_text().set_value(ostr.str());
   823 			nodetextmap[active_node]->property_text().set_value(ostr.str());
   810 			(*(mapstorage.nodemap_storage)[nodemap_to_edit])[active_node]=mapvalue_d;
   824 			(*(mapstorage.nodemap_storage)[nodemap_to_edit])[active_node]=mapvalue_d;
   811 			mapwin->updateNode(active_node);
   825 			mapwin.updateNode(active_node);
   812 			break;
   826 			break;
   813 		      default:
   827 		      default:
   814 			break;
   828 			break;
   815 		      }
   829 		      }
   816 		    entrywidget.hide();
   830 		    entrywidget.hide();
   833 
   847 
   834 void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
   848 void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
   835 {
   849 {
   836   delete(nodetextmap[node_to_delete]);
   850   delete(nodetextmap[node_to_delete]);
   837   delete(nodesmap[node_to_delete]);
   851   delete(nodesmap[node_to_delete]);
   838   g.erase(node_to_delete);
   852   mapstorage.graph.erase(node_to_delete);
   839 }
   853 }
   840 
   854 
   841 void GraphDisplayerCanvas::deleteItem(EdgeIt edge_to_delete)
   855 void GraphDisplayerCanvas::deleteItem(EdgeIt edge_to_delete)
   842 {
   856 {
   843   delete(edgetextmap[edge_to_delete]);
   857   delete(edgetextmap[edge_to_delete]);
   844   delete(edgesmap[edge_to_delete]);
   858   delete(edgesmap[edge_to_delete]);
   845   g.erase(edge_to_delete);
   859   mapstorage.graph.erase(edge_to_delete);
   846 }
   860 }
   847 
   861 
   848 void GraphDisplayerCanvas::deleteItem(Graph::Edge edge_to_delete)
   862 void GraphDisplayerCanvas::deleteItem(Graph::Edge edge_to_delete)
   849 {
   863 {
   850   delete(edgetextmap[edge_to_delete]);
   864   delete(edgetextmap[edge_to_delete]);
   851   delete(edgesmap[edge_to_delete]);
   865   delete(edgesmap[edge_to_delete]);
   852   g.erase(edge_to_delete);
   866   mapstorage.graph.erase(edge_to_delete);
   853 }
   867 }
   854 
   868 
   855 void GraphDisplayerCanvas::textReposition(xy<double> new_place)
   869 void GraphDisplayerCanvas::textReposition(xy<double> new_place)
   856 {
   870 {
   857   new_place+=(xy<double>(10,10));
   871   new_place+=(xy<double>(10,10));
   867 	{
   881 	{
   868 	  std::cerr << "ERROR!!!! Valid edge found!" << std::endl;
   882 	  std::cerr << "ERROR!!!! Valid edge found!" << std::endl;
   869 	}
   883 	}
   870       else
   884       else
   871 	{
   885 	{
   872 	  for (EdgeIt i(g); i!=INVALID; ++i)
   886 	  for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   873 	    {
   887 	    {
   874 	      if(edgesmap[i]==active_bre)
   888 	      if(edgesmap[i]==active_bre)
   875 		{
   889 		{
   876 		  forming_edge=i;
   890 		  forming_edge=i;
   877 		}
   891 		}
   893 }
   907 }
   894 
   908 
   895 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
   909 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
   896 {
   910 {
   897   //create the new map
   911   //create the new map
   898   Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (g,default_value);
   912   Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mapstorage.graph, default_value);
   899 
   913 
   900   //if addition was not successful addEdgeMap returns one.
   914   //if addition was not successful addEdgeMap returns one.
   901   //cause can be that there is already a map named like the new one
   915   //cause can be that there is already a map named like the new one
   902   if(mapstorage.addEdgeMap(mapname,emptr))
   916   if(mapstorage.addEdgeMap(mapname,emptr))
   903     {
   917     {
   904       return 1;
   918       return 1;
   905     }
   919     }
   906 
   920 
   907 
   921 
   908   //add it to the list of the displayable maps
   922   //add it to the list of the displayable maps
   909   mapwin->registerNewEdgeMap(mapname);
   923   mapwin.registerNewEdgeMap(mapname);
   910 
   924 
   911   //display it
   925   //display it
   912   changeEdgeText(mapname);
   926   changeEdgeText(mapname);
   913 
   927 
   914   return 0;
   928   return 0;
   915 }
   929 }
   916 
   930 
   917 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
   931 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
   918 {
   932 {
   919   //create the new map
   933   //create the new map
   920   Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (g,default_value);
   934   Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mapstorage.graph,default_value);
   921 
   935 
   922   //if addition was not successful addNodeMap returns one.
   936   //if addition was not successful addNodeMap returns one.
   923   //cause can be that there is already a map named like the new one
   937   //cause can be that there is already a map named like the new one
   924   if(mapstorage.addNodeMap(mapname,emptr))
   938   if(mapstorage.addNodeMap(mapname,emptr))
   925     {
   939     {
   926       return 1;
   940       return 1;
   927     }
   941     }
   928 
   942 
   929   //add it to the list of the displayable maps
   943   //add it to the list of the displayable maps
   930   mapwin->registerNewNodeMap(mapname);
   944   mapwin.registerNewNodeMap(mapname);
   931 
   945 
   932   //display it
   946   //display it
   933   changeNodeText(mapname);
   947   changeNodeText(mapname);
   934 
   948 
   935   return 0;
   949   return 0;