Fixed issue #304. Layout appears different than my pattern.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-05-17 18:43:57 +03:00
parent 2e56525f62
commit 796cd7079e
2 changed files with 20 additions and 32 deletions

View file

@ -227,26 +227,27 @@ 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)
{
// Path can't be closed
if (p.first() == p.last())
{
if (j == i)
{
continue;
}
else
{
QPointF temp = p.at(j);
if (current == temp)
{
QVector<QPointF>::iterator iter = p.begin() + j;
p.erase(iter);
j--;
}
}
#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;
}
}

View file

@ -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