Fixed getting correct reversed segment for single in the list curve.

(grafted from c45cc62df72241692b4bf035f779a34add622b37)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-02-10 21:39:26 +02:00
parent 44aac2179b
commit 623c28eb9f
3 changed files with 25 additions and 11 deletions

View File

@ -7,7 +7,9 @@
- [#325] Check pattern for inverse compatibility. - [#325] Check pattern for inverse compatibility.
# Version 0.4.2 # Version 0.4.2
- Fixed triggering validation a detail. Two new cases: has been changed Reverse option and the list has been scrolled. - Fixed getting correct reversed segment for single in the list curve.
- Fixed triggering validation a detail. Two new cases: has been changed Reverse option and the list
has been scrolled. Fixed validation when the list conatains only curve.
- Fixed broken path to measurements after using Save As option. - Fixed broken path to measurements after using Save As option.
- Tool line. Block selecting the same point twice. - Tool line. Block selecting the same point twice.
- [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths. - [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths.

View File

@ -371,8 +371,8 @@ QVector<QPointF> VDetail::ContourPoints(const VContainer *data) const
{ {
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId()); const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId());
const QPointF begin = StartSegment(data, i); const QPointF begin = StartSegment(data, i, at(i).getReverse());
const QPointF end = EndSegment(data, i); const QPointF end = EndSegment(data, i, at(i).getReverse());
points << curve->GetSegmentPoints(begin, end, at(i).getReverse()); points << curve->GetSegmentPoints(begin, end, at(i).getReverse());
} }
@ -415,8 +415,8 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
{ {
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId()); const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId());
const QPointF begin = StartSegment(data, i); const QPointF begin = StartSegment(data, i, at(i).getReverse());
const QPointF end = EndSegment(data, i); const QPointF end = EndSegment(data, i, at(i).getReverse());
const QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, at(i).getReverse()); const QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, at(i).getReverse());
pointsEkv << biasPoints(nodePoints, at(i).getMx(), at(i).getMy()); pointsEkv << biasPoints(nodePoints, at(i).getMx(), at(i).getMy());
@ -524,7 +524,7 @@ int VDetail::indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPointF VDetail::StartSegment(const VContainer *data, const int &i) const QPointF VDetail::StartSegment(const VContainer *data, const int &i, bool reverse) const
{ {
if (i < 0 && i > CountNode()-1) if (i < 0 && i > CountNode()-1)
{ {
@ -533,7 +533,13 @@ QPointF VDetail::StartSegment(const VContainer *data, const int &i) const
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId()); const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId());
QPointF begin = curve->GetPoints().first(); QVector<QPointF> points = curve->GetPoints();
if (reverse)
{
points = VGObject::GetReversePoints(points);
}
QPointF begin = points.first();
if (CountNode() > 1) if (CountNode() > 1)
{ {
if (i == 0) if (i == 0)
@ -555,7 +561,7 @@ QPointF VDetail::StartSegment(const VContainer *data, const int &i) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPointF VDetail::EndSegment(const VContainer *data, const int &i) const QPointF VDetail::EndSegment(const VContainer *data, const int &i, bool reverse) const
{ {
if (i < 0 && i > CountNode()-1) if (i < 0 && i > CountNode()-1)
{ {
@ -564,7 +570,13 @@ QPointF VDetail::EndSegment(const VContainer *data, const int &i) const
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId()); const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).getId());
QPointF end = curve->GetPoints().last(); QVector<QPointF> points = curve->GetPoints();
if (reverse)
{
points = VGObject::GetReversePoints(points);
}
QPointF end = points.last();
if (CountNode() > 2) if (CountNode() > 2)
{ {
if (i == CountNode() - 1) if (i == CountNode() - 1)

View File

@ -89,8 +89,8 @@ private:
static int indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id); static int indexOfNode(const QVector<VNodeDetail> &list, const quint32 &id);
QPointF StartSegment(const VContainer *data, const int &i) const; QPointF StartSegment(const VContainer *data, const int &i, bool reverse) const;
QPointF EndSegment(const VContainer *data, const int &i) const; QPointF EndSegment(const VContainer *data, const int &i, bool reverse) const;
static QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my); static QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my);
}; };