Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
eb17639bb7
|
@ -35,14 +35,10 @@ qint64 VContainer::_id = 0;
|
||||||
|
|
||||||
VContainer::VContainer()
|
VContainer::VContainer()
|
||||||
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
|
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
|
||||||
pointsModeling(QHash<qint64, VPointF>()),
|
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
||||||
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
|
||||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
|
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
|
||||||
splinesModeling(QHash<qint64, VSpline>()),
|
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), lengthArcs(QHash<QString, qreal>()),
|
||||||
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), arcsModeling(QHash<qint64, VArc>()),
|
splinePaths(QHash<qint64, VSplinePath>()), details(QHash<qint64, VDetail>())
|
||||||
lengthArcs(QHash<QString, qreal>()),
|
|
||||||
splinePaths(QHash<qint64, VSplinePath>()), splinePathsModeling(QHash<qint64, VSplinePath>()),
|
|
||||||
details(QHash<qint64, VDetail>())
|
|
||||||
{
|
{
|
||||||
SetSize(500);
|
SetSize(500);
|
||||||
SetGrowth(1760);
|
SetGrowth(1760);
|
||||||
|
@ -57,14 +53,10 @@ VContainer &VContainer::operator =(const VContainer &data)
|
||||||
|
|
||||||
VContainer::VContainer(const VContainer &data)
|
VContainer::VContainer(const VContainer &data)
|
||||||
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
|
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
|
||||||
pointsModeling(QHash<qint64, VPointF>()),
|
|
||||||
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
||||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
|
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
|
||||||
splinesModeling(QHash<qint64, VSpline>()),
|
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), lengthArcs(QHash<QString, qreal>()),
|
||||||
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), arcsModeling(QHash<qint64, VArc>()),
|
splinePaths(QHash<qint64, VSplinePath>()), details(QHash<qint64, VDetail>())
|
||||||
lengthArcs(QHash<QString, qreal>()),
|
|
||||||
splinePaths(QHash<qint64, VSplinePath>()), splinePathsModeling(QHash<qint64, VSplinePath>()),
|
|
||||||
details(QHash<qint64, VDetail>())
|
|
||||||
{
|
{
|
||||||
setData(data);
|
setData(data);
|
||||||
}
|
}
|
||||||
|
@ -73,19 +65,15 @@ void VContainer::setData(const VContainer &data)
|
||||||
{
|
{
|
||||||
base = *data.DataBase();
|
base = *data.DataBase();
|
||||||
points = *data.DataPoints();
|
points = *data.DataPoints();
|
||||||
pointsModeling = *data.DataPointsModeling();
|
|
||||||
standartTable = *data.DataStandartTable();
|
standartTable = *data.DataStandartTable();
|
||||||
incrementTable = *data.DataIncrementTable();
|
incrementTable = *data.DataIncrementTable();
|
||||||
lengthLines = *data.DataLengthLines();
|
lengthLines = *data.DataLengthLines();
|
||||||
lineAngles = *data.DataLineAngles();
|
lineAngles = *data.DataLineAngles();
|
||||||
splines = *data.DataSplines();
|
splines = *data.DataSplines();
|
||||||
splinesModeling = *data.DataSplinesModeling();
|
|
||||||
lengthSplines = *data.DataLengthSplines();
|
lengthSplines = *data.DataLengthSplines();
|
||||||
arcs = *data.DataArcs();
|
arcs = *data.DataArcs();
|
||||||
arcsModeling = *data.DataArcsModeling();
|
|
||||||
lengthArcs = *data.DataLengthArcs();
|
lengthArcs = *data.DataLengthArcs();
|
||||||
splinePaths = *data.DataSplinePaths();
|
splinePaths = *data.DataSplinePaths();
|
||||||
splinePathsModeling = *data.DataSplinePathsModeling();
|
|
||||||
details = *data.DataDetails();
|
details = *data.DataDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +82,6 @@ VPointF VContainer::GetPoint(qint64 id) const
|
||||||
return GetObject(points, id);
|
return GetObject(points, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF VContainer::GetPointModeling(qint64 id) const
|
|
||||||
{
|
|
||||||
return GetObject(pointsModeling, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename key, typename val>
|
template <typename key, typename val>
|
||||||
val VContainer::GetObject(const QHash<key, val> &obj, key id)
|
val VContainer::GetObject(const QHash<key, val> &obj, key id)
|
||||||
{
|
{
|
||||||
|
@ -153,31 +136,16 @@ VSpline VContainer::GetSpline(qint64 id) const
|
||||||
return GetObject(splines, id);
|
return GetObject(splines, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline VContainer::GetSplineModeling(qint64 id) const
|
|
||||||
{
|
|
||||||
return GetObject(splinesModeling, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
VArc VContainer::GetArc(qint64 id) const
|
VArc VContainer::GetArc(qint64 id) const
|
||||||
{
|
{
|
||||||
return GetObject(arcs, id);
|
return GetObject(arcs, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VArc VContainer::GetArcModeling(qint64 id) const
|
|
||||||
{
|
|
||||||
return GetObject(arcsModeling, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
VSplinePath VContainer::GetSplinePath(qint64 id) const
|
VSplinePath VContainer::GetSplinePath(qint64 id) const
|
||||||
{
|
{
|
||||||
return GetObject(splinePaths, id);
|
return GetObject(splinePaths, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSplinePath VContainer::GetSplinePathModeling(qint64 id) const
|
|
||||||
{
|
|
||||||
return GetObject(splinePathsModeling, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
VDetail VContainer::GetDetail(qint64 id) const
|
VDetail VContainer::GetDetail(qint64 id) const
|
||||||
{
|
{
|
||||||
return GetObject(details, id);
|
return GetObject(details, id);
|
||||||
|
@ -188,11 +156,6 @@ qint64 VContainer::AddPoint(const VPointF &point)
|
||||||
return AddObject(points, point);
|
return AddObject(points, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddPointModeling(const VPointF &point)
|
|
||||||
{
|
|
||||||
return AddObject(pointsModeling, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 VContainer::AddDetail(const VDetail &detail)
|
qint64 VContainer::AddDetail(const VDetail &detail)
|
||||||
{
|
{
|
||||||
return AddObject(details, detail);
|
return AddObject(details, detail);
|
||||||
|
@ -223,7 +186,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
VPointF point = GetPointModeling(detail[i].getId());
|
VPointF point = GetPoint(detail[i].getId());
|
||||||
points.append(point.toQPointF());
|
points.append(point.toQPointF());
|
||||||
if (detail.getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +199,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
VArc arc = GetArcModeling(detail[i].getId());
|
VArc arc = GetArc(detail[i].getId());
|
||||||
qreal len1 = GetLengthContour(points, arc.GetPoints());
|
qreal len1 = GetLengthContour(points, arc.GetPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
|
@ -259,7 +222,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
VSpline spline = GetSplineModeling(detail[i].getId());
|
VSpline spline = GetSpline(detail[i].getId());
|
||||||
qreal len1 = GetLengthContour(points, spline.GetPoints());
|
qreal len1 = GetLengthContour(points, spline.GetPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
|
@ -283,7 +246,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
VSplinePath splinePath = GetSplinePathModeling(detail[i].getId());
|
VSplinePath splinePath = GetSplinePath(detail[i].getId());
|
||||||
qreal len1 = GetLengthContour(points, splinePath.GetPathPoints());
|
qreal len1 = GetLengthContour(points, splinePath.GetPathPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
|
@ -612,10 +575,6 @@ void VContainer::Clear()
|
||||||
lengthArcs.clear();
|
lengthArcs.clear();
|
||||||
lineAngles.clear();
|
lineAngles.clear();
|
||||||
details.clear();
|
details.clear();
|
||||||
arcsModeling.clear();
|
|
||||||
pointsModeling.clear();
|
|
||||||
splinePathsModeling.clear();
|
|
||||||
splinesModeling.clear();
|
|
||||||
ClearObject();
|
ClearObject();
|
||||||
CreateManTableIGroup ();
|
CreateManTableIGroup ();
|
||||||
}
|
}
|
||||||
|
@ -670,23 +629,13 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, const Draw::Draws &mode)
|
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId)
|
||||||
{
|
{
|
||||||
QString nameLine = GetNameLine(firstPointId, secondPointId, mode);
|
QString nameLine = GetNameLine(firstPointId, secondPointId);
|
||||||
VPointF first;
|
VPointF first = GetPoint(firstPointId);
|
||||||
VPointF second;
|
VPointF second = GetPoint(secondPointId);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
first = GetPoint(firstPointId);
|
|
||||||
second = GetPoint(secondPointId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
first = GetPointModeling(firstPointId);
|
|
||||||
second = GetPointModeling(secondPointId);
|
|
||||||
}
|
|
||||||
AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
|
AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
|
||||||
nameLine = GetNameLineAngle(firstPointId, secondPointId, mode);
|
nameLine = GetNameLineAngle(firstPointId, secondPointId);
|
||||||
AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle());
|
AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,31 +644,16 @@ qint64 VContainer::AddSpline(const VSpline &spl)
|
||||||
return AddObject(splines, spl);
|
return AddObject(splines, spl);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddSplineModeling(const VSpline &spl)
|
|
||||||
{
|
|
||||||
return AddObject(splinesModeling, spl);
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 VContainer::AddSplinePath(const VSplinePath &splPath)
|
qint64 VContainer::AddSplinePath(const VSplinePath &splPath)
|
||||||
{
|
{
|
||||||
return AddObject(splinePaths, splPath);
|
return AddObject(splinePaths, splPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddSplinePathModeling(const VSplinePath &splPath)
|
|
||||||
{
|
|
||||||
return AddObject(splinePathsModeling, splPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 VContainer::AddArc(const VArc &arc)
|
qint64 VContainer::AddArc(const VArc &arc)
|
||||||
{
|
{
|
||||||
return AddObject(arcs, arc);
|
return AddObject(arcs, arc);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddArcModeling(const VArc &arc)
|
|
||||||
{
|
|
||||||
return AddObject(arcsModeling, arc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename key, typename val>
|
template <typename key, typename val>
|
||||||
qint64 VContainer::AddObject(QHash<key, val> &obj, const val& value)
|
qint64 VContainer::AddObject(QHash<key, val> &obj, const val& value)
|
||||||
{
|
{
|
||||||
|
@ -728,37 +662,19 @@ qint64 VContainer::AddObject(QHash<key, val> &obj, const val& value)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode) const
|
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const
|
||||||
{
|
{
|
||||||
VPointF first;
|
VPointF first = GetPoint(firstPoint);
|
||||||
VPointF second;
|
VPointF second = GetPoint(secondPoint);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
first = GetPoint(firstPoint);
|
|
||||||
second = GetPoint(secondPoint);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
first = GetPointModeling(firstPoint);
|
|
||||||
second = GetPointModeling(secondPoint);
|
|
||||||
}
|
|
||||||
return QString("Line_%1_%2").arg(first.name(), second.name());
|
return QString("Line_%1_%2").arg(first.name(), second.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode) const
|
QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const
|
||||||
{
|
{
|
||||||
VPointF first;
|
VPointF first = GetPoint(firstPoint);
|
||||||
VPointF second;
|
VPointF second = GetPoint(secondPoint);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
first = GetPoint(firstPoint);
|
|
||||||
second = GetPoint(secondPoint);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
first = GetPointModeling(firstPoint);
|
|
||||||
second = GetPointModeling(secondPoint);
|
|
||||||
}
|
|
||||||
return QString("AngleLine_%1_%2").arg(first.name(), second.name());
|
return QString("AngleLine_%1_%2").arg(first.name(), second.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,11 +683,6 @@ void VContainer::UpdatePoint(qint64 id, const VPointF &point)
|
||||||
UpdateObject(points, id, point);
|
UpdateObject(points, id, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::UpdatePointModeling(qint64 id, const VPointF &point)
|
|
||||||
{
|
|
||||||
UpdateObject(pointsModeling, id, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VContainer::UpdateDetail(qint64 id, const VDetail &detail)
|
void VContainer::UpdateDetail(qint64 id, const VDetail &detail)
|
||||||
{
|
{
|
||||||
UpdateObject(details, id, detail);
|
UpdateObject(details, id, detail);
|
||||||
|
@ -782,31 +693,16 @@ void VContainer::UpdateSpline(qint64 id, const VSpline &spl)
|
||||||
UpdateObject(splines, id, spl);
|
UpdateObject(splines, id, spl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::UpdateSplineModeling(qint64 id, const VSpline &spl)
|
|
||||||
{
|
|
||||||
UpdateObject(splinesModeling, id, spl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath)
|
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath)
|
||||||
{
|
{
|
||||||
UpdateObject(splinePaths, id, splPath);
|
UpdateObject(splinePaths, id, splPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::UpdateSplinePathModeling(qint64 id, const VSplinePath &splPath)
|
|
||||||
{
|
|
||||||
UpdateObject(splinePathsModeling, id, splPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VContainer::UpdateArc(qint64 id, const VArc &arc)
|
void VContainer::UpdateArc(qint64 id, const VArc &arc)
|
||||||
{
|
{
|
||||||
UpdateObject(arcs, id, arc);
|
UpdateObject(arcs, id, arc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::UpdateArcModeling(qint64 id, const VArc &arc)
|
|
||||||
{
|
|
||||||
UpdateObject(arcsModeling, id, arc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(name.isEmpty() == false);
|
Q_ASSERT(name.isEmpty() == false);
|
||||||
|
|
|
@ -69,12 +69,6 @@ public:
|
||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
VPointF GetPoint(qint64 id) const;
|
VPointF GetPoint(qint64 id) const;
|
||||||
/**
|
|
||||||
* @brief GetPointModeling return a point modeling by id
|
|
||||||
* @param id id of point modeling
|
|
||||||
* @return point modeling
|
|
||||||
*/
|
|
||||||
VPointF GetPointModeling(qint64 id) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief GetStandartTableCell return standart table row by name
|
* @brief GetStandartTableCell return standart table row by name
|
||||||
* @param name name of standart table row
|
* @param name name of standart table row
|
||||||
|
@ -117,36 +111,18 @@ public:
|
||||||
* @return spline
|
* @return spline
|
||||||
*/
|
*/
|
||||||
VSpline GetSpline(qint64 id) const;
|
VSpline GetSpline(qint64 id) const;
|
||||||
/**
|
|
||||||
* @brief GetSplineModeling return spline modeling by id
|
|
||||||
* @param id id of spline modeling
|
|
||||||
* @return spline modeling
|
|
||||||
*/
|
|
||||||
VSpline GetSplineModeling(qint64 id) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief GetArc return arc by id
|
* @brief GetArc return arc by id
|
||||||
* @param id id of arc
|
* @param id id of arc
|
||||||
* @return arc
|
* @return arc
|
||||||
*/
|
*/
|
||||||
VArc GetArc(qint64 id) const;
|
VArc GetArc(qint64 id) const;
|
||||||
/**
|
|
||||||
* @brief GetArcModeling return arc modeling by id
|
|
||||||
* @param id id of arc modeling
|
|
||||||
* @return arc modeling
|
|
||||||
*/
|
|
||||||
VArc GetArcModeling(qint64 id) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief GetSplinePath return spline path by id
|
* @brief GetSplinePath return spline path by id
|
||||||
* @param id id of spline path
|
* @param id id of spline path
|
||||||
* @return spline path
|
* @return spline path
|
||||||
*/
|
*/
|
||||||
VSplinePath GetSplinePath(qint64 id) const;
|
VSplinePath GetSplinePath(qint64 id) const;
|
||||||
/**
|
|
||||||
* @brief GetSplinePathModeling return spline path modeling by id
|
|
||||||
* @param id id of spline modeling path
|
|
||||||
* @return spline modeling path
|
|
||||||
*/
|
|
||||||
VSplinePath GetSplinePathModeling(qint64 id) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief GetDetail return detail by id
|
* @brief GetDetail return detail by id
|
||||||
* @param id id of detail
|
* @param id id of detail
|
||||||
|
@ -164,12 +140,6 @@ public:
|
||||||
* @return return id of new point in container
|
* @return return id of new point in container
|
||||||
*/
|
*/
|
||||||
qint64 AddPoint(const VPointF& point);
|
qint64 AddPoint(const VPointF& point);
|
||||||
/**
|
|
||||||
* @brief AddPointModeling add new point modeling to container
|
|
||||||
* @param point new point modeling
|
|
||||||
* @return return id of new point modeling in container
|
|
||||||
*/
|
|
||||||
qint64 AddPointModeling(const VPointF& point);
|
|
||||||
/**
|
/**
|
||||||
* @brief AddDetail add new detail to container
|
* @brief AddDetail add new detail to container
|
||||||
* @param detail new detail
|
* @param detail new detail
|
||||||
|
@ -225,32 +195,19 @@ public:
|
||||||
* @param secondPointId id of second point of line
|
* @param secondPointId id of second point of line
|
||||||
* @param mode mode of line
|
* @param mode mode of line
|
||||||
*/
|
*/
|
||||||
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId,
|
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId);
|
||||||
const Draw::Draws &mode = Draw::Calculation);
|
|
||||||
/**
|
/**
|
||||||
* @brief AddSpline add spline to container
|
* @brief AddSpline add spline to container
|
||||||
* @param spl new spline
|
* @param spl new spline
|
||||||
* @return id of spline in container
|
* @return id of spline in container
|
||||||
*/
|
*/
|
||||||
qint64 AddSpline(const VSpline& spl);
|
qint64 AddSpline(const VSpline& spl);
|
||||||
/**
|
|
||||||
* @brief AddSplineModeling add spline modeling to container
|
|
||||||
* @param spl new spline modeling
|
|
||||||
* @return id of spline modeling in container
|
|
||||||
*/
|
|
||||||
qint64 AddSplineModeling(const VSpline& spl);
|
|
||||||
/**
|
/**
|
||||||
* @brief AddSplinePath add spline path to container
|
* @brief AddSplinePath add spline path to container
|
||||||
* @param splPath new spline path
|
* @param splPath new spline path
|
||||||
* @return id of spline path in container
|
* @return id of spline path in container
|
||||||
*/
|
*/
|
||||||
qint64 AddSplinePath(const VSplinePath& splPath);
|
qint64 AddSplinePath(const VSplinePath& splPath);
|
||||||
/**
|
|
||||||
* @brief AddSplinePathModeling add spline path modeling to container
|
|
||||||
* @param splPath new spline path
|
|
||||||
* @return id of spline path in container
|
|
||||||
*/
|
|
||||||
qint64 AddSplinePathModeling(const VSplinePath& splPath);
|
|
||||||
/**
|
/**
|
||||||
* @brief AddArc add arc to container
|
* @brief AddArc add arc to container
|
||||||
* @param arc new arc
|
* @param arc new arc
|
||||||
|
@ -267,32 +224,22 @@ public:
|
||||||
* @brief GetNameLine return name of line
|
* @brief GetNameLine return name of line
|
||||||
* @param firstPoint id of first point of line
|
* @param firstPoint id of first point of line
|
||||||
* @param secondPoint id of second point of line
|
* @param secondPoint id of second point of line
|
||||||
* @param mode mode of line
|
|
||||||
* @return name of line
|
* @return name of line
|
||||||
*/
|
*/
|
||||||
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint,
|
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const;
|
||||||
const Draw::Draws &mode = Draw::Calculation) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief GetNameLineAngle return name of line angle
|
* @brief GetNameLineAngle return name of line angle
|
||||||
* @param firstPoint id of first point of line
|
* @param firstPoint id of first point of line
|
||||||
* @param secondPoint id of second point of line
|
* @param secondPoint id of second point of line
|
||||||
* @param mode mode of line
|
|
||||||
* @return name of angle of line
|
* @return name of angle of line
|
||||||
*/
|
*/
|
||||||
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
|
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const;
|
||||||
const Draw::Draws &mode = Draw::Calculation) const;
|
|
||||||
/**
|
/**
|
||||||
* @brief UpdatePoint update point by id
|
* @brief UpdatePoint update point by id
|
||||||
* @param id id of existing point
|
* @param id id of existing point
|
||||||
* @param point point
|
* @param point point
|
||||||
*/
|
*/
|
||||||
void UpdatePoint(qint64 id, const VPointF& point);
|
void UpdatePoint(qint64 id, const VPointF& point);
|
||||||
/**
|
|
||||||
* @brief UpdatePointModeling update point modeling by id
|
|
||||||
* @param id id of existing point modeling
|
|
||||||
* @param point point modeling
|
|
||||||
*/
|
|
||||||
void UpdatePointModeling(qint64 id, const VPointF& point);
|
|
||||||
/**
|
/**
|
||||||
* @brief UpdateDetail update detail by id
|
* @brief UpdateDetail update detail by id
|
||||||
* @param id id of existing detail
|
* @param id id of existing detail
|
||||||
|
@ -305,24 +252,12 @@ public:
|
||||||
* @param spl spline
|
* @param spl spline
|
||||||
*/
|
*/
|
||||||
void UpdateSpline(qint64 id, const VSpline& spl);
|
void UpdateSpline(qint64 id, const VSpline& spl);
|
||||||
/**
|
|
||||||
* @brief UpdateSplineModeling update spline modeling by id
|
|
||||||
* @param id id of existing spline modeling
|
|
||||||
* @param spl spline modeling
|
|
||||||
*/
|
|
||||||
void UpdateSplineModeling(qint64 id, const VSpline& spl);
|
|
||||||
/**
|
/**
|
||||||
* @brief UpdateSplinePath update spline path by id
|
* @brief UpdateSplinePath update spline path by id
|
||||||
* @param id id of existing spline path
|
* @param id id of existing spline path
|
||||||
* @param splPath spline path
|
* @param splPath spline path
|
||||||
*/
|
*/
|
||||||
void UpdateSplinePath(qint64 id, const VSplinePath& splPath);
|
void UpdateSplinePath(qint64 id, const VSplinePath& splPath);
|
||||||
/**
|
|
||||||
* @brief UpdateSplinePathModeling update spline path modeling by id
|
|
||||||
* @param id id of existing spline path modeling
|
|
||||||
* @param splPath spline path modeling
|
|
||||||
*/
|
|
||||||
void UpdateSplinePathModeling(qint64 id, const VSplinePath& splPath);
|
|
||||||
/**
|
/**
|
||||||
* @brief UpdateArc update arc by id
|
* @brief UpdateArc update arc by id
|
||||||
* @param id id of existing arc
|
* @param id id of existing arc
|
||||||
|
@ -437,31 +372,16 @@ public:
|
||||||
* @return pointer on container of points
|
* @return pointer on container of points
|
||||||
*/
|
*/
|
||||||
inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
|
inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
|
||||||
/**
|
|
||||||
* @brief data container with dataPointsModeling return container of points modeling
|
|
||||||
* @return pointer on container of points modeling
|
|
||||||
*/
|
|
||||||
inline const QHash<qint64, VPointF> *DataPointsModeling() const {return &pointsModeling;}
|
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataSplines return container of splines
|
* @brief data container with dataSplines return container of splines
|
||||||
* @return pointer on container of splines
|
* @return pointer on container of splines
|
||||||
*/
|
*/
|
||||||
inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
|
inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
|
||||||
/**
|
|
||||||
* @brief data container with dataSplinesModeling return container of splines modeling
|
|
||||||
* @return pointer on container of splines modeling
|
|
||||||
*/
|
|
||||||
inline const QHash<qint64, VSpline> *DataSplinesModeling() const {return &splinesModeling;}
|
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataArcs return container of arcs
|
* @brief data container with dataArcs return container of arcs
|
||||||
* @return pointer on container of arcs
|
* @return pointer on container of arcs
|
||||||
*/
|
*/
|
||||||
inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
|
inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
|
||||||
/**
|
|
||||||
* @brief data container with dataArcsModeling return container of arcs modeling
|
|
||||||
* @return pointer on container of arcs modeling
|
|
||||||
*/
|
|
||||||
inline const QHash<qint64, VArc> *DataArcsModeling() const {return &arcsModeling;}
|
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataBase return container of data
|
* @brief data container with dataBase return container of data
|
||||||
* @return pointer on container of base data
|
* @return pointer on container of base data
|
||||||
|
@ -502,11 +422,6 @@ public:
|
||||||
* @return pointer on container of spline paths
|
* @return pointer on container of spline paths
|
||||||
*/
|
*/
|
||||||
inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
|
inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
|
||||||
/**
|
|
||||||
* @brief data container with dataSplinePathsModeling return container of spline paths modeling
|
|
||||||
* @return pointer on container of spline paths modeling
|
|
||||||
*/
|
|
||||||
inline const QHash<qint64, VSplinePath> *DataSplinePathsModeling() const {return &splinePathsModeling;}
|
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataDetails return container of details
|
* @brief data container with dataDetails return container of details
|
||||||
* @return pointer on container of details
|
* @return pointer on container of details
|
||||||
|
@ -586,10 +501,6 @@ private:
|
||||||
* @brief points container of points
|
* @brief points container of points
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VPointF> points;
|
QHash<qint64, VPointF> points;
|
||||||
/**
|
|
||||||
* @brief pointsModeling container of points modeling
|
|
||||||
*/
|
|
||||||
QHash<qint64, VPointF> pointsModeling;
|
|
||||||
/**
|
/**
|
||||||
* @brief standartTable container of standart table rows
|
* @brief standartTable container of standart table rows
|
||||||
*/
|
*/
|
||||||
|
@ -610,10 +521,6 @@ private:
|
||||||
* @brief splines container of splines
|
* @brief splines container of splines
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VSpline> splines;
|
QHash<qint64, VSpline> splines;
|
||||||
/**
|
|
||||||
* @brief splinesModeling container of splines modeling
|
|
||||||
*/
|
|
||||||
QHash<qint64, VSpline> splinesModeling;
|
|
||||||
/**
|
/**
|
||||||
* @brief lengthSplines container of splines length
|
* @brief lengthSplines container of splines length
|
||||||
*/
|
*/
|
||||||
|
@ -622,10 +529,6 @@ private:
|
||||||
* @brief arcs container of arcs
|
* @brief arcs container of arcs
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VArc> arcs;
|
QHash<qint64, VArc> arcs;
|
||||||
/**
|
|
||||||
* @brief arcsModeling container of arcs modeling
|
|
||||||
*/
|
|
||||||
QHash<qint64, VArc> arcsModeling;
|
|
||||||
/**
|
/**
|
||||||
* @brief lengthArcs container of arcs length
|
* @brief lengthArcs container of arcs length
|
||||||
*/
|
*/
|
||||||
|
@ -634,10 +537,6 @@ private:
|
||||||
* @brief splinePaths container of spline paths
|
* @brief splinePaths container of spline paths
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VSplinePath> splinePaths;
|
QHash<qint64, VSplinePath> splinePaths;
|
||||||
/**
|
|
||||||
* @brief splinePathsModeling container of spline paths modeling
|
|
||||||
*/
|
|
||||||
QHash<qint64, VSplinePath> splinePathsModeling;
|
|
||||||
/**
|
/**
|
||||||
* @brief details container of details
|
* @brief details container of details
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,7 +35,6 @@ VPointF &VPointF::operator =(const VPointF &point)
|
||||||
_my = point.my();
|
_my = point.my();
|
||||||
_x = point.x();
|
_x = point.x();
|
||||||
_y = point.y();
|
_y = point.y();
|
||||||
mode = point.getMode();
|
|
||||||
idObject = point.getIdObject();
|
idObject = point.getIdObject();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,14 +43,14 @@ public:
|
||||||
* @brief VPointF creat empty point
|
* @brief VPointF creat empty point
|
||||||
*/
|
*/
|
||||||
inline VPointF ()
|
inline VPointF ()
|
||||||
:_name(QString()), _mx(0), _my(0), _x(0), _y(0), mode(Draw::Calculation), idObject(0){}
|
:_name(QString()), _mx(0), _my(0), _x(0), _y(0), idObject(0){}
|
||||||
/**
|
/**
|
||||||
* @brief VPointF copy constructor
|
* @brief VPointF copy constructor
|
||||||
* @param point
|
* @param point
|
||||||
*/
|
*/
|
||||||
inline VPointF (const VPointF &point )
|
inline VPointF (const VPointF &point )
|
||||||
:_name(point.name()), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()),
|
:_name(point.name()), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()),
|
||||||
mode(point.getMode()), idObject(point.getIdObject()){}
|
idObject(point.getIdObject()){}
|
||||||
/**
|
/**
|
||||||
* @brief VPointF create new point
|
* @brief VPointF create new point
|
||||||
* @param x x coordinate
|
* @param x x coordinate
|
||||||
|
@ -58,12 +58,10 @@ public:
|
||||||
* @param name name of point
|
* @param name name of point
|
||||||
* @param mx offset name respect to x
|
* @param mx offset name respect to x
|
||||||
* @param my offset name respect to y
|
* @param my offset name respect to y
|
||||||
* @param mode mode of draw
|
|
||||||
* @param idObject point modeling keep here id of parent point
|
* @param idObject point modeling keep here id of parent point
|
||||||
*/
|
*/
|
||||||
inline VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my,
|
inline VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, qint64 idObject = 0)
|
||||||
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0)
|
:_name(name), _mx(mx), _my(my), _x(x), _y(y), idObject(idObject){}
|
||||||
:_name(name), _mx(mx), _my(my), _x(x), _y(y), mode(mode), idObject(idObject){}
|
|
||||||
/**
|
/**
|
||||||
* @brief operator = assignment operator
|
* @brief operator = assignment operator
|
||||||
* @param point point
|
* @param point point
|
||||||
|
@ -126,16 +124,6 @@ public:
|
||||||
* @param value y coordinate
|
* @param value y coordinate
|
||||||
*/
|
*/
|
||||||
inline void setY(const qreal &value){_y = value;}
|
inline void setY(const qreal &value){_y = value;}
|
||||||
/**
|
|
||||||
* @brief getMode return mode of point
|
|
||||||
* @return mode
|
|
||||||
*/
|
|
||||||
inline Draw::Draws getMode() const{return mode;}
|
|
||||||
/**
|
|
||||||
* @brief setMode set mode for point
|
|
||||||
* @param value mode
|
|
||||||
*/
|
|
||||||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
|
||||||
/**
|
/**
|
||||||
* @brief getIdObject return id of parrent.
|
* @brief getIdObject return id of parrent.
|
||||||
* @return id
|
* @return id
|
||||||
|
@ -167,10 +155,6 @@ private:
|
||||||
* @brief _y y coordinate
|
* @brief _y y coordinate
|
||||||
*/
|
*/
|
||||||
qreal _y;
|
qreal _y;
|
||||||
/**
|
|
||||||
* @brief mode mode of point
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
/**
|
||||||
* @brief idObject id of parent. Only for point modeling. All another return 0.
|
* @brief idObject id of parent. Only for point modeling. All another return 0.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
|
||||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0)
|
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -83,32 +83,9 @@ DialogAlongLine::~DialogAlongLine()
|
||||||
|
|
||||||
void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
||||||
|
@ -142,8 +119,8 @@ void DialogAlongLine::DialogAccepted()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->lineEditFormula->text();
|
formula = ui->lineEditFormula->text();
|
||||||
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogAlongLine create dialog
|
* @brief DialogAlongLine create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogAlongLine(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogAlongLine();
|
~DialogAlongLine();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogArc::DialogArc(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
:DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
||||||
timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString())
|
timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -52,6 +52,7 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
||||||
|
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
|
|
||||||
CheckState();
|
CheckState();
|
||||||
|
@ -119,32 +120,10 @@ void DialogArc::SetRadius(const QString &value)
|
||||||
|
|
||||||
void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id)==false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
|
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -156,7 +135,7 @@ void DialogArc::DialogAccepted()
|
||||||
radius = ui->lineEditRadius->text();
|
radius = ui->lineEditRadius->text();
|
||||||
f1 = ui->lineEditF1->text();
|
f1 = ui->lineEditF1->text();
|
||||||
f2 = ui->lineEditF2->text();
|
f2 = ui->lineEditF2->text();
|
||||||
center = getCurrentPointId(ui->comboBoxBasePoint);
|
center = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogArc create dialog
|
* @brief DialogArc create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogArc(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogArc();
|
~DialogArc();
|
||||||
/**
|
/**
|
||||||
* @brief GetCenter return id of center point
|
* @brief GetCenter return id of center point
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogBisector::DialogBisector(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()),
|
||||||
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0)
|
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -55,6 +55,7 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||||
|
@ -83,32 +84,9 @@ DialogBisector::~DialogBisector()
|
||||||
|
|
||||||
void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
||||||
|
@ -186,8 +164,8 @@ void DialogBisector::DialogAccepted()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->lineEditFormula->text();
|
formula = ui->lineEditFormula->text();
|
||||||
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
thirdPointId = getCurrentPointId(ui->comboBoxThirdPoint);
|
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogBisector create dialog
|
* @brief DialogBisector create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogBisector(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogBisector();
|
~DialogBisector();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
113
src/dialogs/dialogcutspline.cpp
Normal file
113
src/dialogs/dialogcutspline.cpp
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutspline.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "dialogcutspline.h"
|
||||||
|
#include "ui_dialogcutspline.h"
|
||||||
|
|
||||||
|
DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent)
|
||||||
|
:DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
listWidget = ui->listWidget;
|
||||||
|
labelResultCalculation = ui->labelResultCalculation;
|
||||||
|
labelDescription = ui->labelDescription;
|
||||||
|
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
|
||||||
|
radioButtonStandartTable = ui->radioButtonStandartTable;
|
||||||
|
radioButtonIncrements = ui->radioButtonIncrements;
|
||||||
|
radioButtonLengthLine = ui->radioButtonLengthLine;
|
||||||
|
radioButtonLengthArc = ui->radioButtonLengthArc;
|
||||||
|
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
||||||
|
lineEditFormula = ui->lineEditFormula;
|
||||||
|
labelEditFormula = ui->labelEditFormula;
|
||||||
|
labelEditNamePoint = ui->labelEditNamePoint;
|
||||||
|
flagFormula = false;
|
||||||
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogCutSpline::DialogAccepted);
|
||||||
|
flagName = false;
|
||||||
|
CheckState();
|
||||||
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
connect(bCansel, &QPushButton::clicked, this, &DialogCutSpline::DialogRejected);
|
||||||
|
|
||||||
|
FillComboBoxSplines(ui->comboBoxSpline);
|
||||||
|
|
||||||
|
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
|
||||||
|
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
|
||||||
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSpline::ValChenged);
|
||||||
|
|
||||||
|
ShowVariable(data->DataBase());
|
||||||
|
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSpline::SizeGrowth);
|
||||||
|
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogCutSpline::StandartTable);
|
||||||
|
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSpline::Increments);
|
||||||
|
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSpline::LengthLines);
|
||||||
|
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSpline::LengthArcs);
|
||||||
|
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSpline::LengthCurves);
|
||||||
|
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula);
|
||||||
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged);
|
||||||
|
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogCutSpline::~DialogCutSpline()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSpline::setPointName(const QString &value)
|
||||||
|
{
|
||||||
|
pointName = value;
|
||||||
|
ui->lineEditNamePoint->setText(pointName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSpline::setFormula(const QString &value)
|
||||||
|
{
|
||||||
|
formula = value;
|
||||||
|
ui->lineEditFormula->setText(formula);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSpline::setSplineId(const qint64 &value, const qint64 &id)
|
||||||
|
{
|
||||||
|
setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
|
{
|
||||||
|
if (type == Scene::Spline)
|
||||||
|
{
|
||||||
|
VSpline spl = data->GetSpline(id);
|
||||||
|
ChangeCurrentText(ui->comboBoxSpline, spl.name());
|
||||||
|
emit ToolTip("");
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSpline::DialogAccepted()
|
||||||
|
{
|
||||||
|
pointName = ui->lineEditNamePoint->text();
|
||||||
|
formula = ui->lineEditFormula->text();
|
||||||
|
splineId = getCurrentObjectId(ui->comboBoxSpline);
|
||||||
|
emit DialogClosed(QDialog::Accepted);
|
||||||
|
}
|
94
src/dialogs/dialogcutspline.h
Normal file
94
src/dialogs/dialogcutspline.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutspline.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DIALOGCUTSPLINE_H
|
||||||
|
#define DIALOGCUTSPLINE_H
|
||||||
|
|
||||||
|
#include "dialogtool.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DialogCutSpline;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogCutSpline : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DialogCutSpline(const VContainer *data, QWidget *parent = 0);
|
||||||
|
~DialogCutSpline();
|
||||||
|
/**
|
||||||
|
* @brief getPointName return name of point
|
||||||
|
* @return name
|
||||||
|
*/
|
||||||
|
inline QString getPointName() const {return pointName;}
|
||||||
|
/**
|
||||||
|
* @brief setPointName set name of point
|
||||||
|
* @param value name
|
||||||
|
*/
|
||||||
|
void setPointName(const QString &value);
|
||||||
|
/**
|
||||||
|
* @brief getFormula return string of formula
|
||||||
|
* @return formula
|
||||||
|
*/
|
||||||
|
inline QString getFormula() const {return formula;}
|
||||||
|
/**
|
||||||
|
* @brief setFormula set string of formula
|
||||||
|
* @param value formula
|
||||||
|
*/
|
||||||
|
void setFormula(const QString &value);
|
||||||
|
/**
|
||||||
|
* @brief getSplineId return id base point of line
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
inline qint64 getSplineId() const {return splineId;}
|
||||||
|
/**
|
||||||
|
* @brief setSplineId set id spline
|
||||||
|
* @param value id
|
||||||
|
* @param id don't show this id in list
|
||||||
|
*/
|
||||||
|
void setSplineId(const qint64 &value, const qint64 &id);
|
||||||
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
* @param id id of point or detail
|
||||||
|
* @param type type of object
|
||||||
|
*/
|
||||||
|
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
|
||||||
|
/**
|
||||||
|
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||||
|
*/
|
||||||
|
virtual void DialogAccepted();
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogCutSpline)
|
||||||
|
Ui::DialogCutSpline *ui;
|
||||||
|
QString pointName;
|
||||||
|
QString formula;
|
||||||
|
qint64 splineId;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGCUTSPLINE_H
|
360
src/dialogs/dialogcutspline.ui
Normal file
360
src/dialogs/dialogcutspline.ui
Normal file
|
@ -0,0 +1,360 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogCutSpline</class>
|
||||||
|
<widget class="QDialog" name="DialogCutSpline">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>520</width>
|
||||||
|
<height>461</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula calculation of length of curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonEqual">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculate formula</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelResultCalculation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value of length</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxSpline">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Selected curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonPutHere">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditNamePoint">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name new point</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Input data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonSizeGrowth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size and growth</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonStandartTable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Standart table</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonIncrements">
|
||||||
|
<property name="text">
|
||||||
|
<string>Increments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthArc">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of arcs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthSpline">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of curves</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Variables. Click twice to select.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogCutSpline</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogCutSpline</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
114
src/dialogs/dialogcutsplinepath.cpp
Normal file
114
src/dialogs/dialogcutsplinepath.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutsplinrpath.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "dialogcutsplinepath.h"
|
||||||
|
#include "ui_dialogcutsplinepath.h"
|
||||||
|
|
||||||
|
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent)
|
||||||
|
:DialogTool(data, parent), ui(new Ui::DialogCutSplinePath), pointName(QString()), formula(QString()),
|
||||||
|
splinePathId(0)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
listWidget = ui->listWidget;
|
||||||
|
labelResultCalculation = ui->labelResultCalculation;
|
||||||
|
labelDescription = ui->labelDescription;
|
||||||
|
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
|
||||||
|
radioButtonStandartTable = ui->radioButtonStandartTable;
|
||||||
|
radioButtonIncrements = ui->radioButtonIncrements;
|
||||||
|
radioButtonLengthLine = ui->radioButtonLengthLine;
|
||||||
|
radioButtonLengthArc = ui->radioButtonLengthArc;
|
||||||
|
radioButtonLengthCurve = ui->radioButtonLengthSpline;
|
||||||
|
lineEditFormula = ui->lineEditFormula;
|
||||||
|
labelEditFormula = ui->labelEditFormula;
|
||||||
|
labelEditNamePoint = ui->labelEditNamePoint;
|
||||||
|
flagFormula = false;
|
||||||
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogCutSplinePath::DialogAccepted);
|
||||||
|
flagName = false;
|
||||||
|
CheckState();
|
||||||
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected);
|
||||||
|
|
||||||
|
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||||
|
|
||||||
|
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
|
||||||
|
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
|
||||||
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSplinePath::ValChenged);
|
||||||
|
|
||||||
|
ShowVariable(data->DataBase());
|
||||||
|
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSplinePath::SizeGrowth);
|
||||||
|
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogCutSplinePath::StandartTable);
|
||||||
|
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSplinePath::Increments);
|
||||||
|
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthLines);
|
||||||
|
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthArcs);
|
||||||
|
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthCurves);
|
||||||
|
connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula);
|
||||||
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged);
|
||||||
|
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogCutSplinePath::~DialogCutSplinePath()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSplinePath::setPointName(const QString &value)
|
||||||
|
{
|
||||||
|
pointName = value;
|
||||||
|
ui->lineEditNamePoint->setText(pointName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSplinePath::setFormula(const QString &value)
|
||||||
|
{
|
||||||
|
formula = value;
|
||||||
|
ui->lineEditFormula->setText(formula);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSplinePath::setSplinePathId(const qint64 &value, const qint64 &id)
|
||||||
|
{
|
||||||
|
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
|
{
|
||||||
|
if (type == Scene::SplinePath)
|
||||||
|
{
|
||||||
|
VSplinePath splPath = data->GetSplinePath(id);
|
||||||
|
ChangeCurrentText(ui->comboBoxSplinePath, splPath.name());
|
||||||
|
emit ToolTip("");
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogCutSplinePath::DialogAccepted()
|
||||||
|
{
|
||||||
|
pointName = ui->lineEditNamePoint->text();
|
||||||
|
formula = ui->lineEditFormula->text();
|
||||||
|
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
|
||||||
|
emit DialogClosed(QDialog::Accepted);
|
||||||
|
}
|
94
src/dialogs/dialogcutsplinepath.h
Normal file
94
src/dialogs/dialogcutsplinepath.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutsplinrpath.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DIALOGCUTSPLINEPATH_H
|
||||||
|
#define DIALOGCUTSPLINEPATH_H
|
||||||
|
|
||||||
|
#include "dialogtool.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DialogCutSplinePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogCutSplinePath : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DialogCutSplinePath(const VContainer *data, QWidget *parent = 0);
|
||||||
|
~DialogCutSplinePath();
|
||||||
|
/**
|
||||||
|
* @brief getPointName return name of point
|
||||||
|
* @return name
|
||||||
|
*/
|
||||||
|
inline QString getPointName() const {return pointName;}
|
||||||
|
/**
|
||||||
|
* @brief setPointName set name of point
|
||||||
|
* @param value name
|
||||||
|
*/
|
||||||
|
void setPointName(const QString &value);
|
||||||
|
/**
|
||||||
|
* @brief getFormula return string of formula
|
||||||
|
* @return formula
|
||||||
|
*/
|
||||||
|
inline QString getFormula() const {return formula;}
|
||||||
|
/**
|
||||||
|
* @brief setFormula set string of formula
|
||||||
|
* @param value formula
|
||||||
|
*/
|
||||||
|
void setFormula(const QString &value);
|
||||||
|
/**
|
||||||
|
* @brief getSplineId return id base point of line
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
inline qint64 getSplinePathId() const {return splinePathId;}
|
||||||
|
/**
|
||||||
|
* @brief setSplineId set id spline
|
||||||
|
* @param value id
|
||||||
|
* @param id don't show this id in list
|
||||||
|
*/
|
||||||
|
void setSplinePathId(const qint64 &value, const qint64 &id);
|
||||||
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||||
|
* @param id id of point or detail
|
||||||
|
* @param type type of object
|
||||||
|
*/
|
||||||
|
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
|
||||||
|
/**
|
||||||
|
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||||
|
*/
|
||||||
|
virtual void DialogAccepted();
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogCutSplinePath)
|
||||||
|
Ui::DialogCutSplinePath *ui;
|
||||||
|
QString pointName;
|
||||||
|
QString formula;
|
||||||
|
qint64 splinePathId;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGCUTSPLINEPATH_H
|
360
src/dialogs/dialogcutsplinepath.ui
Normal file
360
src/dialogs/dialogcutsplinepath.ui
Normal file
|
@ -0,0 +1,360 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogCutSplinePath</class>
|
||||||
|
<widget class="QDialog" name="DialogCutSplinePath">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>605</width>
|
||||||
|
<height>397</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula calculation of length of curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonEqual">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculate formula</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelResultCalculation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value of length</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxSplinePath">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Selected curve path</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonPutHere">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditNamePoint">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name new point</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Input data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonSizeGrowth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size and growth</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonStandartTable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Standart table</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonIncrements">
|
||||||
|
<property name="text">
|
||||||
|
<string>Increments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthArc">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of arcs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthSpline">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of curves</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Variables. Click twice to select.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogCutSplinePath</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogCutSplinePath</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -31,8 +31,8 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogDetail::DialogDetail(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true)
|
:DialogTool(data, parent), ui(), details(VDetail()), supplement(true), closed(true)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
labelEditNamePoint = ui.labelEditNameDetail;
|
labelEditNamePoint = ui.labelEditNameDetail;
|
||||||
|
@ -55,36 +55,21 @@ DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *pa
|
||||||
|
|
||||||
void DialogDetail::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogDetail::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type != Scene::Line && type != Scene::Detail)
|
if (type != Scene::Line && type != Scene::Detail)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case (Scene::Arc):
|
case (Scene::Arc):
|
||||||
NewItem(id, Tool::NodeArc, mode, NodeDetail::Contour);
|
NewItem(id, Tool::NodeArc, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
case (Scene::Point):
|
case (Scene::Point):
|
||||||
NewItem(id, Tool::NodePoint, mode, NodeDetail::Contour);
|
NewItem(id, Tool::NodePoint, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
case (Scene::Spline):
|
case (Scene::Spline):
|
||||||
NewItem(id, Tool::NodeSpline, mode, NodeDetail::Contour);
|
NewItem(id, Tool::NodeSpline, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
case (Scene::SplinePath):
|
case (Scene::SplinePath):
|
||||||
NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour);
|
NewItem(id, Tool::NodeSplinePath, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<tr("Got wrong scene object. Ignore.");
|
qWarning()<<tr("Got wrong scene object. Ignore.");
|
||||||
|
@ -110,65 +95,33 @@ void DialogDetail::DialogAccepted()
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::Draws &mode,
|
void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, qreal mx,
|
||||||
const NodeDetail::NodeDetails &typeNode, qreal mx, qreal my)
|
qreal my)
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
switch (typeTool)
|
switch (typeTool)
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
name = point.name();
|
name = point.name();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
VArc arc;
|
VArc arc = data->GetArc(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
arc = data->GetArc(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arc = data->GetArcModeling(id);
|
|
||||||
}
|
|
||||||
name = arc.name();
|
name = arc.name();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
VSpline spl;
|
VSpline spl = data->GetSpline(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
spl = data->GetSpline(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spl = data->GetSplineModeling(id);
|
|
||||||
}
|
|
||||||
name = spl.GetName();
|
name = spl.GetName();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
VSplinePath splPath;
|
VSplinePath splPath = data->GetSplinePath(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
splPath = data->GetSplinePath(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
splPath = data->GetSplinePathModeling(id);
|
|
||||||
}
|
|
||||||
name = splPath.name();
|
name = splPath.name();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +132,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
VNodeDetail node(id, typeTool, mode, typeNode, mx, my);
|
VNodeDetail node(id, typeTool, typeNode, mx, my);
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
ui.listWidget->addItem(item);
|
ui.listWidget->addItem(item);
|
||||||
disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
@ -200,8 +153,8 @@ void DialogDetail::setDetails(const VDetail &value)
|
||||||
ui.listWidget->clear();
|
ui.listWidget->clear();
|
||||||
for (ptrdiff_t i = 0; i < details.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < details.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(),
|
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getTypeNode(), details[i].getMx(),
|
||||||
details[i].getMx(), details[i].getMy());
|
details[i].getMy());
|
||||||
}
|
}
|
||||||
ui.lineEditNameDetail->setText(details.getName());
|
ui.lineEditNameDetail->setText(details.getName());
|
||||||
ui.checkBoxSeams->setChecked(details.getSupplement());
|
ui.checkBoxSeams->setChecked(details.getSupplement());
|
||||||
|
|
|
@ -42,10 +42,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogDetail create dialog
|
* @brief DialogDetail create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
|
DialogDetail(const VContainer *data, QWidget *parent = 0);
|
||||||
/**
|
/**
|
||||||
* @brief getDetails return detail
|
* @brief getDetails return detail
|
||||||
* @return detail
|
* @return detail
|
||||||
|
@ -118,8 +117,8 @@ private:
|
||||||
* @param mx offset respect to x
|
* @param mx offset respect to x
|
||||||
* @param my offset respect to y
|
* @param my offset respect to y
|
||||||
*/
|
*/
|
||||||
void NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::Draws &mode,
|
void NewItem(qint64 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode,
|
||||||
const NodeDetail::NodeDetails &typeNode, qreal mx = 0, qreal my = 0);
|
qreal mx = 0, qreal my = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGDETAIL_H
|
#endif // DIALOGDETAIL_H
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
|
||||||
formula(QString()), angle(0), basePointId(0)
|
formula(QString()), angle(0), basePointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -56,7 +56,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
|
|
||||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||||
|
|
||||||
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
|
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
|
||||||
|
@ -93,32 +95,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
|
||||||
|
|
||||||
void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
|
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -160,7 +139,7 @@ void DialogEndLine::DialogAccepted()
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->lineEditFormula->text();
|
formula = ui->lineEditFormula->text();
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
angle = ui->doubleSpinBoxAngle->value();
|
||||||
basePointId = getCurrentPointId(ui->comboBoxBasePoint);
|
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogEndLine create dialog
|
* @brief DialogEndLine create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogEndLine(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogEndLine();
|
~DialogEndLine();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogHeight::DialogHeight(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogHeight), number(0), pointName(QString()),
|
||||||
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0)
|
typeLine(QString()), basePointId(0), p1LineId(0), p2LineId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -43,6 +43,7 @@ DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *pa
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||||
|
@ -87,32 +88,9 @@ void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id)
|
||||||
|
|
||||||
void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
switch (number)
|
switch (number)
|
||||||
{
|
{
|
||||||
case (0):
|
case (0):
|
||||||
|
@ -144,8 +122,8 @@ void DialogHeight::DialogAccepted()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
basePointId = getCurrentPointId(ui->comboBoxBasePoint);
|
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||||
p1LineId = getCurrentPointId(ui->comboBoxP1Line);
|
p1LineId = getCurrentObjectId(ui->comboBoxP1Line);
|
||||||
p2LineId = getCurrentPointId(ui->comboBoxP2Line);
|
p2LineId = getCurrentObjectId(ui->comboBoxP2Line);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogHeight create dialog
|
* @brief DialogHeight create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogHeight(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogHeight();
|
~DialogHeight();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent)
|
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent)
|
||||||
:DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
|
:DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
|
||||||
cursorToolRecordRow(0)
|
cursorToolRecordRow(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent)
|
DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent)
|
||||||
:DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0)
|
:DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitialStandartTable();
|
InitialStandartTable();
|
||||||
|
|
|
@ -31,16 +31,18 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogLine::DialogLine(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0)
|
:DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted);
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||||
|
|
||||||
number = 0;
|
number = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,32 +85,9 @@ void DialogLine::DialogAccepted()
|
||||||
|
|
||||||
void DialogLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogLine create dialog
|
* @brief DialogLine create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogLine(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogLine();
|
~DialogLine();
|
||||||
/**
|
/**
|
||||||
* @brief getFirstPoint return id first point
|
* @brief getFirstPoint return id first point
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()),
|
||||||
p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true)
|
p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -43,6 +43,7 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
|
||||||
flagName = false;
|
flagName = false;
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxP1Line1);
|
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||||
FillComboBoxPoints(ui->comboBoxP2Line1);
|
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||||
FillComboBoxPoints(ui->comboBoxP1Line2);
|
FillComboBoxPoints(ui->comboBoxP1Line2);
|
||||||
|
@ -58,32 +59,9 @@ DialogLineIntersect::~DialogLineIntersect()
|
||||||
|
|
||||||
void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxP1Line1->findText(point.name());
|
qint32 index = ui->comboBoxP1Line1->findText(point.name());
|
||||||
|
@ -155,10 +133,10 @@ void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
void DialogLineIntersect::DialogAccepted()
|
void DialogLineIntersect::DialogAccepted()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
p1Line1 = getCurrentPointId(ui->comboBoxP1Line1);
|
p1Line1 = getCurrentObjectId(ui->comboBoxP1Line1);
|
||||||
p2Line1 = getCurrentPointId(ui->comboBoxP2Line1);
|
p2Line1 = getCurrentObjectId(ui->comboBoxP2Line1);
|
||||||
p1Line2 = getCurrentPointId(ui->comboBoxP1Line2);
|
p1Line2 = getCurrentObjectId(ui->comboBoxP1Line2);
|
||||||
p2Line2 = getCurrentPointId(ui->comboBoxP2Line2);
|
p2Line2 = getCurrentObjectId(ui->comboBoxP2Line2);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogLineIntersect create dialog
|
* @brief DialogLineIntersect create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogLineIntersect(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogLineIntersect();
|
~DialogLineIntersect();
|
||||||
/**
|
/**
|
||||||
* @brief getP1Line1 return id first point of first line
|
* @brief getP1Line1 return id first point of first line
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogNormal::DialogNormal(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
|
||||||
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
|
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -56,6 +56,7 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||||
|
@ -99,32 +100,9 @@ DialogNormal::~DialogNormal()
|
||||||
|
|
||||||
void DialogNormal::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogNormal::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
||||||
|
@ -159,8 +137,8 @@ void DialogNormal::DialogAccepted()
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->lineEditFormula->text();
|
formula = ui->lineEditFormula->text();
|
||||||
angle = ui->doubleSpinBoxAngle->value();
|
angle = ui->doubleSpinBoxAngle->value();
|
||||||
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogNormal create dialog
|
* @brief DialogNormal create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogNormal(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogNormal();
|
~DialogNormal();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0),
|
:DialogTool(data, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0),
|
||||||
firstPoint(0), secondPoint(0)
|
firstPoint(0), secondPoint(0)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
@ -54,6 +54,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui.comboBoxCenter);
|
FillComboBoxPoints(ui.comboBoxCenter);
|
||||||
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
||||||
|
@ -76,32 +77,9 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
|
||||||
|
|
||||||
void DialogPointOfContact::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogPointOfContact::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui.comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui.comboBoxFirstPoint->findText(point.name());
|
||||||
|
@ -145,9 +123,9 @@ void DialogPointOfContact::DialogAccepted()
|
||||||
{
|
{
|
||||||
pointName = ui.lineEditNamePoint->text();
|
pointName = ui.lineEditNamePoint->text();
|
||||||
radius = ui.lineEditFormula->text();
|
radius = ui.lineEditFormula->text();
|
||||||
center = getCurrentPointId(ui.comboBoxCenter);
|
center = getCurrentObjectId(ui.comboBoxCenter);
|
||||||
firstPoint = getCurrentPointId(ui.comboBoxFirstPoint);
|
firstPoint = getCurrentObjectId(ui.comboBoxFirstPoint);
|
||||||
secondPoint = getCurrentPointId(ui.comboBoxSecondPoint);
|
secondPoint = getCurrentObjectId(ui.comboBoxSecondPoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogPointOfContact create dialog
|
* @brief DialogPointOfContact create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogPointOfContact(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
* @return name
|
* @return name
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
|
||||||
firstPointId(0), secondPointId(0)
|
firstPointId(0), secondPointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -43,8 +43,10 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Dra
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||||
|
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,32 +63,9 @@ void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint
|
||||||
|
|
||||||
void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
qint32 index = ui->comboBoxFirstPoint->findText(point.name());
|
||||||
|
@ -118,8 +97,8 @@ void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &ty
|
||||||
void DialogPointOfIntersection::DialogAccepted()
|
void DialogPointOfIntersection::DialogAccepted()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogPointOfIntersection create dialog
|
* @brief DialogPointOfIntersection create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogPointOfIntersection(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogPointOfIntersection(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogPointOfIntersection();
|
~DialogPointOfIntersection();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -45,5 +45,7 @@
|
||||||
#include "dialogspline.h"
|
#include "dialogspline.h"
|
||||||
#include "dialogsplinepath.h"
|
#include "dialogsplinepath.h"
|
||||||
#include "dialogheight.h"
|
#include "dialogheight.h"
|
||||||
|
#include "dialogcutspline.h"
|
||||||
|
#include "dialogcutsplinepath.h"
|
||||||
|
|
||||||
#endif // DIALOGS_H
|
#endif // DIALOGS_H
|
||||||
|
|
|
@ -18,7 +18,9 @@ HEADERS += \
|
||||||
src/dialogs/dialogdetail.h \
|
src/dialogs/dialogdetail.h \
|
||||||
src/dialogs/dialogbisector.h \
|
src/dialogs/dialogbisector.h \
|
||||||
src/dialogs/dialogarc.h \
|
src/dialogs/dialogarc.h \
|
||||||
src/dialogs/dialogalongline.h
|
src/dialogs/dialogalongline.h \
|
||||||
|
src/dialogs/dialogcutspline.h \
|
||||||
|
src/dialogs/dialogcutsplinepath.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/dialogs/dialogtriangle.cpp \
|
src/dialogs/dialogtriangle.cpp \
|
||||||
|
@ -39,7 +41,9 @@ SOURCES += \
|
||||||
src/dialogs/dialogdetail.cpp \
|
src/dialogs/dialogdetail.cpp \
|
||||||
src/dialogs/dialogbisector.cpp \
|
src/dialogs/dialogbisector.cpp \
|
||||||
src/dialogs/dialogarc.cpp \
|
src/dialogs/dialogarc.cpp \
|
||||||
src/dialogs/dialogalongline.cpp
|
src/dialogs/dialogalongline.cpp \
|
||||||
|
src/dialogs/dialogcutspline.cpp \
|
||||||
|
src/dialogs/dialogcutsplinepath.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/dialogs/dialogtriangle.ui \
|
src/dialogs/dialogtriangle.ui \
|
||||||
|
@ -59,4 +63,6 @@ FORMS += \
|
||||||
src/dialogs/dialogdetail.ui \
|
src/dialogs/dialogdetail.ui \
|
||||||
src/dialogs/dialogbisector.ui \
|
src/dialogs/dialogbisector.ui \
|
||||||
src/dialogs/dialogarc.ui \
|
src/dialogs/dialogarc.ui \
|
||||||
src/dialogs/dialogalongline.ui
|
src/dialogs/dialogalongline.ui \
|
||||||
|
src/dialogs/dialogcutspline.ui \
|
||||||
|
src/dialogs/dialogcutsplinepath.ui
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
||||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0)
|
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -57,6 +57,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected);
|
||||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||||
FillComboBoxPoints(ui->comboBoxPShoulder);
|
FillComboBoxPoints(ui->comboBoxPShoulder);
|
||||||
|
@ -84,32 +85,9 @@ DialogShoulderPoint::~DialogShoulderPoint()
|
||||||
|
|
||||||
void DialogShoulderPoint::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogShoulderPoint::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxP1Line->findText(point.name());
|
qint32 index = ui->comboBoxP1Line->findText(point.name());
|
||||||
|
@ -154,9 +132,9 @@ void DialogShoulderPoint::DialogAccepted()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||||
formula = ui->lineEditFormula->text();
|
formula = ui->lineEditFormula->text();
|
||||||
p1Line = getCurrentPointId(ui->comboBoxP1Line);
|
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
||||||
p2Line = getCurrentPointId(ui->comboBoxP2Line);
|
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
||||||
pShoulder = getCurrentPointId(ui->comboBoxPShoulder);
|
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogShoulderPoint create dialog
|
* @brief DialogShoulderPoint create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogShoulderPoint(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogShoulderPoint();
|
~DialogShoulderPoint();
|
||||||
/**
|
/**
|
||||||
* @brief getPointName return name of point
|
* @brief getPointName return name of point
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
|
DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogSinglePoint), name(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogSinglePoint), name(QString()),
|
||||||
point(QPointF())
|
point(QPointF())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogSpline::DialogSpline(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogSpline::DialogSpline(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
|
:DialogTool(data, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
|
||||||
kAsm1(1), kAsm2(1), kCurve(1)
|
kAsm1(1), kAsm2(1), kCurve(1)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -41,11 +41,9 @@ DialogSpline::DialogSpline(const VContainer *data, Draw::Draws mode, QWidget *pa
|
||||||
|
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogSpline::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogSpline::DialogRejected);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
FillComboBoxPoints(ui->comboBoxP1);
|
||||||
FillComboBoxPoints(ui->comboBoxP1);
|
FillComboBoxPoints(ui->comboBoxP4);
|
||||||
FillComboBoxPoints(ui->comboBoxP4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogSpline::~DialogSpline()
|
DialogSpline::~DialogSpline()
|
||||||
|
@ -55,34 +53,9 @@ DialogSpline::~DialogSpline()
|
||||||
|
|
||||||
void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
FillComboBoxPoints(ui->comboBoxP1);
|
|
||||||
FillComboBoxPoints(ui->comboBoxP4);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
if (number == 0)
|
if (number == 0)
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxP1->findText(point.name());
|
qint32 index = ui->comboBoxP1->findText(point.name());
|
||||||
|
@ -104,18 +77,10 @@ void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
index = ui->comboBoxP1->currentIndex();
|
index = ui->comboBoxP1->currentIndex();
|
||||||
qint64 p1Id = qvariant_cast<qint64>(ui->comboBoxP1->itemData(index));
|
qint64 p1Id = qvariant_cast<qint64>(ui->comboBoxP1->itemData(index));
|
||||||
QPointF p1;
|
|
||||||
QPointF p4;
|
QPointF p1 = data->GetPoint(p1Id).toQPointF();
|
||||||
if (mode == Draw::Calculation)
|
QPointF p4 = data->GetPoint(id).toQPointF();
|
||||||
{
|
|
||||||
p1 = data->GetPoint(p1Id).toQPointF();
|
|
||||||
p4 = data->GetPoint(id).toQPointF();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p1 = data->GetPointModeling(p1Id).toQPointF();
|
|
||||||
p4 = data->GetPointModeling(id).toQPointF();
|
|
||||||
}
|
|
||||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||||
}
|
}
|
||||||
|
@ -129,8 +94,8 @@ void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
|
|
||||||
void DialogSpline::DialogAccepted()
|
void DialogSpline::DialogAccepted()
|
||||||
{
|
{
|
||||||
p1 = getCurrentPointId(ui->comboBoxP1);
|
p1 = getCurrentObjectId(ui->comboBoxP1);
|
||||||
p4 = getCurrentPointId(ui->comboBoxP4);
|
p4 = getCurrentObjectId(ui->comboBoxP4);
|
||||||
angle1 = ui->spinBoxAngle1->value();
|
angle1 = ui->spinBoxAngle1->value();
|
||||||
angle2 = ui->spinBoxAngle2->value();
|
angle2 = ui->spinBoxAngle2->value();
|
||||||
kAsm1 = ui->doubleSpinBoxKasm1->value();
|
kAsm1 = ui->doubleSpinBoxKasm1->value();
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogSpline create dialog
|
* @brief DialogSpline create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogSpline(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogSpline();
|
~DialogSpline();
|
||||||
/**
|
/**
|
||||||
* @brief getP1 return id first point of spline
|
* @brief getP1 return id first point of spline
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
|
:DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
@ -41,6 +41,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi
|
||||||
|
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxPoint);
|
FillComboBoxPoints(ui->comboBoxPoint);
|
||||||
|
|
||||||
path = VSplinePath(data->DataPoints());
|
path = VSplinePath(data->DataPoints());
|
||||||
|
@ -78,21 +79,6 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
||||||
|
|
||||||
void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
NewItem(id, 1, 0, 1);
|
NewItem(id, 1, 0, 1);
|
||||||
|
@ -168,15 +154,7 @@ void DialogSplinePath::KAsm2Changed(qreal d)
|
||||||
|
|
||||||
void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2)
|
void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(point.name());
|
QListWidgetItem *item = new QListWidgetItem(point.name());
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
VSplinePoint p(id, kAsm1, angle, kAsm2);
|
VSplinePoint p(id, kAsm1, angle, kAsm2);
|
||||||
|
|
|
@ -47,11 +47,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogSplinePath create dialog
|
* @brief DialogSplinePath create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation,
|
DialogSplinePath(const VContainer *data, QWidget *parent = 0);
|
||||||
QWidget *parent = 0);
|
|
||||||
~DialogSplinePath();
|
~DialogSplinePath();
|
||||||
/**
|
/**
|
||||||
* @brief GetPath return spline path
|
* @brief GetPath return spline path
|
||||||
|
|
|
@ -31,12 +31,11 @@
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogTool::DialogTool(const VContainer *data, QWidget *parent)
|
||||||
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0),
|
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0),
|
||||||
spinBoxAngle(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0),
|
spinBoxAngle(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0),
|
||||||
labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0),
|
labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0),
|
||||||
radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0),
|
radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0)
|
||||||
idDetail(0), mode(mode)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(data != 0);
|
Q_ASSERT(data != 0);
|
||||||
timerFormula = new QTimer(this);
|
timerFormula = new QTimer(this);
|
||||||
|
@ -65,45 +64,72 @@ void DialogTool::showEvent(QShowEvent *event)
|
||||||
|
|
||||||
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
box->clear();
|
box->clear();
|
||||||
if (mode == Draw::Calculation)
|
const QHash<qint64, VPointF> *points = data->DataPoints();
|
||||||
|
QHashIterator<qint64, VPointF> i(*points);
|
||||||
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
const QHash<qint64, VPointF> *points = data->DataPoints();
|
i.next();
|
||||||
QHashIterator<qint64, VPointF> i(*points);
|
if (i.key() != id)
|
||||||
while (i.hasNext())
|
{
|
||||||
|
VPointF point = i.value();
|
||||||
|
box->addItem(point.name(), i.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
|
box->clear();
|
||||||
|
const QHash<qint64, VSpline> *spls = data->DataSplines();
|
||||||
|
QHashIterator<qint64, VSpline> i(*spls);
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
i.next();
|
||||||
|
if(cut == ComboMode::CutSpline)
|
||||||
|
{
|
||||||
|
if (i.key() != id + 1 && i.key() != id + 2)
|
||||||
|
{
|
||||||
|
VSpline spl = i.value();
|
||||||
|
box->addItem(spl.name(), i.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
i.next();
|
|
||||||
if (i.key() != id)
|
if (i.key() != id)
|
||||||
{
|
{
|
||||||
VPointF point = i.value();
|
VSpline spl = i.value();
|
||||||
box->addItem(point.name(), i.key());
|
box->addItem(spl.name(), i.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
|
box->clear();
|
||||||
|
const QHash<qint64, VSplinePath> *splPaths = data->DataSplinePaths();
|
||||||
|
QHashIterator<qint64, VSplinePath> i(*splPaths);
|
||||||
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
if (idDetail <= 0)
|
i.next();
|
||||||
|
if(cut == ComboMode::CutSpline)
|
||||||
{
|
{
|
||||||
qWarning()<<tr("Wrong details id.")<<Q_FUNC_INFO;
|
if (i.key() != id + 1 && i.key() != id + 2)
|
||||||
return;
|
|
||||||
}
|
|
||||||
VDetail det = data->GetDetail(idDetail);
|
|
||||||
for (ptrdiff_t i = 0; i< det.CountNode(); ++i)
|
|
||||||
{
|
|
||||||
if (det[i].getTypeTool() == Tool::NodePoint ||
|
|
||||||
det[i].getTypeTool() == Tool::AlongLineTool ||
|
|
||||||
det[i].getTypeTool() == Tool::BisectorTool ||
|
|
||||||
det[i].getTypeTool() == Tool::EndLineTool ||
|
|
||||||
det[i].getTypeTool() == Tool::LineIntersectTool ||
|
|
||||||
det[i].getTypeTool() == Tool::NormalTool ||
|
|
||||||
det[i].getTypeTool() == Tool::PointOfContact ||
|
|
||||||
det[i].getTypeTool() == Tool::ShoulderPointTool)
|
|
||||||
{
|
{
|
||||||
if (det[i].getId() != id)
|
VSplinePath splPath = i.value();
|
||||||
{
|
box->addItem(splPath.name(), i.key());
|
||||||
VPointF point = data->GetPointModeling(det[i].getId());
|
}
|
||||||
box->addItem(point.name(), det[i].getId());
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
if (i.key() != id)
|
||||||
|
{
|
||||||
|
VSplinePath splPath = i.value();
|
||||||
|
box->addItem(splPath.name(), i.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +184,7 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<tr("Can't find point by name")<<value;
|
qWarning()<<tr("Can't find object by name")<<value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +268,25 @@ void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 DialogTool::getCurrentPointId(QComboBox *box) const
|
void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
||||||
|
ComboMode::ComboBoxCutSpline cut) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
|
FillComboBoxSplines(box, id, cut);
|
||||||
|
splineId = value;
|
||||||
|
ChangeCurrentData(box, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
||||||
|
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
|
FillComboBoxSplinesPath(box, id, cut);
|
||||||
|
splinePathId = value;
|
||||||
|
ChangeCurrentData(box, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DialogTool::getCurrentObjectId(QComboBox *box) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_ASSERT(box != 0);
|
||||||
qint32 index = box->currentIndex();
|
qint32 index = box->currentIndex();
|
||||||
|
@ -517,16 +561,6 @@ void DialogTool::UpdateList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogTool::CheckObject(const qint64 &id)
|
|
||||||
{
|
|
||||||
if (mode == Draw::Calculation || idDetail == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
VDetail det = data->GetDetail(idDetail);
|
|
||||||
return det.Containes(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,16 @@
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include "../container/vcontainer.h"
|
#include "../container/vcontainer.h"
|
||||||
|
|
||||||
|
namespace ComboMode
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief The ComboBoxCutSpline enum
|
||||||
|
*/
|
||||||
|
enum ComboBoxCutSpline { CutSpline, NoCutSpline };
|
||||||
|
Q_DECLARE_FLAGS(ComboBoxCutSplines, ComboBoxCutSpline)
|
||||||
|
}
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutSplines )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The DialogTool class parent for all dialog of tools.
|
* @brief The DialogTool class parent for all dialog of tools.
|
||||||
*/
|
*/
|
||||||
|
@ -47,21 +57,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogTool create dialog
|
* @brief DialogTool create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogTool(const VContainer *data, QWidget *parent = 0);
|
||||||
virtual ~DialogTool() {}
|
virtual ~DialogTool() {}
|
||||||
/**
|
|
||||||
* @brief getIdDetail return id detail
|
|
||||||
* @return id
|
|
||||||
*/
|
|
||||||
inline qint64 getIdDetail() const {return idDetail;}
|
|
||||||
/**
|
|
||||||
* @brief setIdDetail set id detail
|
|
||||||
* @param value id
|
|
||||||
*/
|
|
||||||
inline void setIdDetail(const qint64 &value) {idDetail = value;}
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief DialogClosed signal dialog closed
|
* @brief DialogClosed signal dialog closed
|
||||||
|
@ -252,20 +251,6 @@ protected:
|
||||||
* @brief radioButtonLengthCurve radio button for lengths of curves variables
|
* @brief radioButtonLengthCurve radio button for lengths of curves variables
|
||||||
*/
|
*/
|
||||||
QRadioButton *radioButtonLengthCurve;
|
QRadioButton *radioButtonLengthCurve;
|
||||||
/**
|
|
||||||
* @brief idDetail id detail
|
|
||||||
*/
|
|
||||||
qint64 idDetail;
|
|
||||||
/**
|
|
||||||
* @brief mode mode
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
|
||||||
* @brief CheckObject check if object belongs to detail
|
|
||||||
* @param id id of object (point, arc, spline, spline path)
|
|
||||||
* @return true - belons, false - don't
|
|
||||||
*/
|
|
||||||
bool CheckObject(const qint64 &id);
|
|
||||||
/**
|
/**
|
||||||
* @brief closeEvent handle when dialog cloded
|
* @brief closeEvent handle when dialog cloded
|
||||||
* @param event event
|
* @param event event
|
||||||
|
@ -282,6 +267,15 @@ protected:
|
||||||
* @param id don't show this id in list
|
* @param id don't show this id in list
|
||||||
*/
|
*/
|
||||||
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
|
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
|
||||||
|
/**
|
||||||
|
* @brief FillComboBoxSplines fill comboBox list of splines
|
||||||
|
* @param box comboBox
|
||||||
|
* @param id don't show id+1 and id+2 in list
|
||||||
|
*/
|
||||||
|
void FillComboBoxSplines(QComboBox *box, const qint64 &id = 0,
|
||||||
|
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||||
|
void FillComboBoxSplinesPath(QComboBox *box, const qint64 &id = 0,
|
||||||
|
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||||
/**
|
/**
|
||||||
* @brief FillComboBoxTypeLine fill comboBox list of type lines
|
* @brief FillComboBoxTypeLine fill comboBox list of type lines
|
||||||
* @param box comboBox
|
* @param box comboBox
|
||||||
|
@ -350,12 +344,30 @@ protected:
|
||||||
* @param id don't show this id in list
|
* @param id don't show this id in list
|
||||||
*/
|
*/
|
||||||
void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const;
|
void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const;
|
||||||
|
/**
|
||||||
|
* @brief setCurrentSplineId set current spline id in combobox
|
||||||
|
* @param box combobox
|
||||||
|
* @param splineId save current spline id
|
||||||
|
* @param value spline id
|
||||||
|
* @param id don't show this id in list
|
||||||
|
*/
|
||||||
|
void setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
||||||
|
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
||||||
|
/**
|
||||||
|
* @brief setCurrentSplinePathId set current splinePath id in combobox
|
||||||
|
* @param box combobox
|
||||||
|
* @param splinePathId save current splinePath id
|
||||||
|
* @param value splinePath id
|
||||||
|
* @param id don't show this id in list
|
||||||
|
*/
|
||||||
|
void setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value, const qint64 &id,
|
||||||
|
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
||||||
/**
|
/**
|
||||||
* @brief getCurrentPointId return current point id in combobox
|
* @brief getCurrentPointId return current point id in combobox
|
||||||
* @param box combobox
|
* @param box combobox
|
||||||
* @return id or -1 if combobox is empty
|
* @return id or -1 if combobox is empty
|
||||||
*/
|
*/
|
||||||
qint64 getCurrentPointId(QComboBox *box) const;
|
qint64 getCurrentObjectId(QComboBox *box) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGTOOL_H
|
#endif // DIALOGTOOL_H
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, mode, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
|
:DialogTool(data, parent), ui(new Ui::DialogTriangle), number(0), pointName(QString()), axisP1Id(0),
|
||||||
axisP2Id(0), firstPointId(0), secondPointId(0)
|
axisP2Id(0), firstPointId(0), secondPointId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -43,10 +43,12 @@ DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget
|
||||||
CheckState();
|
CheckState();
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxAxisP1);
|
FillComboBoxPoints(ui->comboBoxAxisP1);
|
||||||
FillComboBoxPoints(ui->comboBoxAxisP2);
|
FillComboBoxPoints(ui->comboBoxAxisP2);
|
||||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||||
|
|
||||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,32 +59,9 @@ DialogTriangle::~DialogTriangle()
|
||||||
|
|
||||||
void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (idDetail == 0 && mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (type == Scene::Detail)
|
|
||||||
{
|
|
||||||
idDetail = id;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mode == Draw::Modeling)
|
|
||||||
{
|
|
||||||
if (CheckObject(id) == false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
VPointF point;
|
VPointF point = data->GetPoint(id);
|
||||||
if (mode == Draw::Calculation)
|
|
||||||
{
|
|
||||||
point = data->GetPoint(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
point = data->GetPointModeling(id);
|
|
||||||
}
|
|
||||||
switch (number)
|
switch (number)
|
||||||
{
|
{
|
||||||
case (0):
|
case (0):
|
||||||
|
@ -118,10 +97,10 @@ void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
void DialogTriangle::DialogAccepted()
|
void DialogTriangle::DialogAccepted()
|
||||||
{
|
{
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
axisP1Id = getCurrentPointId(ui->comboBoxAxisP1);
|
axisP1Id = getCurrentObjectId(ui->comboBoxAxisP1);
|
||||||
axisP2Id = getCurrentPointId(ui->comboBoxAxisP2);
|
axisP2Id = getCurrentObjectId(ui->comboBoxAxisP2);
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief DialogTriangle create dialog
|
* @brief DialogTriangle create dialog
|
||||||
* @param data container with data
|
* @param data container with data
|
||||||
* @param mode mode of creation tool
|
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogTriangle(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
|
DialogTriangle(const VContainer *data, QWidget *parent = 0);
|
||||||
~DialogTriangle();
|
~DialogTriangle();
|
||||||
/**
|
/**
|
||||||
* @brief getAxisP1Id return id first point of axis
|
* @brief getAxisP1Id return id first point of axis
|
||||||
|
|
|
@ -33,12 +33,12 @@ class QRectF;
|
||||||
|
|
||||||
VArc::VArc ()
|
VArc::VArc ()
|
||||||
: f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
|
: f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
|
||||||
center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0), _name(QString()){}
|
center(0), points(QHash<qint64, VPointF>()), idObject(0), _name(QString()){}
|
||||||
|
|
||||||
VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
||||||
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject)
|
qreal f1, QString formulaF1, qreal f2, QString formulaF2, qint64 idObject)
|
||||||
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
|
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
|
||||||
center(center), points(*points), mode(mode), idObject(idObject), _name(QString())
|
center(center), points(*points), idObject(idObject), _name(QString())
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @todo Change name of arc in formula. Name now not unique.
|
* @todo Change name of arc in formula. Name now not unique.
|
||||||
|
@ -49,8 +49,7 @@ VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, Q
|
||||||
VArc::VArc(const VArc &arc)
|
VArc::VArc(const VArc &arc)
|
||||||
: f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
|
: f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
|
||||||
formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()),
|
formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()),
|
||||||
center(arc.GetCenter()), points(arc.GetDataPoints()), mode(arc.getMode()),
|
center(arc.GetCenter()), points(arc.GetDataPoints()), idObject(arc.getIdObject()), _name(arc.name()){}
|
||||||
idObject(arc.getIdObject()), _name(arc.name()){}
|
|
||||||
|
|
||||||
VArc &VArc::operator =(const VArc &arc)
|
VArc &VArc::operator =(const VArc &arc)
|
||||||
{
|
{
|
||||||
|
@ -62,7 +61,6 @@ VArc &VArc::operator =(const VArc &arc)
|
||||||
this->radius = arc.GetRadius();
|
this->radius = arc.GetRadius();
|
||||||
this->formulaRadius = arc.GetFormulaRadius();
|
this->formulaRadius = arc.GetFormulaRadius();
|
||||||
this->center = arc.GetCenter();
|
this->center = arc.GetCenter();
|
||||||
this->mode = arc.getMode();
|
|
||||||
this->idObject = arc.getIdObject();
|
this->idObject = arc.getIdObject();
|
||||||
this->_name = arc.name();
|
this->_name = arc.name();
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -56,8 +56,7 @@ public:
|
||||||
* @param f2 кінцевий кут в градусах.
|
* @param f2 кінцевий кут в градусах.
|
||||||
*/
|
*/
|
||||||
VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
||||||
qreal f1, QString formulaF1, qreal f2, QString formulaF2,
|
qreal f1, QString formulaF1, qreal f2, QString formulaF2, qint64 idObject = 0);
|
||||||
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
|
|
||||||
/**
|
/**
|
||||||
* @brief VArc
|
* @brief VArc
|
||||||
* @param arc
|
* @param arc
|
||||||
|
@ -160,16 +159,6 @@ public:
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QVector<QPointF> SplOfArc( qint32 number ) const;
|
QVector<QPointF> SplOfArc( qint32 number ) const;
|
||||||
/**
|
|
||||||
* @brief getMode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline Draw::Draws getMode() const {return mode;}
|
|
||||||
/**
|
|
||||||
* @brief setMode
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
|
||||||
/**
|
/**
|
||||||
* @brief getIdObject
|
* @brief getIdObject
|
||||||
* @return
|
* @return
|
||||||
|
@ -223,10 +212,6 @@ private:
|
||||||
* @brief points
|
* @brief points
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VPointF> points;
|
QHash<qint64, VPointF> points;
|
||||||
/**
|
|
||||||
* @brief mode
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
/**
|
||||||
* @brief idObject
|
* @brief idObject
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,21 +29,18 @@
|
||||||
#include "vnodedetail.h"
|
#include "vnodedetail.h"
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail()
|
VNodeDetail::VNodeDetail()
|
||||||
:id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling), typeNode(NodeDetail::Contour), mx(0), my(0){}
|
:id(0), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){}
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
|
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my)
|
||||||
qreal mx, qreal my)
|
:id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my){}
|
||||||
:id(id), typeTool(typeTool), mode(mode), typeNode(typeNode), mx(mx), my(my){}
|
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail(const VNodeDetail &node)
|
VNodeDetail::VNodeDetail(const VNodeDetail &node)
|
||||||
:id(node.getId()), typeTool(node.getTypeTool()), mode(node.getMode()), typeNode(node.getTypeNode()),
|
:id(node.getId()), typeTool(node.getTypeTool()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){}
|
||||||
mx(node.getMx()), my(node.getMy()){}
|
|
||||||
|
|
||||||
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node)
|
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node)
|
||||||
{
|
{
|
||||||
id = node.getId();
|
id = node.getId();
|
||||||
typeTool = node.getTypeTool();
|
typeTool = node.getTypeTool();
|
||||||
mode = node.getMode();
|
|
||||||
typeNode = node.getTypeNode();
|
typeNode = node.getTypeNode();
|
||||||
mx = node.getMx();
|
mx = node.getMx();
|
||||||
my = node.getMy();
|
my = node.getMy();
|
||||||
|
|
|
@ -61,8 +61,8 @@ public:
|
||||||
* @param mx
|
* @param mx
|
||||||
* @param my
|
* @param my
|
||||||
*/
|
*/
|
||||||
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
|
VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0,
|
||||||
qreal mx = 0, qreal my = 0);
|
qreal my = 0);
|
||||||
/**
|
/**
|
||||||
* @brief VNodeDetail
|
* @brief VNodeDetail
|
||||||
* @param node
|
* @param node
|
||||||
|
@ -94,16 +94,6 @@ public:
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
|
inline void setTypeTool(const Tool::Tools &value) {typeTool = value;}
|
||||||
/**
|
|
||||||
* @brief getMode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline Draw::Draws getMode() const {return mode;}
|
|
||||||
/**
|
|
||||||
* @brief setMode
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
|
||||||
/**
|
/**
|
||||||
* @brief getTypeNode
|
* @brief getTypeNode
|
||||||
* @return
|
* @return
|
||||||
|
@ -143,10 +133,6 @@ private:
|
||||||
* @brief typeTool
|
* @brief typeTool
|
||||||
*/
|
*/
|
||||||
Tool::Tools typeTool;
|
Tool::Tools typeTool;
|
||||||
/**
|
|
||||||
* @brief mode
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
/**
|
||||||
* @brief typeNode
|
* @brief typeNode
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,33 +32,32 @@
|
||||||
|
|
||||||
VSpline::VSpline()
|
VSpline::VSpline()
|
||||||
:p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1),
|
:p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1),
|
||||||
points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0), _name(QString()){}
|
points(QHash<qint64, VPointF>()), idObject(0), _name(QString()){}
|
||||||
|
|
||||||
VSpline::VSpline ( const VSpline & spline )
|
VSpline::VSpline ( const VSpline & spline )
|
||||||
:p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()),
|
:p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()),
|
||||||
angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()),
|
angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()),
|
||||||
points(spline.GetDataPoints()), mode(spline.getMode()), idObject(spline.getIdObject()), _name(spline.name()){}
|
points(spline.GetDataPoints()), idObject(spline.getIdObject()), _name(spline.name()){}
|
||||||
|
|
||||||
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
||||||
qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode, qint64 idObject)
|
qreal kAsm1, qreal kAsm2, qreal kCurve, qint64 idObject)
|
||||||
:p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2),
|
:p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2),
|
||||||
kCurve(kCurve), points(*points), mode(mode), idObject(idObject), _name(QString())
|
kCurve(kCurve), points(*points), idObject(idObject), _name(QString())
|
||||||
{
|
{
|
||||||
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
||||||
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
|
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
||||||
qreal kCurve, Draw::Draws mode, qint64 idObject)
|
qreal kCurve, qint64 idObject)
|
||||||
:p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode),
|
:p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points),
|
||||||
idObject(idObject), _name(QString())
|
idObject(idObject), _name(QString())
|
||||||
{
|
{
|
||||||
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
||||||
ModifiSpl ( p1, p2, p3, p4, kCurve);
|
ModifiSpl ( p1, p2, p3, p4, kCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve)
|
||||||
qreal kAsm1, qreal kAsm2, qreal kCurve)
|
|
||||||
{
|
{
|
||||||
this->p1 = p1;
|
this->p1 = p1;
|
||||||
this->p4 = p4;
|
this->p4 = p4;
|
||||||
|
@ -208,32 +207,97 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in
|
||||||
throw "Не можу знайти точку перетину сплайну з лінією.";
|
throw "Не можу знайти точку перетину сплайну з лінією.";
|
||||||
}
|
}
|
||||||
|
|
||||||
//void VSpline::CutSpline ( qreal length, VSpline* curFir, VSpline* curSec ) const{
|
qreal VSpline::LengthT(qreal t) const
|
||||||
// if ( length > GetLength()){
|
{
|
||||||
// throw"Не правильна довжина нового сплайну\n";
|
if(t < 0 || t > 1)
|
||||||
// }
|
{
|
||||||
// qreal parT = length / GetLength();
|
qWarning()<<"Wrong value t.";
|
||||||
// QLineF seg1_2 ( GetPointP1 (), GetP2 () );
|
return 0;
|
||||||
// seg1_2.setLength(seg1_2.length () * parT);
|
}
|
||||||
// QPointF p12 = seg1_2.p2();
|
QLineF seg1_2 ( GetPointP1 ().toQPointF(), GetP2 () );
|
||||||
// QLineF seg2_3 ( GetP2 (), GetP3 () );
|
seg1_2.setLength(seg1_2.length () * t);
|
||||||
// seg2_3.setLength(seg2_3.length () * parT);
|
QPointF p12 = seg1_2.p2();
|
||||||
// QPointF p23 = seg2_3.p2();
|
|
||||||
// QLineF seg12_23 ( p12, p23 );
|
QLineF seg2_3 ( GetP2 (), GetP3 () );
|
||||||
// seg12_23.setLength(seg12_23.length () * parT);
|
seg2_3.setLength(seg2_3.length () * t);
|
||||||
// QPointF p123 = seg12_23.p2();
|
QPointF p23 = seg2_3.p2();
|
||||||
// QLineF seg3_4 ( GetP3 (), GetPointP4 () );
|
|
||||||
// seg3_4.setLength(seg3_4.length () * parT);
|
QLineF seg12_23 ( p12, p23 );
|
||||||
// QPointF p34 = seg3_4.p2();
|
seg12_23.setLength(seg12_23.length () * t);
|
||||||
// QLineF seg23_34 ( p23, p34 );
|
QPointF p123 = seg12_23.p2();
|
||||||
// seg23_34.setLength(seg23_34.length () * parT);
|
|
||||||
// QPointF p234 = seg23_34.p2();
|
QLineF seg3_4 ( GetP3 (), GetPointP4 ().toQPointF() );
|
||||||
// QLineF seg123_234 ( p123, p234 );
|
seg3_4.setLength(seg3_4.length () * t);
|
||||||
// seg123_234.setLength(seg123_234.length () * parT);
|
QPointF p34 = seg3_4.p2();
|
||||||
// QPointF p1234 = seg123_234.p2();
|
|
||||||
// curFir->ModifiSpl ( GetPointP1 (), p12, p123, p1234 );
|
QLineF seg23_34 ( p23, p34 );
|
||||||
// curSec->ModifiSpl ( p1234, p234, p34, GetPointP4 () );
|
seg23_34.setLength(seg23_34.length () * t);
|
||||||
//}
|
QPointF p234 = seg23_34.p2();
|
||||||
|
|
||||||
|
QLineF seg123_234 ( p123, p234 );
|
||||||
|
seg123_234.setLength(seg123_234.length () * t);
|
||||||
|
QPointF p1234 = seg123_234.p2();
|
||||||
|
|
||||||
|
return LengthBezier ( GetPointP1().toQPointF(), p12, p123, p1234);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const
|
||||||
|
{
|
||||||
|
//Always need return two splines, so we must correct wrong length.
|
||||||
|
if(length < GetLength()*0.02)
|
||||||
|
{
|
||||||
|
length = GetLength()*0.02;
|
||||||
|
}
|
||||||
|
else if ( length > GetLength()*0.98)
|
||||||
|
{
|
||||||
|
length = GetLength()*0.98;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Very stupid way find correct value of t.
|
||||||
|
// Better first compare with t = 0.5. Find length of spline.
|
||||||
|
// If length larger, take t = 0.75 and so on.
|
||||||
|
// If length less, take t = 0.25 and so on.
|
||||||
|
qreal parT = 0;
|
||||||
|
qreal step = 0.001;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
parT = parT + step;
|
||||||
|
qreal splLength = LengthT(parT);
|
||||||
|
if(splLength >= length || parT > 1){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF seg1_2 ( GetPointP1 ().toQPointF(), GetP2 () );
|
||||||
|
seg1_2.setLength(seg1_2.length () * parT);
|
||||||
|
QPointF p12 = seg1_2.p2();
|
||||||
|
|
||||||
|
QLineF seg2_3 ( GetP2 (), GetP3 () );
|
||||||
|
seg2_3.setLength(seg2_3.length () * parT);
|
||||||
|
QPointF p23 = seg2_3.p2();
|
||||||
|
|
||||||
|
QLineF seg12_23 ( p12, p23 );
|
||||||
|
seg12_23.setLength(seg12_23.length () * parT);
|
||||||
|
QPointF p123 = seg12_23.p2();
|
||||||
|
|
||||||
|
QLineF seg3_4 ( GetP3 (), GetPointP4 ().toQPointF() );
|
||||||
|
seg3_4.setLength(seg3_4.length () * parT);
|
||||||
|
QPointF p34 = seg3_4.p2();
|
||||||
|
|
||||||
|
QLineF seg23_34 ( p23, p34 );
|
||||||
|
seg23_34.setLength(seg23_34.length () * parT);
|
||||||
|
QPointF p234 = seg23_34.p2();
|
||||||
|
|
||||||
|
QLineF seg123_234 ( p123, p234 );
|
||||||
|
seg123_234.setLength(seg123_234.length () * parT);
|
||||||
|
QPointF p1234 = seg123_234.p2();
|
||||||
|
|
||||||
|
spl1p2 = p12;
|
||||||
|
spl1p3 = p123;
|
||||||
|
spl2p2 = p234;
|
||||||
|
spl2p3 = p34;
|
||||||
|
return p1234;
|
||||||
|
}
|
||||||
|
|
||||||
//void VSpline::CutSpline ( QPointF point, VSpline* curFir, VSpline* curSec ) const{
|
//void VSpline::CutSpline ( QPointF point, VSpline* curFir, VSpline* curSec ) const{
|
||||||
// qreal t = param_t (point);
|
// qreal t = param_t (point);
|
||||||
|
@ -790,7 +854,6 @@ VSpline &VSpline::operator =(const VSpline &spline)
|
||||||
this->kAsm2 = spline.GetKasm2();
|
this->kAsm2 = spline.GetKasm2();
|
||||||
this->kCurve = spline.GetKcurve();
|
this->kCurve = spline.GetKcurve();
|
||||||
this->points = spline.GetDataPoints();
|
this->points = spline.GetDataPoints();
|
||||||
this->mode = spline.getMode();
|
|
||||||
this->idObject = spline.getIdObject();
|
this->idObject = spline.getIdObject();
|
||||||
this->_name = spline.name();
|
this->_name = spline.name();
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -40,39 +40,41 @@ class QString;
|
||||||
#define M_2PI 6.28318530717958647692528676655900576
|
#define M_2PI 6.28318530717958647692528676655900576
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief VSpline клас, що реалізує сплайн.
|
* @brief VSpline class that implements the spline.
|
||||||
*/
|
*/
|
||||||
class VSpline
|
class VSpline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VSpline();
|
/**
|
||||||
/**
|
* @brief VSpline default constructor
|
||||||
* @brief VSpline конструктор.
|
*/
|
||||||
* @param spline сплайн з якого копіюємо.
|
VSpline();
|
||||||
*/
|
/**
|
||||||
VSpline (const VSpline &spline );
|
* @brief VSpline constructor.
|
||||||
/**
|
* @param spline spline from which the copy.
|
||||||
* @brief VSpline конструктор.
|
*/
|
||||||
* @param p1 початкова точка сплайна.
|
VSpline (const VSpline &spline );
|
||||||
* @param p4 кінцева точка сплайна.
|
/**
|
||||||
* @param angle1 кут в градусах першої напрямної.
|
* @brief VSpline constructor.
|
||||||
* @param angle2 кут в градусах другої напрямної.
|
* @param p1 початкова точка сплайна.
|
||||||
* @param kCurve коефіцієнт кривизни сплайна.
|
* @param p4 кінцева точка сплайна.
|
||||||
* @param kAsm1 коефіцієнт довжини першої напрямної.
|
* @param angle1 кут в градусах першої напрямної.
|
||||||
* @param kAsm2 коефіцієнт довжини другої напрямної.
|
* @param angle2 кут в градусах другої напрямної.
|
||||||
*/
|
* @param kCurve коефіцієнт кривизни сплайна.
|
||||||
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
* @param kAsm1 коефіцієнт довжини першої напрямної.
|
||||||
qreal kAsm1, qreal kAsm2, qreal kCurve, Draw::Draws mode = Draw::Calculation,
|
* @param kAsm2 коефіцієнт довжини другої напрямної.
|
||||||
qint64 idObject = 0);
|
*/
|
||||||
/**
|
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1,
|
||||||
* @brief VSpline конструктор.
|
qreal kAsm2, qreal kCurve, qint64 idObject = 0);
|
||||||
* @param p1 початкова точка сплайну.
|
/**
|
||||||
* @param p2 перша контролююча точка сплайну.
|
* @brief VSpline конструктор.
|
||||||
* @param p3 друга контролююча точка сплайну.
|
* @param p1 початкова точка сплайну.
|
||||||
* @param p4 кінцева точка сплайну.
|
* @param p2 перша контролююча точка сплайну.
|
||||||
*/
|
* @param p3 друга контролююча точка сплайну.
|
||||||
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
* @param p4 кінцева точка сплайну.
|
||||||
qreal kCurve, Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
|
*/
|
||||||
|
VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
||||||
|
qreal kCurve, qint64 idObject = 0);
|
||||||
/**
|
/**
|
||||||
* @brief ModifiSpl модифікує сплайн.
|
* @brief ModifiSpl модифікує сплайн.
|
||||||
* @param p1 початкова точка сплайну.
|
* @param p1 початкова точка сплайну.
|
||||||
|
@ -84,7 +86,7 @@ public:
|
||||||
* @param kAsm2 коефіцієнт довжини другої напрямної.
|
* @param kAsm2 коефіцієнт довжини другої напрямної.
|
||||||
*/
|
*/
|
||||||
void ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
|
void ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
|
||||||
qreal kCurve);
|
qreal kCurve);
|
||||||
/**
|
/**
|
||||||
* @brief ModifiSpl модифікує сплайн.
|
* @brief ModifiSpl модифікує сплайн.
|
||||||
* @param p1 початкова точка сплайну.
|
* @param p1 початкова точка сплайну.
|
||||||
|
@ -94,17 +96,17 @@ public:
|
||||||
*/
|
*/
|
||||||
void ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4,
|
void ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4,
|
||||||
const qreal &kCurve);
|
const qreal &kCurve);
|
||||||
/**
|
// /**
|
||||||
* @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки.
|
// * @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки.
|
||||||
* @param pRotate точка навколо якої повертаємо.
|
// * @param pRotate точка навколо якої повертаємо.
|
||||||
* @param angle кут в градусах.
|
// * @param angle кут в градусах.
|
||||||
*/
|
// */
|
||||||
// void RotationSpl ( QPointF pRotate, qreal angle );
|
// void RotationSpl ( QPointF pRotate, qreal angle );
|
||||||
/**
|
// /**
|
||||||
* @brief BiasSpl зміщує сплайн.
|
// * @brief BiasSpl зміщує сплайн.
|
||||||
* @param mx зміщення по х координаті.
|
// * @param mx зміщення по х координаті.
|
||||||
* @param my зміщення по у координаті.
|
// * @param my зміщення по у координаті.
|
||||||
*/
|
// */
|
||||||
// void BiasSpl ( qreal mx, qreal my );
|
// void BiasSpl ( qreal mx, qreal my );
|
||||||
/**
|
/**
|
||||||
* @brief GetP1 повертає першу точку сплайну.
|
* @brief GetP1 повертає першу точку сплайну.
|
||||||
|
@ -183,13 +185,18 @@ public:
|
||||||
* @return результат перевірки.
|
* @return результат перевірки.
|
||||||
*/
|
*/
|
||||||
QLineF::IntersectType CrossingSplLine(const QLineF &line, QPointF *intersectionPoint ) const;
|
QLineF::IntersectType CrossingSplLine(const QLineF &line, QPointF *intersectionPoint ) const;
|
||||||
|
qreal LengthT(qreal t) const;
|
||||||
/**
|
/**
|
||||||
* @brief CutSpline розрізає сплайн.
|
* @brief CutSpline cut spline. GetPointP1() of base spline will return first point for first spline, GetPointP4()
|
||||||
* @param length дожина першого сплайну.
|
* of base spline will return forth point of second spline.
|
||||||
* @param curFir перший сплайн.
|
* @param length length first spline
|
||||||
* @param curSec другий сплайн.
|
* @param spl1p2 second point of first spline
|
||||||
|
* @param spl1p3 third point of first spline
|
||||||
|
* @param spl2p2 second point of second spline
|
||||||
|
* @param spl2p3 third point of second spline
|
||||||
|
* @return point of cutting. This point is forth point of first spline and first point of second spline.
|
||||||
*/
|
*/
|
||||||
// void CutSpline ( qreal length, VSpline* curFir, VSpline* curSec ) const;
|
QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
|
||||||
/**
|
/**
|
||||||
* @brief CutSpline розрізає сплайн.
|
* @brief CutSpline розрізає сплайн.
|
||||||
* @param point точка що ділить сплайн.
|
* @param point точка що ділить сплайн.
|
||||||
|
@ -218,16 +225,6 @@ public:
|
||||||
* @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну.
|
* @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну.
|
||||||
*/
|
*/
|
||||||
// void Mirror(const QPointF Pmirror);
|
// void Mirror(const QPointF Pmirror);
|
||||||
/**
|
|
||||||
* @brief getMode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline Draw::Draws getMode() const {return mode;}
|
|
||||||
/**
|
|
||||||
* @brief setMode
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
|
||||||
/**
|
/**
|
||||||
* @brief SplinePoints
|
* @brief SplinePoints
|
||||||
* @param p1
|
* @param p1
|
||||||
|
@ -318,10 +315,6 @@ private:
|
||||||
* @brief points
|
* @brief points
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VPointF> points;
|
QHash<qint64, VPointF> points;
|
||||||
/**
|
|
||||||
* @brief mode
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
/**
|
||||||
* @brief idObject
|
* @brief idObject
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,15 +30,14 @@
|
||||||
#include "../exception/vexception.h"
|
#include "../exception/vexception.h"
|
||||||
|
|
||||||
VSplinePath::VSplinePath()
|
VSplinePath::VSplinePath()
|
||||||
: path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(QHash<qint64, VPointF>()), idObject(0),
|
: path(QVector<VSplinePoint>()), kCurve(1), points(QHash<qint64, VPointF>()), idObject(0), _name(QString()){}
|
||||||
_name(QString()){}
|
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject)
|
VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, qint64 idObject)
|
||||||
: path(QVector<VSplinePoint>()), kCurve(kCurve), mode(mode), points(*points), idObject(idObject), _name(QString())
|
: path(QVector<VSplinePoint>()), kCurve(kCurve), points(*points), idObject(idObject), _name(QString())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
||||||
: path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()),
|
: path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), points(splPath.GetDataPoints()),
|
||||||
idObject(splPath.getIdObject()), _name(splPath.name()){}
|
idObject(splPath.getIdObject()), _name(splPath.name()){}
|
||||||
|
|
||||||
void VSplinePath::append(const VSplinePoint &point)
|
void VSplinePath::append(const VSplinePoint &point)
|
||||||
|
@ -158,7 +157,6 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path)
|
||||||
{
|
{
|
||||||
this->path = path.GetSplinePath();
|
this->path = path.GetSplinePath();
|
||||||
this->kCurve = path.getKCurve();
|
this->kCurve = path.getKCurve();
|
||||||
this->mode = path.getMode();
|
|
||||||
this->points = path.GetDataPoints();
|
this->points = path.GetDataPoints();
|
||||||
this->idObject = path.getIdObject();
|
this->idObject = path.getIdObject();
|
||||||
this->_name = path.name();
|
this->_name = path.name();
|
||||||
|
@ -169,3 +167,49 @@ VSplinePoint & VSplinePath::operator[](ptrdiff_t indx)
|
||||||
{
|
{
|
||||||
return path[indx];
|
return path[indx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3,
|
||||||
|
QPointF &spl2p2, QPointF &spl2p3) const
|
||||||
|
{
|
||||||
|
if(Count() < 2)
|
||||||
|
{
|
||||||
|
throw VException(tr("Can't cut spline path with one point"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Always need return two spline paths, so we must correct wrong length.
|
||||||
|
qreal fullLength = GetLength();
|
||||||
|
if(length < fullLength * 0.02)
|
||||||
|
{
|
||||||
|
length = fullLength * 0.02;
|
||||||
|
}
|
||||||
|
else if ( length > fullLength * 0.98)
|
||||||
|
{
|
||||||
|
length = fullLength * 0.98;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullLength = 0;
|
||||||
|
for (qint32 i = 1; i <= Count(); ++i)
|
||||||
|
{
|
||||||
|
VSpline spl = VSpline(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||||
|
path[i-1].KAsm2(), path[i].KAsm1(), kCurve);
|
||||||
|
fullLength += spl.GetLength();
|
||||||
|
if(fullLength > length)
|
||||||
|
{
|
||||||
|
p1 = i-1;
|
||||||
|
p2 = i;
|
||||||
|
return spl.CutSpline(length - (fullLength - spl.GetLength()), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QPointF();
|
||||||
|
}
|
||||||
|
|
||||||
|
QHash<qint64, VPointF> VSplinePath::getPoints() const
|
||||||
|
{
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VSplinePath::setPoints(const QHash<qint64, VPointF> *value)
|
||||||
|
{
|
||||||
|
points = *value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief VSplinePath конструктор по замовчуванню.
|
* @brief VSplinePath конструктор по замовчуванню.
|
||||||
*/
|
*/
|
||||||
VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve = 1,
|
VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve = 1, qint64 idObject = 0);
|
||||||
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
|
|
||||||
/**
|
/**
|
||||||
* @brief VSplinePath
|
* @brief VSplinePath
|
||||||
* @param splPath
|
* @param splPath
|
||||||
|
@ -156,16 +155,6 @@ public:
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
VSplinePoint &operator[](ptrdiff_t indx);
|
VSplinePoint &operator[](ptrdiff_t indx);
|
||||||
/**
|
|
||||||
* @brief getMode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline Draw::Draws getMode() const {return mode;}
|
|
||||||
/**
|
|
||||||
* @brief setMode
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
|
||||||
/**
|
/**
|
||||||
* @brief getIdObject
|
* @brief getIdObject
|
||||||
* @return
|
* @return
|
||||||
|
@ -186,6 +175,19 @@ public:
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
void setName(const QString &name) {_name = name;}
|
void setName(const QString &name) {_name = name;}
|
||||||
|
/**
|
||||||
|
* @brief CutSplinePath
|
||||||
|
* @param length
|
||||||
|
* @param p1
|
||||||
|
* @param p2
|
||||||
|
* @param spl1p3
|
||||||
|
* @param spl2p2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
||||||
|
QPointF &spl2p3) const;
|
||||||
|
QHash<qint64, VPointF> getPoints() const;
|
||||||
|
void setPoints(const QHash<qint64, VPointF> *value);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief path вектор з точок сплайна.
|
* @brief path вектор з точок сплайна.
|
||||||
|
@ -195,10 +197,6 @@ protected:
|
||||||
* @brief kCurve
|
* @brief kCurve
|
||||||
*/
|
*/
|
||||||
qreal kCurve;
|
qreal kCurve;
|
||||||
/**
|
|
||||||
* @brief mode
|
|
||||||
*/
|
|
||||||
Draw::Draws mode;
|
|
||||||
/**
|
/**
|
||||||
* @brief points
|
* @brief points
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -57,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
dialogDetail(QSharedPointer<DialogDetail>()), dialogHeight(QSharedPointer<DialogHeight>()),
|
dialogDetail(QSharedPointer<DialogDetail>()), dialogHeight(QSharedPointer<DialogHeight>()),
|
||||||
dialogTriangle(QSharedPointer<DialogTriangle>()),
|
dialogTriangle(QSharedPointer<DialogTriangle>()),
|
||||||
dialogPointOfIntersection(QSharedPointer<DialogPointOfIntersection>()),
|
dialogPointOfIntersection(QSharedPointer<DialogPointOfIntersection>()),
|
||||||
|
dialogCutSpline(QSharedPointer<DialogCutSpline>()), dialogCutSplinePath (QSharedPointer<DialogCutSplinePath>()),
|
||||||
dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false),
|
dialogHistory(0), doc(0), data(0), comboBoxDraws(0), fileName(QString()), changeInFile(false),
|
||||||
mode(Draw::Calculation)
|
mode(Draw::Calculation)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +105,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight);
|
connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight);
|
||||||
connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle);
|
connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle);
|
||||||
connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection);
|
connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection);
|
||||||
|
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
||||||
|
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
||||||
|
|
||||||
data = new VContainer;
|
data = new VContainer;
|
||||||
|
|
||||||
|
@ -248,7 +251,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso
|
||||||
QCursor cur(pixmap, 2, 3);
|
QCursor cur(pixmap, 2, 3);
|
||||||
view->setCursor(cur);
|
view->setCursor(cur);
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
dialog = QSharedPointer<Dialog>(new Dialog(data, mode));
|
dialog = QSharedPointer<Dialog>(new Dialog(data));
|
||||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject);
|
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject);
|
||||||
connect(dialog.data(), &Dialog::DialogClosed, this, closeDialogSlot);
|
connect(dialog.data(), &Dialog::DialogClosed, this, closeDialogSlot);
|
||||||
connect(dialog.data(), &Dialog::ToolTip, this, &MainWindow::ShowToolTip);
|
connect(dialog.data(), &Dialog::ToolTip, this, &MainWindow::ShowToolTip);
|
||||||
|
@ -268,25 +271,18 @@ template <typename T>
|
||||||
void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail)
|
void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail)
|
||||||
{
|
{
|
||||||
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
||||||
|
Q_ASSERT(tools != 0);
|
||||||
VToolDetail *det = qobject_cast<VToolDetail*>(tools->value(idDetail));
|
VToolDetail *det = qobject_cast<VToolDetail*>(tools->value(idDetail));
|
||||||
Q_ASSERT(det != 0);
|
Q_ASSERT(det != 0);
|
||||||
det->AddTool(tool, id, typeTool);
|
det->AddTool(tool, id, typeTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DrawTool, typename ModelingTool, typename Dialog>
|
template <typename DrawTool, typename Dialog>
|
||||||
void MainWindow::ClosedDialog(QSharedPointer<Dialog> &dialog, int result)
|
void MainWindow::ClosedDialog(QSharedPointer<Dialog> &dialog, int result)
|
||||||
{
|
{
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
if (mode == Draw::Calculation)
|
DrawTool::Create(dialog, currentScene, doc, data);
|
||||||
{
|
|
||||||
DrawTool::Create(dialog, currentScene, doc, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ModelingTool *endLine = ModelingTool::Create(dialog, doc, data);
|
|
||||||
AddToolToDetail(endLine, endLine->getId(), tool, dialog->getIdDetail());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
}
|
}
|
||||||
|
@ -299,7 +295,7 @@ void MainWindow::ToolEndLine(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogEndLine(int result)
|
void MainWindow::ClosedDialogEndLine(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolEndLine, VModelingEndLine>(dialogEndLine, result);
|
ClosedDialog<VToolEndLine>(dialogEndLine, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolLine(bool checked)
|
void MainWindow::ToolLine(bool checked)
|
||||||
|
@ -310,7 +306,7 @@ void MainWindow::ToolLine(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogLine(int result)
|
void MainWindow::ClosedDialogLine(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolLine, VModelingLine>(dialogLine, result);
|
ClosedDialog<VToolLine>(dialogLine, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolAlongLine(bool checked)
|
void MainWindow::ToolAlongLine(bool checked)
|
||||||
|
@ -321,7 +317,7 @@ void MainWindow::ToolAlongLine(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogAlongLine(int result)
|
void MainWindow::ClosedDialogAlongLine(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolAlongLine, VModelingAlongLine>(dialogAlongLine, result);
|
ClosedDialog<VToolAlongLine>(dialogAlongLine, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolShoulderPoint(bool checked)
|
void MainWindow::ToolShoulderPoint(bool checked)
|
||||||
|
@ -333,7 +329,7 @@ void MainWindow::ToolShoulderPoint(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogShoulderPoint(int result)
|
void MainWindow::ClosedDialogShoulderPoint(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolShoulderPoint, VModelingShoulderPoint>(dialogShoulderPoint, result);
|
ClosedDialog<VToolShoulderPoint>(dialogShoulderPoint, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolNormal(bool checked)
|
void MainWindow::ToolNormal(bool checked)
|
||||||
|
@ -344,7 +340,7 @@ void MainWindow::ToolNormal(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogNormal(int result)
|
void MainWindow::ClosedDialogNormal(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolNormal, VModelingNormal>(dialogNormal, result);
|
ClosedDialog<VToolNormal>(dialogNormal, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolBisector(bool checked)
|
void MainWindow::ToolBisector(bool checked)
|
||||||
|
@ -355,7 +351,7 @@ void MainWindow::ToolBisector(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogBisector(int result)
|
void MainWindow::ClosedDialogBisector(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolBisector, VModelingBisector>(dialogBisector, result);
|
ClosedDialog<VToolBisector>(dialogBisector, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolLineIntersect(bool checked)
|
void MainWindow::ToolLineIntersect(bool checked)
|
||||||
|
@ -367,7 +363,7 @@ void MainWindow::ToolLineIntersect(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogLineIntersect(int result)
|
void MainWindow::ClosedDialogLineIntersect(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolLineIntersect, VModelingLineIntersect>(dialogLineIntersect, result);
|
ClosedDialog<VToolLineIntersect>(dialogLineIntersect, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolSpline(bool checked)
|
void MainWindow::ToolSpline(bool checked)
|
||||||
|
@ -378,7 +374,18 @@ void MainWindow::ToolSpline(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogSpline(int result)
|
void MainWindow::ClosedDialogSpline(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolSpline, VModelingSpline>(dialogSpline, result);
|
ClosedDialog<VToolSpline>(dialogSpline, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ToolCutSpline(bool checked)
|
||||||
|
{
|
||||||
|
SetToolButton(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
|
||||||
|
tr("Select simple curve"), dialogCutSpline, &MainWindow::ClosedDialogCutSpline);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ClosedDialogCutSpline(int result)
|
||||||
|
{
|
||||||
|
ClosedDialog<VToolCutSpline>(dialogCutSpline, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolArc(bool checked)
|
void MainWindow::ToolArc(bool checked)
|
||||||
|
@ -389,19 +396,29 @@ void MainWindow::ToolArc(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogArc(int result)
|
void MainWindow::ClosedDialogArc(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolArc, VModelingArc>(dialogArc, result);
|
ClosedDialog<VToolArc>(dialogArc, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolSplinePath(bool checked)
|
void MainWindow::ToolSplinePath(bool checked)
|
||||||
{
|
{
|
||||||
SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png",
|
SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png",
|
||||||
tr("Select point of curve path"), dialogSplinePath,
|
tr("Select point of curve path"), dialogSplinePath, &MainWindow::ClosedDialogSplinePath);
|
||||||
&MainWindow::ClosedDialogSplinePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ClosedDialogSplinePath(int result)
|
void MainWindow::ClosedDialogSplinePath(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolSplinePath, VModelingSplinePath>(dialogSplinePath, result);
|
ClosedDialog<VToolSplinePath>(dialogSplinePath, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ToolCutSplinePath(bool checked)
|
||||||
|
{
|
||||||
|
SetToolButton(checked, Tool::CutSplinePathTool, ":/cursor/splinepath_cut_point_cursor.png",
|
||||||
|
tr("Select curve path"), dialogCutSplinePath, &MainWindow::ClosedDialogCutSplinePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ClosedDialogCutSplinePath(int result)
|
||||||
|
{
|
||||||
|
ClosedDialog<VToolCutSplinePath>(dialogCutSplinePath, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolPointOfContact(bool checked)
|
void MainWindow::ToolPointOfContact(bool checked)
|
||||||
|
@ -413,7 +430,7 @@ void MainWindow::ToolPointOfContact(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogPointOfContact(int result)
|
void MainWindow::ClosedDialogPointOfContact(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolPointOfContact, VModelingPointOfContact>(dialogPointOfContact, result);
|
ClosedDialog<VToolPointOfContact>(dialogPointOfContact, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolDetail(bool checked)
|
void MainWindow::ToolDetail(bool checked)
|
||||||
|
@ -426,7 +443,7 @@ void MainWindow::ToolDetail(bool checked)
|
||||||
QCursor cur(pixmap, 2, 3);
|
QCursor cur(pixmap, 2, 3);
|
||||||
view->setCursor(cur);
|
view->setCursor(cur);
|
||||||
helpLabel->setText(tr("Select points, arcs, curves clockwise."));
|
helpLabel->setText(tr("Select points, arcs, curves clockwise."));
|
||||||
dialogDetail = QSharedPointer<DialogDetail>(new DialogDetail(data, mode));
|
dialogDetail = QSharedPointer<DialogDetail>(new DialogDetail(data));
|
||||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogDetail.data(),
|
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogDetail.data(),
|
||||||
&DialogDetail::ChoosedObject);
|
&DialogDetail::ChoosedObject);
|
||||||
connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &MainWindow::ClosedDialogDetail);
|
connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &MainWindow::ClosedDialogDetail);
|
||||||
|
@ -458,7 +475,7 @@ void MainWindow::ToolHeight(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogHeight(int result)
|
void MainWindow::ClosedDialogHeight(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolHeight, VModelingHeight>(dialogHeight, result);
|
ClosedDialog<VToolHeight>(dialogHeight, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolTriangle(bool checked)
|
void MainWindow::ToolTriangle(bool checked)
|
||||||
|
@ -469,7 +486,7 @@ void MainWindow::ToolTriangle(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogTriangle(int result)
|
void MainWindow::ClosedDialogTriangle(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolTriangle, VModelingTriangle>(dialogTriangle, result);
|
ClosedDialog<VToolTriangle>(dialogTriangle, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToolPointOfIntersection(bool checked)
|
void MainWindow::ToolPointOfIntersection(bool checked)
|
||||||
|
@ -481,7 +498,7 @@ void MainWindow::ToolPointOfIntersection(bool checked)
|
||||||
|
|
||||||
void MainWindow::ClosedDialogPointOfIntersection(int result)
|
void MainWindow::ClosedDialogPointOfIntersection(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolPointOfIntersection, VModelingPointOfIntersection>(dialogPointOfIntersection, result);
|
ClosedDialog<VToolPointOfIntersection>(dialogPointOfIntersection, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::About()
|
void MainWindow::About()
|
||||||
|
@ -762,6 +779,18 @@ void MainWindow::CanselTool()
|
||||||
currentScene->setFocus(Qt::OtherFocusReason);
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
currentScene->clearSelection();
|
currentScene->clearSelection();
|
||||||
break;
|
break;
|
||||||
|
case Tool::CutSplineTool:
|
||||||
|
dialogCutSpline.clear();
|
||||||
|
ui->toolButtonSplineCutPoint->setChecked(false);
|
||||||
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
|
currentScene->clearSelection();
|
||||||
|
break;
|
||||||
|
case Tool::CutSplinePathTool:
|
||||||
|
dialogCutSplinePath.clear();
|
||||||
|
ui->toolButtonSplinePathCutPoint->setChecked(false);
|
||||||
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
|
currentScene->clearSelection();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Get wrong tool type. Ignore.";
|
qWarning()<<"Get wrong tool type. Ignore.";
|
||||||
break;
|
break;
|
||||||
|
@ -816,7 +845,9 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
verScrollBar->setValue(currentScene->getVerScrollBar());
|
verScrollBar->setValue(currentScene->getVerScrollBar());
|
||||||
|
|
||||||
mode = Draw::Calculation;
|
mode = Draw::Calculation;
|
||||||
|
SetEnableTool(true);
|
||||||
doc->setCurrentData();
|
doc->setCurrentData();
|
||||||
|
ui->toolBox->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -843,6 +874,8 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
verScrollBar = view->verticalScrollBar();
|
verScrollBar = view->verticalScrollBar();
|
||||||
verScrollBar->setValue(currentScene->getVerScrollBar());
|
verScrollBar->setValue(currentScene->getVerScrollBar());
|
||||||
mode = Draw::Modeling;
|
mode = Draw::Modeling;
|
||||||
|
SetEnableTool(true);
|
||||||
|
ui->toolBox->setCurrentIndex(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1039,21 +1072,34 @@ void MainWindow::ClosedActionHistory()
|
||||||
|
|
||||||
void MainWindow::SetEnableTool(bool enable)
|
void MainWindow::SetEnableTool(bool enable)
|
||||||
{
|
{
|
||||||
ui->toolButtonEndLine->setEnabled(enable);
|
bool drawTools = false;
|
||||||
ui->toolButtonLine->setEnabled(enable);
|
bool modelingTools = false;
|
||||||
ui->toolButtonAlongLine->setEnabled(enable);
|
if(mode == Draw::Calculation)
|
||||||
ui->toolButtonShoulderPoint->setEnabled(enable);
|
{
|
||||||
ui->toolButtonNormal->setEnabled(enable);
|
drawTools = enable;
|
||||||
ui->toolButtonBisector->setEnabled(enable);
|
}
|
||||||
ui->toolButtonLineIntersect->setEnabled(enable);
|
else
|
||||||
ui->toolButtonSpline->setEnabled(enable);
|
{
|
||||||
ui->toolButtonArc->setEnabled(enable);
|
modelingTools = enable; // Soon we will have some tools for modeling.
|
||||||
ui->toolButtonSplinePath->setEnabled(enable);
|
}
|
||||||
ui->toolButtonPointOfContact->setEnabled(enable);
|
//Drawing Tools
|
||||||
ui->toolButtonNewDetail->setEnabled(enable);
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||||
ui->toolButtonHeight->setEnabled(enable);
|
ui->toolButtonLine->setEnabled(drawTools);
|
||||||
ui->toolButtonTriangle->setEnabled(enable);
|
ui->toolButtonAlongLine->setEnabled(drawTools);
|
||||||
ui->toolButtonPointOfIntersection->setEnabled(enable);
|
ui->toolButtonShoulderPoint->setEnabled(drawTools);
|
||||||
|
ui->toolButtonNormal->setEnabled(drawTools);
|
||||||
|
ui->toolButtonBisector->setEnabled(drawTools);
|
||||||
|
ui->toolButtonLineIntersect->setEnabled(drawTools);
|
||||||
|
ui->toolButtonSpline->setEnabled(drawTools);
|
||||||
|
ui->toolButtonArc->setEnabled(drawTools);
|
||||||
|
ui->toolButtonSplinePath->setEnabled(drawTools);
|
||||||
|
ui->toolButtonPointOfContact->setEnabled(drawTools);
|
||||||
|
ui->toolButtonNewDetail->setEnabled(drawTools);
|
||||||
|
ui->toolButtonHeight->setEnabled(drawTools);
|
||||||
|
ui->toolButtonTriangle->setEnabled(drawTools);
|
||||||
|
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
|
||||||
|
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
|
||||||
|
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::MinimumScrollBar()
|
void MainWindow::MinimumScrollBar()
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "dialogs/dialogs.h"
|
#include "dialogs/dialogs.h"
|
||||||
#include "tools/vtooldetail.h"
|
#include "tools/vtooldetail.h"
|
||||||
#include "tools/drawTools/drawtools.h"
|
#include "tools/drawTools/drawtools.h"
|
||||||
#include "tools/modelingTools/modelingtools.h"
|
|
||||||
#include "xml/vdomdocument.h"
|
#include "xml/vdomdocument.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
|
@ -188,6 +187,11 @@ public slots:
|
||||||
* @param checked
|
* @param checked
|
||||||
*/
|
*/
|
||||||
void ToolSpline(bool checked);
|
void ToolSpline(bool checked);
|
||||||
|
/**
|
||||||
|
* @brief ToolCutSpline handler tool CutSpline
|
||||||
|
* @param checked true - button is checked
|
||||||
|
*/
|
||||||
|
void ToolCutSpline(bool checked);
|
||||||
/**
|
/**
|
||||||
* @brief ToolArc
|
* @brief ToolArc
|
||||||
* @param checked
|
* @param checked
|
||||||
|
@ -198,6 +202,11 @@ public slots:
|
||||||
* @param checked
|
* @param checked
|
||||||
*/
|
*/
|
||||||
void ToolSplinePath(bool checked);
|
void ToolSplinePath(bool checked);
|
||||||
|
/**
|
||||||
|
* @brief ToolCutSplinePath handler tool CutSplinePath
|
||||||
|
* @param checked true - button is checked
|
||||||
|
*/
|
||||||
|
void ToolCutSplinePath(bool checked);
|
||||||
/**
|
/**
|
||||||
* @brief ToolPointOfContact
|
* @brief ToolPointOfContact
|
||||||
* @param checked
|
* @param checked
|
||||||
|
@ -273,6 +282,11 @@ public slots:
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
void ClosedDialogSplinePath(int result);
|
void ClosedDialogSplinePath(int result);
|
||||||
|
/**
|
||||||
|
* @brief ClosedDialogCutSplinePath handler close event tool CutSplinePath
|
||||||
|
* @param result result of working of dialog
|
||||||
|
*/
|
||||||
|
void ClosedDialogCutSplinePath(int result);
|
||||||
/**
|
/**
|
||||||
* @brief ClosedDialogPointOfContact
|
* @brief ClosedDialogPointOfContact
|
||||||
* @param result
|
* @param result
|
||||||
|
@ -298,6 +312,11 @@ public slots:
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
void ClosedDialogPointOfIntersection(int result);
|
void ClosedDialogPointOfIntersection(int result);
|
||||||
|
/**
|
||||||
|
* @brief ClosedDialogCutSpline handler close event tool CutSpline
|
||||||
|
* @param result result of working of dialog
|
||||||
|
*/
|
||||||
|
void ClosedDialogCutSpline(int result);
|
||||||
/**
|
/**
|
||||||
* @brief About
|
* @brief About
|
||||||
*/
|
*/
|
||||||
|
@ -444,6 +463,14 @@ private:
|
||||||
* @brief dialogPointOfIntersection
|
* @brief dialogPointOfIntersection
|
||||||
*/
|
*/
|
||||||
QSharedPointer<DialogPointOfIntersection> dialogPointOfIntersection;
|
QSharedPointer<DialogPointOfIntersection> dialogPointOfIntersection;
|
||||||
|
/**
|
||||||
|
* @brief dialogCutSpline pointer to the dialog tool cut spline
|
||||||
|
*/
|
||||||
|
QSharedPointer<DialogCutSpline> dialogCutSpline;
|
||||||
|
/**
|
||||||
|
* @brief dialogCutSplinePath pointer to the dialog tool cut spline path
|
||||||
|
*/
|
||||||
|
QSharedPointer<DialogCutSplinePath> dialogCutSplinePath;
|
||||||
/**
|
/**
|
||||||
* @brief dialogHistory
|
* @brief dialogHistory
|
||||||
*/
|
*/
|
||||||
|
@ -527,7 +554,7 @@ private:
|
||||||
*/
|
*/
|
||||||
void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool,
|
void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool,
|
||||||
const qint64 &idDetail);
|
const qint64 &idDetail);
|
||||||
template <typename DrawTool, typename ModelingTool, typename Dialog>
|
template <typename DrawTool, typename Dialog>
|
||||||
/**
|
/**
|
||||||
* @brief ClosedDialog
|
* @brief ClosedDialog
|
||||||
* @param dialog
|
* @param dialog
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<string>Valentina</string>
|
<string>Valentina</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/segment.png</normaloff>:/icon/32x32/segment.png</iconset>
|
<normaloff>:/icon/32x32/segment.png</normaloff>:/icon/32x32/segment.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/shoulder.png</normaloff>:/icon/32x32/shoulder.png</iconset>
|
<normaloff>:/icon/32x32/shoulder.png</normaloff>:/icon/32x32/shoulder.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/point_of_contact.png</normaloff>:/icon/32x32/point_of_contact.png</iconset>
|
<normaloff>:/icon/32x32/point_of_contact.png</normaloff>:/icon/32x32/point_of_contact.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/bisector.png</normaloff>:/icon/32x32/bisector.png</iconset>
|
<normaloff>:/icon/32x32/bisector.png</normaloff>:/icon/32x32/bisector.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/normal.png</normaloff>:/icon/32x32/normal.png</iconset>
|
<normaloff>:/icon/32x32/normal.png</normaloff>:/icon/32x32/normal.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/along_line.png</normaloff>:/icon/32x32/along_line.png</iconset>
|
<normaloff>:/icon/32x32/along_line.png</normaloff>:/icon/32x32/along_line.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/height.png</normaloff>:/icon/32x32/height.png</iconset>
|
<normaloff>:/icon/32x32/height.png</normaloff>:/icon/32x32/height.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -258,7 +258,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/triangle.png</normaloff>:/icon/32x32/triangle.png</iconset>
|
<normaloff>:/icon/32x32/triangle.png</normaloff>:/icon/32x32/triangle.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -281,7 +281,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/point_of_intersection.png</normaloff>:/icon/32x32/point_of_intersection.png</iconset>
|
<normaloff>:/icon/32x32/point_of_intersection.png</normaloff>:/icon/32x32/point_of_intersection.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -331,7 +331,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/line.png</normaloff>:/icon/32x32/line.png</iconset>
|
<normaloff>:/icon/32x32/line.png</normaloff>:/icon/32x32/line.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -357,7 +357,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/intersect.png</normaloff>:/icon/32x32/intersect.png</iconset>
|
<normaloff>:/icon/32x32/intersect.png</normaloff>:/icon/32x32/intersect.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -379,7 +379,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>150</width>
|
<width>150</width>
|
||||||
<height>58</height>
|
<height>104</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/spline.png</normaloff>:/icon/32x32/spline.png</iconset>
|
<normaloff>:/icon/32x32/spline.png</normaloff>:/icon/32x32/spline.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -433,7 +433,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/splinePath.png</normaloff>:/icon/32x32/splinePath.png</iconset>
|
<normaloff>:/icon/32x32/splinePath.png</normaloff>:/icon/32x32/splinePath.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -447,6 +447,58 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonSplinePathCutPoint">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Tool cut path curve.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/splinePath_cut_point.png</normaloff>:/icon/32x32/splinePath_cut_point.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QToolButton" name="toolButtonSplineCutPoint">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Tool cut curve.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/spline_cut_point.png</normaloff>:/icon/32x32/spline_cut_point.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_4">
|
<widget class="QWidget" name="page_4">
|
||||||
|
@ -483,7 +535,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/arc.png</normaloff>:/icon/32x32/arc.png</iconset>
|
<normaloff>:/icon/32x32/arc.png</normaloff>:/icon/32x32/arc.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -530,7 +582,7 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/new_detail.png</normaloff>:/icon/32x32/new_detail.png</iconset>
|
<normaloff>:/icon/32x32/new_detail.png</normaloff>:/icon/32x32/new_detail.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
@ -723,7 +775,7 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/draw.png</normaloff>:/icon/32x32/draw.png</iconset>
|
<normaloff>:/icon/32x32/draw.png</normaloff>:/icon/32x32/draw.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -741,7 +793,7 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/kontur.png</normaloff>:/icon/32x32/kontur.png</iconset>
|
<normaloff>:/icon/32x32/kontur.png</normaloff>:/icon/32x32/kontur.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -759,7 +811,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
|
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -771,7 +823,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionNewDraw">
|
<action name="actionNewDraw">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/new_draw.png</normaloff>:/icon/32x32/new_draw.png</iconset>
|
<normaloff>:/icon/32x32/new_draw.png</normaloff>:/icon/32x32/new_draw.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -783,7 +835,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOptionDraw">
|
<action name="actionOptionDraw">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/option_draw.png</normaloff>:/icon/32x32/option_draw.png</iconset>
|
<normaloff>:/icon/32x32/option_draw.png</normaloff>:/icon/32x32/option_draw.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -798,7 +850,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/table.png</normaloff>:/icon/32x32/table.png</iconset>
|
<normaloff>:/icon/32x32/table.png</normaloff>:/icon/32x32/table.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -813,7 +865,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/history.png</normaloff>:/icon/32x32/history.png</iconset>
|
<normaloff>:/icon/32x32/history.png</normaloff>:/icon/32x32/history.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -822,7 +874,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLayout">
|
<action name="actionLayout">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icon.qrc">
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
|
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -864,7 +916,7 @@
|
||||||
<tabstop>toolButtonNewDetail</tabstop>
|
<tabstop>toolButtonNewDetail</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icon.qrc"/>
|
<include location="../share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -65,8 +65,10 @@ namespace Tool
|
||||||
BisectorTool,
|
BisectorTool,
|
||||||
LineIntersectTool,
|
LineIntersectTool,
|
||||||
SplineTool,
|
SplineTool,
|
||||||
|
CutSplineTool,
|
||||||
ArcTool,
|
ArcTool,
|
||||||
SplinePathTool,
|
SplinePathTool,
|
||||||
|
CutSplinePathTool,
|
||||||
PointOfContact,
|
PointOfContact,
|
||||||
Detail,
|
Detail,
|
||||||
NodePoint,
|
NodePoint,
|
||||||
|
|
|
@ -44,5 +44,7 @@
|
||||||
#include "vtoolheight.h"
|
#include "vtoolheight.h"
|
||||||
#include "vtooltriangle.h"
|
#include "vtooltriangle.h"
|
||||||
#include "vtoolpointofintersection.h"
|
#include "vtoolpointofintersection.h"
|
||||||
|
#include "vtoolcutspline.h"
|
||||||
|
#include "vtoolcutsplinepath.h"
|
||||||
|
|
||||||
#endif // DRAWTOOLS_H
|
#endif // DRAWTOOLS_H
|
||||||
|
|
247
src/tools/drawTools/vtoolcutspline.cpp
Normal file
247
src/tools/drawTools/vtoolcutspline.cpp
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vtoolcutspline.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "vtoolcutspline.h"
|
||||||
|
#include "../../container/calculator.h"
|
||||||
|
|
||||||
|
const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline");
|
||||||
|
const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
|
||||||
|
|
||||||
|
VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
|
||||||
|
const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id,
|
||||||
|
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
||||||
|
:VToolPoint(doc, data, id, parent), formula(formula), splineId(splineId),
|
||||||
|
dialogCutSpline(QSharedPointer<DialogCutSpline>()), firstSpline(), secondSpline(), spl1id(spl1id), spl2id(spl2id)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(splineId > 0, Q_FUNC_INFO, "splineId <= 0");
|
||||||
|
Q_ASSERT_X(spl1id > 0, Q_FUNC_INFO, "spl1id <= 0");
|
||||||
|
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
|
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
||||||
|
Q_ASSERT(firstSpline != 0);
|
||||||
|
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||||
|
firstSpline->setParentItem(this);
|
||||||
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
|
||||||
|
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
||||||
|
Q_ASSERT(secondSpline != 0);
|
||||||
|
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||||
|
secondSpline->setParentItem(this);
|
||||||
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
|
||||||
|
if (typeCreation == Tool::FromGui)
|
||||||
|
{
|
||||||
|
AddToFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::setDialog()
|
||||||
|
{
|
||||||
|
Q_ASSERT(dialogCutSpline.isNull() == false);
|
||||||
|
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||||
|
dialogCutSpline->setFormula(formula);
|
||||||
|
dialogCutSpline->setSplineId(splineId, id);
|
||||||
|
dialogCutSpline->setPointName(point.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::Create(QSharedPointer<DialogCutSpline> &dialog, VMainGraphicsScene *scene,
|
||||||
|
VDomDocument *doc, VContainer *data)
|
||||||
|
{
|
||||||
|
QString pointName = dialog->getPointName();
|
||||||
|
QString formula = dialog->getFormula();
|
||||||
|
qint64 splineId = dialog->getSplineId();
|
||||||
|
Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::Create(const qint64 _id, const QString &pointName,
|
||||||
|
const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my,
|
||||||
|
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||||
|
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
||||||
|
{
|
||||||
|
VSpline spl = data->GetSpline(splineId);
|
||||||
|
Calculator cal(data);
|
||||||
|
QString errorMsg;
|
||||||
|
qreal result = cal.eval(formula, &errorMsg);
|
||||||
|
if (errorMsg.isEmpty())
|
||||||
|
{
|
||||||
|
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||||
|
QPointF point = spl.CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
|
||||||
|
qint64 id = _id;
|
||||||
|
qint64 spl1id = 0;
|
||||||
|
qint64 spl2id = 0;
|
||||||
|
if (typeCreation == Tool::FromGui)
|
||||||
|
{
|
||||||
|
id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my));
|
||||||
|
spl1id = id + 1;
|
||||||
|
spl2id = id + 2;
|
||||||
|
|
||||||
|
VSpline spline1 = VSpline(data->DataPoints(), spl.GetP1(), spl1p2, spl1p3, id, spl.GetKcurve());
|
||||||
|
spl1id = data->AddSpline(spline1);
|
||||||
|
data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength()));
|
||||||
|
|
||||||
|
VSpline spline2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, spl.GetP4(), spl.GetKcurve());
|
||||||
|
spl2id = data->AddSpline(spline2);
|
||||||
|
data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
||||||
|
|
||||||
|
spl1id = id + 1;
|
||||||
|
spl2id = id + 2;
|
||||||
|
|
||||||
|
VSpline spline1 = VSpline(data->DataPoints(), spl.GetP1(), spl1p2, spl1p3, id, spl.GetKcurve());
|
||||||
|
data->UpdateSpline(spl1id, spline1);
|
||||||
|
data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength()));
|
||||||
|
|
||||||
|
VSpline spline2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, spl.GetP4(), spl.GetKcurve());
|
||||||
|
data->UpdateSpline(spl2id, spline2);
|
||||||
|
data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength()));
|
||||||
|
|
||||||
|
if (parse != Document::FullParse)
|
||||||
|
{
|
||||||
|
doc->UpdateToolData(id, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//VDrawTool::AddRecord(id, Tool::CutSplineTool, doc);
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation);
|
||||||
|
scene->addItem(point);
|
||||||
|
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
|
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||||
|
doc->AddTool(id, point);
|
||||||
|
doc->AddTool(spl1id, point);
|
||||||
|
doc->AddTool(spl2id, point);
|
||||||
|
doc->IncrementReferens(splineId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::FullUpdateFromFile()
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
formula = domElement.attribute(AttrLength, "");
|
||||||
|
splineId = domElement.attribute(AttrSpline, "").toLongLong();
|
||||||
|
}
|
||||||
|
RefreshGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::FullUpdateFromGui(int result)
|
||||||
|
{
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
domElement.setAttribute(AttrName, dialogCutSpline->getPointName());
|
||||||
|
domElement.setAttribute(AttrLength, dialogCutSpline->getFormula());
|
||||||
|
domElement.setAttribute(AttrSpline, QString().setNum(dialogCutSpline->getSplineId()));
|
||||||
|
emit FullUpdateTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogCutSpline.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::SplineChoosed(qint64 id)
|
||||||
|
{
|
||||||
|
emit ChoosedTool(id, Scene::Spline);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::ChangedActivDraw(const QString &newName)
|
||||||
|
{
|
||||||
|
if (nameActivDraw == newName)
|
||||||
|
{
|
||||||
|
currentColor = Qt::black;
|
||||||
|
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
firstSpline->setAcceptHoverEvents(true);
|
||||||
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
secondSpline->setAcceptHoverEvents(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentColor = Qt::gray;
|
||||||
|
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
firstSpline->setAcceptHoverEvents(false);
|
||||||
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
secondSpline->setAcceptHoverEvents(false);
|
||||||
|
}
|
||||||
|
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||||
|
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||||
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
|
{
|
||||||
|
ContextMenu(dialogCutSpline, this, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::AddToFile()
|
||||||
|
{
|
||||||
|
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||||
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
|
AddAttribute(domElement, AttrId, id);
|
||||||
|
AddAttribute(domElement, AttrType, ToolType);
|
||||||
|
AddAttribute(domElement, AttrName, point.name());
|
||||||
|
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||||
|
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||||
|
|
||||||
|
AddAttribute(domElement, AttrLength, formula);
|
||||||
|
AddAttribute(domElement, AttrSpline, splineId);
|
||||||
|
|
||||||
|
AddToCalculation(domElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::RefreshGeometry()
|
||||||
|
{
|
||||||
|
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||||
|
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||||
|
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
||||||
|
{
|
||||||
|
VSpline spl = VAbstractTool::data.GetSpline(splid);
|
||||||
|
QPainterPath path;
|
||||||
|
path.addPath(spl.GetPath());
|
||||||
|
path.setFillRule( Qt::WindingFill );
|
||||||
|
if(tr == SimpleSpline::FirstPoint)
|
||||||
|
{
|
||||||
|
path.translate(-spl.GetPointP1().toQPointF().x(), -spl.GetPointP1().toQPointF().y());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.translate(-spl.GetPointP4().toQPointF().x(), -spl.GetPointP4().toQPointF().y());
|
||||||
|
}
|
||||||
|
spline->setPath(path);
|
||||||
|
}
|
150
src/tools/drawTools/vtoolcutspline.h
Normal file
150
src/tools/drawTools/vtoolcutspline.h
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vtoolcutspline.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VTOOLCUTSPLINE_H
|
||||||
|
#define VTOOLCUTSPLINE_H
|
||||||
|
|
||||||
|
#include "vtoolpoint.h"
|
||||||
|
#include "../../dialogs/dialogcutspline.h"
|
||||||
|
#include "../../widgets/vsimplespline.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The VToolCutSpline class for tool CutSpline. This tool find point on spline and cut spline on two.
|
||||||
|
*/
|
||||||
|
class VToolCutSpline : public VToolPoint
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief VToolCutSpline
|
||||||
|
* @param doc
|
||||||
|
* @param data
|
||||||
|
* @param id
|
||||||
|
* @param formula
|
||||||
|
* @param splineId
|
||||||
|
* @param typeCreation
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
|
||||||
|
const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id,
|
||||||
|
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||||
|
/**
|
||||||
|
* @brief setDialog
|
||||||
|
*/
|
||||||
|
virtual void setDialog();
|
||||||
|
/**
|
||||||
|
* @brief Create
|
||||||
|
* @param dialog
|
||||||
|
* @param scene
|
||||||
|
* @param doc dom document container
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
static void Create(QSharedPointer<DialogCutSpline> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||||
|
VContainer *data);
|
||||||
|
/**
|
||||||
|
* @brief Create
|
||||||
|
* @param _id
|
||||||
|
* @param pointName
|
||||||
|
* @param formula
|
||||||
|
* @param splineId
|
||||||
|
* @param mx
|
||||||
|
* @param my
|
||||||
|
* @param scene
|
||||||
|
* @param doc dom document container
|
||||||
|
* @param data
|
||||||
|
* @param parse
|
||||||
|
* @param typeCreation
|
||||||
|
*/
|
||||||
|
static void Create(const qint64 _id, const QString &pointName,
|
||||||
|
const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my,
|
||||||
|
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||||
|
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
||||||
|
/**
|
||||||
|
* @brief ToolType
|
||||||
|
*/
|
||||||
|
static const QString ToolType;
|
||||||
|
static const QString AttrSpline;
|
||||||
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief FullUpdateFromFile
|
||||||
|
*/
|
||||||
|
virtual void FullUpdateFromFile();
|
||||||
|
/**
|
||||||
|
* @brief FullUpdateFromGui
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
virtual void FullUpdateFromGui(int result);
|
||||||
|
/**
|
||||||
|
* @brief SplineChoosed
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void SplineChoosed(qint64 id);
|
||||||
|
/**
|
||||||
|
* @brief ChangedActivDraw
|
||||||
|
* @param newName
|
||||||
|
*/
|
||||||
|
virtual void ChangedActivDraw(const QString &newName);
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief contextMenuEvent
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
|
/**
|
||||||
|
* @brief AddToFile
|
||||||
|
*/
|
||||||
|
virtual void AddToFile();
|
||||||
|
void RefreshGeometry();
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
|
/**
|
||||||
|
* @brief formula keep formula of length
|
||||||
|
*/
|
||||||
|
QString formula;
|
||||||
|
/**
|
||||||
|
* @brief splineId keep id of spline
|
||||||
|
*/
|
||||||
|
qint64 splineId;
|
||||||
|
/**
|
||||||
|
* @brief DialogCutSpline pointer to the tool's dialog
|
||||||
|
*/
|
||||||
|
QSharedPointer<DialogCutSpline> dialogCutSpline;
|
||||||
|
/**
|
||||||
|
* @brief firstSpline
|
||||||
|
*/
|
||||||
|
VSimpleSpline *firstSpline;
|
||||||
|
/**
|
||||||
|
* @brief secondSpline
|
||||||
|
*/
|
||||||
|
VSimpleSpline *secondSpline;
|
||||||
|
const qint64 spl1id;
|
||||||
|
const qint64 spl2id;
|
||||||
|
void RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VTOOLCUTSPLINE_H
|
316
src/tools/drawTools/vtoolcutsplinepath.cpp
Normal file
316
src/tools/drawTools/vtoolcutsplinepath.cpp
Normal file
|
@ -0,0 +1,316 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vtoolcutsplinepath.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @date 15 12, 2013
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "vtoolcutsplinepath.h"
|
||||||
|
#include "../../container/calculator.h"
|
||||||
|
|
||||||
|
const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath");
|
||||||
|
const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
||||||
|
|
||||||
|
VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
|
const QString &formula, const qint64 &splinePathId,
|
||||||
|
const qint64 &splPath1id, const qint64 &splPath2id,
|
||||||
|
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
||||||
|
:VToolPoint(doc, data, id, parent), formula(formula), splinePathId(splinePathId),
|
||||||
|
dialogCutSplinePath(QSharedPointer<DialogCutSplinePath>()), firstSpline(), secondSpline(),
|
||||||
|
splPath1id (splPath1id), splPath2id(splPath2id)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(splinePathId > 0, Q_FUNC_INFO, "splinePathId <= 0");
|
||||||
|
Q_ASSERT_X(splPath1id > 0, Q_FUNC_INFO, "spl1id <= 0");
|
||||||
|
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
|
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
||||||
|
Q_ASSERT(firstSpline != 0);
|
||||||
|
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||||
|
firstSpline->setParentItem(this);
|
||||||
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
|
||||||
|
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
||||||
|
Q_ASSERT(secondSpline != 0);
|
||||||
|
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||||
|
secondSpline->setParentItem(this);
|
||||||
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
|
||||||
|
if (typeCreation == Tool::FromGui)
|
||||||
|
{
|
||||||
|
AddToFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::setDialog()
|
||||||
|
{
|
||||||
|
Q_ASSERT(dialogCutSplinePath.isNull() == false);
|
||||||
|
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||||
|
dialogCutSplinePath->setFormula(formula);
|
||||||
|
dialogCutSplinePath->setSplinePathId(splinePathId, id);
|
||||||
|
dialogCutSplinePath->setPointName(point.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::Create(QSharedPointer<DialogCutSplinePath> &dialog, VMainGraphicsScene *scene,
|
||||||
|
VDomDocument *doc, VContainer *data)
|
||||||
|
{
|
||||||
|
QString pointName = dialog->getPointName();
|
||||||
|
QString formula = dialog->getFormula();
|
||||||
|
qint64 splinePathId = dialog->getSplinePathId();
|
||||||
|
Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, const QString &formula,
|
||||||
|
const qint64 &splinePathId, const qreal &mx, const qreal &my,
|
||||||
|
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||||
|
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
||||||
|
{
|
||||||
|
VSplinePath splPath = data->GetSplinePath(splinePathId);
|
||||||
|
Calculator cal(data);
|
||||||
|
QString errorMsg;
|
||||||
|
qreal result = cal.eval(formula, &errorMsg);
|
||||||
|
if (errorMsg.isEmpty())
|
||||||
|
{
|
||||||
|
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||||
|
qint32 p1 = 0, p2 = 0;
|
||||||
|
QPointF point = splPath.CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
|
||||||
|
qint64 id = _id;
|
||||||
|
qint64 splPath1id = 0;
|
||||||
|
qint64 splPath2id = 0;
|
||||||
|
if (typeCreation == Tool::FromGui)
|
||||||
|
{
|
||||||
|
id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my));
|
||||||
|
splPath1id = id + 1;
|
||||||
|
splPath2id = id + 2;
|
||||||
|
|
||||||
|
VSplinePoint splP1 = splPath[p1];
|
||||||
|
VSplinePoint splP2 = splPath[p2];
|
||||||
|
VSpline spl1 = VSpline(data->DataPoints(), splP1.P(), spl1p2, spl1p3, id, splPath.getKCurve());
|
||||||
|
VSpline spl2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, splP2.P(), splPath.getKCurve());
|
||||||
|
|
||||||
|
|
||||||
|
VSplinePath splPath1, splPath2;
|
||||||
|
splPath1.setPoints(data->DataPoints());
|
||||||
|
splPath2.setPoints(data->DataPoints());
|
||||||
|
for(qint32 i = 0; i < splPath.CountPoint(); i++)
|
||||||
|
{
|
||||||
|
if(i <= p1 && i < p2){
|
||||||
|
if(i == p1)
|
||||||
|
{
|
||||||
|
splPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
||||||
|
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1());
|
||||||
|
splPath1.append(cutPoint);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
splPath1.append(splPath[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(i == p2)
|
||||||
|
{
|
||||||
|
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
||||||
|
splPath2.append(cutPoint);
|
||||||
|
splPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
splPath2.append(splPath[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
splPath1id = data->AddSplinePath(splPath1);
|
||||||
|
data->AddLengthSpline(splPath1.name(), toMM(splPath1.GetLength()));
|
||||||
|
|
||||||
|
splPath2id = data->AddSplinePath(splPath2);
|
||||||
|
data->AddLengthSpline(splPath2.name(), toMM(splPath2.GetLength()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
||||||
|
|
||||||
|
splPath1id = id + 1;
|
||||||
|
splPath2id = id + 2;
|
||||||
|
|
||||||
|
VSplinePoint splP1 = splPath[p1];
|
||||||
|
VSplinePoint splP2 = splPath[p2];
|
||||||
|
VSpline spl1 = VSpline(data->DataPoints(), splP1.P(), spl1p2, spl1p3, id, splPath.getKCurve());
|
||||||
|
VSpline spl2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, splP2.P(), splPath.getKCurve());
|
||||||
|
|
||||||
|
VSplinePath splPath1, splPath2;
|
||||||
|
splPath1.setPoints(data->DataPoints());
|
||||||
|
splPath2.setPoints(data->DataPoints());
|
||||||
|
for(qint32 i = 0; i < splPath.CountPoint(); i++)
|
||||||
|
{
|
||||||
|
if(i <= p1 && i < p2){
|
||||||
|
if(i == p1)
|
||||||
|
{
|
||||||
|
splPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
||||||
|
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1());
|
||||||
|
splPath1.append(cutPoint);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
splPath1.append(splPath[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(i == p2)
|
||||||
|
{
|
||||||
|
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
||||||
|
splPath2.append(cutPoint);
|
||||||
|
splPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
splPath2.append(splPath[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data->UpdateSplinePath(splPath1id, splPath1);
|
||||||
|
data->AddLengthSpline(splPath1.name(), toMM(splPath1.GetLength()));
|
||||||
|
|
||||||
|
data->UpdateSplinePath(splPath2id, splPath2);
|
||||||
|
data->AddLengthSpline(splPath2.name(), toMM(splPath2.GetLength()));
|
||||||
|
|
||||||
|
if (parse != Document::FullParse)
|
||||||
|
{
|
||||||
|
doc->UpdateToolData(id, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//VDrawTool::AddRecord(id, Tool::CutSplineTool, doc);
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
||||||
|
splPath2id, typeCreation);
|
||||||
|
scene->addItem(point);
|
||||||
|
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
|
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||||
|
doc->AddTool(id, point);
|
||||||
|
doc->AddTool(splPath1id, point);
|
||||||
|
doc->AddTool(splPath2id, point);
|
||||||
|
doc->IncrementReferens(splinePathId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::FullUpdateFromFile()
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
formula = domElement.attribute(AttrLength, "");
|
||||||
|
splinePathId = domElement.attribute(AttrSplinePath, "").toLongLong();
|
||||||
|
}
|
||||||
|
RefreshGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::FullUpdateFromGui(int result)
|
||||||
|
{
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
domElement.setAttribute(AttrName, dialogCutSplinePath->getPointName());
|
||||||
|
domElement.setAttribute(AttrLength, dialogCutSplinePath->getFormula());
|
||||||
|
domElement.setAttribute(AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId()));
|
||||||
|
emit FullUpdateTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogCutSplinePath.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::SplineChoosed(qint64 id)
|
||||||
|
{
|
||||||
|
emit ChoosedTool(id, Scene::SplinePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
|
||||||
|
{
|
||||||
|
if (nameActivDraw == newName)
|
||||||
|
{
|
||||||
|
currentColor = Qt::black;
|
||||||
|
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
firstSpline->setAcceptHoverEvents(true);
|
||||||
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
|
secondSpline->setAcceptHoverEvents(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentColor = Qt::gray;
|
||||||
|
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
firstSpline->setAcceptHoverEvents(false);
|
||||||
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
|
secondSpline->setAcceptHoverEvents(false);
|
||||||
|
}
|
||||||
|
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||||
|
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||||
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
|
{
|
||||||
|
ContextMenu(dialogCutSplinePath, this, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::AddToFile()
|
||||||
|
{
|
||||||
|
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||||
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
|
AddAttribute(domElement, AttrId, id);
|
||||||
|
AddAttribute(domElement, AttrType, ToolType);
|
||||||
|
AddAttribute(domElement, AttrName, point.name());
|
||||||
|
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||||
|
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||||
|
|
||||||
|
AddAttribute(domElement, AttrLength, formula);
|
||||||
|
AddAttribute(domElement, AttrSplinePath, splinePathId);
|
||||||
|
|
||||||
|
AddToCalculation(domElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::RefreshGeometry()
|
||||||
|
{
|
||||||
|
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||||
|
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||||
|
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
||||||
|
{
|
||||||
|
VSplinePath splPath = VAbstractTool::data.GetSplinePath(splPathid);
|
||||||
|
QPainterPath path;
|
||||||
|
path.addPath(splPath.GetPath());
|
||||||
|
path.setFillRule( Qt::WindingFill );
|
||||||
|
if(tr == SimpleSpline::FirstPoint)
|
||||||
|
{
|
||||||
|
VSpline spl = splPath.GetSpline(1);
|
||||||
|
path.translate(-spl.GetPointP1().toQPointF().x(), -spl.GetPointP1().toQPointF().y());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VSpline spl = splPath.GetSpline(splPath.Count());
|
||||||
|
path.translate(-spl.GetPointP4().toQPointF().x(), -spl.GetPointP4().toQPointF().y());
|
||||||
|
}
|
||||||
|
spline->setPath(path);
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file vmodelingtriangle.h
|
** @file vtoolcutsplinepath.h
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
** @date November 15, 2013
|
** @date 15 12, 2013
|
||||||
**
|
**
|
||||||
** @brief
|
** @brief
|
||||||
** @copyright
|
** @copyright
|
||||||
|
@ -26,35 +26,23 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef VMODELINGTRIANGLE_H
|
#ifndef VTOOLCUTSPLINEPATH_H
|
||||||
#define VMODELINGTRIANGLE_H
|
#define VTOOLCUTSPLINEPATH_H
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
#include "vtoolpoint.h"
|
||||||
#include "../drawTools/vtooltriangle.h"
|
#include "../../dialogs/dialogcutsplinepath.h"
|
||||||
#include "../../dialogs/dialogtriangle.h"
|
#include "../../widgets/vsimplespline.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VModelingTriangle class
|
* @brief The VToolCutSplinePath class
|
||||||
*/
|
*/
|
||||||
class VModelingTriangle : public VModelingPoint
|
class VToolCutSplinePath : public VToolPoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
/**
|
VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
|
||||||
* @brief VModelingTriangle
|
const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id,
|
||||||
* @param doc dom document container
|
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param axisP1Id
|
|
||||||
* @param axisP2Id
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
|
|
||||||
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
|
||||||
/**
|
/**
|
||||||
* @brief setDialog
|
* @brief setDialog
|
||||||
*/
|
*/
|
||||||
|
@ -62,35 +50,35 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Create
|
* @brief Create
|
||||||
* @param dialog
|
* @param dialog
|
||||||
|
* @param scene
|
||||||
* @param doc dom document container
|
* @param doc dom document container
|
||||||
* @param data
|
* @param data
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
static VModelingTriangle* Create(QSharedPointer<DialogTriangle> &dialog, VDomDocument *doc, VContainer *data);
|
static void Create(QSharedPointer<DialogCutSplinePath> &dialog, VMainGraphicsScene *scene,
|
||||||
|
VDomDocument *doc, VContainer *data);
|
||||||
/**
|
/**
|
||||||
* @brief Create
|
* @brief Create
|
||||||
* @param _id
|
* @param _id
|
||||||
* @param pointName
|
* @param pointName
|
||||||
* @param axisP1Id
|
* @param formula
|
||||||
* @param axisP2Id
|
* @param splineId
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param mx
|
* @param mx
|
||||||
* @param my
|
* @param my
|
||||||
|
* @param scene
|
||||||
* @param doc dom document container
|
* @param doc dom document container
|
||||||
* @param data
|
* @param data
|
||||||
* @param parse
|
* @param parse
|
||||||
* @param typeCreation
|
* @param typeCreation
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id,
|
static void Create(const qint64 _id, const QString &pointName, const QString &formula,
|
||||||
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
|
const qint64 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
const Tool::Sources &typeCreation);
|
||||||
/**
|
/**
|
||||||
* @brief ToolType
|
* @brief ToolType
|
||||||
*/
|
*/
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
|
static const QString AttrSplinePath;
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief FullUpdateFromFile
|
* @brief FullUpdateFromFile
|
||||||
|
@ -101,11 +89,17 @@ public slots:
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
protected:
|
|
||||||
/**
|
/**
|
||||||
* @brief RemoveReferens
|
* @brief SplineChoosed
|
||||||
|
* @param id
|
||||||
*/
|
*/
|
||||||
virtual void RemoveReferens();
|
void SplineChoosed(qint64 id);
|
||||||
|
/**
|
||||||
|
* @brief ChangedActivDraw
|
||||||
|
* @param newName
|
||||||
|
*/
|
||||||
|
virtual void ChangedActivDraw(const QString &newName);
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent
|
* @brief contextMenuEvent
|
||||||
* @param event
|
* @param event
|
||||||
|
@ -115,28 +109,32 @@ protected:
|
||||||
* @brief AddToFile
|
* @brief AddToFile
|
||||||
*/
|
*/
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
|
void RefreshGeometry();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VModelingTriangle)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
/**
|
/**
|
||||||
* @brief axisP1Id
|
* @brief formula keep formula of length
|
||||||
*/
|
*/
|
||||||
qint64 axisP1Id;
|
QString formula;
|
||||||
/**
|
/**
|
||||||
* @brief axisP2Id
|
* @brief splineId keep id of spline
|
||||||
*/
|
*/
|
||||||
qint64 axisP2Id;
|
qint64 splinePathId;
|
||||||
/**
|
/**
|
||||||
* @brief firstPointId
|
* @brief DialogCutSpline pointer to the tool's dialog
|
||||||
*/
|
*/
|
||||||
qint64 firstPointId;
|
QSharedPointer<DialogCutSplinePath> dialogCutSplinePath;
|
||||||
/**
|
/**
|
||||||
* @brief secondPointId
|
* @brief firstSpline
|
||||||
*/
|
*/
|
||||||
qint64 secondPointId;
|
VSimpleSpline *firstSpline;
|
||||||
/**
|
/**
|
||||||
* @brief dialogTriangle
|
* @brief secondSpline
|
||||||
*/
|
*/
|
||||||
QSharedPointer<DialogTriangle> dialogTriangle;
|
VSimpleSpline *secondSpline;
|
||||||
|
const qint64 splPath1id;
|
||||||
|
const qint64 splPath2id;
|
||||||
|
void RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VMODELINGTRIANGLE_H
|
#endif // VTOOLCUTSPLINEPATH_H
|
|
@ -113,7 +113,7 @@ protected:
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief dialogEndLine
|
* @brief dialogEndLine pointer to the dialog
|
||||||
*/
|
*/
|
||||||
QSharedPointer<DialogEndLine> dialogEndLine;
|
QSharedPointer<DialogEndLine> dialogEndLine;
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,7 +131,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
|
||||||
line.setLength(line.length()+step);
|
line.setLength(line.length()+step);
|
||||||
a = QLineF(line.p2(), firstPoint).length();
|
a = QLineF(line.p2(), firstPoint).length();
|
||||||
b = QLineF(line.p2(), secondPoint).length();
|
b = QLineF(line.p2(), secondPoint).length();
|
||||||
if (static_cast<qint32>(c*c) == static_cast<qint32>(a*a + b*b))
|
if (qFuzzyCompare(c*c, a*a + b*b))
|
||||||
{
|
{
|
||||||
QLineF l1(axisP2, firstPoint);
|
QLineF l1(axisP2, firstPoint);
|
||||||
QLineF l2(axisP2, secondPoint);
|
QLineF l2(axisP2, secondPoint);
|
||||||
|
@ -142,6 +142,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
|
||||||
}
|
}
|
||||||
if (c*c < a*a + b*b)
|
if (c*c < a*a + b*b)
|
||||||
{
|
{
|
||||||
|
//Still don't know why this code handled. Need to think about that.
|
||||||
qWarning()<<tr("Can't find point.")<<Q_FUNC_INFO;
|
qWarning()<<tr("Can't find point.")<<Q_FUNC_INFO;
|
||||||
return line.p2();
|
return line.p2();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,174 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingalongline.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingalongline.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingAlongLine::ToolType = QStringLiteral("alongLine");
|
|
||||||
|
|
||||||
VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
|
|
||||||
const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const QString &typeLine,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId),
|
|
||||||
dialogAlongLine(QSharedPointer<DialogAlongLine>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formula = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogAlongLine->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrLength, dialogAlongLine->getFormula());
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
dialogAlongLine.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogAlongLine, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(secondPointId);
|
|
||||||
VModelingLinePoint::RemoveReferens();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingAlongLine::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogAlongLine.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogAlongLine->setTypeLine(typeLine);
|
|
||||||
dialogAlongLine->setFormula(formula);
|
|
||||||
dialogAlongLine->setFirstPointId(basePointId, id);
|
|
||||||
dialogAlongLine->setSecondPointId(secondPointId, id);
|
|
||||||
dialogAlongLine->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingAlongLine *VModelingAlongLine::Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data)
|
|
||||||
{
|
|
||||||
QString formula = dialog->getFormula();
|
|
||||||
qint64 firstPointId = dialog->getFirstPointId();
|
|
||||||
qint64 secondPointId = dialog->getSecondPointId();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
|
|
||||||
const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const qreal &mx, const qreal &my,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingAlongLine *point = 0;
|
|
||||||
VPointF firstPoint = data->GetPointModeling(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPointModeling(secondPointId);
|
|
||||||
QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF());
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
line.setLength(toPixel(result));
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(firstPointId, id);
|
|
||||||
data->AddLine(id, secondPointId);
|
|
||||||
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
|
|
||||||
typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingalongline.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGALONGLINE_H
|
|
||||||
#define VMODELINGALONGLINE_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialogalongline.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingAlongLine class
|
|
||||||
*/
|
|
||||||
class VModelingAlongLine : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingAlongLine
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param formula
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeLine
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
|
|
||||||
const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const QString &typeLine,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingAlongLine* Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param pointName
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
|
|
||||||
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief secondPointId
|
|
||||||
*/
|
|
||||||
qint64 secondPointId;
|
|
||||||
/**
|
|
||||||
* @brief dialogAlongLine
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogAlongLine> dialogAlongLine;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGALONGLINE_H
|
|
|
@ -1,198 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingarc.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingarc.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingArc::TagName = QStringLiteral("arc");
|
|
||||||
const QString VModelingArc::ToolType = QStringLiteral("simple");
|
|
||||||
|
|
||||||
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem *parent)
|
|
||||||
:VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogArc(QSharedPointer<DialogArc>())
|
|
||||||
{
|
|
||||||
this->setPen(QPen(baseColor, widthHairLine));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
RefreshGeometry();
|
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogArc.isNull() == false);
|
|
||||||
VArc arc = VAbstractTool::data.GetArcModeling(id);
|
|
||||||
dialogArc->SetCenter(arc.GetCenter());
|
|
||||||
dialogArc->SetRadius(arc.GetFormulaRadius());
|
|
||||||
dialogArc->SetF1(arc.GetFormulaF1());
|
|
||||||
dialogArc->SetF2(arc.GetFormulaF2());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingArc* VModelingArc::Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 center = dialog->GetCenter();
|
|
||||||
QString radius = dialog->GetRadius();
|
|
||||||
QString f1 = dialog->GetF1();
|
|
||||||
QString f2 = dialog->GetF2();
|
|
||||||
return Create(0, center, radius, f1, f2, doc, data, Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
|
|
||||||
const QString &f2, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingArc *toolArc = 0;
|
|
||||||
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
|
|
||||||
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(radius, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
calcRadius = toPixel(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
errorMsg.clear();
|
|
||||||
result = cal.eval(f1, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
calcF1 = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
errorMsg.clear();
|
|
||||||
result = cal.eval(f2, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
calcF2 = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
VArc arc = VArc(data->DataPointsModeling(), center, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddArcModeling(arc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdateArcModeling(id, arc);
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLengthArc(arc.name(), toMM(arc.GetLength()));
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
toolArc = new VModelingArc(doc, data, id, typeCreation);
|
|
||||||
doc->AddTool(id, toolArc);
|
|
||||||
doc->IncrementReferens(center);
|
|
||||||
}
|
|
||||||
return toolArc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter()));
|
|
||||||
domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
|
|
||||||
domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
|
|
||||||
domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogArc.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogArc, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::AddToFile()
|
|
||||||
{
|
|
||||||
VArc arc = VAbstractTool::data.GetArcModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrCenter, arc.GetCenter());
|
|
||||||
AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius());
|
|
||||||
AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1());
|
|
||||||
AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2());
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, Scene::Arc);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::RemoveReferens()
|
|
||||||
{
|
|
||||||
VArc arc = VAbstractTool::data.GetArcModeling(id);
|
|
||||||
doc->DecrementReferens(arc.GetCenter());
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingArc::RefreshGeometry()
|
|
||||||
{
|
|
||||||
VArc arc = VAbstractTool::data.GetArcModeling(id);
|
|
||||||
QPainterPath path;
|
|
||||||
path.addPath(arc.GetPath());
|
|
||||||
path.setFillRule( Qt::WindingFill );
|
|
||||||
this->setPath(path);
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingarc.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGARC_H
|
|
||||||
#define VMODELINGARC_H
|
|
||||||
|
|
||||||
#include "vmodelingtool.h"
|
|
||||||
#include <QGraphicsPathItem>
|
|
||||||
#include "../../dialogs/dialogarc.h"
|
|
||||||
#include "../../widgets/vcontrolpointspline.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingArc class
|
|
||||||
*/
|
|
||||||
class VModelingArc :public VModelingTool, public QGraphicsPathItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingArc
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingArc* Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param center
|
|
||||||
* @param radius
|
|
||||||
* @param f1
|
|
||||||
* @param f2
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
|
|
||||||
const QString &f2, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief TagName
|
|
||||||
*/
|
|
||||||
static const QString TagName;
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief dialogArc
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogArc> dialogArc;
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry
|
|
||||||
*/
|
|
||||||
void RefreshGeometry();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGARC_H
|
|
|
@ -1,185 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingbisector.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingbisector.h"
|
|
||||||
#include "../drawTools/vtoolbisector.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingBisector::ToolType = QStringLiteral("bisector");
|
|
||||||
|
|
||||||
VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem *parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0),
|
|
||||||
thirdPointId(0), dialogBisector(QSharedPointer<DialogBisector>())
|
|
||||||
{
|
|
||||||
this->firstPointId = firstPointId;
|
|
||||||
this->thirdPointId = thirdPointId;
|
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogBisector.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogBisector->setTypeLine(typeLine);
|
|
||||||
dialogBisector->setFormula(formula);
|
|
||||||
dialogBisector->setFirstPointId(firstPointId, id);
|
|
||||||
dialogBisector->setSecondPointId(basePointId, id);
|
|
||||||
dialogBisector->setThirdPointId(thirdPointId, id);
|
|
||||||
dialogBisector->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingBisector *VModelingBisector::Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data)
|
|
||||||
{
|
|
||||||
QString formula = dialog->getFormula();
|
|
||||||
qint64 firstPointId = dialog->getFirstPointId();
|
|
||||||
qint64 secondPointId = dialog->getSecondPointId();
|
|
||||||
qint64 thirdPointId = dialog->getThirdPointId();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, doc,
|
|
||||||
data, Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &formula,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const qint64 &thirdPointId, const QString &typeLine,
|
|
||||||
const QString &pointName, const qreal &mx, const qreal &my,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingBisector *point = 0;
|
|
||||||
VPointF firstPoint = data->GetPointModeling(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPointModeling(secondPointId);
|
|
||||||
VPointF thirdPoint = data->GetPointModeling(thirdPointId);
|
|
||||||
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
QPointF fPoint = VToolBisector::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(),
|
|
||||||
thirdPoint.toQPointF(), toPixel(result));
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(firstPointId, id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId,
|
|
||||||
thirdPointId, typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
doc->IncrementReferens(thirdPointId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formula = domElement.attribute(AttrLength, "");
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogBisector->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrLength, dialogBisector->getFormula());
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId()));
|
|
||||||
domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogBisector.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogBisector, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, basePointId);
|
|
||||||
AddAttribute(domElement, AttrThirdPoint, thirdPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingBisector::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(firstPointId);
|
|
||||||
doc->DecrementReferens(thirdPointId);
|
|
||||||
VModelingLinePoint::RemoveReferens();
|
|
||||||
}
|
|
|
@ -1,137 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingbisector.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGBISECTOR_H
|
|
||||||
#define VMODELINGBISECTOR_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialogbisector.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingBisector class
|
|
||||||
*/
|
|
||||||
class VModelingBisector : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingBisector
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param thirdPointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const qint64 &thirdPointId, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingBisector* Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param formula
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param thirdPointId
|
|
||||||
* @param typeLine
|
|
||||||
* @param pointName
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
|
|
||||||
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief firstPointId
|
|
||||||
*/
|
|
||||||
qint64 firstPointId;
|
|
||||||
/**
|
|
||||||
* @brief thirdPointId
|
|
||||||
*/
|
|
||||||
qint64 thirdPointId;
|
|
||||||
/**
|
|
||||||
* @brief dialogBisector
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogBisector> dialogBisector;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGBISECTOR_H
|
|
|
@ -1,161 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingendline.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingendline.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingEndLine::ToolType = QStringLiteral("endLine");
|
|
||||||
|
|
||||||
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qreal &angle,
|
|
||||||
const qint64 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
|
|
||||||
dialogEndLine(QSharedPointer<DialogEndLine>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingEndLine::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogEndLine.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogEndLine->setTypeLine(typeLine);
|
|
||||||
dialogEndLine->setFormula(formula);
|
|
||||||
dialogEndLine->setAngle(angle);
|
|
||||||
dialogEndLine->setBasePointId(basePointId, id);
|
|
||||||
dialogEndLine->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingEndLine *VModelingEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
QString formula = dialog->getFormula();
|
|
||||||
qreal angle = dialog->getAngle();
|
|
||||||
qint64 basePointId = dialog->getBasePointId();
|
|
||||||
return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, doc, data, Document::FullParse,
|
|
||||||
Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &pointName,
|
|
||||||
const QString &typeLine, const QString &formula,
|
|
||||||
const qreal &angle, const qint64 &basePointId, const qreal &mx,
|
|
||||||
const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingEndLine *point = 0;
|
|
||||||
VPointF basePoint = data->GetPointModeling(basePointId);
|
|
||||||
QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y()));
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
line.setLength(toPixel(result));
|
|
||||||
line.setAngle(angle);
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(basePointId, id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingEndLine(doc, data, id, typeLine, formula, angle, basePointId, typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(basePointId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingEndLine::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formula = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
|
||||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogEndLine, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingEndLine::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogEndLine->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrLength, dialogEndLine->getFormula());
|
|
||||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle()));
|
|
||||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogEndLine.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingEndLine::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
|
||||||
AddAttribute(domElement, AttrAngle, angle);
|
|
||||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
|
@ -1,121 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingbisector.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGENDLINE_H
|
|
||||||
#define VMODELINGENDLINE_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialogendline.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingEndLine class
|
|
||||||
*/
|
|
||||||
class VModelingEndLine : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingEndLine
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param angle
|
|
||||||
* @param basePointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qreal &angle,
|
|
||||||
const qint64 &basePointId, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param pointName
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param angle
|
|
||||||
* @param basePointId
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
|
|
||||||
const QString &formula, const qreal &angle, const qint64 &basePointId,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief dialogEndLine
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogEndLine> dialogEndLine;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGENDLINE_H
|
|
|
@ -1,163 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingheight.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingheight.h"
|
|
||||||
#include "../drawTools/vtoolheight.h"
|
|
||||||
|
|
||||||
const QString VModelingHeight::ToolType = QStringLiteral("height");
|
|
||||||
|
|
||||||
VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId,
|
|
||||||
const qint64 &p2LineId, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent),
|
|
||||||
dialogHeight(QSharedPointer<DialogHeight>()), p1LineId(p1LineId), p2LineId(p2LineId)
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingHeight::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogHeight.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogHeight->setTypeLine(typeLine);
|
|
||||||
dialogHeight->setBasePointId(basePointId, id);
|
|
||||||
dialogHeight->setP1LineId(p1LineId, id);
|
|
||||||
dialogHeight->setP2LineId(p2LineId, id);
|
|
||||||
dialogHeight->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingHeight *VModelingHeight::Create(QSharedPointer<DialogHeight> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
disconnect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &DialogHeight::UpdateList);
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
qint64 basePointId = dialog->getBasePointId();
|
|
||||||
qint64 p1LineId = dialog->getP1LineId();
|
|
||||||
qint64 p2LineId = dialog->getP2LineId();
|
|
||||||
return Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
|
|
||||||
const qint64 &basePointId, const qint64 &p1LineId,
|
|
||||||
const qint64 &p2LineId, const qreal &mx, const qreal &my,
|
|
||||||
VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingHeight *point = 0;
|
|
||||||
VPointF basePoint = data->GetPointModeling(basePointId);
|
|
||||||
VPointF p1Line = data->GetPointModeling(p1LineId);
|
|
||||||
VPointF p2Line = data->GetPointModeling(p2LineId);
|
|
||||||
|
|
||||||
QPointF pHeight = VToolHeight::FindPoint(QLineF(p1Line.toQPointF(), p2Line.toQPointF()),
|
|
||||||
basePoint.toQPointF());
|
|
||||||
QLineF line = QLineF(basePoint.toQPointF(), pHeight);
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(basePointId, id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId, typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(basePointId);
|
|
||||||
doc->IncrementReferens(p1LineId);
|
|
||||||
doc->IncrementReferens(p2LineId);
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingHeight::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
|
|
||||||
p1LineId = domElement.attribute(AttrP1Line, "").toLongLong();
|
|
||||||
p2LineId = domElement.attribute(AttrP2Line, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingHeight::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogHeight->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId()));
|
|
||||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId()));
|
|
||||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogHeight.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogHeight, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingHeight::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrBasePoint, basePointId);
|
|
||||||
AddAttribute(domElement, AttrP1Line, p1LineId);
|
|
||||||
AddAttribute(domElement, AttrP2Line, p2LineId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingheight.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGHEIGHT_H
|
|
||||||
#define VMODELINGHEIGHT_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialogheight.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingHeight class
|
|
||||||
*/
|
|
||||||
class VModelingHeight : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingHeight
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param basePointId
|
|
||||||
* @param p1LineId
|
|
||||||
* @param p2LineId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId,
|
|
||||||
const qint64 &p2LineId, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingHeight* Create(QSharedPointer<DialogHeight> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param pointName
|
|
||||||
* @param typeLine
|
|
||||||
* @param basePointId
|
|
||||||
* @param p1LineId
|
|
||||||
* @param p2LineId
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
|
|
||||||
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief dialogHeight
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogHeight> dialogHeight;
|
|
||||||
/**
|
|
||||||
* @brief p1LineId
|
|
||||||
*/
|
|
||||||
qint64 p1LineId;
|
|
||||||
/**
|
|
||||||
* @brief p2LineId
|
|
||||||
*/
|
|
||||||
qint64 p2LineId;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGHEIGHT_H
|
|
|
@ -1,157 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingline.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingline.h"
|
|
||||||
|
|
||||||
const QString VModelingLine::TagName = QStringLiteral("line");
|
|
||||||
|
|
||||||
VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
|
|
||||||
qint64 secondPoint, const Tool::Sources &typeCreation, QGraphicsItem *parent):
|
|
||||||
VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint),
|
|
||||||
secondPoint(secondPoint), dialogLine(QSharedPointer<DialogLine>())
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
//TODO translate please
|
|
||||||
//Лінія
|
|
||||||
VPointF first = data->GetPointModeling(firstPoint);
|
|
||||||
VPointF second = data->GetPointModeling(secondPoint);
|
|
||||||
this->setLine(QLineF(first.toQPointF(), second.toQPointF()));
|
|
||||||
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::setDialog()
|
|
||||||
{
|
|
||||||
dialogLine->setFirstPoint(firstPoint);
|
|
||||||
dialogLine->setSecondPoint(secondPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingLine *VModelingLine::Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 firstPoint = dialog->getFirstPoint();
|
|
||||||
qint64 secondPoint = dialog->getSecondPoint();
|
|
||||||
return Create(0, firstPoint, secondPoint, doc, data, Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingLine *line = 0;
|
|
||||||
Q_ASSERT(doc != 0);
|
|
||||||
Q_ASSERT(data != 0);
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->getNextId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
data->UpdateId(id);
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(firstPoint, secondPoint, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation);
|
|
||||||
doc->AddTool(id, line);
|
|
||||||
doc->IncrementReferens(firstPoint);
|
|
||||||
doc->IncrementReferens(secondPoint);
|
|
||||||
}
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
VPointF first = VAbstractTool::data.GetPointModeling(firstPoint);
|
|
||||||
VPointF second = VAbstractTool::data.GetPointModeling(secondPoint);
|
|
||||||
this->setLine(QLineF(first.toQPointF(), second.toQPointF()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogLine.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogLine, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::AddToFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPoint);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPoint);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLine::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(firstPoint);
|
|
||||||
doc->DecrementReferens(secondPoint);
|
|
||||||
}
|
|
|
@ -1,139 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingline.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGLINE_H
|
|
||||||
#define VMODELINGLINE_H
|
|
||||||
|
|
||||||
#include "vmodelingtool.h"
|
|
||||||
#include <QGraphicsLineItem>
|
|
||||||
#include "../../dialogs/dialogline.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingLine class
|
|
||||||
*/
|
|
||||||
class VModelingLine: public VModelingTool, public QGraphicsLineItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingLine
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param firstPoint
|
|
||||||
* @param secondPoint
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
|
|
||||||
qint64 secondPoint, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param firstPoint
|
|
||||||
* @param secondPoint
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief TagName
|
|
||||||
*/
|
|
||||||
static const QString TagName;
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief firstPoint
|
|
||||||
*/
|
|
||||||
qint64 firstPoint;
|
|
||||||
/**
|
|
||||||
* @brief secondPoint
|
|
||||||
*/
|
|
||||||
qint64 secondPoint;
|
|
||||||
/**
|
|
||||||
* @brief dialogLine
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogLine> dialogLine;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGLINE_H
|
|
|
@ -1,180 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelinglineintersect.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelinglineintersect.h"
|
|
||||||
|
|
||||||
const QString VModelingLineIntersect::ToolType = QStringLiteral("lineIntersect");
|
|
||||||
|
|
||||||
VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
|
||||||
const qint64 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2),
|
|
||||||
p2Line2(p2Line2), dialogLineIntersect(QSharedPointer<DialogLineIntersect>())
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogLineIntersect.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogLineIntersect->setP1Line1(p1Line1);
|
|
||||||
dialogLineIntersect->setP2Line1(p2Line1);
|
|
||||||
dialogLineIntersect->setP1Line2(p1Line2);
|
|
||||||
dialogLineIntersect->setP2Line2(p2Line2);
|
|
||||||
dialogLineIntersect->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingLineIntersect *VModelingLineIntersect::Create(QSharedPointer<DialogLineIntersect> &dialog,
|
|
||||||
VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 p1Line1Id = dialog->getP1Line1();
|
|
||||||
qint64 p2Line1Id = dialog->getP2Line1();
|
|
||||||
qint64 p1Line2Id = dialog->getP1Line2();
|
|
||||||
qint64 p2Line2Id = dialog->getP2Line2();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id,
|
|
||||||
const qint64 &p2Line1Id, const qint64 &p1Line2Id,
|
|
||||||
const qint64 &p2Line2Id, const QString &pointName,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingLineIntersect *point = 0;
|
|
||||||
VPointF p1Line1 = data->GetPointModeling(p1Line1Id);
|
|
||||||
VPointF p2Line1 = data->GetPointModeling(p2Line1Id);
|
|
||||||
VPointF p1Line2 = data->GetPointModeling(p1Line2Id);
|
|
||||||
VPointF p2Line2 = data->GetPointModeling(p2Line2Id);
|
|
||||||
|
|
||||||
QLineF line1(p1Line1.toQPointF(), p2Line1.toQPointF());
|
|
||||||
QLineF line2(p1Line2.toQPointF(), p2Line2.toQPointF());
|
|
||||||
QPointF fPoint;
|
|
||||||
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
|
||||||
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
|
|
||||||
{
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(p1Line1Id, id, Draw::Modeling);
|
|
||||||
data->AddLine(id, p2Line1Id, Draw::Modeling);
|
|
||||||
data->AddLine(p1Line2Id, id, Draw::Modeling);
|
|
||||||
data->AddLine(id, p2Line2Id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id,
|
|
||||||
typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(p1Line1Id);
|
|
||||||
doc->IncrementReferens(p2Line1Id);
|
|
||||||
doc->IncrementReferens(p1Line2Id);
|
|
||||||
doc->IncrementReferens(p2Line2Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong();
|
|
||||||
p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong();
|
|
||||||
p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong();
|
|
||||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogLineIntersect->getPointName());
|
|
||||||
domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1()));
|
|
||||||
domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1()));
|
|
||||||
domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2()));
|
|
||||||
domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogLineIntersect.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogLineIntersect, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrP1Line1, p1Line1);
|
|
||||||
AddAttribute(domElement, AttrP2Line1, p2Line1);
|
|
||||||
AddAttribute(domElement, AttrP1Line2, p1Line2);
|
|
||||||
AddAttribute(domElement, AttrP2Line2, p2Line2);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLineIntersect::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(p1Line1);
|
|
||||||
doc->DecrementReferens(p2Line1);
|
|
||||||
doc->DecrementReferens(p1Line2);
|
|
||||||
doc->DecrementReferens(p2Line2);
|
|
||||||
}
|
|
|
@ -1,143 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelinglineintersect.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGLINEINTERSECT_H
|
|
||||||
#define VMODELINGLINEINTERSECT_H
|
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
|
||||||
#include "../../dialogs/dialoglineintersect.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingLineIntersect class
|
|
||||||
*/
|
|
||||||
class VModelingLineIntersect:public VModelingPoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingLineIntersect
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param p1Line1
|
|
||||||
* @param p2Line1
|
|
||||||
* @param p1Line2
|
|
||||||
* @param p2Line2
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const qint64 &p1Line1, const qint64 &p2Line1,
|
|
||||||
const qint64 &p1Line2, const qint64 &p2Line2,
|
|
||||||
const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingLineIntersect* Create(QSharedPointer<DialogLineIntersect> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param p1Line1Id
|
|
||||||
* @param p2Line1Id
|
|
||||||
* @param p1Line2Id
|
|
||||||
* @param p2Line2Id
|
|
||||||
* @param pointName
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
|
|
||||||
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief p1Line1
|
|
||||||
*/
|
|
||||||
qint64 p1Line1;
|
|
||||||
/**
|
|
||||||
* @brief p2Line1
|
|
||||||
*/
|
|
||||||
qint64 p2Line1;
|
|
||||||
/**
|
|
||||||
* @brief p1Line2
|
|
||||||
*/
|
|
||||||
qint64 p1Line2;
|
|
||||||
/**
|
|
||||||
* @brief p2Line2
|
|
||||||
*/
|
|
||||||
qint64 p2Line2;
|
|
||||||
/**
|
|
||||||
* @brief dialogLineIntersect
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogLineIntersect> dialogLineIntersect;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGLINEINTERSECT_H
|
|
|
@ -1,67 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelinglinepoint.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
|
|
||||||
VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qint64 &basePointId,
|
|
||||||
const qreal &angle, QGraphicsItem *parent)
|
|
||||||
:VModelingPoint(doc, data, id, parent), typeLine(typeLine), formula(formula), angle(angle),
|
|
||||||
basePointId(basePointId), mainLine(0)
|
|
||||||
{
|
|
||||||
//Лінія, що з'єднує дві точки
|
|
||||||
QPointF point1 = data->GetPointModeling(basePointId).toQPointF();
|
|
||||||
QPointF point2 = data->GetPointModeling(id).toQPointF();
|
|
||||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if (typeLine == TypeLineNone)
|
|
||||||
{
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingLinePoint::RefreshGeometry()
|
|
||||||
{
|
|
||||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPointModeling(id));
|
|
||||||
QPointF point = VModelingTool::data.GetPointModeling(id).toQPointF();
|
|
||||||
QPointF basePoint = VModelingTool::data.GetPointModeling(basePointId).toQPointF();
|
|
||||||
mainLine->setLine(QLineF(basePoint - point, QPointF()));
|
|
||||||
if (typeLine == TypeLineNone)
|
|
||||||
{
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelinglinepoint.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGLINEPOINT_H
|
|
||||||
#define VMODELINGLINEPOINT_H
|
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingLinePoint class
|
|
||||||
*/
|
|
||||||
class VModelingLinePoint : public VModelingPoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingLinePoint
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param basePointId
|
|
||||||
* @param angle
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
|
||||||
const QString &formula, const qint64 &basePointId, const qreal &angle,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief typeLine
|
|
||||||
*/
|
|
||||||
QString typeLine;
|
|
||||||
/**
|
|
||||||
* @brief formula
|
|
||||||
*/
|
|
||||||
QString formula;
|
|
||||||
/**
|
|
||||||
* @brief angle
|
|
||||||
*/
|
|
||||||
qreal angle;
|
|
||||||
/**
|
|
||||||
* @brief basePointId
|
|
||||||
*/
|
|
||||||
qint64 basePointId;
|
|
||||||
/**
|
|
||||||
* @brief mainLine
|
|
||||||
*/
|
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry
|
|
||||||
*/
|
|
||||||
virtual void RefreshGeometry();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens() {doc->DecrementReferens(basePointId);}
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VModelingLinePoint)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGLINEPOINT_H
|
|
|
@ -1,175 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingnormal.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingnormal.h"
|
|
||||||
#include "../drawTools/vtoolnormal.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingNormal::ToolType = QStringLiteral("normal");
|
|
||||||
|
|
||||||
VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
|
||||||
const QString &formula, const qreal &angle, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
|
|
||||||
secondPointId(secondPointId), dialogNormal(QSharedPointer<DialogNormal>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogNormal.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogNormal->setTypeLine(typeLine);
|
|
||||||
dialogNormal->setFormula(formula);
|
|
||||||
dialogNormal->setAngle(angle);
|
|
||||||
dialogNormal->setFirstPointId(basePointId, id);
|
|
||||||
dialogNormal->setSecondPointId(secondPointId, id);
|
|
||||||
dialogNormal->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingNormal* VModelingNormal::Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
QString formula = dialog->getFormula();
|
|
||||||
qint64 firstPointId = dialog->getFirstPointId();
|
|
||||||
qint64 secondPointId = dialog->getSecondPointId();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
qreal angle = dialog->getAngle();
|
|
||||||
return Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
|
|
||||||
const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingNormal *point = 0;
|
|
||||||
VPointF firstPoint = data->GetPointModeling(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPointModeling(secondPointId);
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
QPointF fPoint = VToolNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(),
|
|
||||||
toPixel(result), angle);
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(firstPointId, id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingNormal(doc, data, id, typeLine, formula, angle, firstPointId, secondPointId,
|
|
||||||
typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formula = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
angle = domElement.attribute(AttrAngle, "").toInt();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogNormal->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrLength, dialogNormal->getFormula());
|
|
||||||
domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle()));
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogNormal.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogNormal, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
|
||||||
AddAttribute(domElement, AttrAngle, angle);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, basePointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingNormal::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(secondPointId);
|
|
||||||
VModelingLinePoint::RemoveReferens();
|
|
||||||
}
|
|
|
@ -1,132 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingnormal.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGNORMAL_H
|
|
||||||
#define VMODELINGNORMAL_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialognormal.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingNormal class
|
|
||||||
*/
|
|
||||||
class VModelingNormal : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingNormal
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param angle
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qreal &angle,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingNormal* Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param formula
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeLine
|
|
||||||
* @param pointName
|
|
||||||
* @param angle
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
|
|
||||||
const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief secondPointId
|
|
||||||
*/
|
|
||||||
qint64 secondPointId;
|
|
||||||
/**
|
|
||||||
* @brief dialogNormal
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogNormal> dialogNormal;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGNORMAL_H
|
|
|
@ -1,121 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpoint.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
|
||||||
#include "../../container/vpointf.h"
|
|
||||||
|
|
||||||
const QString VModelingPoint::TagName = QStringLiteral("point");
|
|
||||||
|
|
||||||
VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent)
|
|
||||||
:VModelingTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0)
|
|
||||||
{
|
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
|
||||||
lineName = new QGraphicsLineItem(this);
|
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
|
||||||
&VModelingPoint::NameChangePosition);
|
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::NameChangePosition(const QPointF &pos)
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QPointF p = pos - this->pos();
|
|
||||||
point.setMx(p.x());
|
|
||||||
point.setMy(p.y());
|
|
||||||
RefreshLine();
|
|
||||||
UpdateNamePosition(point.mx(), point.my());
|
|
||||||
VAbstractTool::data.UpdatePoint(id, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::UpdateNamePosition(qreal mx, qreal my)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
|
|
||||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
|
|
||||||
emit toolhaveChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, Scene::Point);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::RefreshPointGeometry(const VPointF &point)
|
|
||||||
{
|
|
||||||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
|
||||||
rec.translate(-rec.center().x(), -rec.center().y());
|
|
||||||
this->setRect(rec);
|
|
||||||
this->setPos(point.toQPointF());
|
|
||||||
disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
|
||||||
&VModelingPoint::NameChangePosition);
|
|
||||||
namePoint->setText(point.name());
|
|
||||||
namePoint->setPos(QPointF(point.mx(), point.my()));
|
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
|
||||||
&VModelingPoint::NameChangePosition);
|
|
||||||
RefreshLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPoint::RefreshLine()
|
|
||||||
{
|
|
||||||
QRectF nameRec = namePoint->sceneBoundingRect();
|
|
||||||
QPointF p1, p2;
|
|
||||||
LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
|
|
||||||
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
|
||||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
|
||||||
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4))
|
|
||||||
{
|
|
||||||
lineName->setVisible(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineName->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpoint.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGPOINT_H
|
|
||||||
#define VMODELINGPOINT_H
|
|
||||||
|
|
||||||
#include "vmodelingtool.h"
|
|
||||||
#include "../../widgets/vgraphicssimpletextitem.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingPoint class
|
|
||||||
*/
|
|
||||||
class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingPoint
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
|
|
||||||
virtual ~VModelingPoint() {}
|
|
||||||
/**
|
|
||||||
* @brief TagName
|
|
||||||
*/
|
|
||||||
static const QString TagName;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief NameChangePosition
|
|
||||||
* @param pos
|
|
||||||
*/
|
|
||||||
void NameChangePosition(const QPointF &pos);
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result) = 0;
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief radius
|
|
||||||
*/
|
|
||||||
qreal radius;
|
|
||||||
/**
|
|
||||||
* @brief namePoint
|
|
||||||
*/
|
|
||||||
VGraphicsSimpleTextItem *namePoint;
|
|
||||||
/**
|
|
||||||
* @brief lineName
|
|
||||||
*/
|
|
||||||
QGraphicsLineItem *lineName;
|
|
||||||
/**
|
|
||||||
* @brief UpdateNamePosition
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
*/
|
|
||||||
virtual void UpdateNamePosition(qreal mx, qreal my);
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief RefreshPointGeometry
|
|
||||||
* @param point
|
|
||||||
*/
|
|
||||||
virtual void RefreshPointGeometry(const VPointF &point);
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine
|
|
||||||
*/
|
|
||||||
void RefreshLine();
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VModelingPoint)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGPOINT_H
|
|
|
@ -1,177 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpointofcontact.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingpointofcontact.h"
|
|
||||||
#include "../drawTools/vtoolpointofcontact.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingPointOfContact::ToolType = QStringLiteral("pointOfContact");
|
|
||||||
|
|
||||||
VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &radius, const qint64 ¢er,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
: VModelingPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId),
|
|
||||||
secondPointId(secondPointId), dialogPointOfContact(QSharedPointer<DialogPointOfContact>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogPointOfContact.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogPointOfContact->setRadius(radius);
|
|
||||||
dialogPointOfContact->setCenter(center, id);
|
|
||||||
dialogPointOfContact->setFirstPoint(firstPointId, id);
|
|
||||||
dialogPointOfContact->setSecondPoint(secondPointId, id);
|
|
||||||
dialogPointOfContact->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingPointOfContact *VModelingPointOfContact::Create(QSharedPointer<DialogPointOfContact> &dialog,
|
|
||||||
VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
QString radius = dialog->getRadius();
|
|
||||||
qint64 center = dialog->getCenter();
|
|
||||||
qint64 firstPointId = dialog->getFirstPoint();
|
|
||||||
qint64 secondPointId = dialog->getSecondPoint();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const QString &radius,
|
|
||||||
const qint64 ¢er, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId,
|
|
||||||
const QString &pointName, const qreal &mx,
|
|
||||||
const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingPointOfContact *point = 0;
|
|
||||||
VPointF centerP = data->GetPointModeling(center);
|
|
||||||
VPointF firstP = data->GetPointModeling(firstPointId);
|
|
||||||
VPointF secondP = data->GetPointModeling(secondPointId);
|
|
||||||
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(radius, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP.toQPointF(),
|
|
||||||
firstP.toQPointF(), secondP.toQPointF());
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingPointOfContact(doc, data, id, radius, center, firstPointId, secondPointId,
|
|
||||||
typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(center);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
radius = domElement.attribute(AttrRadius, "");
|
|
||||||
center = domElement.attribute(AttrCenter, "").toLongLong();
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshPointGeometry(VAbstractTool::data.GetPointModeling(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogPointOfContact->getPointName());
|
|
||||||
domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius());
|
|
||||||
domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter()));
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogPointOfContact.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogPointOfContact, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrRadius, radius);
|
|
||||||
AddAttribute(domElement, AttrCenter, center);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfContact::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(center);
|
|
||||||
doc->DecrementReferens(firstPointId);
|
|
||||||
doc->DecrementReferens(secondPointId);
|
|
||||||
}
|
|
|
@ -1,144 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpointofcontact.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGPOINTOFCONTACT_H
|
|
||||||
#define VMODELINGPOINTOFCONTACT_H
|
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
|
||||||
#include "../../dialogs/dialogpointofcontact.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingPointOfContact class
|
|
||||||
*/
|
|
||||||
class VModelingPointOfContact : public VModelingPoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingPointOfContact
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param radius
|
|
||||||
* @param center
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &radius, const qint64 ¢er,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingPointOfContact* Create(QSharedPointer<DialogPointOfContact> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param radius
|
|
||||||
* @param center
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param pointName
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 ¢er,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const QString &pointName, const qreal &mx, const qreal &my,
|
|
||||||
VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief radius
|
|
||||||
*/
|
|
||||||
QString radius;
|
|
||||||
/**
|
|
||||||
* @brief center
|
|
||||||
*/
|
|
||||||
qint64 center;
|
|
||||||
/**
|
|
||||||
* @brief firstPointId
|
|
||||||
*/
|
|
||||||
qint64 firstPointId;
|
|
||||||
/**
|
|
||||||
* @brief secondPointId
|
|
||||||
*/
|
|
||||||
qint64 secondPointId;
|
|
||||||
/**
|
|
||||||
* @brief dialogPointOfContact
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogPointOfContact> dialogPointOfContact;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGPOINTOFCONTACT_H
|
|
|
@ -1,152 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpointofintersection.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingpointofintersection.h"
|
|
||||||
|
|
||||||
const QString VModelingPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
|
|
||||||
|
|
||||||
VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId),
|
|
||||||
dialogPointOfIntersection(QSharedPointer<DialogPointOfIntersection>())
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogPointOfIntersection.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPoint(id);
|
|
||||||
dialogPointOfIntersection->setFirstPointId(firstPointId, id);
|
|
||||||
dialogPointOfIntersection->setSecondPointId(secondPointId, id);
|
|
||||||
dialogPointOfIntersection->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingPointOfIntersection *VModelingPointOfIntersection::Create(QSharedPointer<DialogPointOfIntersection> &dialog,
|
|
||||||
VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 firstPointId = dialog->getFirstPointId();
|
|
||||||
qint64 secondPointId = dialog->getSecondPointId();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, pointName, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64 _id, const QString &pointName,
|
|
||||||
const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const qreal &mx,
|
|
||||||
const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingPointOfIntersection *tool = 0;
|
|
||||||
VPointF firstPoint = data->GetPoint(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPoint(secondPointId);
|
|
||||||
|
|
||||||
QPointF point(firstPoint.x(), secondPoint.y());
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
tool = new VModelingPointOfIntersection(doc, data, id, firstPointId, secondPointId, typeCreation);
|
|
||||||
doc->AddTool(id, tool);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
return tool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName());
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogPointOfIntersection.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(firstPointId);
|
|
||||||
doc->DecrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogPointOfIntersection, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingPointOfIntersection::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
|
@ -1,131 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingpointofintersection.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGPOINTOFINTERSECTION_H
|
|
||||||
#define VMODELINGPOINTOFINTERSECTION_H
|
|
||||||
|
|
||||||
#include "vmodelingpoint.h"
|
|
||||||
#include "../../dialogs/dialogpointofintersection.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingPointOfIntersection class
|
|
||||||
*/
|
|
||||||
class VModelingPointOfIntersection : public VModelingPoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingPointOfIntersection
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingPointOfIntersection* Create(QSharedPointer<DialogPointOfIntersection> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param pointName
|
|
||||||
* @param firstPointId
|
|
||||||
* @param secondPointId
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingPointOfIntersection* Create(const qint64 _id, const QString &pointName,
|
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VModelingPointOfIntersection)
|
|
||||||
/**
|
|
||||||
* @brief firstPointId
|
|
||||||
*/
|
|
||||||
qint64 firstPointId;
|
|
||||||
/**
|
|
||||||
* @brief secondPointId
|
|
||||||
*/
|
|
||||||
qint64 secondPointId;
|
|
||||||
/**
|
|
||||||
* @brief dialogPointOfIntersection
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogPointOfIntersection> dialogPointOfIntersection;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGPOINTOFINTERSECTION_H
|
|
|
@ -1,184 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingshoulderpoint.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingshoulderpoint.h"
|
|
||||||
#include "../drawTools/vtoolshoulderpoint.h"
|
|
||||||
#include "../../container/calculator.h"
|
|
||||||
|
|
||||||
const QString VModelingShoulderPoint::ToolType = QStringLiteral("shoulder");
|
|
||||||
|
|
||||||
VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|
||||||
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
|
||||||
const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent)
|
|
||||||
:VModelingLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line),
|
|
||||||
pShoulder(pShoulder), dialogShoulderPoint(QSharedPointer<DialogShoulderPoint>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogShoulderPoint.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
dialogShoulderPoint->setTypeLine(typeLine);
|
|
||||||
dialogShoulderPoint->setFormula(formula);
|
|
||||||
dialogShoulderPoint->setP1Line(basePointId, id);
|
|
||||||
dialogShoulderPoint->setP2Line(p2Line, id);
|
|
||||||
dialogShoulderPoint->setPShoulder(pShoulder, id);
|
|
||||||
dialogShoulderPoint->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingShoulderPoint *VModelingShoulderPoint::Create(QSharedPointer<DialogShoulderPoint> &dialog,
|
|
||||||
VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
QString formula = dialog->getFormula();
|
|
||||||
qint64 p1Line = dialog->getP1Line();
|
|
||||||
qint64 p2Line = dialog->getP2Line();
|
|
||||||
qint64 pShoulder = dialog->getPShoulder();
|
|
||||||
QString typeLine = dialog->getTypeLine();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, doc, data,
|
|
||||||
Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const QString &formula,
|
|
||||||
const qint64 &p1Line, const qint64 &p2Line,
|
|
||||||
const qint64 &pShoulder, const QString &typeLine,
|
|
||||||
const QString &pointName, const qreal &mx,
|
|
||||||
const qreal &my, VDomDocument *doc, VContainer *data,
|
|
||||||
const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingShoulderPoint *point = 0;
|
|
||||||
VPointF firstPoint = data->GetPointModeling(p1Line);
|
|
||||||
VPointF secondPoint = data->GetPointModeling(p2Line);
|
|
||||||
VPointF shoulderPoint = data->GetPointModeling(pShoulder);
|
|
||||||
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if (errorMsg.isEmpty())
|
|
||||||
{
|
|
||||||
QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(),
|
|
||||||
shoulderPoint.toQPointF(), toPixel(result));
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPointModeling(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePointModeling(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLine(p1Line, id, Draw::Modeling);
|
|
||||||
data->AddLine(p2Line, id, Draw::Modeling);
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
point = new VModelingShoulderPoint(doc, data, id, typeLine, formula, p1Line, p2Line, pShoulder,
|
|
||||||
typeCreation);
|
|
||||||
doc->AddTool(id, point);
|
|
||||||
doc->IncrementReferens(p1Line);
|
|
||||||
doc->IncrementReferens(p2Line);
|
|
||||||
doc->IncrementReferens(pShoulder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formula = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrP1Line, "").toLongLong();
|
|
||||||
p2Line = domElement.attribute(AttrP2Line, "").toLongLong();
|
|
||||||
pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName());
|
|
||||||
domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine());
|
|
||||||
domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula());
|
|
||||||
domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line()));
|
|
||||||
domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line()));
|
|
||||||
domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogShoulderPoint.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogShoulderPoint, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrTypeLine, typeLine);
|
|
||||||
AddAttribute(domElement, AttrLength, formula);
|
|
||||||
AddAttribute(domElement, AttrP1Line, basePointId);
|
|
||||||
AddAttribute(domElement, AttrP2Line, p2Line);
|
|
||||||
AddAttribute(domElement, AttrPShoulder, pShoulder);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingShoulderPoint::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(p2Line);
|
|
||||||
doc->DecrementReferens(pShoulder);
|
|
||||||
VModelingLinePoint::RemoveReferens();
|
|
||||||
}
|
|
|
@ -1,137 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingshoulderpoint.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGSHOULDERPOINT_H
|
|
||||||
#define VMODELINGSHOULDERPOINT_H
|
|
||||||
|
|
||||||
#include "vmodelinglinepoint.h"
|
|
||||||
#include "../../dialogs/dialogshoulderpoint.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingShoulderPoint class
|
|
||||||
*/
|
|
||||||
class VModelingShoulderPoint : public VModelingLinePoint
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingShoulderPoint
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeLine
|
|
||||||
* @param formula
|
|
||||||
* @param p1Line
|
|
||||||
* @param p2Line
|
|
||||||
* @param pShoulder
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
|
||||||
const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
|
|
||||||
const qint64 &pShoulder, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingShoulderPoint* Create(QSharedPointer<DialogShoulderPoint> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param formula
|
|
||||||
* @param p1Line
|
|
||||||
* @param p2Line
|
|
||||||
* @param pShoulder
|
|
||||||
* @param typeLine
|
|
||||||
* @param pointName
|
|
||||||
* @param mx
|
|
||||||
* @param my
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line,
|
|
||||||
const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine,
|
|
||||||
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief p2Line
|
|
||||||
*/
|
|
||||||
qint64 p2Line;
|
|
||||||
/**
|
|
||||||
* @brief pShoulder
|
|
||||||
*/
|
|
||||||
qint64 pShoulder;
|
|
||||||
/**
|
|
||||||
* @brief dialogShoulderPoint
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogShoulderPoint> dialogShoulderPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGSHOULDERPOINT_H
|
|
|
@ -1,273 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingspline.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingspline.h"
|
|
||||||
#include "../../geometry/vspline.h"
|
|
||||||
|
|
||||||
const QString VModelingSpline::TagName = QStringLiteral("spline");
|
|
||||||
const QString VModelingSpline::ToolType = QStringLiteral("simple");
|
|
||||||
|
|
||||||
VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem *parent)
|
|
||||||
:VModelingTool(doc, data, id), QGraphicsPathItem(parent),
|
|
||||||
dialogSpline(QSharedPointer<DialogSpline>()), controlPoints(QVector<VControlPointSpline *>())
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
VSpline spl = data->GetSplineModeling(id);
|
|
||||||
QPainterPath path;
|
|
||||||
path.addPath(spl.GetPath());
|
|
||||||
path.setFillRule( Qt::WindingFill );
|
|
||||||
this->setPath(path);
|
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
|
|
||||||
VControlPointSpline *controlPoint1 = new VControlPointSpline(1, SplinePoint::FirstPoint, spl.GetP2(),
|
|
||||||
spl.GetPointP1().toQPointF(), this);
|
|
||||||
connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
connect(this, &VModelingSpline::RefreshLine, controlPoint1, &VControlPointSpline::RefreshLine);
|
|
||||||
connect(this, &VModelingSpline::setEnabledPoint, controlPoint1, &VControlPointSpline::setEnabledPoint);
|
|
||||||
controlPoints.append(controlPoint1);
|
|
||||||
|
|
||||||
VControlPointSpline *controlPoint2 = new VControlPointSpline(1, SplinePoint::LastPoint, spl.GetP3(),
|
|
||||||
spl.GetPointP4().toQPointF(), this);
|
|
||||||
connect(controlPoint2, &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
connect(this, &VModelingSpline::RefreshLine, controlPoint2, &VControlPointSpline::RefreshLine);
|
|
||||||
connect(this, &VModelingSpline::setEnabledPoint, controlPoint2, &VControlPointSpline::setEnabledPoint);
|
|
||||||
controlPoints.append(controlPoint2);
|
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogSpline.isNull() == false);
|
|
||||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
|
||||||
dialogSpline->setP1(spl.GetP1());
|
|
||||||
dialogSpline->setP4(spl.GetP4());
|
|
||||||
dialogSpline->setAngle1(spl.GetAngle1());
|
|
||||||
dialogSpline->setAngle2(spl.GetAngle2());
|
|
||||||
dialogSpline->setKAsm1(spl.GetKasm1());
|
|
||||||
dialogSpline->setKAsm2(spl.GetKasm2());
|
|
||||||
dialogSpline->setKCurve(spl.GetKcurve());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingSpline *VModelingSpline::Create(QSharedPointer<DialogSpline> &dialog, VDomDocument *doc, VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 p1 = dialog->getP1();
|
|
||||||
qint64 p4 = dialog->getP4();
|
|
||||||
qreal kAsm1 = dialog->getKAsm1();
|
|
||||||
qreal kAsm2 = dialog->getKAsm2();
|
|
||||||
qreal angle1 = dialog->getAngle1();
|
|
||||||
qreal angle2 = dialog->getAngle2();
|
|
||||||
qreal kCurve = dialog->getKCurve();
|
|
||||||
return Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, doc, data, Document::FullParse,
|
|
||||||
Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4,
|
|
||||||
const qreal &kAsm1, const qreal kAsm2, const qreal &angle1,
|
|
||||||
const qreal &angle2, const qreal &kCurve, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingSpline *spl = 0;
|
|
||||||
VSpline spline = VSpline(data->DataPointsModeling(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddSplineModeling(spline);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdateSplineModeling(id, spline);
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLengthSpline(spline.name(), toMM(spline.GetLength()));
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
spl = new VModelingSpline(doc, data, id, typeCreation);
|
|
||||||
doc->AddTool(id, spl);
|
|
||||||
doc->IncrementReferens(p1);
|
|
||||||
doc->IncrementReferens(p4);
|
|
||||||
}
|
|
||||||
return spl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
VSpline spl = VSpline (VAbstractTool::data.DataPointsModeling(), dialogSpline->getP1(),
|
|
||||||
dialogSpline->getP4(), dialogSpline->getAngle1(), dialogSpline->getAngle2(),
|
|
||||||
dialogSpline->getKAsm1(), dialogSpline->getKAsm2(), dialogSpline->getKCurve());
|
|
||||||
|
|
||||||
disconnect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
disconnect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
controlPoints[0]->setPos(spl.GetP2());
|
|
||||||
controlPoints[1]->setPos(spl.GetP3());
|
|
||||||
connect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
|
|
||||||
spl = VSpline (VAbstractTool::data.DataPointsModeling(), dialogSpline->getP1(),
|
|
||||||
controlPoints[0]->pos(), controlPoints[1]->pos(), dialogSpline->getP4(),
|
|
||||||
dialogSpline->getKCurve());
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1()));
|
|
||||||
domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4()));
|
|
||||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
|
||||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
|
||||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
|
||||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogSpline.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
|
|
||||||
const QPointF &pos)
|
|
||||||
{
|
|
||||||
Q_UNUSED(indexSpline);
|
|
||||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
|
||||||
if (position == SplinePoint::FirstPoint)
|
|
||||||
{
|
|
||||||
spl.ModifiSpl (spl.GetP1(), pos, spl.GetP3(), spl.GetP4(), spl.GetKcurve());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spl.ModifiSpl (spl.GetP1(), spl.GetP2(), pos, spl.GetP4(), spl.GetKcurve());
|
|
||||||
}
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1()));
|
|
||||||
domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2()));
|
|
||||||
domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1()));
|
|
||||||
domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2()));
|
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogSpline, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::AddToFile()
|
|
||||||
{
|
|
||||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrPoint1, spl.GetP1());
|
|
||||||
AddAttribute(domElement, AttrPoint4, spl.GetP4());
|
|
||||||
AddAttribute(domElement, AttrAngle1, spl.GetAngle1());
|
|
||||||
AddAttribute(domElement, AttrAngle2, spl.GetAngle2());
|
|
||||||
AddAttribute(domElement, AttrKAsm1, spl.GetKasm1());
|
|
||||||
AddAttribute(domElement, AttrKAsm2, spl.GetKasm2());
|
|
||||||
AddAttribute(domElement, AttrKCurve, spl.GetKcurve());
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, Scene::Spline);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::RemoveReferens()
|
|
||||||
{
|
|
||||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
|
||||||
doc->DecrementReferens(spl.GetP1());
|
|
||||||
doc->DecrementReferens(spl.GetP4());
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSpline::RefreshGeometry()
|
|
||||||
{
|
|
||||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
|
||||||
QPainterPath path;
|
|
||||||
path.addPath(spl.GetPath());
|
|
||||||
path.setFillRule( Qt::WindingFill );
|
|
||||||
this->setPath(path);
|
|
||||||
QPointF splinePoint = VAbstractTool::data.GetPointModeling(spl.GetP1()).toQPointF();
|
|
||||||
QPointF controlPoint = spl.GetP2();
|
|
||||||
emit RefreshLine(1, SplinePoint::FirstPoint, controlPoint, splinePoint);
|
|
||||||
splinePoint = VAbstractTool::data.GetPointModeling(spl.GetP4()).toQPointF();
|
|
||||||
controlPoint = spl.GetP3();
|
|
||||||
emit RefreshLine(1, SplinePoint::LastPoint, controlPoint, splinePoint);
|
|
||||||
|
|
||||||
disconnect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
disconnect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
controlPoints[0]->setPos(spl.GetP2());
|
|
||||||
controlPoints[1]->setPos(spl.GetP3());
|
|
||||||
connect(controlPoints[0], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSpline::ControlPointChangePosition);
|
|
||||||
}
|
|
|
@ -1,172 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingspline.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGSPLINE_H
|
|
||||||
#define VMODELINGSPLINE_H
|
|
||||||
|
|
||||||
#include "vmodelingtool.h"
|
|
||||||
#include <QGraphicsPathItem>
|
|
||||||
#include "../../dialogs/dialogspline.h"
|
|
||||||
#include "../../widgets/vcontrolpointspline.h"
|
|
||||||
#include "../../geometry/vsplinepath.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingSpline class
|
|
||||||
*/
|
|
||||||
class VModelingSpline:public VModelingTool, public QGraphicsPathItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingSpline
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 );
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingSpline* Create(QSharedPointer<DialogSpline> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param p1
|
|
||||||
* @param p4
|
|
||||||
* @param kAsm1
|
|
||||||
* @param kAsm2
|
|
||||||
* @param angle1
|
|
||||||
* @param angle2
|
|
||||||
* @param kCurve
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
|
|
||||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief TagName
|
|
||||||
*/
|
|
||||||
static const QString TagName;
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine
|
|
||||||
* @param indexSpline
|
|
||||||
* @param position
|
|
||||||
* @param controlPoint
|
|
||||||
* @param splinePoint
|
|
||||||
*/
|
|
||||||
void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position,
|
|
||||||
const QPointF &controlPoint, const QPointF &splinePoint );
|
|
||||||
/**
|
|
||||||
* @brief setEnabledPoint
|
|
||||||
* @param enable
|
|
||||||
*/
|
|
||||||
void setEnabledPoint ( bool enable );
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile ();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui ( int result );
|
|
||||||
/**
|
|
||||||
* @brief ControlPointChangePosition
|
|
||||||
* @param indexSpline
|
|
||||||
* @param position
|
|
||||||
* @param pos
|
|
||||||
*/
|
|
||||||
void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position,
|
|
||||||
const QPointF &pos);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile ();
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief dialogSpline
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogSpline> dialogSpline;
|
|
||||||
/**
|
|
||||||
* @brief controlPoints
|
|
||||||
*/
|
|
||||||
QVector<VControlPointSpline *> controlPoints;
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry
|
|
||||||
*/
|
|
||||||
void RefreshGeometry ();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGSPLINE_H
|
|
|
@ -1,310 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingsplinepath.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingsplinepath.h"
|
|
||||||
|
|
||||||
const QString VModelingSplinePath::TagName = QStringLiteral("spline");
|
|
||||||
const QString VModelingSplinePath::ToolType = QStringLiteral("path");
|
|
||||||
|
|
||||||
VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingTool(doc, data, id), QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer<DialogSplinePath>()),
|
|
||||||
controlPoints(QVector<VControlPointSpline *>())
|
|
||||||
{
|
|
||||||
ignoreFullUpdate = true;
|
|
||||||
VSplinePath splPath = data->GetSplinePathModeling(id);
|
|
||||||
QPainterPath path;
|
|
||||||
path.addPath(splPath.GetPath());
|
|
||||||
path.setFillRule( Qt::WindingFill );
|
|
||||||
this->setPath(path);
|
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
|
||||||
|
|
||||||
for (qint32 i = 1; i<=splPath.Count(); ++i)
|
|
||||||
{
|
|
||||||
VSpline spl = splPath.GetSpline(i);
|
|
||||||
VControlPointSpline *controlPoint = new VControlPointSpline(i, SplinePoint::FirstPoint, spl.GetP2(),
|
|
||||||
spl.GetPointP1().toQPointF(), this);
|
|
||||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
connect(this, &VModelingSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine);
|
|
||||||
connect(this, &VModelingSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint);
|
|
||||||
controlPoints.append(controlPoint);
|
|
||||||
|
|
||||||
controlPoint = new VControlPointSpline(i, SplinePoint::LastPoint, spl.GetP3(),
|
|
||||||
spl.GetPointP4().toQPointF(), this);
|
|
||||||
connect(controlPoint, &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
connect(this, &VModelingSplinePath::RefreshLine, controlPoint, &VControlPointSpline::RefreshLine);
|
|
||||||
connect(this, &VModelingSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint);
|
|
||||||
controlPoints.append(controlPoint);
|
|
||||||
}
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogSplinePath.isNull() == false);
|
|
||||||
VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id);
|
|
||||||
dialogSplinePath->SetPath(splPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingSplinePath *VModelingSplinePath::Create(QSharedPointer<DialogSplinePath> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data)
|
|
||||||
{
|
|
||||||
VSplinePath path = dialog->GetPath();
|
|
||||||
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
|
||||||
{
|
|
||||||
doc->IncrementReferens(path[i].P());
|
|
||||||
}
|
|
||||||
return Create(0, path, doc, data, Document::FullParse, Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingSplinePath *spl = 0;
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddSplinePathModeling(path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdateSplinePathModeling(id, path);
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->AddLengthSpline(path.name(), toMM(path.GetLength()));
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
spl = new VModelingSplinePath(doc, data, id, typeCreation);
|
|
||||||
doc->AddTool(id, spl);
|
|
||||||
}
|
|
||||||
return spl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
VSplinePath splPath = dialogSplinePath->GetPath();
|
|
||||||
for (qint32 i = 1; i<=splPath.Count(); ++i)
|
|
||||||
{
|
|
||||||
VSpline spl = splPath.GetSpline(i);
|
|
||||||
qint32 j = i*2;
|
|
||||||
disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
controlPoints[j-2]->setPos(spl.GetP2());
|
|
||||||
controlPoints[j-1]->setPos(spl.GetP3());
|
|
||||||
connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
|
|
||||||
spl = VSpline (VAbstractTool::data.DataPointsModeling(), spl.GetP1(), controlPoints[j-2]->pos(),
|
|
||||||
controlPoints[j-1]->pos(), spl.GetP4(), splPath.getKCurve());
|
|
||||||
CorectControlPoints(spl, splPath, i);
|
|
||||||
CorectControlPoints(spl, splPath, i);
|
|
||||||
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
|
||||||
UpdatePathPoint(domElement, splPath);
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogSplinePath.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
|
|
||||||
const QPointF &pos)
|
|
||||||
{
|
|
||||||
VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id);
|
|
||||||
VSpline spl = splPath.GetSpline(indexSpline);
|
|
||||||
if (position == SplinePoint::FirstPoint)
|
|
||||||
{
|
|
||||||
spl.ModifiSpl (spl.GetP1(), pos, spl.GetP3(), spl.GetP4(), spl.GetKcurve());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spl.ModifiSpl (spl.GetP1(), spl.GetP2(), pos, spl.GetP4(), spl.GetKcurve());
|
|
||||||
}
|
|
||||||
|
|
||||||
CorectControlPoints(spl, splPath, indexSpline);
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
|
|
||||||
UpdatePathPoint(domElement, splPath);
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline)
|
|
||||||
{
|
|
||||||
VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint);
|
|
||||||
p.SetAngle(spl.GetAngle1());
|
|
||||||
p.SetKAsm2(spl.GetKasm1());
|
|
||||||
splPath.UpdatePoint(indexSpline, SplinePoint::FirstPoint, p);
|
|
||||||
|
|
||||||
p = splPath.GetSplinePoint(indexSpline, SplinePoint::LastPoint);
|
|
||||||
p.SetAngle(spl.GetAngle2()-180);
|
|
||||||
p.SetKAsm1(spl.GetKasm2());
|
|
||||||
splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path)
|
|
||||||
{
|
|
||||||
QDomNodeList nodeList = node.childNodes();
|
|
||||||
qint32 num = nodeList.size();
|
|
||||||
for (qint32 i = 0; i < num; ++i)
|
|
||||||
{
|
|
||||||
QDomElement domElement = nodeList.at(i).toElement();
|
|
||||||
if (domElement.isNull() == false)
|
|
||||||
{
|
|
||||||
VSplinePoint p = path[i];
|
|
||||||
domElement.setAttribute(AttrPSpline, QString().setNum(p.P()));
|
|
||||||
domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1()));
|
|
||||||
domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2()));
|
|
||||||
domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogSplinePath, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::AddToFile()
|
|
||||||
{
|
|
||||||
VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
|
|
||||||
|
|
||||||
for (qint32 i = 0; i < splPath.CountPoint(); ++i)
|
|
||||||
{
|
|
||||||
AddPathPoint(domElement, splPath[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint)
|
|
||||||
{
|
|
||||||
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
|
||||||
|
|
||||||
AddAttribute(pathPoint, AttrPSpline, splPoint.P());
|
|
||||||
AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
|
|
||||||
AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
|
|
||||||
AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
|
|
||||||
|
|
||||||
domElement.appendChild(pathPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, Scene::SplinePath);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::RemoveReferens()
|
|
||||||
{
|
|
||||||
VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id);
|
|
||||||
for (qint32 i = 0; i < splPath.Count(); ++i)
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(splPath[i].P());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingSplinePath::RefreshGeometry()
|
|
||||||
{
|
|
||||||
VSplinePath splPath = VAbstractTool::data.GetSplinePathModeling(id);
|
|
||||||
QPainterPath path;
|
|
||||||
path.addPath(splPath.GetPath());
|
|
||||||
path.setFillRule( Qt::WindingFill );
|
|
||||||
this->setPath(path);
|
|
||||||
for (qint32 i = 1; i<=splPath.Count(); ++i)
|
|
||||||
{
|
|
||||||
VSpline spl = splPath.GetSpline(i);
|
|
||||||
QPointF splinePoint = spl.GetPointP1().toQPointF();
|
|
||||||
QPointF controlPoint = spl.GetP2();
|
|
||||||
emit RefreshLine(i, SplinePoint::FirstPoint, controlPoint, splinePoint);
|
|
||||||
splinePoint = spl.GetPointP4().toQPointF();
|
|
||||||
controlPoint = spl.GetP3();
|
|
||||||
emit RefreshLine(i, SplinePoint::LastPoint, controlPoint, splinePoint);
|
|
||||||
|
|
||||||
qint32 j = i*2;
|
|
||||||
disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
controlPoints[j-2]->setPos(spl.GetP2());
|
|
||||||
controlPoints[j-1]->setPos(spl.GetP3());
|
|
||||||
connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
|
||||||
&VModelingSplinePath::ControlPointChangePosition);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,183 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingsplinepath.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGSPLINEPATH_H
|
|
||||||
#define VMODELINGSPLINEPATH_H
|
|
||||||
|
|
||||||
#include "vmodelingtool.h"
|
|
||||||
#include <QGraphicsPathItem>
|
|
||||||
#include "../../dialogs/dialogsplinepath.h"
|
|
||||||
#include "../../widgets/vcontrolpointspline.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingSplinePath class
|
|
||||||
*/
|
|
||||||
class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingSplinePath
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param typeCreation
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation,
|
|
||||||
QGraphicsItem * parent = 0);
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog();
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param dialog
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingSplinePath* Create(QSharedPointer<DialogSplinePath> &dialog, VDomDocument *doc, VContainer *data);
|
|
||||||
/**
|
|
||||||
* @brief Create
|
|
||||||
* @param _id
|
|
||||||
* @param path
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param parse
|
|
||||||
* @param typeCreation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc,
|
|
||||||
VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation);
|
|
||||||
/**
|
|
||||||
* @brief TagName
|
|
||||||
*/
|
|
||||||
static const QString TagName;
|
|
||||||
/**
|
|
||||||
* @brief ToolType
|
|
||||||
*/
|
|
||||||
static const QString ToolType;
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* @brief RefreshLine
|
|
||||||
* @param indexSpline
|
|
||||||
* @param pos
|
|
||||||
* @param controlPoint
|
|
||||||
* @param splinePoint
|
|
||||||
*/
|
|
||||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
|
|
||||||
const QPointF &splinePoint);
|
|
||||||
/**
|
|
||||||
* @brief setEnabledPoint
|
|
||||||
* @param enable
|
|
||||||
*/
|
|
||||||
void setEnabledPoint(bool enable);
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromFile();
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
|
||||||
/**
|
|
||||||
* @brief ControlPointChangePosition
|
|
||||||
* @param indexSpline
|
|
||||||
* @param position
|
|
||||||
* @param pos
|
|
||||||
*/
|
|
||||||
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
|
|
||||||
const QPointF &pos);
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief contextMenuEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief AddToFile
|
|
||||||
*/
|
|
||||||
virtual void AddToFile();
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent
|
|
||||||
* @param event
|
|
||||||
*/
|
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
|
||||||
/**
|
|
||||||
* @brief RemoveReferens
|
|
||||||
*/
|
|
||||||
virtual void RemoveReferens();
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief dialogSplinePath
|
|
||||||
*/
|
|
||||||
QSharedPointer<DialogSplinePath> dialogSplinePath;
|
|
||||||
/**
|
|
||||||
* @brief controlPoints
|
|
||||||
*/
|
|
||||||
QVector<VControlPointSpline *> controlPoints;
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry
|
|
||||||
*/
|
|
||||||
void RefreshGeometry();
|
|
||||||
/**
|
|
||||||
* @brief AddPathPoint
|
|
||||||
* @param domElement
|
|
||||||
* @param splPoint
|
|
||||||
*/
|
|
||||||
void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint);
|
|
||||||
/**
|
|
||||||
* @brief UpdatePathPoint
|
|
||||||
* @param node
|
|
||||||
* @param path
|
|
||||||
*/
|
|
||||||
void UpdatePathPoint(QDomNode& node, VSplinePath &path);
|
|
||||||
/**
|
|
||||||
* @brief CorectControlPoints
|
|
||||||
* @param spl
|
|
||||||
* @param splPath
|
|
||||||
* @param indexSpline
|
|
||||||
*/
|
|
||||||
void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGSPLINEPATH_H
|
|
|
@ -1,157 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingtool.h
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef VMODELINGTOOL_H
|
|
||||||
#define VMODELINGTOOL_H
|
|
||||||
|
|
||||||
#include "../vabstracttool.h"
|
|
||||||
#include <QGraphicsSceneContextMenuEvent>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VModelingTool class
|
|
||||||
*/
|
|
||||||
class VModelingTool: public VAbstractTool
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief VModelingTool
|
|
||||||
* @param doc dom document container
|
|
||||||
* @param data
|
|
||||||
* @param id
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
|
|
||||||
virtual ~VModelingTool(){}
|
|
||||||
/**
|
|
||||||
* @brief setDialog
|
|
||||||
*/
|
|
||||||
virtual void setDialog(){}
|
|
||||||
/**
|
|
||||||
* @brief ignoreContextMenu
|
|
||||||
* @param enable
|
|
||||||
*/
|
|
||||||
inline void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;}
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromGui
|
|
||||||
* @param result
|
|
||||||
*/
|
|
||||||
virtual void FullUpdateFromGui(int result)=0;
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief ignoreContextMenuEvent
|
|
||||||
*/
|
|
||||||
bool ignoreContextMenuEvent;
|
|
||||||
/**
|
|
||||||
* @brief ignoreFullUpdate
|
|
||||||
*/
|
|
||||||
bool ignoreFullUpdate;
|
|
||||||
/**
|
|
||||||
* @brief AddToModeling
|
|
||||||
* @param domElement
|
|
||||||
*/
|
|
||||||
void AddToModeling(const QDomElement &domElement);
|
|
||||||
/**
|
|
||||||
* @brief decrementReferens
|
|
||||||
*/
|
|
||||||
virtual void decrementReferens();
|
|
||||||
template <typename Dialog, typename Tool>
|
|
||||||
/**
|
|
||||||
* @brief ContextMenu
|
|
||||||
* @param dialog
|
|
||||||
* @param tool
|
|
||||||
* @param event
|
|
||||||
* @param showRemove
|
|
||||||
*/
|
|
||||||
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
|
|
||||||
bool showRemove = true)
|
|
||||||
{
|
|
||||||
if (ignoreContextMenuEvent == false)
|
|
||||||
{
|
|
||||||
QMenu menu;
|
|
||||||
QAction *actionOption = menu.addAction(tr("Options"));
|
|
||||||
QAction *actionRemove = 0;
|
|
||||||
if (showRemove)
|
|
||||||
{
|
|
||||||
actionRemove = menu.addAction(tr("Delete"));
|
|
||||||
if (_referens > 1)
|
|
||||||
{
|
|
||||||
actionRemove->setEnabled(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
actionRemove->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QAction *selectedAction = menu.exec(event->screenPos());
|
|
||||||
if (selectedAction == actionOption)
|
|
||||||
{
|
|
||||||
dialog = QSharedPointer<Dialog>(new Dialog(getData()));
|
|
||||||
|
|
||||||
connect(qobject_cast< VMainGraphicsScene * >(tool->scene()),
|
|
||||||
&VMainGraphicsScene::ChoosedObject, dialog.data(), &Dialog::ChoosedObject);
|
|
||||||
connect(dialog.data(), &Dialog::DialogClosed, tool, &Tool::FullUpdateFromGui);
|
|
||||||
if (ignoreFullUpdate == false)
|
|
||||||
{
|
|
||||||
connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList);
|
|
||||||
}
|
|
||||||
|
|
||||||
tool->setDialog();
|
|
||||||
|
|
||||||
dialog->show();
|
|
||||||
}
|
|
||||||
if (showRemove)
|
|
||||||
{
|
|
||||||
if (selectedAction == actionRemove)
|
|
||||||
{
|
|
||||||
//deincrement referens
|
|
||||||
RemoveReferens();
|
|
||||||
//remove form xml file
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
QDomElement element;
|
|
||||||
bool ok = doc->GetActivCalculationElement(element);
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
element.removeChild(domElement);
|
|
||||||
//update xml file
|
|
||||||
emit FullUpdateTree();
|
|
||||||
//remove form scene
|
|
||||||
emit RemoveTool(tool);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VMODELINGTOOL_H
|
|
|
@ -1,170 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vmodelingtriangle.cpp
|
|
||||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vmodelingtriangle.h"
|
|
||||||
#include "../drawTools/vtooltriangle.h"
|
|
||||||
|
|
||||||
const QString VModelingTriangle::ToolType = QStringLiteral("triangle");
|
|
||||||
|
|
||||||
VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
|
|
||||||
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
|
|
||||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
|
||||||
:VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId),
|
|
||||||
secondPointId(secondPointId), dialogTriangle(QSharedPointer<DialogTriangle>())
|
|
||||||
{
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
AddToFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::setDialog()
|
|
||||||
{
|
|
||||||
Q_ASSERT(dialogTriangle.isNull() == false);
|
|
||||||
VPointF p = VAbstractTool::data.GetPoint(id);
|
|
||||||
dialogTriangle->setAxisP1Id(axisP1Id, id);
|
|
||||||
dialogTriangle->setAxisP2Id(axisP2Id, id);
|
|
||||||
dialogTriangle->setFirstPointId(firstPointId, id);
|
|
||||||
dialogTriangle->setSecondPointId(secondPointId, id);
|
|
||||||
dialogTriangle->setPointName(p.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingTriangle *VModelingTriangle::Create(QSharedPointer<DialogTriangle> &dialog, VDomDocument *doc,
|
|
||||||
VContainer *data)
|
|
||||||
{
|
|
||||||
qint64 axisP1Id = dialog->getAxisP1Id();
|
|
||||||
qint64 axisP2Id = dialog->getAxisP2Id();
|
|
||||||
qint64 firstPointId = dialog->getFirstPointId();
|
|
||||||
qint64 secondPointId = dialog->getSecondPointId();
|
|
||||||
QString pointName = dialog->getPointName();
|
|
||||||
return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse,
|
|
||||||
Tool::FromGui);
|
|
||||||
}
|
|
||||||
|
|
||||||
VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id,
|
|
||||||
const qint64 &axisP2Id, const qint64 &firstPointId,
|
|
||||||
const qint64 &secondPointId, const qreal &mx, const qreal &my,
|
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
|
||||||
const Tool::Sources &typeCreation)
|
|
||||||
{
|
|
||||||
VModelingTriangle *tool = 0;
|
|
||||||
VPointF axisP1 = data->GetPoint(axisP1Id);
|
|
||||||
VPointF axisP2 = data->GetPoint(axisP2Id);
|
|
||||||
VPointF firstPoint = data->GetPoint(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPoint(secondPointId);
|
|
||||||
|
|
||||||
QPointF point = VToolTriangle::FindPoint(axisP1.toQPointF(), axisP2.toQPointF(), firstPoint.toQPointF(),
|
|
||||||
secondPoint.toQPointF());
|
|
||||||
qint64 id = _id;
|
|
||||||
if (typeCreation == Tool::FromGui)
|
|
||||||
{
|
|
||||||
id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
|
||||||
if (parse != Document::FullParse)
|
|
||||||
{
|
|
||||||
doc->UpdateToolData(id, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, secondPointId, typeCreation);
|
|
||||||
doc->AddTool(id, tool);
|
|
||||||
doc->IncrementReferens(axisP1Id);
|
|
||||||
doc->IncrementReferens(axisP2Id);
|
|
||||||
doc->IncrementReferens(firstPointId);
|
|
||||||
doc->IncrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
return tool;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong();
|
|
||||||
axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong();
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
|
|
||||||
}
|
|
||||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::FullUpdateFromGui(int result)
|
|
||||||
{
|
|
||||||
if (result == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
domElement.setAttribute(AttrName, dialogTriangle->getPointName());
|
|
||||||
domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id()));
|
|
||||||
domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id()));
|
|
||||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId()));
|
|
||||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId()));
|
|
||||||
emit FullUpdateTree();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
dialogTriangle.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::RemoveReferens()
|
|
||||||
{
|
|
||||||
doc->DecrementReferens(axisP1Id);
|
|
||||||
doc->DecrementReferens(axisP2Id);
|
|
||||||
doc->DecrementReferens(firstPointId);
|
|
||||||
doc->DecrementReferens(secondPointId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
ContextMenu(dialogTriangle, this, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VModelingTriangle::AddToFile()
|
|
||||||
{
|
|
||||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
|
||||||
AddAttribute(domElement, AttrType, ToolType);
|
|
||||||
AddAttribute(domElement, AttrName, point.name());
|
|
||||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
|
||||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
|
||||||
|
|
||||||
AddAttribute(domElement, AttrAxisP1, axisP1Id);
|
|
||||||
AddAttribute(domElement, AttrAxisP2, axisP2Id);
|
|
||||||
AddAttribute(domElement, AttrFirstPoint, firstPointId);
|
|
||||||
AddAttribute(domElement, AttrSecondPoint, secondPointId);
|
|
||||||
|
|
||||||
AddToModeling(domElement);
|
|
||||||
}
|
|
|
@ -30,13 +30,9 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
|
const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
|
||||||
const QString VAbstractNode::AttrTypeObject = QStringLiteral("typeObject");
|
|
||||||
const QString VAbstractNode::TypeObjectCalculation = QStringLiteral("Calculation");
|
|
||||||
const QString VAbstractNode::TypeObjectModeling = QStringLiteral("Modeling");
|
|
||||||
|
|
||||||
VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject,
|
VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, QObject *parent)
|
||||||
QObject *parent)
|
: VAbstractTool(doc, data, id, parent), idNode(idNode)
|
||||||
: VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject)
|
|
||||||
{
|
{
|
||||||
_referens = 0;
|
_referens = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,37 +44,19 @@ public:
|
||||||
* @param data
|
* @param data
|
||||||
* @param id
|
* @param id
|
||||||
* @param idNode
|
* @param idNode
|
||||||
* @param typeobject
|
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode,
|
VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, QObject *parent = 0 );
|
||||||
Draw::Draws typeobject, QObject *parent = 0 );
|
|
||||||
virtual ~VAbstractNode() {}
|
virtual ~VAbstractNode() {}
|
||||||
/**
|
/**
|
||||||
* @brief AttrIdObject
|
* @brief AttrIdObject
|
||||||
*/
|
*/
|
||||||
static const QString AttrIdObject;
|
static const QString AttrIdObject;
|
||||||
/**
|
|
||||||
* @brief AttrTypeObject
|
|
||||||
*/
|
|
||||||
static const QString AttrTypeObject;
|
|
||||||
/**
|
|
||||||
* @brief TypeObjectCalculation
|
|
||||||
*/
|
|
||||||
static const QString TypeObjectCalculation;
|
|
||||||
/**
|
|
||||||
* @brief TypeObjectModeling
|
|
||||||
*/
|
|
||||||
static const QString TypeObjectModeling;
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief idNode
|
* @brief idNode
|
||||||
*/
|
*/
|
||||||
qint64 idNode;
|
qint64 idNode;
|
||||||
/**
|
|
||||||
* @brief typeobject
|
|
||||||
*/
|
|
||||||
Draw::Draws typeobject;
|
|
||||||
/**
|
/**
|
||||||
* @brief AddToModeling
|
* @brief AddToModeling
|
||||||
* @param domElement
|
* @param domElement
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user