Logo Search packages:      
Sourcecode: qcad version File versions  Download package

RS_String RS_Units::formatDecimal ( double  length,
RS2::Unit  unit,
int  prec,
bool  showUnit = false 
) [static]

Formats the given length in decimal (normal) format (e.g. 2.5).

length The length in the current unit of the drawing.
prec Precisision of the value (e.g. 0.001) &
showUnit Append unit to the value.

Definition at line 525 of file rs_units.cpp.

References RS_Math::doubleToString(), and unitToSign().

Referenced by formatLinear().


    RS_String ret;

    // unit appended to value (e.g. 'mm'):
    RS_String unitString = "";
    if (showUnit) {
        unitString = unitToSign(unit);

    ret = RS_Math::doubleToString(length, prec);
    if(showUnit) {

    return ret;

Generated by  Doxygen 1.6.0   Back to index