Fixed issue #41.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-07 12:46:23 +02:00
parent bc25721ffa
commit 80e7af2ec4
2 changed files with 32 additions and 1 deletions

View File

@ -215,6 +215,34 @@ void VContainer::UpdateId(qint64 newId)
}
}
QVector<QPointF> VContainer::CorrectEquidistantPoints(const QVector<QPointF> &points) const
{
QVector<QPointF> correctPoints;
if(points.size()<4)//Better don't check if only three points. We can destroy equidistant.
{
qWarning()<<"Only three points.";
return points;
}
for(qint32 i = 0; i <points.size(); ++i)
{
if(i == points.size()-1)
{
correctPoints.append(points.at(i));
continue;
}
if(points.at(i) == points.at(i+1))
{
correctPoints.append(points.at(i));
++i;
}
else
{
correctPoints.append(points.at(i));
}
}
return correctPoints;
}
QPainterPath VContainer::ContourPath(qint64 idDetail) const
{
VDetail detail = GetDetail(idDetail);
@ -323,6 +351,8 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
}
path.lineTo(points[0]);
pointsEkv = CorrectEquidistantPoints(pointsEkv);
if (detail.getSupplement() == true)
{
QPainterPath ekv;

View File

@ -378,6 +378,7 @@ public:
* @param newId id
*/
static void UpdateId(qint64 newId);
QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points) const;
/**
* @brief ContourPath create painter path for detail
* @param idDetail id of detail
@ -440,7 +441,7 @@ public:
void CreateManTableIGroup ();
private:
/**
* @brief _id current id. New object will have value +1. For full class equal 0.
* @brief _id current id. New object will have value +1. For empty class equal 0.
*/
static qint64 _id;
/**