Method for refreshing attributes in file.
--HG-- branch : feature
This commit is contained in:
parent
cdf2e02eef
commit
5e94742b06
|
@ -43,6 +43,10 @@ VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, c
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolAlongLine::FullUpdateFromFile()
|
||||
|
@ -106,6 +110,22 @@ void VToolAlongLine::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolAlongLine::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrFirstPoint, basePointId);
|
||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolAlongLine::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(secondPointId);
|
||||
|
|
|
@ -116,6 +116,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,10 @@ VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::S
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolArc::setDialog()
|
||||
|
@ -199,6 +203,19 @@ void VToolArc::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolArc::RefreshDataInFile()
|
||||
{
|
||||
VArc arc = VAbstractTool::data.GetArc(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrCenter, arc.GetCenter());
|
||||
domElement.setAttribute(AttrRadius, arc.GetFormulaRadius());
|
||||
domElement.setAttribute(AttrAngle1, arc.GetFormulaF1());
|
||||
domElement.setAttribute(AttrAngle2, arc.GetFormulaF2());
|
||||
}
|
||||
}
|
||||
|
||||
void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -125,6 +125,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -45,6 +45,10 @@ VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
|
||||
|
@ -204,6 +208,23 @@ void VToolBisector::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolBisector::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
||||
domElement.setAttribute(AttrSecondPoint, basePointId);
|
||||
domElement.setAttribute(AttrThirdPoint, thirdPointId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolBisector::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(firstPointId);
|
||||
|
|
|
@ -129,6 +129,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -58,6 +58,10 @@ VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolCutSpline::setDialog()
|
||||
|
@ -222,6 +226,20 @@ void VToolCutSpline::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolCutSpline::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrSpline, splineId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolCutSpline::RefreshGeometry()
|
||||
{
|
||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||
|
|
|
@ -119,6 +119,13 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RefreshGeometry
|
||||
*/
|
||||
void RefreshGeometry();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCutSpline)
|
||||
|
|
|
@ -60,6 +60,10 @@ VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, cons
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::setDialog()
|
||||
|
@ -289,6 +293,20 @@ void VToolCutSplinePath::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrSplinePath, splinePathId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::RefreshGeometry()
|
||||
{
|
||||
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||
|
|
|
@ -109,6 +109,13 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RefreshGeometry
|
||||
*/
|
||||
void RefreshGeometry();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||
|
|
|
@ -43,6 +43,10 @@ VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolEndLine::setDialog()
|
||||
|
@ -166,3 +170,19 @@ void VToolEndLine::AddToFile()
|
|||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolEndLine::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrAngle, angle);
|
||||
domElement.setAttribute(AttrBasePoint, basePointId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
private:
|
||||
/**
|
||||
* @brief dialogEndLine pointer to the dialog
|
||||
|
|
|
@ -41,6 +41,10 @@ VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolHeight::setDialog()
|
||||
|
@ -187,3 +191,19 @@ void VToolHeight::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
|
||||
}
|
||||
|
||||
void VToolHeight::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrBasePoint, basePointId);
|
||||
domElement.setAttribute(AttrP1Line, p1LineId);
|
||||
domElement.setAttribute(AttrP2Line, p2LineId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
private:
|
||||
/**
|
||||
* @brief dialogHeight
|
||||
|
|
|
@ -49,6 +49,10 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLine::setDialog()
|
||||
|
@ -166,6 +170,16 @@ void VToolLine::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolLine::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrFirstPoint, firstPoint);
|
||||
domElement.setAttribute(AttrSecondPoint, secondPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
|
|
@ -120,6 +120,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief hoverMoveEvent
|
||||
* @param event
|
||||
|
|
|
@ -42,6 +42,10 @@ VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, cons
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLineIntersect::setDialog()
|
||||
|
@ -184,6 +188,22 @@ void VToolLineIntersect::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolLineIntersect::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrP1Line1, p1Line1);
|
||||
domElement.setAttribute(AttrP2Line1, p2Line1);
|
||||
domElement.setAttribute(AttrP1Line2, p1Line2);
|
||||
domElement.setAttribute(AttrP2Line2, p2Line2);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLineIntersect::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(p1Line1);
|
||||
|
|
|
@ -116,6 +116,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,10 @@ VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolNormal::setDialog()
|
||||
|
@ -190,6 +193,23 @@ void VToolNormal::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolNormal::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrAngle, angle);
|
||||
domElement.setAttribute(AttrFirstPoint, basePointId);
|
||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolNormal::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(secondPointId);
|
||||
|
|
|
@ -130,6 +130,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,10 @@ VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, co
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolPointOfContact::setDialog()
|
||||
|
@ -207,6 +211,22 @@ void VToolPointOfContact::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolPointOfContact::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrRadius, radius);
|
||||
domElement.setAttribute(AttrCenter, center);
|
||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolPointOfContact::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(center);
|
||||
|
|
|
@ -126,6 +126,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,10 @@ VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolPointOfIntersection::setDialog()
|
||||
|
@ -152,3 +156,17 @@ void VToolPointOfIntersection::AddToFile()
|
|||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolPointOfIntersection::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrName, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrName, toMM(point.my()));
|
||||
domElement.setAttribute(AttrFirstPoint, firstPointId);
|
||||
domElement.setAttribute(AttrSecondPoint, secondPointId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolPointOfIntersection)
|
||||
/**
|
||||
|
|
|
@ -42,6 +42,10 @@ VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, cons
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::setDialog()
|
||||
|
@ -211,6 +215,23 @@ void VToolShoulderPoint::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrName, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrName, toMM(point.my()));
|
||||
domElement.setAttribute(AttrTypeLine, typeLine);
|
||||
domElement.setAttribute(AttrLength, formula);
|
||||
domElement.setAttribute(AttrP1Line, basePointId);
|
||||
domElement.setAttribute(AttrP2Line, p2Line);
|
||||
domElement.setAttribute(AttrPShoulder, pShoulder);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(p2Line);
|
||||
|
|
|
@ -128,6 +128,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,10 @@ VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSinglePoint::setDialog()
|
||||
|
@ -66,6 +70,20 @@ void VToolSinglePoint::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolSinglePoint::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrX, QString().setNum(toMM(point.x())));
|
||||
domElement.setAttribute(AttrY, QString().setNum(toMM(point.y())));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(point.mx())));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(point.my())));
|
||||
}
|
||||
}
|
||||
|
||||
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemPositionChange && scene())
|
||||
|
|
|
@ -92,6 +92,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief itemChange
|
||||
* @param change
|
||||
|
|
|
@ -68,6 +68,10 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, const T
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSpline::setDialog()
|
||||
|
@ -222,6 +226,22 @@ void VToolSpline::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolSpline::RefreshDataInFile()
|
||||
{
|
||||
VSpline spl = VAbstractTool::data.GetSpline(id);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -153,6 +153,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile ();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -69,6 +69,10 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::setDialog()
|
||||
|
@ -271,6 +275,39 @@ void VToolSplinePath::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolSplinePath::RefreshDataInFile()
|
||||
{
|
||||
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
|
||||
for (qint32 i = 1; i<=splPath.Count(); ++i)
|
||||
{
|
||||
VSpline spl = splPath.GetSpline(i);
|
||||
qint32 j = i*2;
|
||||
disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
controlPoints[j-2]->setPos(spl.GetP2());
|
||||
controlPoints[j-1]->setPos(spl.GetP3());
|
||||
connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this,
|
||||
&VToolSplinePath::ControlPointChangePosition);
|
||||
|
||||
spl = VSpline (VAbstractTool::data.DataPoints(), 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint)
|
||||
{
|
||||
QDomElement pathPoint = doc->createElement(AttrPathPoint);
|
||||
|
|
|
@ -145,6 +145,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -41,6 +41,10 @@ VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VToolTriangle::setDialog()
|
||||
|
@ -212,3 +216,19 @@ void VToolTriangle::AddToFile()
|
|||
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
void VToolTriangle::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrName, point.name());
|
||||
domElement.setAttribute(AttrMx, toMM(point.mx()));
|
||||
domElement.setAttribute(AttrMy, toMM(point.my()));
|
||||
domElement.setAttribute(AttrAxisP1, QString().setNum(axisP1Id));
|
||||
domElement.setAttribute(AttrAxisP2, QString().setNum(axisP2Id));
|
||||
domElement.setAttribute(AttrFirstPoint, QString().setNum(firstPointId));
|
||||
domElement.setAttribute(AttrSecondPoint, QString().setNum(secondPointId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolTriangle)
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,10 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse,
|
||||
|
@ -78,6 +82,15 @@ void VNodeArc::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
void VNodeArc::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
||||
}
|
||||
}
|
||||
|
||||
void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -79,6 +79,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -51,6 +51,10 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
|
||||
|
@ -88,6 +92,18 @@ void VNodePoint::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
void VNodePoint::RefreshDataInFile()
|
||||
{
|
||||
VPointF point = VAbstractTool::data.GetPoint(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
||||
domElement.setAttribute(AttrMx, QString().setNum(toMM(point.mx())));
|
||||
domElement.setAttribute(AttrMy, QString().setNum(toMM(point.my())));
|
||||
}
|
||||
}
|
||||
|
||||
void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -96,6 +96,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -44,6 +44,10 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
|
||||
|
@ -79,6 +83,15 @@ void VNodeSpline::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
void VNodeSpline::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
||||
}
|
||||
}
|
||||
|
||||
void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -80,6 +80,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile ();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -44,6 +44,10 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
|||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
|
||||
|
@ -83,6 +87,15 @@ void VNodeSplinePath::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
void VNodeSplinePath::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
domElement.setAttribute(AttrIdObject, QString().setNum(idNode));
|
||||
}
|
||||
}
|
||||
|
||||
void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
|
|
@ -79,6 +79,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief mouseReleaseEvent
|
||||
* @param event
|
||||
|
|
|
@ -285,6 +285,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile()=0;
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile()=0;
|
||||
/**
|
||||
* @brief getData
|
||||
* @return
|
||||
|
|
|
@ -215,6 +215,24 @@ void VToolDetail::AddToFile()
|
|||
}
|
||||
}
|
||||
|
||||
void VToolDetail::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
VDetail det = VAbstractTool::data.GetDetail(id);
|
||||
domElement.setAttribute(AttrName, det.getName());
|
||||
domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement()));
|
||||
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
|
||||
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
|
||||
RemoveAllChild(domElement);
|
||||
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
||||
{
|
||||
AddNode(domElement, det[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemPositionHasChanged && scene())
|
||||
|
|
|
@ -156,6 +156,10 @@ protected:
|
|||
* @brief AddToFile
|
||||
*/
|
||||
virtual void AddToFile ();
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief itemChange
|
||||
* @param change
|
||||
|
|
Loading…
Reference in New Issue
Block a user