1.1 --- a/graph_displayer_canvas-edge.cc Wed Jul 27 11:02:51 2005 +0000
1.2 +++ b/graph_displayer_canvas-edge.cc Wed Jul 27 11:19:35 2005 +0000
1.3 @@ -119,37 +119,10 @@
1.4 {
1.5 edgemap_to_edit=mapname;
1.6 double number=(*(mapstorage.edgemap_storage)[mapname])[i];
1.7 -// int length=1;
1.8 -// //if number is smaller than one, length would be negative, or invalid
1.9 -// if(number>=1)
1.10 -// {
1.11 -// length=(int)(floor(log(number)/log(10)))+1;
1.12 -// }
1.13 -// int maxpos=(int)(pow(10,length-1));
1.14 -// int strl=length+1+RANGE;
1.15 -// char * str=new char[strl];
1.16 -// str[length]='.';
1.17 -// str[strl]='\0';
1.18 -
1.19 -// for(int j=0;j<strl;j++)
1.20 -// {
1.21 -// if(j!=length)
1.22 -// {
1.23 -// if((number-(int)number)>ALMOST_ONE)
1.24 -// {
1.25 -// number=round(number);
1.26 -// }
1.27 -// int digit=(int)(number/maxpos);
1.28 -// str[j]=(digit+'0');
1.29 -// number-=digit*maxpos;
1.30 -// number*=10;
1.31 -// }
1.32 -// }
1.33 -// edgetextmap[i]->property_text().set_value(str);
1.34
1.35 std::ostringstream ostr;
1.36 ostr << number;
1.37 -
1.38 +
1.39 edgetextmap[i]->property_text().set_value(ostr.str());
1.40 }
1.41 else
1.42 @@ -165,34 +138,11 @@
1.43 if(mapname!="Default")
1.44 {
1.45 double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
1.46 - int length=1;
1.47 - //if number is smaller than one, length would be negative, or invalid
1.48 - if(number>=1)
1.49 - {
1.50 - length=(int)(floor(log(number)/log(10)))+1;
1.51 - }
1.52 - int maxpos=(int)(pow(10,length-1));
1.53 - int strl=length+1+RANGE;
1.54 - char * str=new char[strl];
1.55 - str[length]='.';
1.56 - str[strl]='\0';
1.57 -
1.58 - for(int j=0;j<strl;j++)
1.59 - {
1.60 - if(j!=length)
1.61 - {
1.62 - if((number-(int)number)>ALMOST_ONE)
1.63 - {
1.64 - number=round(number);
1.65 - }
1.66 - int digit=(int)(number/maxpos);
1.67 - str[j]=(digit+'0');
1.68 - number-=digit*maxpos;
1.69 - number*=10;
1.70 - }
1.71 - }
1.72 -
1.73 - edgetextmap[edge]->property_text().set_value(str);
1.74 +
1.75 + std::ostringstream ostr;
1.76 + ostr << number;
1.77 +
1.78 + edgetextmap[edge]->property_text().set_value(ostr.str());
1.79 }
1.80 else
1.81 {