gui/graph_displayer_canvas-node.cc
changeset 1591 03aa0a6c8dca
parent 1579 ed7da82bbecf
child 1596 44897b1ba4e2
equal deleted inserted replaced
2:b5904c9e704f 3:1a3337989b03
   133   //the number in the map will be written on the node
   133   //the number in the map will be written on the node
   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=NULL;
   139   if(mapname!="Default")
   139   if(mapname!="Default")
   140     {
   140     {
   141       actual_map=(mapstorage.nodemap_storage)[mapname];
   141       actual_map=(mapstorage.nodemap_storage)[mapname];
   142     }
   142     }
   143 
   143 
   163       
   163       
   164 	      for(int j=0;j<strl;j++)
   164 	      for(int j=0;j<strl;j++)
   165 		{
   165 		{
   166 		  if(j!=length)
   166 		  if(j!=length)
   167 		    {
   167 		    {
   168  		      int digit=(int)round(number/maxpos);
   168 //  		      std::cout << (number) << "-" << (int)number << "=" << (number)-(int)number << std::endl;
       
   169 		      if((number-(int)number)>ALMOST_ONE)
       
   170 			{
       
   171 // 			  std::cout<<"rounding: " <<number<<std::endl;
       
   172 			  number=round(number);
       
   173 			}
       
   174  		      int digit=(int)(number/maxpos);
       
   175 // 		      std::cout << number << "/" << maxpos << "=" << digit << std::endl;
   169 		      str[j]=(digit+'0');
   176 		      str[j]=(digit+'0');
   170 		      number-=digit*maxpos;
   177 		      number-=digit*maxpos;
   171 		      number*=10;
   178 		      number*=10;
   172 		    }
   179 		    }
   173 		}
   180 		}
   200       
   207       
   201 	  for(int j=0;j<strl;j++)
   208 	  for(int j=0;j<strl;j++)
   202 	    {
   209 	    {
   203 	      if(j!=length)
   210 	      if(j!=length)
   204 		{
   211 		{
       
   212 		  if((number-(int)number)>ALMOST_ONE)
       
   213 		    {
       
   214 		      number=round(number);
       
   215 		    }
   205 		  int digit=(int)(number/maxpos);
   216 		  int digit=(int)(number/maxpos);
   206 		  str[j]=(digit+'0');
   217 		  str[j]=(digit+'0');
   207 		  number-=digit*maxpos;
   218 		  number-=digit*maxpos;
   208 		  number*=10;
   219 		  number*=10;
   209 		}
   220 		}