graph_displayer_canvas-node.cc
branchgui
changeset 36 7a8c41aa3c29
parent 35 79bffdf6aea2
child 45 199f433eb7cd
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 		}