/** * @return Automatically created label for the default * measurement of this dimension. */ QString RS_DimDiametric::getMeasuredLabel() { // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint) * getGeneralFactor(); RS_Graphic* graphic = getGraphic(); QString ret; if (graphic) { int dimlunit = getGraphicVariableInt("$DIMLUNIT", 2); int dimdec = getGraphicVariableInt("$DIMDEC", 4); int dimzin = getGraphicVariableInt("$DIMZIN", 1); RS2::LinearFormat format = graphic->getLinearFormat(dimlunit); ret = RS_Units::formatLinear(dist, RS2::None, format, dimdec); if (format == RS2::Decimal) ret = stripZerosLinear(ret, dimzin); //verify if units are decimal and comma separator if (dimlunit==2){ if (getGraphicVariableInt("$DIMDSEP", 0) == 44) ret.replace(QChar('.'), QChar(',')); } } else { ret = QString("%1").arg(dist); } return ret; }
/** * @return Automatically created label for the default * measurement of this dimension. */ QString RS_DimRadial::getMeasuredLabel() { // Definitive dimension line: double dist = data.definitionPoint.distanceTo(edata.definitionPoint) * getGeneralFactor(); RS_Graphic* graphic = getGraphic(); QString ret; if (graphic!=NULL) { ret = RS_Units::formatLinear(dist, graphic->getUnit(), graphic->getLinearFormat(), graphic->getLinearPrecision()); } else { ret = QString("%1").arg(dist); } return ret; }
/** * @return Automatically created label for the default * measurement of this dimension. */ QString RS_DimLinear::getMeasuredLabel() { // direction of dimension line RS_Vector dirDim = RS_Vector::polar(100.0, edata.angle); // construction line for dimension line RS_ConstructionLine dimLine(nullptr, RS_ConstructionLineData(data.definitionPoint, data.definitionPoint + dirDim)); RS_Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1); RS_Vector dimP2 = dimLine.getNearestPointOnEntity(edata.extensionPoint2); // Definitive dimension line: double dist = dimP1.distanceTo(dimP2) * getGeneralFactor(); RS_Graphic* graphic = getGraphic(); QString ret; if (graphic) { int dimlunit = getGraphicVariableInt("$DIMLUNIT", 2); int dimdec = getGraphicVariableInt("$DIMDEC", 4); int dimzin = getGraphicVariableInt("$DIMZIN", 1); RS2::LinearFormat format = graphic->getLinearFormat(dimlunit); ret = RS_Units::formatLinear(dist, RS2::None, format, dimdec); if (format == RS2::Decimal) ret = stripZerosLinear(ret, dimzin); //verify if units are decimal and comma separator if (format == RS2::Decimal || format == RS2::ArchitecturalMetric){ if (getGraphicVariableInt("$DIMDSEP", 0) == 44) ret.replace(QChar('.'), QChar(',')); } } else { ret = QString("%1").arg(dist); } return ret; }