Example #1
0
/**
 * @return Automatically created label for the default
 * measurement of this dimension.
 */
QString RS_DimLinear::getMeasuredLabel() {
    // direction of dimension line
    RS_Vector dirDim;
    dirDim.setPolar(100.0, edata.angle);

    // construction line for dimension line
    RS_ConstructionLine dimLine(NULL,
                                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);

        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;
}
Example #2
0
/**
 * @return Automatically creted label for the default
 * measurement of this dimension.
 */
QString RS_DimAligned::getMeasuredLabel() {
    double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2);

        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_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;
}