graph_displayer_canvas-edge.cc
branchgui
changeset 134 82e19031c319
parent 94 adfdc2f70548
child 147 10ef59f6633c
equal deleted inserted replaced
18:4bc1b880f097 19:97a20700d448
     6 {
     6 {
     7   double min, max;
     7   double min, max;
     8 
     8 
     9   min=edge_property_defaults[E_WIDTH];
     9   min=edge_property_defaults[E_WIDTH];
    10   max=edge_property_defaults[E_WIDTH];
    10   max=edge_property_defaults[E_WIDTH];
    11   Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_WIDTH]);
    11   Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
    12   
    12   
    13   if(edge==INVALID)
    13   if(edge==INVALID)
    14     {
    14     {
    15       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    15       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    16 	{
    16 	{
    17 	  double v=fabs(actual_map[i]);
    17 	  double v=fabs(actual_map[i]);
    18 	  int w;
    18 	  int w;
    19 	  if(min==max)
    19 	  if(min==max)
    20 	    {
    20 	    {
    42 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
    42 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
    43 {
    43 {
    44   Graph::EdgeMap<double> * actual_map;
    44   Graph::EdgeMap<double> * actual_map;
    45   double min, max;
    45   double min, max;
    46 
    46 
    47   min=(mainwin.mapstorage).minOfEdgeMap(mapname);
    47   min=(mytab.mapstorage).minOfEdgeMap(mapname);
    48   max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
    48   max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    49   actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
    49   actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
    50 
    50 
    51   if(edge==INVALID)
    51   if(edge==INVALID)
    52     {
    52     {
    53       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    53       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    54 	{
    54 	{
    55 	  double v=fabs((*actual_map)[i]);
    55 	  double v=fabs((*actual_map)[i]);
    56 	  int w;
    56 	  int w;
    57 	  if(min==max)
    57 	  if(min==max)
    58 	    {
    58 	    {
    81 
    81 
    82   //function maps the range of the maximum and
    82   //function maps the range of the maximum and
    83   //the minimum of the nodemap to the range of
    83   //the minimum of the nodemap to the range of
    84   //green in RGB
    84   //green in RGB
    85   Graph::EdgeMap<double> * actual_map;
    85   Graph::EdgeMap<double> * actual_map;
    86   actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
    86   actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
    87 
    87 
    88   double max, min;
    88   double max, min;
    89 
    89 
    90   max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
    90   max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    91   min=(mainwin.mapstorage).minOfEdgeMap(mapname);
    91   min=(mytab.mapstorage).minOfEdgeMap(mapname);
    92 
    92 
    93   if(edge==INVALID)
    93   if(edge==INVALID)
    94     {
    94     {
    95       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    95       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    96 	{
    96 	{
    97 	  double w=(*actual_map)[i];
    97 	  double w=(*actual_map)[i];
    98 
    98 
    99 	  Gdk::Color color;
    99 	  Gdk::Color color;
   100 	  if(max!=min)
   100 	  if(max!=min)
   132 {  
   132 {  
   133 
   133 
   134   //function maps the range of the maximum and
   134   //function maps the range of the maximum and
   135   //the minimum of the nodemap to the range of
   135   //the minimum of the nodemap to the range of
   136   //green in RGB
   136   //green in RGB
   137   Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_COLOR]);
   137   Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
   138 
   138 
   139   double max, min;
   139   double max, min;
   140 
   140 
   141   max=edge_property_defaults[E_COLOR];
   141   max=edge_property_defaults[E_COLOR];
   142   min=edge_property_defaults[E_COLOR];
   142   min=edge_property_defaults[E_COLOR];
   143 
   143 
   144   if(edge==INVALID)
   144   if(edge==INVALID)
   145     {
   145     {
   146       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   146       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   147 	{
   147 	{
   148 	  double w=actual_map[i];
   148 	  double w=actual_map[i];
   149 
   149 
   150 	  Gdk::Color color;
   150 	  Gdk::Color color;
   151 	  if(max!=min)
   151 	  if(max!=min)
   186   //in that case empty string will be written, because
   186   //in that case empty string will be written, because
   187   //that is the deleter map
   187   //that is the deleter map
   188   
   188   
   189   if(edge==INVALID)
   189   if(edge==INVALID)
   190     {
   190     {
   191       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   191       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   192 	{
   192 	{
   193 	  edgemap_to_edit=mapname;
   193 	  edgemap_to_edit=mapname;
   194 	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[i];
   194 	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
   195 	  
   195 	  
   196 	  std::ostringstream ostr;
   196 	  std::ostringstream ostr;
   197 	  ostr << number;
   197 	  ostr << number;
   198 	  
   198 	  
   199 	  edgetextmap[i]->property_text().set_value(ostr.str());
   199 	  edgetextmap[i]->property_text().set_value(ostr.str());
   200 	}
   200 	}
   201 
   201 
   202     }
   202     }
   203   else
   203   else
   204     {
   204     {
   205 	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[edge];
   205 	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
   206 
   206 
   207 	  std::ostringstream ostr;
   207 	  std::ostringstream ostr;
   208 	  ostr << number;
   208 	  ostr << number;
   209 	  
   209 	  
   210 	  edgetextmap[edge]->property_text().set_value(ostr.str());
   210 	  edgetextmap[edge]->property_text().set_value(ostr.str());
   221   //in that case empty string will be written, because
   221   //in that case empty string will be written, because
   222   //that is the deleter map
   222   //that is the deleter map
   223   
   223   
   224   if(edge==INVALID)
   224   if(edge==INVALID)
   225     {
   225     {
   226       for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   226       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   227 	{
   227 	{
   228 	  edgemap_to_edit="";
   228 	  edgemap_to_edit="";
   229 	  edgetextmap[i]->property_text().set_value("");
   229 	  edgetextmap[i]->property_text().set_value("");
   230 	}
   230 	}
   231 
   231