/** * Return coordinates of i-th control point. * * @param i :: Index of a control point. 0 <= i < getNControlPoints(). */ QPointF Shape2D::getControlPoint(size_t i) const { if (i >= getNControlPoints()) { throw std::range_error("Control point index is out of range"); } if (i < 4) return m_boundingRect.vertex(i); return getShapeControlPoint(i - NCommonCP); }
void Shape2DRing::setShapeControlPoint(size_t i,const QPointF& pos) { QPointF dp = pos - getShapeControlPoint(i); switch(i) { case 0: m_yWidth -= dp.y(); break; case 1: m_yWidth += dp.y(); break; case 2: m_xWidth += dp.x(); break; case 3: m_xWidth -= dp.x(); break; } refit(); }