Fixed issue #304. Layout appears different than my pattern.
--HG-- branch : release
This commit is contained in:
parent
2e56525f62
commit
796cd7079e
|
@ -227,27 +227,28 @@ QVector<QPointF> VAbstractDetail::Equidistant(const QVector<QPointF> &points, co
|
|||
QVector<QPointF> VAbstractDetail::RemoveDublicates(const QVector<QPointF> &points)
|
||||
{
|
||||
QVector<QPointF> p = points;
|
||||
for (int i = 0; i < p.size(); i++)
|
||||
{
|
||||
QPointF current = p.at(i);
|
||||
|
||||
for (int j = i; j < p.size(); j++)
|
||||
if (not p.isEmpty() && p.size() > 1)
|
||||
{
|
||||
if (j == i)
|
||||
// Path can't be closed
|
||||
if (p.first() == p.last())
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||
p.remove(p.size() - 1);
|
||||
#else
|
||||
p.removeLast();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < p.size()-1; ++i)
|
||||
{
|
||||
if (p.at(i) == p.at(i+1))
|
||||
{
|
||||
p.erase(p.begin() + i + 1);
|
||||
--i;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
QPointF temp = p.at(j);
|
||||
if (current == temp)
|
||||
{
|
||||
QVector<QPointF>::iterator iter = p.begin() + j;
|
||||
p.erase(iter);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
|
|
|
@ -69,14 +69,7 @@ QVector<QPointF> VLayoutDetail::GetContourPoints() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutDetail::SetCountourPoints(const QVector<QPointF> &points)
|
||||
{
|
||||
d->contour = points;
|
||||
// Contour can't be closed
|
||||
if (d->contour.first() == d->contour.last())
|
||||
{
|
||||
d->contour.removeLast();
|
||||
}
|
||||
|
||||
d->contour = RemoveDublicates(RoundPoints(d->contour));
|
||||
d->contour = RemoveDublicates(RoundPoints(points));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -94,12 +87,6 @@ void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool
|
|||
d->seamAllowence = points;
|
||||
if (not d->seamAllowence.isEmpty())
|
||||
{
|
||||
// Seam allowence can't be closed
|
||||
if (d->seamAllowence.first() == d->seamAllowence.last())
|
||||
{
|
||||
d->seamAllowence.removeLast();
|
||||
}
|
||||
|
||||
d->seamAllowence = RemoveDublicates(RoundPoints(d->seamAllowence));
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user