Increase precision of DbU::getValueString() to 3 decimals for micrometer.

Uses SmartTruncate when displaying rulers.
This commit is contained in:
Jean-Paul Chaput 2010-01-26 16:24:20 +00:00
parent 53b89a61dc
commit e6f4c5c508
2 changed files with 9 additions and 7 deletions

View File

@ -260,10 +260,10 @@ namespace Hurricane {
if ( _stringMode == Grid ) {
unitSymbol = 'g';
snprintf ( buffer, 1024, "%.1f", getGrid(u) );
snprintf ( buffer, 1024, "%.3f", getGrid(u) );
} else if ( _stringMode == Symbolic ) {
unitSymbol = 'l';
snprintf ( buffer, 1024, "%.1f", getLambda(u) );
snprintf ( buffer, 1024, "%.3f", getLambda(u) );
} else if ( _stringMode == Physical ) {
switch ( _stringModeUnitPower ) {
case Pico: unitSymbol = 'p'; break;
@ -274,7 +274,7 @@ namespace Hurricane {
case Kilo: unitSymbol = 'k'; break;
default: unitSymbol = '?'; break;
}
snprintf ( buffer, 1024, "%.1f", getPhysical(u,_stringModeUnitPower) );
snprintf ( buffer, 1024, "%.3f", getPhysical(u,_stringModeUnitPower) );
} else {
if ( _stringMode != Db )
cerr << "[ERROR] Unknown Unit representation mode: " << _stringMode << endl;

View File

@ -1904,7 +1904,8 @@ namespace Hurricane {
// if ( !tick ) continue;
textGrad = DbU::getValueString( gradStep*tick, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
textGrad = DbU::getValueString( gradStep*tick
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
textGrad.resize ( textGrad.size()-1 );
drawDisplayText ( QPoint ( pxGrad - 1, pxOrigin.y() + tickLength )
@ -1920,7 +1921,7 @@ namespace Hurricane {
, pxAngle.x(), pxAngle.y()+tickLength );
textGrad = DbU::getValueString ( angle.getX() - origin.getX()
, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
textGrad.resize ( textGrad.size()-1 );
drawDisplayText ( QPoint ( pxAngle.x() - 1,pxAngle.y() + tickLength )
@ -1963,7 +1964,8 @@ namespace Hurricane {
// if ( !tick ) continue;
textGrad = DbU::getValueString( gradStep*tick, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
textGrad = DbU::getValueString( gradStep*tick
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
textGrad.resize ( textGrad.size()-1 );
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pyGrad + 1)
@ -1979,7 +1981,7 @@ namespace Hurricane {
, pxOrigin.x()-tickLength, pxAngle.y() );
textGrad = DbU::getValueString( angle.getY() - origin.getY()
, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
textGrad.resize ( textGrad.size()-1 );
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pxAngle.y() + 1)