Uh, long comment arrives... Zoom update does not happen after editorial steps. Nodes initial color is light blue, if there is any item under them. Strange node-text relations disappeared. Initial values of new items are given now in a more common way. The wood-cutter way of handling default values of properties is now changed. gui
authorhegyi
Wed, 29 Jun 2005 19:44:30 +0000
branchgui
changeset 3166e85f44a66f
parent 30 f70bbee5350a
child 32 1f45545f124c
Uh, long comment arrives... Zoom update does not happen after editorial steps. Nodes initial color is light blue, if there is any item under them. Strange node-text relations disappeared. Initial values of new items are given now in a more common way. The wood-cutter way of handling default values of properties is now changed.
graph_displayer_canvas-edge.cc
graph_displayer_canvas-event.cc
graph_displayer_canvas-node.cc
graph_displayer_canvas.cc
map_win.cc
mapstorage.cc
mapstorage.h
     1.1 --- a/graph_displayer_canvas-edge.cc	Wed Jun 29 15:41:33 2005 +0000
     1.2 +++ b/graph_displayer_canvas-edge.cc	Wed Jun 29 19:44:30 2005 +0000
     1.3 @@ -5,11 +5,21 @@
     1.4  
     1.5  int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     1.6  {
     1.7 +  Graph::EdgeMap<double> * actual_map;
     1.8 +  if(mapname=="Default")
     1.9 +    {
    1.10 +      actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
    1.11 +    }
    1.12 +  else
    1.13 +    {
    1.14 +      actual_map=(mapstorage.edgemap_storage)[mapname];
    1.15 +    }
    1.16 +
    1.17    if(edge==INVALID)
    1.18      {
    1.19        for (EdgeIt i(g); i!=INVALID; ++i)
    1.20  	{
    1.21 -	  int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
    1.22 +	  int w=(int)(*actual_map)[i];
    1.23  	  if(w>=0)
    1.24  	    {
    1.25  	      edgesmap[i]->property_width_pixels().set_value(w);
    1.26 @@ -18,7 +28,7 @@
    1.27      }
    1.28    else
    1.29      {
    1.30 -      int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
    1.31 +      int w=(int)(*actual_map)[edge];
    1.32        if(w>=0)
    1.33  	{
    1.34  	  edgesmap[edge]->property_width_pixels().set_value(w);
    1.35 @@ -33,16 +43,35 @@
    1.36    //function maps the range of the maximum and
    1.37    //the minimum of the nodemap to the range of
    1.38    //green in RGB
    1.39 +  Graph::EdgeMap<double> * actual_map;
    1.40 +  if(mapname=="Default")
    1.41 +    {
    1.42 +      actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
    1.43 +    }
    1.44 +  else
    1.45 +    {
    1.46 +      actual_map=(mapstorage.edgemap_storage)[mapname];
    1.47 +    }
    1.48 +
    1.49 +  double max, min;
    1.50 +
    1.51 +  if(mapname!="Default")
    1.52 +    {
    1.53 +      max=mapstorage.maxOfEdgeMap(mapname);
    1.54 +      min=mapstorage.minOfEdgeMap(mapname);
    1.55 +    }
    1.56 +  else
    1.57 +    {
    1.58 +      max=edge_property_defaults[E_COLOR];
    1.59 +      min=edge_property_defaults[E_COLOR];
    1.60 +    }
    1.61 +
    1.62    if(edge==INVALID)
    1.63      {
    1.64 -
    1.65        for (EdgeIt i(g); i!=INVALID; ++i)
    1.66  	{
    1.67 -	  double w=(*(mapstorage.edgemap_storage)[mapname])[i];
    1.68 -	  double max=mapstorage.maxOfEdgeMap(mapname);
    1.69 -	  double min=mapstorage.minOfEdgeMap(mapname);
    1.70 -      
    1.71 -	  //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    1.72 +	  double w=(*actual_map)[i];
    1.73 +
    1.74  	  Gdk::Color color;
    1.75  	  if(max!=min)
    1.76  	    {
    1.77 @@ -52,18 +81,15 @@
    1.78  	    {
    1.79  	      color.set_rgb_p (0, 100, 0);
    1.80  	    }
    1.81 -
    1.82  	  edgesmap[i]->property_fill_color_gdk().set_value(color);
    1.83  	}
    1.84      }
    1.85    else
    1.86      {
    1.87 -      double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
    1.88 -      double max=mapstorage.maxOfEdgeMap(mapname);
    1.89 -      double min=mapstorage.minOfEdgeMap(mapname);
    1.90 -      
    1.91 -      //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    1.92        Gdk::Color color;
    1.93 +
    1.94 +      double w=(*actual_map)[edge];
    1.95 +
    1.96        if(max!=min)
    1.97  	{
    1.98  	  color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
    1.99 @@ -85,13 +111,12 @@
   1.100    //EXCEPT when the name of the map is Text, because
   1.101    //in that case empty string will be written, because
   1.102    //that is the deleter map
   1.103 -  //\todo isn't it a bit woodcutter?
   1.104  
   1.105    if(edge==INVALID)
   1.106      {
   1.107        for (EdgeIt i(g); i!=INVALID; ++i)
   1.108  	{
   1.109 -	  if(mapname!=edge_property_strings[E_TEXT])
   1.110 +	  if(mapname!="Default")
   1.111  	    {
   1.112  	      double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   1.113  	      int length=1;
   1.114 @@ -128,7 +153,7 @@
   1.115      }
   1.116    else
   1.117      {
   1.118 -      if(mapname!=edge_property_strings[E_TEXT])
   1.119 +      if(mapname!="Default")
   1.120  	{
   1.121  	  double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
   1.122  	  int length=1;
     2.1 --- a/graph_displayer_canvas-event.cc	Wed Jun 29 15:41:33 2005 +0000
     2.2 +++ b/graph_displayer_canvas-event.cc	Wed Jun 29 19:44:30 2005 +0000
     2.3 @@ -28,20 +28,19 @@
     2.4    switch(newtool)
     2.5      {
     2.6      case MOVE:
     2.7 -      actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
     2.8 +      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
     2.9        break;
    2.10  
    2.11 -      //it has to assigned to canvas, because all the canvas has to be monitored, not only the elements of the already drawn group
    2.12      case CREATE_NODE:
    2.13        actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
    2.14        break;
    2.15  
    2.16      case CREATE_EDGE:
    2.17 -      actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
    2.18 +      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
    2.19        break;
    2.20  
    2.21      case ERASER:
    2.22 -      actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
    2.23 +      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
    2.24        break;
    2.25  
    2.26      default:
    2.27 @@ -60,9 +59,9 @@
    2.28    {
    2.29      case GDK_BUTTON_PRESS:
    2.30        //we mark the location of the event to be able to calculate parameters of dragging
    2.31 -      clicked_x=e->button.x;
    2.32 -      clicked_y=e->button.y;
    2.33 -      active_item=(get_item_at(e->button.x, e->button.y));
    2.34 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    2.35 +
    2.36 +      active_item=(get_item_at(clicked_x, clicked_y));
    2.37        active_node=INVALID;
    2.38        for (NodeIt i(g); i!=INVALID; ++i)
    2.39  	{
    2.40 @@ -85,7 +84,6 @@
    2.41        isbutton=0;
    2.42        active_item=NULL;
    2.43        active_node=INVALID;
    2.44 -      updateScrollRegion();
    2.45        break;
    2.46      case GDK_MOTION_NOTIFY:
    2.47        //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
    2.48 @@ -96,15 +94,19 @@
    2.49  	//new coordinate therefore the new movement
    2.50  	//has to be calculated from here
    2.51  
    2.52 -        double dx=e->motion.x-clicked_x;
    2.53 -        double dy=e->motion.y-clicked_y;
    2.54 +	double new_x, new_y;
    2.55 +
    2.56 +	window_to_world (e->motion.x, e->motion.y, new_x, new_y);
    2.57 +
    2.58 +        double dx=new_x-clicked_x;
    2.59 +        double dy=new_y-clicked_y;
    2.60  
    2.61  	//repositioning node and its text
    2.62          active_item->move(dx, dy);
    2.63  	nodetextmap[active_node]->move(dx, dy);
    2.64  
    2.65 -        clicked_x=e->motion.x;
    2.66 -        clicked_y=e->motion.y;
    2.67 +        clicked_x=new_x;
    2.68 +        clicked_y=new_y;
    2.69  
    2.70  	//all the edges connected to the moved point has to be redrawn
    2.71          EdgeIt ei;
    2.72 @@ -168,7 +170,7 @@
    2.73      default: break;
    2.74    }
    2.75  
    2.76 -  return true;
    2.77 +  return false;
    2.78  }
    2.79  
    2.80  bool GraphDisplayerCanvas::createNodeEventHandler(GdkEvent* e)
    2.81 @@ -177,16 +179,21 @@
    2.82      {
    2.83  
    2.84        //draw the new node in red at the clicked place
    2.85 +    case GDK_2BUTTON_PRESS:
    2.86 +      std::cout << "double click" << std::endl;
    2.87 +      break;
    2.88      case GDK_BUTTON_PRESS:
    2.89        isbutton=1;
    2.90  
    2.91        active_node=NodeIt(g,g.addNode());
    2.92  
    2.93        //initiating values corresponding to new node in maps
    2.94 -      
    2.95  
    2.96        window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    2.97  
    2.98 +      target_item=NULL;
    2.99 +      target_item=get_item_at(clicked_x, clicked_y);
   2.100 +
   2.101        nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
   2.102        active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
   2.103        *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
   2.104 @@ -205,9 +212,8 @@
   2.105        {
   2.106  	double world_motion_x, world_motion_y;
   2.107  	GdkEvent * generated=new GdkEvent();
   2.108 -	window_to_world (e->motion.x, e->motion.y, world_motion_x, world_motion_y);
   2.109 -	generated->motion.x=world_motion_x;
   2.110 -	generated->motion.y=world_motion_y;
   2.111 +	generated->motion.x=e->motion.x;
   2.112 +	generated->motion.y=e->motion.y;
   2.113  	generated->type=GDK_MOTION_NOTIFY;
   2.114  	moveEventHandler(generated);      
   2.115  	break;
   2.116 @@ -216,10 +222,19 @@
   2.117        //finalize the new node
   2.118      case GDK_BUTTON_RELEASE:
   2.119        isbutton=0;
   2.120 -      *active_item << Gnome::Canvas::Properties::fill_color("blue");
   2.121 +      if(!target_item)
   2.122 +	{
   2.123 +	  //Its appropriate color is given by update.
   2.124 +	  //*active_item << Gnome::Canvas::Properties::fill_color("blue");
   2.125 +	}
   2.126 +      else
   2.127 +	{
   2.128 +	  //In this case the given color has to be overwritten, because the noe covers an other item.
   2.129 +	  *active_item << Gnome::Canvas::Properties::fill_color("lightblue");
   2.130 +	}
   2.131 +      target_item=NULL;
   2.132        active_item=NULL;
   2.133        active_node=INVALID;
   2.134 -      updateScrollRegion();
   2.135        break;
   2.136      default:
   2.137        break;
   2.138 @@ -239,9 +254,10 @@
   2.139  	  if(active_node==INVALID)
   2.140  	    {
   2.141  	      //we mark the location of the event to be able to calculate parameters of dragging
   2.142 -	      clicked_x=e->button.x;
   2.143 -	      clicked_y=e->button.y;
   2.144 -	      active_item=(get_item_at(e->button.x, e->button.y));
   2.145 +
   2.146 +	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   2.147 +
   2.148 +	      active_item=(get_item_at(clicked_x, clicked_y));
   2.149  	      active_node=INVALID;
   2.150  	      for (NodeIt i(g); i!=INVALID; ++i)
   2.151  		{
   2.152 @@ -269,7 +285,8 @@
   2.153  	  //node
   2.154  	  else
   2.155  	    {
   2.156 -	      target_item=(get_item_at(e->button.x, e->button.y));
   2.157 +	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   2.158 +	      target_item=(get_item_at(clicked_x, clicked_y));
   2.159  	      Graph::NodeIt target_node=INVALID;
   2.160  	      for (NodeIt i(g); i!=INVALID; ++i)
   2.161  		{
   2.162 @@ -366,7 +383,8 @@
   2.163    switch(e->type)
   2.164      {
   2.165      case GDK_BUTTON_PRESS:
   2.166 -      active_item=(get_item_at(e->button.x, e->button.y));
   2.167 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   2.168 +      active_item=(get_item_at(clicked_x, clicked_y));
   2.169        active_node=INVALID;
   2.170        active_edge=INVALID;
   2.171        for (NodeIt i(g); i!=INVALID; ++i)
   2.172 @@ -386,56 +404,61 @@
   2.173  		}
   2.174  	    }
   2.175  	}
   2.176 -    *active_item << Gnome::Canvas::Properties::fill_color("red");
   2.177 +      if(active_item)
   2.178 +	{
   2.179 +	  *active_item << Gnome::Canvas::Properties::fill_color("red");
   2.180 +	}
   2.181        break;
   2.182  
   2.183      case GDK_BUTTON_RELEASE:
   2.184 -      if(active_item==(get_item_at(e->button.x, e->button.y)))
   2.185 +      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   2.186 +      if(active_item)
   2.187  	{
   2.188 -	  if(active_node!=INVALID)
   2.189 +	  if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
   2.190  	    {
   2.191 +	      if(active_node!=INVALID)
   2.192 +		{
   2.193  
   2.194 -	      //collecting edges to delete
   2.195 -	      EdgeIt e;
   2.196 -	      std::set<Graph::Edge> edges_to_delete;
   2.197 +		  //collecting edges to delete
   2.198 +		  EdgeIt e;
   2.199 +		  std::set<Graph::Edge> edges_to_delete;
   2.200  
   2.201 -	      g.firstOut(e,active_node);
   2.202 -	      for(;e!=INVALID;g.nextOut(e))
   2.203 +		  g.firstOut(e,active_node);
   2.204 +		  for(;e!=INVALID;g.nextOut(e))
   2.205 +		    {
   2.206 +		      edges_to_delete.insert(e);
   2.207 +		    }
   2.208 +
   2.209 +		  g.firstIn(e,active_node);
   2.210 +		  for(;e!=INVALID;g.nextIn(e))
   2.211 +		    {
   2.212 +		      edges_to_delete.insert(e);
   2.213 +		    }
   2.214 +
   2.215 +		  //deleting collected edges
   2.216 +		  for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
   2.217 +		    {
   2.218 +		      deleteItem(*edge_set_it);
   2.219 +		    }
   2.220 +		  deleteItem(active_node);
   2.221 +		}
   2.222 +	      //a simple edge was chosen
   2.223 +	      else
   2.224  		{
   2.225 -		      edges_to_delete.insert(e);
   2.226 +		  deleteItem(active_edge);
   2.227  		}
   2.228 -
   2.229 -	      g.firstIn(e,active_node);
   2.230 -	      for(;e!=INVALID;g.nextIn(e))
   2.231 -		{
   2.232 -		      edges_to_delete.insert(e);
   2.233 -		}
   2.234 -
   2.235 -	      //deleting collected edges
   2.236 -	      for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
   2.237 -		{
   2.238 -		  deleteItem(*edge_set_it);
   2.239 -		}
   2.240 -	      deleteItem(active_node);
   2.241  	    }
   2.242 -	  //a simple edge was chosen
   2.243 +	  //pointer was moved, deletion is cancelled
   2.244  	  else
   2.245  	    {
   2.246 -	      deleteItem(active_edge);
   2.247 -	    }
   2.248 -
   2.249 -	  
   2.250 -	}
   2.251 -      //pointer was moved, deletion is cancelled
   2.252 -      else
   2.253 -	{
   2.254 -	  if(active_node!=INVALID)
   2.255 -	    {
   2.256 -	      *active_item << Gnome::Canvas::Properties::fill_color("blue");
   2.257 -	    }
   2.258 -	  else
   2.259 -	    {
   2.260 -	      *active_item << Gnome::Canvas::Properties::fill_color("green");
   2.261 +	      if(active_node!=INVALID)
   2.262 +		{
   2.263 +		  *active_item << Gnome::Canvas::Properties::fill_color("blue");
   2.264 +		}
   2.265 +	      else
   2.266 +		{
   2.267 +		  *active_item << Gnome::Canvas::Properties::fill_color("green");
   2.268 +		}
   2.269  	    }
   2.270  	}
   2.271        //reseting datas
   2.272 @@ -450,7 +473,7 @@
   2.273      default:
   2.274        break;
   2.275      }
   2.276 -  return true;
   2.277 +  return false;
   2.278  }
   2.279  
   2.280  void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
     3.1 --- a/graph_displayer_canvas-node.cc	Wed Jun 29 15:41:33 2005 +0000
     3.2 +++ b/graph_displayer_canvas-node.cc	Wed Jun 29 19:44:30 2005 +0000
     3.3 @@ -5,15 +5,28 @@
     3.4  
     3.5  int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
     3.6  {
     3.7 +  Graph::NodeMap<double> * actual_map;
     3.8 +  if(mapname=="Default")
     3.9 +    {
    3.10 +      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
    3.11 +    }
    3.12 +  else
    3.13 +    {
    3.14 +      actual_map=(mapstorage.nodemap_storage)[mapname];
    3.15 +    }
    3.16 +
    3.17    if(node==INVALID)
    3.18      {
    3.19        for (NodeIt i(g); i!=INVALID; ++i)
    3.20  	{
    3.21 -	  int w=(int)(*(mapstorage.nodemap_storage)[mapname])[i];
    3.22 +	  int w=(int)(*actual_map)[i];
    3.23  	  if(w>=0)
    3.24  	    {
    3.25  	      double x1, y1, x2, y2;
    3.26 -	      nodesmap[i]->get_bounds(x1, y1, x2, y2);
    3.27 +	      x1=nodesmap[i]->property_x1().get_value();
    3.28 +	      x2=nodesmap[i]->property_x2().get_value();
    3.29 +	      y1=nodesmap[i]->property_y1().get_value();
    3.30 +	      y2=nodesmap[i]->property_y2().get_value();
    3.31  	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
    3.32  	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
    3.33  	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
    3.34 @@ -23,11 +36,16 @@
    3.35      }
    3.36    else
    3.37      {
    3.38 -      int w=(int)(*(mapstorage.nodemap_storage)[mapname])[node];
    3.39 +      //I think only new nodes use this case
    3.40 +//       int w=(int)(*actual_map)[node];
    3.41 +      int w=(int)(node_property_defaults[N_RADIUS]);
    3.42        if(w>=0)
    3.43  	{
    3.44  	  double x1, y1, x2, y2;
    3.45 -	  nodesmap[node]->get_bounds(x1, y1, x2, y2);
    3.46 +	  x1=nodesmap[node]->property_x1().get_value();
    3.47 +	  x2=nodesmap[node]->property_x2().get_value();
    3.48 +	  y1=nodesmap[node]->property_y1().get_value();
    3.49 +	  y2=nodesmap[node]->property_y2().get_value();
    3.50  	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
    3.51  	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
    3.52  	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
    3.53 @@ -44,17 +62,39 @@
    3.54    //the minimum of the nodemap to the range of
    3.55    //green in RGB
    3.56  
    3.57 +  Graph::NodeMap<double> * actual_map;
    3.58 +  if(mapname=="Default")
    3.59 +    {
    3.60 +      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
    3.61 +    }
    3.62 +  else
    3.63 +    {
    3.64 +      actual_map=(mapstorage.nodemap_storage)[mapname];
    3.65 +    }
    3.66 +
    3.67 +  double max, min;
    3.68 +
    3.69 +  if(mapname!="Default")
    3.70 +    {
    3.71 +      max=mapstorage.maxOfNodeMap(mapname);
    3.72 +      min=mapstorage.minOfNodeMap(mapname);
    3.73 +    }
    3.74 +  else
    3.75 +    {
    3.76 +      max=node_property_defaults[N_COLOR];
    3.77 +      min=node_property_defaults[N_COLOR];
    3.78 +    }
    3.79 +
    3.80 +
    3.81    if(node==INVALID)
    3.82      {
    3.83  
    3.84        for (NodeIt i(g); i!=INVALID; ++i)
    3.85  	{
    3.86 -	  double w=(*(mapstorage.nodemap_storage)[mapname])[i];
    3.87 -	  double max=mapstorage.maxOfNodeMap(mapname);
    3.88 -	  double min=mapstorage.minOfNodeMap(mapname);
    3.89 -      
    3.90 -	  //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    3.91  	  Gdk::Color color;
    3.92 +
    3.93 +	  double w=(*actual_map)[i];
    3.94 +
    3.95  	  if(max!=min)
    3.96  	    {
    3.97  	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
    3.98 @@ -69,12 +109,10 @@
    3.99      }
   3.100    else
   3.101      {
   3.102 -      double w=(*(mapstorage.nodemap_storage)[mapname])[node];
   3.103 -      double max=mapstorage.maxOfNodeMap(mapname);
   3.104 -      double min=mapstorage.minOfNodeMap(mapname);
   3.105 -      
   3.106 -      //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
   3.107        Gdk::Color color;
   3.108 +
   3.109 +      double w=(*actual_map)[node];
   3.110 +
   3.111        if(max!=min)
   3.112  	{
   3.113  	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
   3.114 @@ -96,15 +134,24 @@
   3.115    //EXCEPT when the name of the map is Text, because
   3.116    //in that case empty string will be written, because
   3.117    //that is the deleter map
   3.118 -  //\todo isn't it a bit woodcutter?
   3.119 +
   3.120 +  Graph::NodeMap<double> * actual_map;
   3.121 +  if(mapname=="Default")
   3.122 +    {
   3.123 +      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
   3.124 +    }
   3.125 +  else
   3.126 +    {
   3.127 +      actual_map=(mapstorage.nodemap_storage)[mapname];
   3.128 +    }
   3.129  
   3.130    if(node==INVALID)
   3.131      {
   3.132        for (NodeIt i(g); i!=INVALID; ++i)
   3.133  	{
   3.134 -	  if(mapname!=node_property_strings[N_TEXT])
   3.135 +	  if(mapname!="Default")
   3.136  	    {
   3.137 -	      double number=(*(mapstorage.nodemap_storage)[mapname])[i];
   3.138 +	      double number=(*actual_map)[i];
   3.139  	      int length=1;
   3.140  	      //if number is smaller than one, length would be negative, or invalid
   3.141  	      if(number>=1)
   3.142 @@ -138,9 +185,9 @@
   3.143      }
   3.144    else
   3.145      {
   3.146 -      if(mapname!=node_property_strings[N_TEXT])
   3.147 +      if(mapname!="Default")
   3.148  	{
   3.149 -	  double number=(*(mapstorage.nodemap_storage)[mapname])[node];
   3.150 +	  double number=(*actual_map)[node];
   3.151  	  int length=1;
   3.152  	  //if number is smaller than one, length would be negative, or invalid
   3.153  	  if(number>=1)
     4.1 --- a/graph_displayer_canvas.cc	Wed Jun 29 15:41:33 2005 +0000
     4.2 +++ b/graph_displayer_canvas.cc	Wed Jun 29 19:44:30 2005 +0000
     4.3 @@ -5,7 +5,7 @@
     4.4  GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms, MapWin * mw):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),nodetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),mapwin(mw)
     4.5  {
     4.6    
     4.7 -  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
     4.8 +  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
     4.9    actual_tool=CREATE_NODE;
    4.10  
    4.11    active_node=INVALID;
     5.1 --- a/map_win.cc	Wed Jun 29 15:41:33 2005 +0000
     5.2 +++ b/map_win.cc	Wed Jun 29 19:44:30 2005 +0000
     5.3 @@ -23,45 +23,15 @@
     5.4  
     5.5    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
     5.6    {
     5.7 -
     5.8 -    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
     5.9 -    std::set<int> props;
    5.10 -
    5.11 -    int actprop;
    5.12 -
    5.13 -    //here we find out, which map is the default in MapStorage for this property, which are not
    5.14 -    for(int j=0;j<ms.numOfEdgeMaps();j++)
    5.15 -    {
    5.16 -      //this is the default value for this property
    5.17 -      if(emsi->second==&(ms.default_edgemaps[i]))
    5.18 -      {
    5.19 -	actprop=j;
    5.20 -      }
    5.21 -      //these are the maps NOT to show for this property
    5.22 -      for(int k=0;k<EDGE_PROPERTY_NUM;k++)
    5.23 -      {
    5.24 -	if(emsi->second==&(ms.default_edgemaps[k]))
    5.25 -	{
    5.26 -	  props.insert(j);
    5.27 -	}
    5.28 -      }
    5.29 -      emsi++;
    5.30 -    }
    5.31 -
    5.32      //filling in combo box with choices
    5.33      std::list<Glib::ustring> listStrings;
    5.34  
    5.35      listStrings.push_back("Default");
    5.36  
    5.37 -    emsi=ms.beginOfEdgeMaps();
    5.38 -
    5.39 -    for(int j=0;j<ms.numOfEdgeMaps();j++)
    5.40 +    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
    5.41 +    for(;emsi!=ms.endOfEdgeMaps();emsi++)
    5.42      {
    5.43 -      if( ( props.find(j) )==( props.end() ) )
    5.44 -      {
    5.45  	listStrings.push_back(emsi->first);
    5.46 -      }
    5.47 -      emsi++;
    5.48      }
    5.49  
    5.50      e_combo_array[i].set_popdown_strings(listStrings);
    5.51 @@ -102,45 +72,16 @@
    5.52  
    5.53    for(int i=0;i<NODE_PROPERTY_NUM;i++)
    5.54    {
    5.55 -
    5.56 -    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
    5.57 -    std::set<int> props;
    5.58 -
    5.59 -    int actprop;
    5.60 -
    5.61 -    //here we find out, which map is the default in MapStorage for this property, which are not
    5.62 -    for(int j=0;j<ms.numOfNodeMaps();j++)
    5.63 -    {
    5.64 -      //these are the maps NOT to show for this property
    5.65 -      if(emsi->second==&(ms.default_nodemaps[i]))
    5.66 -      {
    5.67 -	actprop=j;
    5.68 -      }
    5.69 -      //this is the other maps to show for this property
    5.70 -      for(int k=0;k<NODE_PROPERTY_NUM;k++)
    5.71 -      {
    5.72 -	if(emsi->second==&(ms.default_nodemaps[k]))
    5.73 -	{
    5.74 -	  props.insert(j);
    5.75 -	}
    5.76 -      }
    5.77 -      emsi++;
    5.78 -    }
    5.79 -
    5.80      //filling in combo box with choices
    5.81      std::list<Glib::ustring> listStrings;
    5.82  
    5.83      listStrings.push_back("Default");
    5.84  
    5.85 -    emsi=ms.beginOfNodeMaps();
    5.86 +    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
    5.87  
    5.88 -    for(int j=0;j<ms.numOfNodeMaps();j++)
    5.89 +    for(;emsi!=ms.endOfNodeMaps();emsi++)
    5.90      {
    5.91 -      if( ( props.find(j) )==( props.end() ) )
    5.92 -      {
    5.93 -	listStrings.push_back(emsi->first);
    5.94 -      }
    5.95 -      emsi++;
    5.96 +      listStrings.push_back(emsi->first);
    5.97      }
    5.98  
    5.99      n_combo_array[i].set_popdown_strings(listStrings);
   5.100 @@ -188,12 +129,7 @@
   5.101      Glib::ustring mapname = entry->get_text();
   5.102      if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   5.103      {
   5.104 -      if(mapname=="Default")
   5.105 -      {
   5.106 -	mapname=edge_property_strings[prop];
   5.107 -      }
   5.108 -
   5.109 -      if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
   5.110 +      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   5.111        {
   5.112  	switch(prop)
   5.113  	{
   5.114 @@ -224,12 +160,7 @@
   5.115      Glib::ustring mapname = entry->get_text();
   5.116      if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   5.117      {
   5.118 -      if(mapname=="Default")
   5.119 -      {
   5.120 -	mapname=node_property_strings[prop];
   5.121 -      }
   5.122 -
   5.123 -      if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
   5.124 +      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   5.125        {
   5.126  	switch(prop)
   5.127  	{
   5.128 @@ -261,18 +192,12 @@
   5.129  	  Glib::ustring mapname = entry->get_text();
   5.130  	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   5.131  	    {
   5.132 -	      if(mapname=="Default")
   5.133 -		{
   5.134 -		  mapname=node_property_strings[i];
   5.135 -		}
   5.136 -
   5.137 -	      if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
   5.138 +	      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   5.139  		{
   5.140  		  switch(i)
   5.141  		    {
   5.142  		    case N_RADIUS:
   5.143 -		      //gdc.changeNodeRadius(mapname, node);
   5.144 -		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::node_update!" << std::endl;
   5.145 +		      gdc.changeNodeRadius(mapname, node);
   5.146  		      break;
   5.147  		    case N_COLOR:
   5.148  		      gdc.changeNodeColor(mapname, node);
   5.149 @@ -301,18 +226,13 @@
   5.150  	  Glib::ustring mapname = entry->get_text();
   5.151  	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   5.152  	    {
   5.153 -	      if(mapname=="Default")
   5.154 -		{
   5.155 -		  mapname=edge_property_strings[i];
   5.156 -		}
   5.157  
   5.158 -	      if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
   5.159 +	      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   5.160  		{
   5.161  		  switch(i)
   5.162  		    {
   5.163  		    case E_WIDTH:
   5.164 -		      //gdc.changeEdgeWidth(mapname, edge);
   5.165 -		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::edge_update!" << std::endl;
   5.166 +		      gdc.changeEdgeWidth(mapname, edge);
   5.167  		      break;
   5.168  		    case E_COLOR:
   5.169  		      gdc.changeEdgeColor(mapname, edge);
     6.1 --- a/mapstorage.cc	Wed Jun 29 15:41:33 2005 +0000
     6.2 +++ b/mapstorage.cc	Wed Jun 29 19:44:30 2005 +0000
     6.3 @@ -2,36 +2,6 @@
     6.4  
     6.5  MapStorage::MapStorage(Graph & graph):g(graph)
     6.6  {
     6.7 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
     6.8 -  {
     6.9 -    Graph::EdgeMap<double> emd(g,edge_property_defaults[i]);
    6.10 -    default_edgemaps.push_back(emd);
    6.11 -  }
    6.12 -
    6.13 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    6.14 -  {
    6.15 -    Graph::NodeMap<double> nmd(g,node_property_defaults[i]);
    6.16 -    default_nodemaps.push_back(nmd);
    6.17 -  }
    6.18 -
    6.19 -  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    6.20 -  {
    6.21 -      for (EdgeIt j(g); j!=INVALID; ++j)
    6.22 -      {
    6.23 -	(default_edgemaps[i])[j]=edge_property_defaults[i];
    6.24 -      }
    6.25 -      addEdgeMap(edge_property_strings[i],&(default_edgemaps[i]));
    6.26 -  }
    6.27 -
    6.28 -  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    6.29 -  {
    6.30 -      for (NodeIt j(g); j!=INVALID; ++j)
    6.31 -      {
    6.32 -	(default_nodemaps[i])[j]=node_property_defaults[i];
    6.33 -      }
    6.34 -      addNodeMap(node_property_strings[i],&(default_nodemaps[i]));
    6.35 -  }
    6.36 -
    6.37  };
    6.38  
    6.39  int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
    6.40 @@ -102,19 +72,9 @@
    6.41  
    6.42  void MapStorage::initMapsForEdge(Graph::Edge e)
    6.43  {
    6.44 -  e=e;
    6.45 -// beragad, aztan csovez
    6.46 -//   std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
    6.47 -//   for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
    6.48 -//     {
    6.49 -//       std::cout << "szevasz\n";
    6.50 -//       (*((*ems_it).second))[e]=0;
    6.51 -//     }
    6.52 -//   std::cout << std::endl;
    6.53 -
    6.54 -// g_closure_invoke...
    6.55 -//   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    6.56 -//     {
    6.57 -//       (default_edgemaps[i])[e]=property_defaults[i];
    6.58 -//     }
    6.59 +  std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
    6.60 +  for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
    6.61 +    {
    6.62 +      (*((*ems_it).second))[e]=5;
    6.63 +    }
    6.64  }
     7.1 --- a/mapstorage.h	Wed Jun 29 15:41:33 2005 +0000
     7.2 +++ b/mapstorage.h	Wed Jun 29 19:44:30 2005 +0000
     7.3 @@ -81,6 +81,12 @@
     7.4    ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
     7.5    std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
     7.6  
     7.7 +  ///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
     7.8 +  std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
     7.9 +
    7.10 +  ///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
    7.11 +  std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
    7.12 +
    7.13    ///This function sets a default base value for the newly created node
    7.14    void initMapsForNode(NodeIt);
    7.15