Ejemplo n.º 1
0
void KReportPosition::setPointPos(const QPointF& pos, UpdatePropertyFlag update)
{
    m_pointPos.setX(pos.x());
    m_pointPos.setY(pos.y());

    if (update == UpdateProperty)
        m_property->setValue(toUnit());
}
Ejemplo n.º 2
0
void KReportPosition::setUnitPos(const QPointF& pos, UpdatePropertyFlag update)
{
    const qreal x = m_unit.fromUserValue(pos.x());
    const qreal y = m_unit.fromUserValue(pos.y());

    m_pointPos.setX(x);
    m_pointPos.setY(y);

    if (update == UpdateProperty)
        m_property->setValue(toUnit());
}
Ejemplo n.º 3
0
void KReportPosition::setScenePos(const QPointF& pos, UpdatePropertyFlag update)
{
    QScreen *srn = QApplication::screens().at(0);

    const qreal x = INCH_TO_POINT(pos.x() / srn->logicalDotsPerInchX());
    const qreal y = INCH_TO_POINT(pos.y() / srn->logicalDotsPerInchY());

    m_pointPos.setX(x);
    m_pointPos.setY(y);

    if (update == UpdateProperty)
        m_property->setValue(toUnit());
}
Ejemplo n.º 4
0
void Quaternion2::GetAxisAngle(double &theta, double &xx, double &yy, double &zz)
{
    toUnit();
    theta = 2 * acos(w);
    double s = sqrt(1 - w * w); // assuming Quaternion2 normalised then w is less than 1, so term always positive.
    if (s < 0.001) { // test to avoid divide by zero, s is always positive due to sqrt
        // if s close to zero then direction of axis not important
        xx = x; // if it is important that axis is normalised then replace with x=1; y=z=0;
        yy = y;
        zz = z;
    } else {
        xx = x / s; // normalise axis
        yy = y / s;
        zz = z / s;
    }
}
Ejemplo n.º 5
0
void KReportPosition::setUnit(const KReportUnit& u)
{
    m_unit = u;
    m_property->setValue(toUnit());
}