graph_displayer_canvas-edge.cc
changeset 164 70e3c3646283
parent 147 10ef59f6633c
child 167 30a7be486475
equal deleted inserted replaced
20:ae5bac22367d 21:085c1a13bb8f
     1 #include "graph_displayer_canvas.h"
     1 #include "graph_displayer_canvas.h"
     2 #include <cmath>
     2 #include <cmath>
     3 
     3 
       
     4 const int minimum_edge_width=2;
     4 
     5 
     5 int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
     6 int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
     6 {
     7 {
     7   double min, max;
     8   double min, max;
     8 
     9 
    22 	    }
    23 	    }
    23 	  else
    24 	  else
    24 	    {
    25 	    {
    25 	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    26 	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    26 	    }
    27 	    }
       
    28 	  if(zoomtrack)
       
    29 	    {
       
    30 	      double actual_ppu=get_pixels_per_unit();
       
    31 	      w=(int)(w/actual_ppu*fixed_zoom_factor);
       
    32 	    }
    27 	  edgesmap[i]->setLineWidth(w);
    33 	  edgesmap[i]->setLineWidth(w);
    28 	}
    34 	}
    29     }
    35     }
    30   else
    36   else
    31     {
    37     {
    52     {
    58     {
    53       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    59       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    54 	{
    60 	{
    55 	  double v=fabs((*actual_map)[i]);
    61 	  double v=fabs((*actual_map)[i]);
    56 	  int w;
    62 	  int w;
    57 	  if(min==max)
    63 	  if(autoscale)
    58 	    {
    64 	    {
    59 	      w=(int)(edge_property_defaults[E_WIDTH]);
    65 	      if(min==max)
    60 	    }
    66 		{
    61 	  else
    67 		  w=(int)(edge_property_defaults[E_WIDTH]);
    62 	    {
    68 		}
    63 	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    69 	      else
       
    70 		{
       
    71 		  w=(int)(minimum_edge_width+(v-min)/(max-min)*(edge_width-minimum_edge_width));
       
    72 		}
       
    73 	    }
       
    74 	  else
       
    75 	    {
       
    76 	      w=(int)(v*edge_width);
       
    77 	    }
       
    78 	  if(w<minimum_edge_width)
       
    79 	    {
       
    80 	      w=minimum_edge_width;
       
    81 	    }
       
    82 	  if(zoomtrack)
       
    83 	    {
       
    84 	      double actual_ppu=get_pixels_per_unit();
       
    85 	      w=(int)(w/actual_ppu*fixed_zoom_factor);
    64 	    }
    86 	    }
    65 	  edgesmap[i]->setLineWidth(w);
    87 	  edgesmap[i]->setLineWidth(w);
    66 	}
    88 	}
    67     }
    89     }
    68   else
    90   else