graph_displayer_canvas-edge.cc
branchgui
changeset 48 b8ec84524fa2
parent 47 9a0e6e92d06c
child 53 e73d7540bd24
     1.1 --- a/graph_displayer_canvas-edge.cc	Thu Jul 28 14:31:32 2005 +0000
     1.2 +++ b/graph_displayer_canvas-edge.cc	Thu Jul 28 15:54:00 2005 +0000
     1.3 @@ -6,12 +6,18 @@
     1.4  int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     1.5  {
     1.6    Graph::EdgeMap<double> * actual_map;
     1.7 +  double min, max;
     1.8 +
     1.9    if(mapname=="Default")
    1.10      {
    1.11 +      min=edge_property_defaults[E_WIDTH];
    1.12 +      max=edge_property_defaults[E_WIDTH];
    1.13        actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
    1.14      }
    1.15    else
    1.16      {
    1.17 +      min=mapstorage.minOfEdgeMap(mapname);
    1.18 +      max=mapstorage.maxOfEdgeMap(mapname);
    1.19        actual_map=(mapstorage.edgemap_storage)[mapname];
    1.20      }
    1.21  
    1.22 @@ -19,11 +25,17 @@
    1.23      {
    1.24        for (EdgeIt i(g); i!=INVALID; ++i)
    1.25  	{
    1.26 -	  int w=(int)(*actual_map)[i];
    1.27 -	  if(w>=0)
    1.28 +	  double v=abs((*actual_map)[i]);
    1.29 +	  int w;
    1.30 +	  if(min==max)
    1.31  	    {
    1.32 -	      edgesmap[i]->property_width_units().set_value(w);
    1.33 +	      w=(int)(edge_property_defaults[E_WIDTH]);
    1.34  	    }
    1.35 +	  else
    1.36 +	    {
    1.37 +	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    1.38 +	    }
    1.39 +	  edgesmap[i]->property_width_units().set_value(w);
    1.40  	}
    1.41      }
    1.42    else