Changeset 1596:44897b1ba4e2 in lemon0.x for gui/graph_displayer_canvasnode.cc
 Timestamp:
 07/27/05 13:19:35 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2100
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

gui/graph_displayer_canvasnode.cc
r1581 r1596 150 150 nodemap_to_edit=mapname; 151 151 double number=(*actual_map)[i]; 152 int length=1; 153 //if number is smaller than one, length would be negative, or invalid 154 if(number>=1) 155 { 156 length=(int)(floor(log(number)/log(10)))+1; 157 } 158 int maxpos=(int)(pow(10,length1)); 159 int strl=length+1+RANGE; 160 char * str=new char[strl]; 161 str[length]='.'; 162 str[strl]='\0'; 163 164 for(int j=0;j<strl;j++) 165 { 166 if(j!=length) 167 { 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; 176 str[j]=(digit+'0'); 177 number=digit*maxpos; 178 number*=10; 179 } 180 } 181 182 nodetextmap[i]>property_text().set_value(str); 152 153 std::ostringstream ostr; 154 ostr << number; 155 156 nodetextmap[i]>property_text().set_value(ostr.str()); 183 157 } 184 158 else … … 194 168 { 195 169 double number=(*actual_map)[node]; 196 int length=1; 197 //if number is smaller than one, length would be negative, or invalid 198 if(number>=1) 199 { 200 length=(int)(floor(log(number)/log(10)))+1; 201 } 202 int maxpos=(int)(pow(10,length1)); 203 int strl=length+1+RANGE; 204 char * str=new char[strl]; 205 str[length]='.'; 206 str[strl]='\0'; 207 208 for(int j=0;j<strl;j++) 209 { 210 if(j!=length) 211 { 212 if((number(int)number)>ALMOST_ONE) 213 { 214 number=round(number); 215 } 216 int digit=(int)(number/maxpos); 217 str[j]=(digit+'0'); 218 number=digit*maxpos; 219 number*=10; 220 } 221 } 222 223 nodetextmap[node]>property_text().set_value(str); 170 171 std::ostringstream ostr; 172 ostr << number; 173 174 nodetextmap[node]>property_text().set_value(ostr.str()); 224 175 } 225 176 else
Note: See TracChangeset
for help on using the changeset viewer.