NodeMap values are now visualizable. Todo: default map-values
authorhegyi
Fri, 24 Jun 2005 18:16:12 +0000
changeset 1512e54392395480
parent 1511 d6b95a59da26
child 1513 b2a79aaa6867
NodeMap values are now visualizable. Todo: default map-values
gui/Makefile.am
gui/all_include.h
gui/graph-displayer.cc
gui/graph_displayer_canvas-edge.cc
gui/graph_displayer_canvas-event.cc
gui/graph_displayer_canvas-node.cc
gui/graph_displayer_canvas.cc
gui/graph_displayer_canvas.h
gui/main_win.cc
gui/map_win.cc
gui/map_win.h
gui/mapstorage.cc
     1.1 --- a/gui/Makefile.am	Fri Jun 24 08:44:54 2005 +0000
     1.2 +++ b/gui/Makefile.am	Fri Jun 24 18:16:12 2005 +0000
     1.3 @@ -7,6 +7,7 @@
     1.4  	all_include.h \
     1.5  	graph_displayer_canvas.cc \
     1.6  	graph_displayer_canvas-edge.cc \
     1.7 +	graph_displayer_canvas-node.cc \
     1.8  	graph_displayer_canvas-event.cc \
     1.9  	graph_displayer_canvas-zoom.cc \
    1.10  	graph_displayer_canvas.h \
     2.1 --- a/gui/all_include.h	Fri Jun 24 08:44:54 2005 +0000
     2.2 +++ b/gui/all_include.h	Fri Jun 24 18:16:12 2005 +0000
     2.3 @@ -16,7 +16,8 @@
     2.4  #include <lemon/error.h>
     2.5  #include <lemon/xy.h>
     2.6  
     2.7 -enum {WIDTH, COLOR, TEXT, PROPERTY_NUM}; // edge properties;
     2.8 +enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // edge properties;
     2.9 +enum {N_RADIUS, N_COLOR, N_TEXT, NODE_PROPERTY_NUM}; // node properties;
    2.10  enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, EDGE_MAP_EDIT, TOOL_NUM}; // tools;
    2.11  #define RANGE 3
    2.12  #define WIN_WIDTH 900
    2.13 @@ -24,8 +25,10 @@
    2.14  
    2.15  
    2.16  #ifndef MAIN_PART
    2.17 -extern std::vector <std::string> property_strings;
    2.18 -extern std::vector <double> property_defaults;
    2.19 +extern std::vector <std::string> edge_property_strings;
    2.20 +extern std::vector <double> edge_property_defaults;
    2.21 +extern std::vector <std::string> node_property_strings;
    2.22 +extern std::vector <double> node_property_defaults;
    2.23  #endif //MAIN_PART
    2.24  
    2.25  using namespace lemon;
     3.1 --- a/gui/graph-displayer.cc	Fri Jun 24 08:44:54 2005 +0000
     3.2 +++ b/gui/graph-displayer.cc	Fri Jun 24 18:16:12 2005 +0000
     3.3 @@ -6,8 +6,10 @@
     3.4  
     3.5  #define MAIN_PART
     3.6  
     3.7 -std::vector <std::string> property_strings;
     3.8 -std::vector <double> property_defaults;
     3.9 +std::vector <std::string> edge_property_strings;
    3.10 +std::vector <double> edge_property_defaults;
    3.11 +std::vector <std::string> node_property_strings;
    3.12 +std::vector <double> node_property_defaults;
    3.13  
    3.14  
    3.15  int main(int argc, char *argv[])
    3.16 @@ -15,15 +17,25 @@
    3.17  
    3.18    //initializing
    3.19  
    3.20 -  property_strings.resize(PROPERTY_NUM);
    3.21 -  property_strings[WIDTH]="Width";
    3.22 -  property_strings[COLOR]="Color";
    3.23 -  property_strings[TEXT]="Text";
    3.24 +  edge_property_strings.resize(EDGE_PROPERTY_NUM);
    3.25 +  edge_property_strings[E_WIDTH]="Edge Width";
    3.26 +  edge_property_strings[E_COLOR]="Edge Color";
    3.27 +  edge_property_strings[E_TEXT]="Edge Text";
    3.28  
    3.29 -  property_defaults.resize(PROPERTY_NUM);
    3.30 -  property_defaults[WIDTH]=10.0;
    3.31 -  property_defaults[COLOR]=100;
    3.32 -  property_defaults[TEXT]=0;
    3.33 +  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
    3.34 +  edge_property_defaults[E_WIDTH]=10.0;
    3.35 +  edge_property_defaults[E_COLOR]=100;
    3.36 +  edge_property_defaults[E_TEXT]=0;
    3.37 +
    3.38 +  node_property_strings.resize(NODE_PROPERTY_NUM);
    3.39 +  node_property_strings[N_RADIUS]="Node Radius";
    3.40 +  node_property_strings[N_COLOR]="Node Color";
    3.41 +  node_property_strings[N_TEXT]="Node Text";
    3.42 +
    3.43 +  node_property_defaults.resize(NODE_PROPERTY_NUM);
    3.44 +  node_property_defaults[N_RADIUS]=20.0;
    3.45 +  node_property_defaults[N_COLOR]=100;
    3.46 +  node_property_defaults[N_TEXT]=0;
    3.47  
    3.48    if(argc<2)
    3.49    {
     4.1 --- a/gui/graph_displayer_canvas-edge.cc	Fri Jun 24 08:44:54 2005 +0000
     4.2 +++ b/gui/graph_displayer_canvas-edge.cc	Fri Jun 24 18:16:12 2005 +0000
     4.3 @@ -3,49 +3,82 @@
     4.4  #include <math.h>
     4.5  
     4.6  
     4.7 -int GraphDisplayerCanvas::changeLineWidth (std::string mapname)
     4.8 +int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     4.9  {
    4.10 -  for (EdgeIt i(g); i!=INVALID; ++i)
    4.11 +  if(edge==INVALID)
    4.12      {
    4.13 -      int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
    4.14 +      for (EdgeIt i(g); i!=INVALID; ++i)
    4.15 +	{
    4.16 +	  int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
    4.17 +	  if(w>=0)
    4.18 +	    {
    4.19 +	      edgesmap[i]->property_width_pixels().set_value(w);
    4.20 +	    }
    4.21 +	}
    4.22 +    }
    4.23 +  else
    4.24 +    {
    4.25 +      int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
    4.26        if(w>=0)
    4.27  	{
    4.28 -	  edgesmap[i]->property_width_pixels().set_value(w);
    4.29 +	  edgesmap[edge]->property_width_pixels().set_value(w);
    4.30  	}
    4.31      }
    4.32    return 0;
    4.33  };
    4.34  
    4.35 -int GraphDisplayerCanvas::changeColor (std::string mapname)
    4.36 +int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge)
    4.37  {  
    4.38  
    4.39    //function maps the range of the maximum and
    4.40    //the minimum of the nodemap to the range of
    4.41    //green in RGB
    4.42 +  if(edge==INVALID)
    4.43 +    {
    4.44  
    4.45 -  for (EdgeIt i(g); i!=INVALID; ++i)
    4.46 -  {
    4.47 -    double w=(*(mapstorage.edgemap_storage)[mapname])[i];
    4.48 -    double max=mapstorage.maxOfEdgeMap(mapname);
    4.49 -    double min=mapstorage.minOfEdgeMap(mapname);
    4.50 +      for (EdgeIt i(g); i!=INVALID; ++i)
    4.51 +	{
    4.52 +	  double w=(*(mapstorage.edgemap_storage)[mapname])[i];
    4.53 +	  double max=mapstorage.maxOfEdgeMap(mapname);
    4.54 +	  double min=mapstorage.minOfEdgeMap(mapname);
    4.55        
    4.56 -    //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    4.57 -    Gdk::Color color;
    4.58 -    if(max!=min)
    4.59 +	  //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    4.60 +	  Gdk::Color color;
    4.61 +	  if(max!=min)
    4.62 +	    {
    4.63 +	      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
    4.64 +	    }
    4.65 +	  else
    4.66 +	    {
    4.67 +	      color.set_rgb_p (0, 100, 0);
    4.68 +	    }
    4.69 +
    4.70 +	  edgesmap[i]->property_fill_color_gdk().set_value(color);
    4.71 +	}
    4.72 +    }
    4.73 +  else
    4.74      {
    4.75 -      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
    4.76 +      double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
    4.77 +      double max=mapstorage.maxOfEdgeMap(mapname);
    4.78 +      double min=mapstorage.minOfEdgeMap(mapname);
    4.79 +      
    4.80 +      //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    4.81 +      Gdk::Color color;
    4.82 +      if(max!=min)
    4.83 +	{
    4.84 +	  color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
    4.85 +	}
    4.86 +      else
    4.87 +	{
    4.88 +	  color.set_rgb_p (0, 100, 0);
    4.89 +	}
    4.90 +
    4.91 +      edgesmap[edge]->property_fill_color_gdk().set_value(color);
    4.92      }
    4.93 -    else
    4.94 -    {
    4.95 -      color.set_rgb_p (0, 100, 0);
    4.96 -    }
    4.97 -
    4.98 -    edgesmap[i]->property_fill_color_gdk().set_value(color);
    4.99 -  }
   4.100    return 0;
   4.101  };
   4.102  
   4.103 -int GraphDisplayerCanvas::changeText (std::string mapname)
   4.104 +int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge)
   4.105  {
   4.106  
   4.107    //the number in the map will be written on the edge
   4.108 @@ -54,11 +87,50 @@
   4.109    //that is the deleter map
   4.110    //\todo isn't it a bit woodcutter?
   4.111  
   4.112 -  for (EdgeIt i(g); i!=INVALID; ++i)
   4.113 +  if(edge==INVALID)
   4.114      {
   4.115 -      if(mapname!="Text")
   4.116 +      for (EdgeIt i(g); i!=INVALID; ++i)
   4.117  	{
   4.118 -	  double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   4.119 +	  if(mapname!=edge_property_strings[E_TEXT])
   4.120 +	    {
   4.121 +	      double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   4.122 +	      int length=1;
   4.123 +	      //if number is smaller than one, length would be negative, or invalid
   4.124 +	      if(number>=1)
   4.125 +		{
   4.126 +		  length=(int)(floor(log(number)/log(10)))+1;
   4.127 +		}
   4.128 +	      int maxpos=(int)(pow(10,length-1));
   4.129 +	      int strl=length+1+RANGE;
   4.130 +	      char * str=new char[strl];
   4.131 +	      str[length]='.';
   4.132 +	      str[strl]='\0';
   4.133 +      
   4.134 +	      for(int j=0;j<strl;j++)
   4.135 +		{
   4.136 +		  if(j!=length)
   4.137 +		    {
   4.138 +		      int digit=(int)(number/maxpos);
   4.139 +		      str[j]=(digit+'0');
   4.140 +		      number-=digit*maxpos;
   4.141 +		      number*=10;
   4.142 +		    }
   4.143 +		}
   4.144 +      
   4.145 +	      edgetextmap[i]->property_text().set_value(str);
   4.146 +	    }
   4.147 +	  else
   4.148 +	    {
   4.149 +	      edgetextmap[i]->property_text().set_value("");
   4.150 +	    }
   4.151 +	}
   4.152 +
   4.153 +    }
   4.154 +  else
   4.155 +    {
   4.156 +      if(mapname!=edge_property_strings[E_TEXT])
   4.157 +	{
   4.158 +	  double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
   4.159  	  int length=1;
   4.160  	  //if number is smaller than one, length would be negative, or invalid
   4.161  	  if(number>=1)
   4.162 @@ -82,12 +154,15 @@
   4.163  		}
   4.164  	    }
   4.165        
   4.166 -	  edgetextmap[i]->property_text().set_value(str);
   4.167 +	  edgetextmap[edge]->property_text().set_value(str);
   4.168  	}
   4.169        else
   4.170  	{
   4.171 -	  edgetextmap[i]->property_text().set_value("");
   4.172 +	  edgetextmap[edge]->property_text().set_value("");
   4.173  	}
   4.174 +	  
   4.175      }
   4.176 +
   4.177    return 0;
   4.178 +
   4.179  };
     5.1 --- a/gui/graph_displayer_canvas-event.cc	Fri Jun 24 08:44:54 2005 +0000
     5.2 +++ b/gui/graph_displayer_canvas-event.cc	Fri Jun 24 18:16:12 2005 +0000
     5.3 @@ -99,7 +99,9 @@
     5.4          double dx=e->motion.x-clicked_x;
     5.5          double dy=e->motion.y-clicked_y;
     5.6  
     5.7 +	//repositioning node and its text
     5.8          active_item->move(dx, dy);
     5.9 +	nodetextmap[active_node]->move(dx, dy);
    5.10  
    5.11          clicked_x=e->motion.x;
    5.12          clicked_y=e->motion.y;
    5.13 @@ -129,6 +131,7 @@
    5.14  		edgesmap[ei]->set_points(coos,true);
    5.15  	      }
    5.16  
    5.17 +	    //reposition of edgetext
    5.18  	    xy<double> text_pos=edgesmap[ei]->get_arrow_pos();
    5.19  	    text_pos+=(xy<double>(10,10));
    5.20  	    edgetextmap[ei]->property_x().set_value(text_pos.x);
    5.21 @@ -189,6 +192,12 @@
    5.22        *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
    5.23        *(nodesmap[active_node]) << Gnome::Canvas::Properties::outline_color("black");
    5.24        (nodesmap[active_node])->show();
    5.25 +
    5.26 +      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, "");
    5.27 +      nodetextmap[active_node]->property_fill_color().set_value("darkblue");
    5.28 +
    5.29 +      mapwin->update_node(active_node);
    5.30 +
    5.31        break;
    5.32  
    5.33        //move the new node
    5.34 @@ -272,39 +281,50 @@
    5.35  	      //the clicked item is a node, the edge can be drawn
    5.36  	      if(target_node!=INVALID)
    5.37  		{
    5.38 -		  *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
    5.39 +		  if(target_node!=active_node)		
    5.40 +		    {
    5.41 +		      *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
    5.42  
    5.43 -		  //creating new edge
    5.44 -		  active_edge=EdgeIt(g,g.addEdge(active_node, target_node));
    5.45 +		      //creating new edge
    5.46 +		      active_edge=EdgeIt(g,g.addEdge(active_node, target_node));
    5.47  
    5.48 -		  //initiating values corresponding to new edge in maps
    5.49 -		  mapstorage.init_maps_for_edge(active_edge);
    5.50 +		      //initiating values corresponding to new edge in maps
    5.51 +		      mapstorage.init_maps_for_edge(active_edge);
    5.52  	  
    5.53 -		  //calculating coordinates of new edge
    5.54 -		  Gnome::Canvas::Points coos;
    5.55 -		  double x1, x2, y1, y2;
    5.56 +		      //calculating coordinates of new edge
    5.57 +		      Gnome::Canvas::Points coos;
    5.58 +		      double x1, x2, y1, y2;
    5.59  	  
    5.60 -		  active_item->get_bounds(x1, y1, x2, y2);
    5.61 -		  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    5.62 +		      active_item->get_bounds(x1, y1, x2, y2);
    5.63 +		      coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    5.64  
    5.65 -		  target_item->get_bounds(x1, y1, x2, y2);
    5.66 -		  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    5.67 +		      target_item->get_bounds(x1, y1, x2, y2);
    5.68 +		      coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    5.69  
    5.70 -		  //drawing new edge
    5.71 -		  edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos, *this);
    5.72 -		  *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("green");
    5.73 -		  edgesmap[active_edge]->property_width_pixels().set_value(10);
    5.74 +		      //drawing new edge
    5.75 +		      edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos, *this);
    5.76 +		      *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("green");
    5.77 +		      edgesmap[active_edge]->property_width_pixels().set_value(10);
    5.78  
    5.79 -		  //redraw nodes to blank terminations of the new edge
    5.80 -		  target_item->raise_to_top();
    5.81 -		  active_item->raise_to_top();
    5.82 +		      //redraw nodes to blank terminations of the new edge
    5.83 +		      target_item->raise_to_top();
    5.84 +		      active_item->raise_to_top();
    5.85  
    5.86 -		  //initializing edge-text as well, to empty string
    5.87 -		  xy<double> text_pos=edgesmap[active_edge]->get_arrow_pos();
    5.88 -		  text_pos+=(xy<double>(10,10));
    5.89 +		      //initializing edge-text as well, to empty string
    5.90 +		      xy<double> text_pos=edgesmap[active_edge]->get_arrow_pos();
    5.91 +		      text_pos+=(xy<double>(10,10));
    5.92  
    5.93 -		  edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    5.94 -		  edgetextmap[active_edge]->property_fill_color().set_value("black");
    5.95 +		      edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    5.96 +		      edgetextmap[active_edge]->property_fill_color().set_value("darkgreen");
    5.97 +
    5.98 +		      //updating its properties
    5.99 +		      mapwin->update_edge(active_edge);
   5.100 +		    }
   5.101 +		  else
   5.102 +		    {
   5.103 +		      target_node=INVALID;
   5.104 +		      std::cout << "Loop edge is not yet implemented!" << std::endl;
   5.105 +		    }
   5.106  		}
   5.107  	      //clicked item was not a node. it could be an e.g. edge. we do not deal with it furthermore.
   5.108  	      else
   5.109 @@ -435,18 +455,21 @@
   5.110  
   5.111  void GraphDisplayerCanvas::delete_item(NodeIt node_to_delete)
   5.112  {
   5.113 +  delete(nodetextmap[node_to_delete]);
   5.114    delete(nodesmap[node_to_delete]);
   5.115    g.erase(node_to_delete);
   5.116  }
   5.117  
   5.118  void GraphDisplayerCanvas::delete_item(EdgeIt edge_to_delete)
   5.119  {
   5.120 +  delete(edgetextmap[edge_to_delete]);
   5.121    delete(edgesmap[edge_to_delete]);
   5.122    g.erase(edge_to_delete);
   5.123  }
   5.124  
   5.125  void GraphDisplayerCanvas::delete_item(Graph::Edge edge_to_delete)
   5.126  {
   5.127 +  delete(edgetextmap[edge_to_delete]);
   5.128    delete(edgesmap[edge_to_delete]);
   5.129    g.erase(edge_to_delete);
   5.130  }
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/gui/graph_displayer_canvas-node.cc	Fri Jun 24 18:16:12 2005 +0000
     6.3 @@ -0,0 +1,175 @@
     6.4 +#include <graph_displayer_canvas.h>
     6.5 +#include <broken_edge.h>
     6.6 +#include <math.h>
     6.7 +
     6.8 +
     6.9 +int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
    6.10 +{
    6.11 +  if(node==INVALID)
    6.12 +    {
    6.13 +      for (NodeIt i(g); i!=INVALID; ++i)
    6.14 +	{
    6.15 +	  int w=(int)(*(mapstorage.nodemap_storage)[mapname])[i];
    6.16 +	  if(w>=0)
    6.17 +	    {
    6.18 +	      double x1, y1, x2, y2;
    6.19 +	      nodesmap[i]->get_bounds(x1, y1, x2, y2);
    6.20 +	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
    6.21 +	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
    6.22 +	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
    6.23 +	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
    6.24 +	    }
    6.25 +	}
    6.26 +    }
    6.27 +  else
    6.28 +    {
    6.29 +      int w=(int)(*(mapstorage.nodemap_storage)[mapname])[node];
    6.30 +      if(w>=0)
    6.31 +	{
    6.32 +	  double x1, y1, x2, y2;
    6.33 +	  nodesmap[node]->get_bounds(x1, y1, x2, y2);
    6.34 +	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
    6.35 +	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
    6.36 +	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
    6.37 +	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
    6.38 +	}
    6.39 +    }
    6.40 +  return 0;
    6.41 +};
    6.42 +
    6.43 +int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Graph::Node node)
    6.44 +{  
    6.45 +
    6.46 +  //function maps the range of the maximum and
    6.47 +  //the minimum of the nodemap to the range of
    6.48 +  //green in RGB
    6.49 +
    6.50 +  if(node==INVALID)
    6.51 +    {
    6.52 +
    6.53 +      for (NodeIt i(g); i!=INVALID; ++i)
    6.54 +	{
    6.55 +	  double w=(*(mapstorage.nodemap_storage)[mapname])[i];
    6.56 +	  double max=mapstorage.maxOfNodeMap(mapname);
    6.57 +	  double min=mapstorage.minOfNodeMap(mapname);
    6.58 +      
    6.59 +	  //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    6.60 +	  Gdk::Color color;
    6.61 +	  if(max!=min)
    6.62 +	    {
    6.63 +	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
    6.64 +	    }
    6.65 +	  else
    6.66 +	    {
    6.67 +	      color.set_rgb_p (0, 0, 100);
    6.68 +	    }
    6.69 +
    6.70 +	  nodesmap[i]->property_fill_color_gdk().set_value(color);
    6.71 +	}
    6.72 +    }
    6.73 +  else
    6.74 +    {
    6.75 +      double w=(*(mapstorage.nodemap_storage)[mapname])[node];
    6.76 +      double max=mapstorage.maxOfNodeMap(mapname);
    6.77 +      double min=mapstorage.minOfNodeMap(mapname);
    6.78 +      
    6.79 +      //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    6.80 +      Gdk::Color color;
    6.81 +      if(max!=min)
    6.82 +	{
    6.83 +	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
    6.84 +	}
    6.85 +      else
    6.86 +	{
    6.87 +	  color.set_rgb_p (0, 0, 100);
    6.88 +	}
    6.89 +
    6.90 +      nodesmap[node]->property_fill_color_gdk().set_value(color);
    6.91 +    }
    6.92 +  return 0;
    6.93 +};
    6.94 +
    6.95 +int GraphDisplayerCanvas::changeNodeText (std::string mapname, Graph::Node node)
    6.96 +{
    6.97 +
    6.98 +  //the number in the map will be written on the node
    6.99 +  //EXCEPT when the name of the map is Text, because
   6.100 +  //in that case empty string will be written, because
   6.101 +  //that is the deleter map
   6.102 +  //\todo isn't it a bit woodcutter?
   6.103 +
   6.104 +  if(node==INVALID)
   6.105 +    {
   6.106 +      for (NodeIt i(g); i!=INVALID; ++i)
   6.107 +	{
   6.108 +	  if(mapname!=node_property_strings[N_TEXT])
   6.109 +	    {
   6.110 +	      double number=(*(mapstorage.nodemap_storage)[mapname])[i];
   6.111 +	      int length=1;
   6.112 +	      //if number is smaller than one, length would be negative, or invalid
   6.113 +	      if(number>=1)
   6.114 +		{
   6.115 +		  length=(int)(floor(log(number)/log(10)))+1;
   6.116 +		}
   6.117 +	      int maxpos=(int)(pow(10,length-1));
   6.118 +	      int strl=length+1+RANGE;
   6.119 +	      char * str=new char[strl];
   6.120 +	      str[length]='.';
   6.121 +	      str[strl]='\0';
   6.122 +      
   6.123 +	      for(int j=0;j<strl;j++)
   6.124 +		{
   6.125 +		  if(j!=length)
   6.126 +		    {
   6.127 +		      int digit=(int)(number/maxpos);
   6.128 +		      str[j]=(digit+'0');
   6.129 +		      number-=digit*maxpos;
   6.130 +		      number*=10;
   6.131 +		    }
   6.132 +		}
   6.133 +      
   6.134 +	      nodetextmap[i]->property_text().set_value(str);
   6.135 +	    }
   6.136 +	  else
   6.137 +	    {
   6.138 +	      nodetextmap[i]->property_text().set_value("");
   6.139 +	    }
   6.140 +	}
   6.141 +    }
   6.142 +  else
   6.143 +    {
   6.144 +      if(mapname!=node_property_strings[N_TEXT])
   6.145 +	{
   6.146 +	  double number=(*(mapstorage.nodemap_storage)[mapname])[node];
   6.147 +	  int length=1;
   6.148 +	  //if number is smaller than one, length would be negative, or invalid
   6.149 +	  if(number>=1)
   6.150 +	    {
   6.151 +	      length=(int)(floor(log(number)/log(10)))+1;
   6.152 +	    }
   6.153 +	  int maxpos=(int)(pow(10,length-1));
   6.154 +	  int strl=length+1+RANGE;
   6.155 +	  char * str=new char[strl];
   6.156 +	  str[length]='.';
   6.157 +	  str[strl]='\0';
   6.158 +      
   6.159 +	  for(int j=0;j<strl;j++)
   6.160 +	    {
   6.161 +	      if(j!=length)
   6.162 +		{
   6.163 +		  int digit=(int)(number/maxpos);
   6.164 +		  str[j]=(digit+'0');
   6.165 +		  number-=digit*maxpos;
   6.166 +		  number*=10;
   6.167 +		}
   6.168 +	    }
   6.169 +      
   6.170 +	  nodetextmap[node]->property_text().set_value(str);
   6.171 +	}
   6.172 +      else
   6.173 +	{
   6.174 +	  nodetextmap[node]->property_text().set_value("");
   6.175 +	}
   6.176 +    }
   6.177 +  return 0;
   6.178 +};
     7.1 --- a/gui/graph_displayer_canvas.cc	Fri Jun 24 08:44:54 2005 +0000
     7.2 +++ b/gui/graph_displayer_canvas.cc	Fri Jun 24 18:16:12 2005 +0000
     7.3 @@ -2,7 +2,7 @@
     7.4  #include <broken_edge.h>
     7.5  #include <math.h>
     7.6  
     7.7 -GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL)
     7.8 +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)
     7.9  {
    7.10    
    7.11    actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false);
    7.12 @@ -34,7 +34,7 @@
    7.13      text_pos+=(xy<double>(10,10));
    7.14  
    7.15      edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    7.16 -    edgetextmap[i]->property_fill_color().set_value("black");
    7.17 +    edgetextmap[i]->property_fill_color().set_value("darkgreen");
    7.18    }
    7.19  
    7.20    //afterwards nodes come to be drawn
    7.21 @@ -56,7 +56,13 @@
    7.22      nodesmap[i]=new Gnome::Canvas::Ellipse(displayed_graph, cm[i].x-20, cm[i].y-20, cm[i].x+20, cm[i].y+20);
    7.23      *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
    7.24      *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
    7.25 -    //!!!!!!! (nodesmap[i])->signal_event().connect(sigc::bind(sigc::mem_fun(*this, &GraphDisplayerCanvas::event_handler),i));
    7.26 +
    7.27 +    //initializing edge-text as well, to empty string
    7.28 +
    7.29 +    xy<double> text_pos((cm[i].x+node_property_defaults[N_RADIUS]+5),(cm[i].y+node_property_defaults[N_RADIUS]+5));
    7.30 +
    7.31 +    nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    7.32 +    nodetextmap[i]->property_fill_color().set_value("darkblue");
    7.33    }
    7.34  
    7.35    updateScrollRegion();
     8.1 --- a/gui/graph_displayer_canvas.h	Fri Jun 24 08:44:54 2005 +0000
     8.2 +++ b/gui/graph_displayer_canvas.h	Fri Jun 24 18:16:12 2005 +0000
     8.3 @@ -6,6 +6,7 @@
     8.4  class GraphDisplayerCanvas;
     8.5  
     8.6  #include <all_include.h>
     8.7 +#include <map_win.h>
     8.8  #include <mapstorage.h>
     8.9  #include <broken_edge.h>
    8.10  #include <libgnomecanvasmm.h>
    8.11 @@ -17,20 +18,32 @@
    8.12    typedef Gnome::Canvas::CanvasAA Parent;
    8.13  
    8.14  public:
    8.15 -  GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
    8.16 +  GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &, MapWin *);
    8.17    virtual ~GraphDisplayerCanvas();
    8.18  
    8.19    ///Changes the linewidth attribute according to the given map.
    8.20    ///\param mapname is the name of the map which contains the new values
    8.21 -  int changeLineWidth (std::string mapname);
    8.22 +  int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID);
    8.23  
    8.24    ///Changes the linecolor attribute according to the given map.
    8.25    ///\param mapname is the name of the map which contains the new values
    8.26 -  int changeColor (std::string mapname);
    8.27 +  int changeEdgeColor (std::string mapname, Graph::Edge new_item=INVALID);
    8.28  
    8.29    ///Changes the text of line attribute according to the given map.
    8.30    ///\param mapname is the name of the map which contains the new values
    8.31 -  int changeText (std::string mapname);
    8.32 +  int changeEdgeText (std::string mapname, Graph::Edge new_item=INVALID);
    8.33 +
    8.34 +  ///Changes the linewidth attribute according to the given map.
    8.35 +  ///\param mapname is the name of the map which contains the new values
    8.36 +  int changeNodeRadius (std::string mapname, Graph::Node new_item=INVALID);
    8.37 +
    8.38 +  ///Changes the linecolor attribute according to the given map.
    8.39 +  ///\param mapname is the name of the map which contains the new values
    8.40 +  int changeNodeColor (std::string mapname, Graph::Node new_item=INVALID);
    8.41 +
    8.42 +  ///Changes the text of line attribute according to the given map.
    8.43 +  ///\param mapname is the name of the map which contains the new values
    8.44 +  int changeNodeText (std::string mapname, Graph::Node new_item=INVALID);
    8.45  
    8.46    ///Callback for 'ViewZoomIn' action.
    8.47    virtual void zoomIn();
    8.48 @@ -107,6 +120,9 @@
    8.49    ///Map of texts to write on edges
    8.50    Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
    8.51  
    8.52 +  ///Map of texts to write on nodes
    8.53 +  Graph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
    8.54 +
    8.55    ///Group of graphical elements of displayed_graph
    8.56    Gnome::Canvas::Group displayed_graph;
    8.57  
    8.58 @@ -133,6 +149,9 @@
    8.59  
    8.60    static const int zoom_step = 5;
    8.61  
    8.62 +  ///We need to store mapwin, to be able to ask the appropriate values for properties of new items.
    8.63 +  MapWin * mapwin;
    8.64 +
    8.65  };
    8.66  
    8.67  #endif //GRAPH_DISPLAYER_CANVAS_H
     9.1 --- a/gui/main_win.cc	Fri Jun 24 08:44:54 2005 +0000
     9.2 +++ b/gui/main_win.cc	Fri Jun 24 18:16:12 2005 +0000
     9.3 @@ -1,7 +1,7 @@
     9.4  #include <main_win.h>
     9.5  
     9.6  MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
     9.7 -    MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),editwin("Editorial Window", gd_canvas),gd_canvas(graph, cm, ms)
     9.8 +    MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),editwin("Editorial Window", gd_canvas),gd_canvas(graph, cm, ms, &mapwin)
     9.9  {
    9.10    set_title (title);
    9.11    set_default_size(WIN_WIDTH,WIN_HEIGHT);
    10.1 --- a/gui/map_win.cc	Fri Jun 24 08:44:54 2005 +0000
    10.2 +++ b/gui/map_win.cc	Fri Jun 24 18:16:12 2005 +0000
    10.3 @@ -10,16 +10,18 @@
    10.4    return true;
    10.5  }
    10.6  
    10.7 -MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst),table(PROPERTY_NUM, 2, false)
    10.8 +MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst)
    10.9  {
   10.10    set_title(title);
   10.11    set_default_size(200, 50);
   10.12  
   10.13    signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::close_if_escape_is_pressed));
   10.14  
   10.15 -  combo_array=new Gtk::Combo [PROPERTY_NUM];
   10.16 +  e_combo_array=new Gtk::Combo [EDGE_PROPERTY_NUM];
   10.17  
   10.18 -  for(int i=0;i<PROPERTY_NUM;i++)
   10.19 +  table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
   10.20 +
   10.21 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   10.22    {
   10.23  
   10.24      std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
   10.25 @@ -35,8 +37,8 @@
   10.26        {
   10.27  	actprop=j;
   10.28        }
   10.29 -      //this is the other maps to show for this property
   10.30 -      for(int k=0;k<PROPERTY_NUM;k++)
   10.31 +      //these are the maps NOT to show for this property
   10.32 +      for(int k=0;k<EDGE_PROPERTY_NUM;k++)
   10.33        {
   10.34  	if(emsi->second==&(ms.default_edgemaps[k]))
   10.35  	{
   10.36 @@ -46,8 +48,6 @@
   10.37        emsi++;
   10.38      }
   10.39  
   10.40 -    //combo_array[i].set_group(group);
   10.41 -
   10.42      //filling in combo box with choices
   10.43      std::list<Glib::ustring> listStrings;
   10.44  
   10.45 @@ -64,17 +64,17 @@
   10.46        emsi++;
   10.47      }
   10.48  
   10.49 -    combo_array[i].set_popdown_strings(listStrings);
   10.50 +    e_combo_array[i].set_popdown_strings(listStrings);
   10.51  
   10.52      //Restrict it to these choices only:
   10.53 -    combo_array[i].set_value_in_list();
   10.54 +    e_combo_array[i].set_value_in_list();
   10.55  
   10.56 -    //binding signal to thew actual entry
   10.57 -    combo_array[i].get_entry()->signal_changed().connect
   10.58 +    //binding signal to the actual entry
   10.59 +    e_combo_array[i].get_entry()->signal_changed().connect
   10.60      (
   10.61       sigc::bind
   10.62       (
   10.63 -      sigc::mem_fun(*this, &MapWin::combo_changed),
   10.64 +      sigc::mem_fun(*this, &MapWin::e_combo_changed),
   10.65        i
   10.66       )
   10.67      );
   10.68 @@ -82,44 +82,106 @@
   10.69      //placing actual entry in the right place
   10.70  
   10.71      label=new Gtk::Label;
   10.72 -    label->set_text(property_strings[i]);
   10.73 +    label->set_text(edge_property_strings[i]);
   10.74 +        
   10.75 +    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.76 +    (*table).attach(e_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.77  
   10.78 -    //    labelpluscombo=new Gtk::HBox;
   10.79 -    //    labelpluscombo->pack_start(*label);
   10.80 -    //    labelpluscombo->pack_start(combo_array[i]);
   10.81 -        
   10.82 -    table.attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.83 -    table.attach(combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.84 -
   10.85 -    /*
   10.86 -    if(actpos<(ms.numOfEdgeMaps()-PROPERTY_NUM+1)/2)
   10.87 -    {
   10.88 -      vbox_r1.pack_start(*labelpluscombo);
   10.89 -    }
   10.90 -    else
   10.91 -    {
   10.92 -      vbox_r2.pack_start(*labelpluscombo);
   10.93 -    }
   10.94 -    actpos++;
   10.95 -    //*/
   10.96  
   10.97    }
   10.98  
   10.99 -  combos.pack_start(vbox_r1);
  10.100 -  combos.pack_start(vbox_r2);
  10.101 +  vbox.pack_start(*(new Gtk::Label("Edge properties")));
  10.102  
  10.103 -  //add(combos);
  10.104 -  add(table);
  10.105 +  vbox.pack_start(*table);
  10.106 +
  10.107 +  vbox.pack_start(*(new Gtk::HSeparator));
  10.108 +
  10.109 +  n_combo_array=new Gtk::Combo [NODE_PROPERTY_NUM];
  10.110 +
  10.111 +  table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);
  10.112 +
  10.113 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  10.114 +  {
  10.115 +
  10.116 +    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
  10.117 +    std::set<int> props;
  10.118 +
  10.119 +    int actprop;
  10.120 +
  10.121 +    //here we find out, which map is the default in MapStorage for this property, which are not
  10.122 +    for(int j=0;j<ms.numOfNodeMaps();j++)
  10.123 +    {
  10.124 +      //these are the maps NOT to show for this property
  10.125 +      if(emsi->second==&(ms.default_nodemaps[i]))
  10.126 +      {
  10.127 +	actprop=j;
  10.128 +      }
  10.129 +      //this is the other maps to show for this property
  10.130 +      for(int k=0;k<NODE_PROPERTY_NUM;k++)
  10.131 +      {
  10.132 +	if(emsi->second==&(ms.default_nodemaps[k]))
  10.133 +	{
  10.134 +	  props.insert(j);
  10.135 +	}
  10.136 +      }
  10.137 +      emsi++;
  10.138 +    }
  10.139 +
  10.140 +    //filling in combo box with choices
  10.141 +    std::list<Glib::ustring> listStrings;
  10.142 +
  10.143 +    listStrings.push_back("Default");
  10.144 +
  10.145 +    emsi=ms.beginOfNodeMaps();
  10.146 +
  10.147 +    for(int j=0;j<ms.numOfNodeMaps();j++)
  10.148 +    {
  10.149 +      if( ( props.find(j) )==( props.end() ) )
  10.150 +      {
  10.151 +	listStrings.push_back(emsi->first);
  10.152 +      }
  10.153 +      emsi++;
  10.154 +    }
  10.155 +
  10.156 +    n_combo_array[i].set_popdown_strings(listStrings);
  10.157 +
  10.158 +    //Restrict it to these choices only:
  10.159 +    n_combo_array[i].set_value_in_list();
  10.160 +
  10.161 +    //binding signal to thew actual entry
  10.162 +    n_combo_array[i].get_entry()->signal_changed().connect
  10.163 +    (
  10.164 +     sigc::bind
  10.165 +     (
  10.166 +      sigc::mem_fun(*this, &MapWin::n_combo_changed),
  10.167 +      i
  10.168 +     )
  10.169 +    );
  10.170 +
  10.171 +    //placing actual entry in the right place
  10.172 +
  10.173 +    label=new Gtk::Label;
  10.174 +    label->set_text(node_property_strings[i]);
  10.175 +        
  10.176 +    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
  10.177 +    (*table).attach(n_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
  10.178 +
  10.179 +
  10.180 +  }
  10.181 +
  10.182 +  add(vbox);
  10.183 +
  10.184 +  vbox.pack_start(*(new Gtk::Label("Node properties")));
  10.185 +
  10.186 +  vbox.pack_start(*table);
  10.187  
  10.188    show_all_children();
  10.189  
  10.190  }
  10.191  
  10.192 -void MapWin::combo_changed(int prop)
  10.193 +void MapWin::e_combo_changed(int prop)
  10.194  {
  10.195 -
  10.196 -  //most nem kommentezem fel, mert ugyis valtozik
  10.197 -  Gtk::Entry* entry = combo_array[prop].get_entry();
  10.198 +  Gtk::Entry* entry = e_combo_array[prop].get_entry();
  10.199  
  10.200    if(entry)
  10.201    {
  10.202 @@ -128,21 +190,21 @@
  10.203      {
  10.204        if(mapname=="Default")
  10.205        {
  10.206 -	mapname=property_strings[prop];
  10.207 +	mapname=edge_property_strings[prop];
  10.208        }
  10.209  
  10.210        if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
  10.211        {
  10.212  	switch(prop)
  10.213  	{
  10.214 -          case WIDTH:
  10.215 -	    gdc.changeLineWidth(mapname);
  10.216 +          case E_WIDTH:
  10.217 +	    gdc.changeEdgeWidth(mapname);
  10.218  	    break;
  10.219 -          case COLOR:
  10.220 -	    gdc.changeColor(mapname);
  10.221 +          case E_COLOR:
  10.222 +	    gdc.changeEdgeColor(mapname);
  10.223  	    break;
  10.224 -          case TEXT:
  10.225 -	    gdc.changeText(mapname);
  10.226 +          case E_TEXT:
  10.227 +	    gdc.changeEdgeText(mapname);
  10.228  	    break;
  10.229            default:
  10.230  	    std::cout<<"Error\n";
  10.231 @@ -151,3 +213,118 @@
  10.232      }
  10.233    }
  10.234  };
  10.235 +
  10.236 +void MapWin::n_combo_changed(int prop)
  10.237 +{
  10.238 +
  10.239 +  Gtk::Entry* entry = n_combo_array[prop].get_entry();
  10.240 +
  10.241 +  if(entry)
  10.242 +  {
  10.243 +    Glib::ustring mapname = entry->get_text();
  10.244 +    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
  10.245 +    {
  10.246 +      if(mapname=="Default")
  10.247 +      {
  10.248 +	mapname=node_property_strings[prop];
  10.249 +      }
  10.250 +
  10.251 +      if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
  10.252 +      {
  10.253 +	switch(prop)
  10.254 +	{
  10.255 +          case N_RADIUS:
  10.256 +	    gdc.changeNodeRadius(mapname);
  10.257 +	    break;
  10.258 +          case N_COLOR:
  10.259 +	    gdc.changeNodeColor(mapname);
  10.260 +	    break;
  10.261 +          case N_TEXT:
  10.262 +	    gdc.changeNodeText(mapname);
  10.263 +	    break;
  10.264 +          default:
  10.265 +	    std::cout<<"Error\n";
  10.266 +	}
  10.267 +      }
  10.268 +    }
  10.269 +  }
  10.270 +};
  10.271 +
  10.272 +void MapWin::update_node(Graph::Node node)
  10.273 +{
  10.274 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
  10.275 +    {
  10.276 +      Gtk::Entry* entry = n_combo_array[i].get_entry();
  10.277 +
  10.278 +      if(entry)
  10.279 +	{
  10.280 +	  Glib::ustring mapname = entry->get_text();
  10.281 +	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
  10.282 +	    {
  10.283 +	      if(mapname=="Default")
  10.284 +		{
  10.285 +		  mapname=node_property_strings[i];
  10.286 +		}
  10.287 +
  10.288 +	      if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
  10.289 +		{
  10.290 +		  switch(i)
  10.291 +		    {
  10.292 +		    case N_RADIUS:
  10.293 +		      //gdc.changeNodeRadius(mapname, node);
  10.294 +		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::node_update!" << std::endl;
  10.295 +		      break;
  10.296 +		    case N_COLOR:
  10.297 +		      gdc.changeNodeColor(mapname, node);
  10.298 +		      break;
  10.299 +		    case N_TEXT:
  10.300 +		      gdc.changeNodeText(mapname, node);
  10.301 +		      break;
  10.302 +		    default:
  10.303 +		      std::cout<<"Error\n";
  10.304 +		    }
  10.305 +		}
  10.306 +	    }
  10.307 +	}
  10.308 +    }
  10.309 +}
  10.310 +
  10.311 +void MapWin::update_edge(Graph::Edge edge)
  10.312 +{
  10.313 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  10.314 +    {
  10.315 +
  10.316 +      Gtk::Entry* entry = e_combo_array[i].get_entry();
  10.317 +
  10.318 +      if(entry)
  10.319 +	{
  10.320 +	  Glib::ustring mapname = entry->get_text();
  10.321 +	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
  10.322 +	    {
  10.323 +	      if(mapname=="Default")
  10.324 +		{
  10.325 +		  mapname=edge_property_strings[i];
  10.326 +		}
  10.327 +
  10.328 +	      if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
  10.329 +		{
  10.330 +		  switch(i)
  10.331 +		    {
  10.332 +		    case E_WIDTH:
  10.333 +		      //gdc.changeEdgeWidth(mapname, edge);
  10.334 +		      std::cout << "If default map-value problem is solved, uncomment line in MapWin::edge_update!" << std::endl;
  10.335 +		      break;
  10.336 +		    case E_COLOR:
  10.337 +		      gdc.changeEdgeColor(mapname, edge);
  10.338 +		      break;
  10.339 +		    case E_TEXT:
  10.340 +		      gdc.changeEdgeText(mapname, edge);
  10.341 +		      break;
  10.342 +		    default:
  10.343 +		      std::cout<<"Error\n";
  10.344 +		    }
  10.345 +		}
  10.346 +	    }
  10.347 +	}
  10.348 +    }
  10.349 +}
    11.1 --- a/gui/map_win.h	Fri Jun 24 08:44:54 2005 +0000
    11.2 +++ b/gui/map_win.h	Fri Jun 24 18:16:12 2005 +0000
    11.3 @@ -3,6 +3,8 @@
    11.4  #ifndef MAP_WIN_H
    11.5  #define MAP_WIN_H
    11.6  
    11.7 +class MapWin;
    11.8 +
    11.9  #include <all_include.h>
   11.10  #include <mapstorage.h>
   11.11  #include <graph_displayer_canvas.h>
   11.12 @@ -24,15 +26,14 @@
   11.13    ///The \ref MapStorage in which the visualizable maps are stored
   11.14    MapStorage & ms;
   11.15  
   11.16 -  Gtk::Table table;
   11.17 +  Gtk::Table * table;
   11.18    
   11.19 -  Gtk::HBox combos, * labelpluscombo;
   11.20 -  Gtk::Combo * combo_array;
   11.21 -
   11.22 -  Gtk::VBox vbox_b, vbox_r1, vbox_r2;
   11.23 +  Gtk::Combo * e_combo_array, * n_combo_array;
   11.24  
   11.25    Gtk::Label * label;
   11.26  
   11.27 +  Gtk::VBox vbox;
   11.28 +
   11.29  public:
   11.30    ///Constructor of MapWin creates the widgets shown in MapWin.
   11.31    MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);
   11.32 @@ -41,7 +42,19 @@
   11.33    ///which button was that and after that calls the
   11.34    ///appropriate function of the \ref GraphDisplayerCanvas
   11.35    ///to change the visible values of that attribute.
   11.36 -  virtual void combo_changed(int);
   11.37 +  virtual void e_combo_changed(int);
   11.38 +  ///If a radiobutton is clicked, this function determines
   11.39 +  ///which button was that and after that calls the
   11.40 +  ///appropriate function of the \ref GraphDisplayerCanvas
   11.41 +  ///to change the visible values of that attribute.
   11.42 +  virtual void n_combo_changed(int);
   11.43 +
   11.44 +  ///This function is created to set the appropriate maps on the newly created node
   11.45 +  void update_node(Graph::Node);
   11.46 +
   11.47 +  ///This function is created to set the appropriate maps on the newly created edge
   11.48 +  void update_edge(Graph::Edge);
   11.49 +
   11.50    virtual bool close_if_escape_is_pressed(GdkEventKey*);
   11.51  };
   11.52  
    12.1 --- a/gui/mapstorage.cc	Fri Jun 24 08:44:54 2005 +0000
    12.2 +++ b/gui/mapstorage.cc	Fri Jun 24 18:16:12 2005 +0000
    12.3 @@ -2,20 +2,34 @@
    12.4  
    12.5  MapStorage::MapStorage(Graph & graph):g(graph)
    12.6  {
    12.7 -  for(int i=0;i<PROPERTY_NUM;i++)
    12.8 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    12.9    {
   12.10 -    Graph::EdgeMap<double> emd(g);
   12.11 +    Graph::EdgeMap<double> emd(g,edge_property_defaults[i]);
   12.12      default_edgemaps.push_back(emd);
   12.13 -    Graph::NodeMap<double> nmd(g);
   12.14 +  }
   12.15 +
   12.16 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   12.17 +  {
   12.18 +    Graph::NodeMap<double> nmd(g,node_property_defaults[i]);
   12.19      default_nodemaps.push_back(nmd);
   12.20    }
   12.21 -  for(int i=0;i<PROPERTY_NUM;i++)
   12.22 +
   12.23 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   12.24    {
   12.25        for (EdgeIt j(g); j!=INVALID; ++j)
   12.26        {
   12.27 -	(default_edgemaps[i])[j]=property_defaults[i];
   12.28 +	(default_edgemaps[i])[j]=edge_property_defaults[i];
   12.29        }
   12.30 -      addEdgeMap(property_strings[i],&(default_edgemaps[i]));
   12.31 +      addEdgeMap(edge_property_strings[i],&(default_edgemaps[i]));
   12.32 +  }
   12.33 +
   12.34 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
   12.35 +  {
   12.36 +      for (NodeIt j(g); j!=INVALID; ++j)
   12.37 +      {
   12.38 +	(default_nodemaps[i])[j]=node_property_defaults[i];
   12.39 +      }
   12.40 +      addNodeMap(node_property_strings[i],&(default_nodemaps[i]));
   12.41    }
   12.42  
   12.43  };
   12.44 @@ -99,7 +113,7 @@
   12.45  //   std::cout << std::endl;
   12.46  
   12.47  // g_closure_invoke...
   12.48 -//   for(int i=0;i<PROPERTY_NUM;i++)
   12.49 +//   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   12.50  //     {
   12.51  //       (default_edgemaps[i])[e]=property_defaults[i];
   12.52  //     }