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(); }
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)); }
void DrawingPolyItem::setPointY(int index, qreal sceneY) { setPointPos(index, QPointF(pointX(index), sceneY)); }
void DrawingPolyItem::setPointX(int index, qreal sceneX) { setPointPos(index, QPointF(sceneX, pointY(index))); }
void DrawingPolyItem::setPointPos(int index, qreal sceneX, qreal sceneY) { setPointPos(index, QPointF(sceneX, sceneY)); }