Ejemplo n.º 1
0
void ModelCurve::alignPoints()
{
    // First set end points

    QPointF from = m_points_pos[0];
    QPointF to   = m_points_pos[3];

    const QVariant &sDim = m_source.dimension();
    const QVariant &tDim = m_target.dimension();

    from = m_source.shapeKind() == ModelMultiShapeItem::Circle ?
           GraphicsAlgo::getPointOnCircle   (m_target.pos(), m_source.pos(), sDim.toReal()/2) :
           GraphicsAlgo::getPointOnRectangle(m_target.pos(), m_source.pos(), sDim.toSizeF().width(), sDim.toSizeF().height());

    to = m_target.shapeKind() == ModelMultiShapeItem::Circle ?
         GraphicsAlgo::getPointOnCircle   (m_source.pos(), m_target.pos(), tDim.toReal()/2) :
         GraphicsAlgo::getPointOnRectangle(m_source.pos(), m_target.pos(), tDim.toSizeF().width(), tDim.toSizeF().height());

    setPointPos(0, from);
    setPointPos(3, to);

    // Now set mid points

    alignMidPoints();
}
Ejemplo n.º 2
0
void ModelCurve::alignMidPoints()
{
    const QPointF &from = m_points_pos[0];
    const QPointF &to   = m_points_pos[3];

    setPointPos(1, GraphicsAlgo::getPointOnLine(from, to, 1./3));
    setPointPos(2, GraphicsAlgo::getPointOnLine(from, to, 2./3));
}
Ejemplo n.º 3
0
void DrawingPolyItem::setPointY(int index, qreal sceneY)
{
	setPointPos(index, QPointF(pointX(index), sceneY));
}
Ejemplo n.º 4
0
void DrawingPolyItem::setPointX(int index, qreal sceneX)
{
	setPointPos(index, QPointF(sceneX, pointY(index)));
}
Ejemplo n.º 5
0
void DrawingPolyItem::setPointPos(int index, qreal sceneX, qreal sceneY)
{
	setPointPos(index, QPointF(sceneX, sceneY));
}