* ./hurricane/src/hurricane,

./hurricane/src/hviewer:
    - Change: In DbU/CellWidget, some more small adjustments on the ruler.
This commit is contained in:
Jean-Paul Chaput 2010-01-27 10:52:34 +00:00
parent 08333f11fa
commit ca270f2396
2 changed files with 19 additions and 16 deletions

View File

@ -256,23 +256,25 @@ namespace Hurricane {
string DbU::getValueString ( DbU::Unit u, int mode )
{
char buffer[1024];
char unitSymbol = 'u';
char unitPower = 'u';
char unitSymbol = '\0';
if ( _stringMode == Grid ) {
unitSymbol = 'g';
unitPower = 'g';
snprintf ( buffer, 1024, "%.1f", getGrid(u) );
} else if ( _stringMode == Symbolic ) {
unitSymbol = 'l';
unitPower = 'l';
snprintf ( buffer, 1024, "%.1f", getLambda(u) );
} else if ( _stringMode == Physical ) {
unitSymbol = 'm';
switch ( _stringModeUnitPower ) {
case Pico: unitSymbol = 'p'; break;
case Nano: unitSymbol = 'n'; break;
case Micro: unitSymbol = 'u'; break;
case Milli: unitSymbol = 'm'; break;
case Unity: unitSymbol = 'U'; break;
case Kilo: unitSymbol = 'k'; break;
default: unitSymbol = '?'; break;
case Pico: unitPower = 'p'; break;
case Nano: unitPower = 'n'; break;
case Micro: unitPower = 'u'; break;
case Milli: unitPower = 'm'; break;
case Unity: unitPower = 'U'; break;
case Kilo: unitPower = 'k'; break;
default: unitPower = '?'; break;
}
snprintf ( buffer, 1024, "%.3f", getPhysical(u,_stringModeUnitPower) );
} else {
@ -289,7 +291,8 @@ namespace Hurricane {
if ( buffer[length] != '0' ) break;
}
}
buffer[++length] = unitSymbol;
buffer[++length] = unitPower;
if ( unitSymbol ) buffer[++length] = unitSymbol;
buffer[++length] = '\0';
return buffer;

View File

@ -1906,7 +1906,7 @@ namespace Hurricane {
textGrad = DbU::getValueString( gradStep*tick
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
if ( tick ) textGrad.resize ( textGrad.size()-1 );
textGrad.resize ( textGrad.size()-((*textGrad.rbegin()=='m')?2:1) );
drawDisplayText ( QPoint ( pxGrad - 1, pxOrigin.y() + tickLength )
, textGrad.c_str()
@ -1920,7 +1920,7 @@ namespace Hurricane {
_drawingPlanes.painter().drawLine ( pxAngle.x(), pxAngle.y()
, pxAngle.x(), pxAngle.y()+tickLength );
textGrad = DbU::getValueString ( angle.getX() - origin.getX()
textGrad = DbU::getValueString ( abs(angle.getX() - origin.getX())
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
//textGrad.resize ( textGrad.size()-1 );
@ -1966,7 +1966,7 @@ namespace Hurricane {
textGrad = DbU::getValueString( gradStep*tick
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
if ( tick ) textGrad.resize ( textGrad.size()-1 );
textGrad.resize ( textGrad.size()-((*textGrad.rbegin()=='m')?2:1) );
drawDisplayText ( QPoint(pxOrigin.x() - tickLength,pyGrad + 1)
, textGrad.c_str()
@ -1980,7 +1980,7 @@ namespace Hurricane {
_drawingPlanes.painter().drawLine ( pxOrigin.x() , pxAngle.y()
, pxOrigin.x()-tickLength, pxAngle.y() );
textGrad = DbU::getValueString( angle.getY() - origin.getY()
textGrad = DbU::getValueString( abs(angle.getY() - origin.getY())
, DbU::SmartTruncate|((symbolicMode())?DbU::Symbolic:DbU::Grid) );
//textGrad.resize ( textGrad.size()-1 );