graph_displayer_canvas-node.cc
branchgui
changeset 35 79bffdf6aea2
parent 31 66e85f44a66f
child 36 7a8c41aa3c29
equal deleted inserted replaced
1:ccb06be01f23 2:b5904c9e704f
   134   //EXCEPT when the name of the map is Text, because
   134   //EXCEPT when the name of the map is Text, because
   135   //in that case empty string will be written, because
   135   //in that case empty string will be written, because
   136   //that is the deleter map
   136   //that is the deleter map
   137 
   137 
   138   Graph::NodeMap<double> * actual_map;
   138   Graph::NodeMap<double> * actual_map;
   139   if(mapname=="Default")
   139   if(mapname!="Default")
   140     {
       
   141       actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
       
   142     }
       
   143   else
       
   144     {
   140     {
   145       actual_map=(mapstorage.nodemap_storage)[mapname];
   141       actual_map=(mapstorage.nodemap_storage)[mapname];
   146     }
   142     }
   147 
   143 
   148   if(node==INVALID)
   144   if(node==INVALID)
   149     {
   145     {
   150       for (NodeIt i(g); i!=INVALID; ++i)
   146       for (NodeIt i(g); i!=INVALID; ++i)
   151 	{
   147 	{
   152 	  if(mapname!="Default")
   148 	  if(mapname!="Default")
   153 	    {
   149 	    {
       
   150 	      nodemap_to_edit=mapname;
   154 	      double number=(*actual_map)[i];
   151 	      double number=(*actual_map)[i];
   155 	      int length=1;
   152 	      int length=1;
   156 	      //if number is smaller than one, length would be negative, or invalid
   153 	      //if number is smaller than one, length would be negative, or invalid
   157 	      if(number>=1)
   154 	      if(number>=1)
   158 		{
   155 		{
   166       
   163       
   167 	      for(int j=0;j<strl;j++)
   164 	      for(int j=0;j<strl;j++)
   168 		{
   165 		{
   169 		  if(j!=length)
   166 		  if(j!=length)
   170 		    {
   167 		    {
   171 		      int digit=(int)(number/maxpos);
   168  		      int digit=(int)round(number/maxpos);
   172 		      str[j]=(digit+'0');
   169 		      str[j]=(digit+'0');
   173 		      number-=digit*maxpos;
   170 		      number-=digit*maxpos;
   174 		      number*=10;
   171 		      number*=10;
   175 		    }
   172 		    }
   176 		}
   173 		}
   177       
   174       
   178 	      nodetextmap[i]->property_text().set_value(str);
   175 	      nodetextmap[i]->property_text().set_value(str);
   179 	    }
   176 	    }
   180 	  else
   177 	  else
   181 	    {
   178 	    {
       
   179 	      nodemap_to_edit="";
   182 	      nodetextmap[i]->property_text().set_value("");
   180 	      nodetextmap[i]->property_text().set_value("");
   183 	    }
   181 	    }
   184 	}
   182 	}
   185     }
   183     }
   186   else
   184   else