55 #include <QPainterPath>
64 #include "../vmisc/vmath.h"
66 #ifdef Q_COMPILER_RVALUE_REFS
71 { std::swap(d, contour.d); }
91 if ( &contour ==
this )
106 d->globalContour = contour;
112 return d->globalContour;
130 return d->paperHeight;
136 d->paperHeight = height;
142 return d->paperWidth;
148 d->paperWidth = width;
154 return QSizeF(
d->paperWidth,
d->paperHeight);
161 if (
d->globalContour.isEmpty())
178 if (globalI ==
d->globalContour.count())
188 while (i < d->globalContour.count())
198 int processedEdges = 0;
210 for (
int i = 0; i < points.size()-1; ++i)
212 newContour.append(points.at(i));
217 }
while (processedEdges < nD);
221 if (newContour.isEmpty() ==
false)
223 if (newContour.last() !=
d->globalContour.at(i))
225 newContour.append(
d->globalContour.at(i));
230 newContour.append(
d->globalContour.at(i));
241 if (
d->globalContour.isEmpty())
247 return d->globalContour.count();
254 if (
d->globalContour.isEmpty())
263 return QLineF(nShift*(i-1), 0, nShift*i, 0);
274 edge = QLineF(
d->globalContour.at(i-1),
d->globalContour.at(i));
290 points.append(edge.p1());
291 points.append(edge.p2());
295 const int n = qFloor(edge.length()/
d->shift);
299 points.append(edge.p1());
300 points.append(edge.p2());
304 const qreal nShift = edge.length()/n;
305 for (
int i = 1; i <= n+1; ++i)
308 l1.setLength(nShift*(i-1));
309 points.append(l1.p2());
324 l1.setLength(nShift*(i-1));
325 points.append(l1.p2());
333 return d->globalContour.at(i);
340 if (points.isEmpty())
344 points.append(points.first());
345 return QPolygonF(points).boundingRect();
352 path.setFillRule(Qt::WindingFill);
355 path.moveTo(points.at(0));
356 for (qint32 i = 1; i < points.count(); ++i)
358 path.lineTo(points.at(i));
360 path.lineTo(points.at(0));
368 int processedEdges = 0;
378 for (
int i = 0; i < points.size()-1; ++i)
380 contour.append(points.at(i));
384 }
while (processedEdges < nD);
390 return QLineF(0, 0,
d->paperWidth - 5, 0);
QSharedDataPointer< VContourData > d
VContour & operator=(const VContour &contour)
QPainterPath ContourPath() const
void SetHeight(int height)
QRectF BoundingRect() const
const QPointF & at(int i) const
void SetShift(quint32 shift)
QVector< QPointF > GetContour() const
void Swap(VContour &contour) Q_DECL_NOTHROW
void AppendWhole(QVector< QPointF > &contour, const VLayoutPiece &detail, int detJ) const
QLineF GlobalEdge(int i) const
QVector< QPointF > CutEdge(const QLineF &edge) const
void SetContour(const QVector< QPointF > &contour)
QLineF EmptySheetEdge() const
int GlobalEdgesCount() const
QVector< QPointF > CutEmptySheetEdge() const
QVector< QPointF > UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const
int LayoutEdgesCount() const
QLineF LayoutEdge(int i) const