Increase precision of DbU::getValueString() to 3 decimals for micrometer.
Uses SmartTruncate when displaying rulers.
This commit is contained in:
parent
53b89a61dc
commit
e6f4c5c508
|
@ -260,10 +260,10 @@ namespace Hurricane {
|
||||||
|
|
||||||
if ( _stringMode == Grid ) {
|
if ( _stringMode == Grid ) {
|
||||||
unitSymbol = 'g';
|
unitSymbol = 'g';
|
||||||
snprintf ( buffer, 1024, "%.1f", getGrid(u) );
|
snprintf ( buffer, 1024, "%.3f", getGrid(u) );
|
||||||
} else if ( _stringMode == Symbolic ) {
|
} else if ( _stringMode == Symbolic ) {
|
||||||
unitSymbol = 'l';
|
unitSymbol = 'l';
|
||||||
snprintf ( buffer, 1024, "%.1f", getLambda(u) );
|
snprintf ( buffer, 1024, "%.3f", getLambda(u) );
|
||||||
} else if ( _stringMode == Physical ) {
|
} else if ( _stringMode == Physical ) {
|
||||||
switch ( _stringModeUnitPower ) {
|
switch ( _stringModeUnitPower ) {
|
||||||
case Pico: unitSymbol = 'p'; break;
|
case Pico: unitSymbol = 'p'; break;
|
||||||
|
@ -274,7 +274,7 @@ namespace Hurricane {
|
||||||
case Kilo: unitSymbol = 'k'; break;
|
case Kilo: unitSymbol = 'k'; break;
|
||||||
default: unitSymbol = '?'; break;
|
default: unitSymbol = '?'; break;
|
||||||
}
|
}
|
||||||
snprintf ( buffer, 1024, "%.1f", getPhysical(u,_stringModeUnitPower) );
|
snprintf ( buffer, 1024, "%.3f", getPhysical(u,_stringModeUnitPower) );
|
||||||
} else {
|
} else {
|
||||||
if ( _stringMode != Db )
|
if ( _stringMode != Db )
|
||||||
cerr << "[ERROR] Unknown Unit representation mode: " << _stringMode << endl;
|
cerr << "[ERROR] Unknown Unit representation mode: " << _stringMode << endl;
|
||||||
|
|
|
@ -1904,7 +1904,8 @@ namespace Hurricane {
|
||||||
|
|
||||||
// if ( !tick ) continue;
|
// 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 );
|
textGrad.resize ( textGrad.size()-1 );
|
||||||
|
|
||||||
drawDisplayText ( QPoint ( pxGrad - 1, pxOrigin.y() + tickLength )
|
drawDisplayText ( QPoint ( pxGrad - 1, pxOrigin.y() + tickLength )
|
||||||
|
@ -1920,7 +1921,7 @@ namespace Hurricane {
|
||||||
, pxAngle.x(), pxAngle.y()+tickLength );
|
, pxAngle.x(), pxAngle.y()+tickLength );
|
||||||
|
|
||||||
textGrad = DbU::getValueString ( angle.getX() - origin.getX()
|
textGrad = DbU::getValueString ( angle.getX() - origin.getX()
|
||||||
, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
|
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
|
||||||
textGrad.resize ( textGrad.size()-1 );
|
textGrad.resize ( textGrad.size()-1 );
|
||||||
|
|
||||||
drawDisplayText ( QPoint ( pxAngle.x() - 1,pxAngle.y() + tickLength )
|
drawDisplayText ( QPoint ( pxAngle.x() - 1,pxAngle.y() + tickLength )
|
||||||
|
@ -1963,7 +1964,8 @@ namespace Hurricane {
|
||||||
|
|
||||||
// if ( !tick ) continue;
|
// 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 );
|
textGrad.resize ( textGrad.size()-1 );
|
||||||
|
|
||||||
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pyGrad + 1)
|
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pyGrad + 1)
|
||||||
|
@ -1979,7 +1981,7 @@ namespace Hurricane {
|
||||||
, pxOrigin.x()-tickLength, pxAngle.y() );
|
, pxOrigin.x()-tickLength, pxAngle.y() );
|
||||||
|
|
||||||
textGrad = DbU::getValueString( angle.getY() - origin.getY()
|
textGrad = DbU::getValueString( angle.getY() - origin.getY()
|
||||||
, (symbolicMode()) ? DbU::Symbolic : DbU::Grid );
|
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
|
||||||
textGrad.resize ( textGrad.size()-1 );
|
textGrad.resize ( textGrad.size()-1 );
|
||||||
|
|
||||||
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pxAngle.y() + 1)
|
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pxAngle.y() + 1)
|
||||||
|
|
Loading…
Reference in New Issue