graph_displayer_canvas-edge.cc
branchgui
changeset 54 9128e364fb19
parent 48 b8ec84524fa2
child 55 e4ee805ca5fc
equal deleted inserted replaced
9:3c8c375930c4 10:6132fc659d41
     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 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     7 {
     7 {
    10 
    10 
    11   if(mapname=="Default")
    11   if(mapname=="Default")
    12     {
    12     {
    13       min=edge_property_defaults[E_WIDTH];
    13       min=edge_property_defaults[E_WIDTH];
    14       max=edge_property_defaults[E_WIDTH];
    14       max=edge_property_defaults[E_WIDTH];
    15       actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
    15       actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]);
    16     }
    16     }
    17   else
    17   else
    18     {
    18     {
    19       min=mapstorage.minOfEdgeMap(mapname);
    19       min=mapstorage.minOfEdgeMap(mapname);
    20       max=mapstorage.maxOfEdgeMap(mapname);
    20       max=mapstorage.maxOfEdgeMap(mapname);
    21       actual_map=(mapstorage.edgemap_storage)[mapname];
    21       actual_map=(mapstorage.edgemap_storage)[mapname];
    22     }
    22     }
    23 
    23 
    24   if(edge==INVALID)
    24   if(edge==INVALID)
    25     {
    25     {
    26       for (EdgeIt i(g); i!=INVALID; ++i)
    26       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    27 	{
    27 	{
    28 	  double v=abs((*actual_map)[i]);
    28 	  double v=abs((*actual_map)[i]);
    29 	  int w;
    29 	  int w;
    30 	  if(min==max)
    30 	  if(min==max)
    31 	    {
    31 	    {
    56   //the minimum of the nodemap to the range of
    56   //the minimum of the nodemap to the range of
    57   //green in RGB
    57   //green in RGB
    58   Graph::EdgeMap<double> * actual_map;
    58   Graph::EdgeMap<double> * actual_map;
    59   if(mapname=="Default")
    59   if(mapname=="Default")
    60     {
    60     {
    61       actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
    61       actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]);
    62     }
    62     }
    63   else
    63   else
    64     {
    64     {
    65       actual_map=(mapstorage.edgemap_storage)[mapname];
    65       actual_map=(mapstorage.edgemap_storage)[mapname];
    66     }
    66     }
    78       min=edge_property_defaults[E_COLOR];
    78       min=edge_property_defaults[E_COLOR];
    79     }
    79     }
    80 
    80 
    81   if(edge==INVALID)
    81   if(edge==INVALID)
    82     {
    82     {
    83       for (EdgeIt i(g); i!=INVALID; ++i)
    83       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    84 	{
    84 	{
    85 	  double w=(*actual_map)[i];
    85 	  double w=(*actual_map)[i];
    86 
    86 
    87 	  Gdk::Color color;
    87 	  Gdk::Color color;
    88 	  if(max!=min)
    88 	  if(max!=min)
   123   //in that case empty string will be written, because
   123   //in that case empty string will be written, because
   124   //that is the deleter map
   124   //that is the deleter map
   125 
   125 
   126   if(edge==INVALID)
   126   if(edge==INVALID)
   127     {
   127     {
   128       for (EdgeIt i(g); i!=INVALID; ++i)
   128       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   129 	{
   129 	{
   130 	  if(mapname!="Default")
   130 	  if(mapname!="Default")
   131 	    {
   131 	    {
   132 	      edgemap_to_edit=mapname;
   132 	      edgemap_to_edit=mapname;
   133 	      double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   133 	      double number=(*(mapstorage.edgemap_storage)[mapname])[i];