Refactoring. Also read attribute color from xml.
--HG-- branch : feature
This commit is contained in:
parent
b8e7cbd1ac
commit
f687105905
|
@ -68,6 +68,7 @@ QString VAbstractSpline::getTagName() const
|
||||||
*/
|
*/
|
||||||
void VAbstractSpline::FullUpdateFromFile()
|
void VAbstractSpline::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
|
ReadAttributes();
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +213,12 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractSpline::ShowFoot(bool show)
|
void VAbstractSpline::ShowFoot(bool show)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,7 @@ protected:
|
||||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
|
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractSpline)
|
Q_DISABLE_COPY(VAbstractSpline)
|
||||||
};
|
};
|
||||||
|
|
|
@ -158,7 +158,7 @@ void VDrawTool::RefreshDataInFile()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +175,20 @@ QColor VDrawTool::CorrectColor(const QColor &color) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VDrawTool::ReadAttributes()
|
||||||
|
{
|
||||||
|
const QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
ReadToolAttributes(domElement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief DialogLinkDestroy removes dialog pointer
|
* @brief DialogLinkDestroy removes dialog pointer
|
||||||
|
|
|
@ -97,6 +97,9 @@ protected:
|
||||||
virtual void RefreshDataInFile();
|
virtual void RefreshDataInFile();
|
||||||
QColor CorrectColor(const QColor &color) const;
|
QColor CorrectColor(const QColor &color) const;
|
||||||
|
|
||||||
|
void ReadAttributes();
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
|
||||||
|
|
||||||
template <typename Dialog, typename Tool>
|
template <typename Dialog, typename Tool>
|
||||||
/**
|
/**
|
||||||
* @brief ContextMenu show context menu for tool.
|
* @brief ContextMenu show context menu for tool.
|
||||||
|
|
|
@ -71,14 +71,7 @@ VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, cons
|
||||||
*/
|
*/
|
||||||
void VToolAlongLine::FullUpdateFromFile()
|
void VToolAlongLine::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formulaLength = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -168,6 +161,16 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
||||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolAlongLine::GetSecondPointId() const
|
quint32 VToolAlongLine::GetSecondPointId() const
|
||||||
{
|
{
|
||||||
|
@ -232,6 +235,7 @@ void VToolAlongLine::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetFormula(formulaLength);
|
dialogTool->SetFormula(formulaLength);
|
||||||
dialogTool->SetFirstPointId(basePointId);
|
dialogTool->SetFirstPointId(basePointId);
|
||||||
dialogTool->SetSecondPointId(secondPointId);
|
dialogTool->SetSecondPointId(secondPointId);
|
||||||
|
|
|
@ -64,6 +64,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief secondPointId id second point of line. */
|
/** @brief secondPointId id second point of line. */
|
||||||
quint32 secondPointId;
|
quint32 secondPointId;
|
||||||
|
|
|
@ -82,6 +82,7 @@ void VToolArc::setDialog()
|
||||||
dialogTool->SetF1(arc->GetFormulaF1());
|
dialogTool->SetF1(arc->GetFormulaF1());
|
||||||
dialogTool->SetF2(arc->GetFormulaF2());
|
dialogTool->SetF2(arc->GetFormulaF2());
|
||||||
dialogTool->SetRadius(arc->GetFormulaRadius());
|
dialogTool->SetRadius(arc->GetFormulaRadius());
|
||||||
|
dialogTool->SetColor(lineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -113,6 +113,7 @@ void VToolBisector::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetFormula(formulaLength);
|
dialogTool->SetFormula(formulaLength);
|
||||||
dialogTool->SetFirstPointId(firstPointId);
|
dialogTool->SetFirstPointId(firstPointId);
|
||||||
dialogTool->SetSecondPointId(basePointId);
|
dialogTool->SetSecondPointId(basePointId);
|
||||||
|
@ -221,15 +222,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
||||||
*/
|
*/
|
||||||
void VToolBisector::FullUpdateFromFile()
|
void VToolBisector::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formulaLength = domElement.attribute(AttrLength, "");
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
basePointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -322,6 +315,17 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrThirdPoint, thirdPointId);
|
doc->SetAttribute(tag, AttrThirdPoint, thirdPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolBisector::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
thirdPointId = doc->GetParametrUInt(domElement, AttrThirdPoint, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolBisector::GetThirdPointId() const
|
quint32 VToolBisector::GetThirdPointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief firstPointId id first point of angle. */
|
/** @brief firstPointId id first point of angle. */
|
||||||
quint32 firstPointId;
|
quint32 firstPointId;
|
||||||
|
|
|
@ -67,6 +67,7 @@ void VToolCurveIntersectAxis::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetAngle(formulaAngle);
|
dialogTool->SetAngle(formulaAngle);
|
||||||
dialogTool->SetBasePointId(basePointId);
|
dialogTool->SetBasePointId(basePointId);
|
||||||
dialogTool->setCurveId(curveId);
|
dialogTool->setCurveId(curveId);
|
||||||
|
@ -250,14 +251,7 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCurveIntersectAxis::FullUpdateFromFile()
|
void VToolCurveIntersectAxis::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
|
||||||
curveId = domElement.attribute(AttrCurve, "").toUInt();
|
|
||||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -313,3 +307,13 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObj
|
||||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||||
doc->SetAttribute(tag, AttrCurve, curveId);
|
doc->SetAttribute(tag, AttrCurve, curveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||||
|
curveId = doc->GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
||||||
|
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||||
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCurveIntersectAxis)
|
Q_DISABLE_COPY(VToolCurveIntersectAxis)
|
||||||
QString formulaAngle;
|
QString formulaAngle;
|
||||||
|
|
|
@ -150,5 +150,4 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
|
||||||
formula = domElement.attribute(AttrLength, "");
|
formula = domElement.attribute(AttrLength, "");
|
||||||
curveCutId = domElement.attribute(attrCurve, "").toUInt();
|
curveCutId = domElement.attribute(attrCurve, "").toUInt();
|
||||||
}
|
}
|
||||||
RefreshGeometry();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,8 @@ void VToolCutArc::ShowVisualization(bool show)
|
||||||
*/
|
*/
|
||||||
void VToolCutArc::FullUpdateFromFile()
|
void VToolCutArc::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
FullUpdateCurveFromFile(AttrArc);
|
ReadAttributes();
|
||||||
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -315,3 +316,10 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrArc, curveCutId);
|
doc->SetAttribute(tag, AttrArc, curveCutId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ protected:
|
||||||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||||
PathDirection direction = PathDirection::Hide);
|
PathDirection direction = PathDirection::Hide);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutArc)
|
Q_DISABLE_COPY(VToolCutArc)
|
||||||
};
|
};
|
||||||
|
|
|
@ -231,7 +231,8 @@ void VToolCutSpline::ShowVisualization(bool show)
|
||||||
*/
|
*/
|
||||||
void VToolCutSpline::FullUpdateFromFile()
|
void VToolCutSpline::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
FullUpdateCurveFromFile(AttrSpline);
|
ReadAttributes();
|
||||||
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -326,3 +327,10 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrSpline, curveCutId);
|
doc->SetAttribute(tag, AttrSpline, curveCutId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
||||||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||||
PathDirection direction = PathDirection::Hide);
|
PathDirection direction = PathDirection::Hide);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSpline)
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
};
|
};
|
||||||
|
|
|
@ -280,7 +280,8 @@ void VToolCutSplinePath::ShowVisualization(bool show)
|
||||||
*/
|
*/
|
||||||
void VToolCutSplinePath::FullUpdateFromFile()
|
void VToolCutSplinePath::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
FullUpdateCurveFromFile(AttrSplinePath);
|
ReadAttributes();
|
||||||
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -377,3 +378,10 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
doc->SetAttribute(tag, AttrLength, formula);
|
doc->SetAttribute(tag, AttrLength, formula);
|
||||||
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
|
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ protected:
|
||||||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||||
PathDirection direction = PathDirection::Hide);
|
PathDirection direction = PathDirection::Hide);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,6 +80,7 @@ void VToolEndLine::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetFormula(formulaLength);
|
dialogTool->SetFormula(formulaLength);
|
||||||
dialogTool->SetAngle(formulaAngle);
|
dialogTool->SetAngle(formulaAngle);
|
||||||
dialogTool->SetBasePointId(basePointId);
|
dialogTool->SetBasePointId(basePointId);
|
||||||
|
@ -181,14 +182,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
||||||
*/
|
*/
|
||||||
void VToolEndLine::FullUpdateFromFile()
|
void VToolEndLine::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formulaLength = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
|
||||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -233,6 +227,7 @@ void VToolEndLine::SaveDialog(QDomElement &domElement)
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||||
|
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||||
|
@ -251,11 +246,22 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||||
|
|
||||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||||
|
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||||
doc->SetAttribute(tag, AttrLength, formulaLength);
|
doc->SetAttribute(tag, AttrLength, formulaLength);
|
||||||
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
||||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolEndLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||||
|
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VFormula VToolEndLine::GetFormulaAngle() const
|
VFormula VToolEndLine::GetFormulaAngle() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
QString formulaAngle;
|
QString formulaAngle;
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,6 +73,7 @@ void VToolHeight::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetBasePointId(basePointId);
|
dialogTool->SetBasePointId(basePointId);
|
||||||
dialogTool->SetP1LineId(p1LineId);
|
dialogTool->SetP1LineId(p1LineId);
|
||||||
dialogTool->SetP2LineId(p2LineId);
|
dialogTool->SetP2LineId(p2LineId);
|
||||||
|
@ -193,14 +194,7 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point)
|
||||||
*/
|
*/
|
||||||
void VToolHeight::FullUpdateFromFile()
|
void VToolHeight::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
|
||||||
p1LineId = domElement.attribute(AttrP1Line, "").toUInt();
|
|
||||||
p2LineId = domElement.attribute(AttrP2Line, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -268,6 +262,16 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrP2Line, p2LineId);
|
doc->SetAttribute(tag, AttrP2Line, p2LineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolHeight::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||||
|
p1LineId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
|
||||||
|
p2LineId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolHeight::GetP2LineId() const
|
quint32 VToolHeight::GetP2LineId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief p1LineId id first point of line. */
|
/** @brief p1LineId id first point of line. */
|
||||||
quint32 p1LineId;
|
quint32 p1LineId;
|
||||||
|
|
|
@ -85,6 +85,7 @@ void VToolLine::setDialog()
|
||||||
dialogTool->SetFirstPoint(firstPoint);
|
dialogTool->SetFirstPoint(firstPoint);
|
||||||
dialogTool->SetSecondPoint(secondPoint);
|
dialogTool->SetSecondPoint(secondPoint);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -189,6 +190,7 @@ QString VToolLine::getTagName() const
|
||||||
*/
|
*/
|
||||||
void VToolLine::FullUpdateFromFile()
|
void VToolLine::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
|
ReadAttributes();
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -384,6 +386,15 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolLine::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolLine::GetSecondPoint() const
|
quint32 VToolLine::GetSecondPoint() const
|
||||||
{
|
{
|
||||||
|
@ -469,13 +480,6 @@ void VToolLine::SetFirstPoint(const quint32 &value)
|
||||||
*/
|
*/
|
||||||
void VToolLine::RefreshGeometry()
|
void VToolLine::RefreshGeometry()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
|
|
||||||
secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
|
|
||||||
typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
|
|
||||||
}
|
|
||||||
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
||||||
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
||||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||||
|
|
|
@ -76,6 +76,7 @@ protected:
|
||||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief firstPoint id first line point. */
|
/** @brief firstPoint id first line point. */
|
||||||
quint32 firstPoint;
|
quint32 firstPoint;
|
||||||
|
|
|
@ -193,14 +193,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
||||||
*/
|
*/
|
||||||
void VToolLineIntersect::FullUpdateFromFile()
|
void VToolLineIntersect::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
p1Line1 = domElement.attribute(AttrP1Line1, "").toUInt();
|
|
||||||
p2Line1 = domElement.attribute(AttrP2Line1, "").toUInt();
|
|
||||||
p1Line2 = domElement.attribute(AttrP1Line2, "").toUInt();
|
|
||||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -291,6 +284,15 @@ void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
doc->SetAttribute(tag, AttrP2Line2, p2Line2);
|
doc->SetAttribute(tag, AttrP2Line2, p2Line2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
p1Line1 = doc->GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR);
|
||||||
|
p2Line1 = doc->GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR);
|
||||||
|
p1Line2 = doc->GetParametrUInt(domElement, AttrP1Line2, NULL_ID_STR);
|
||||||
|
p2Line2 = doc->GetParametrUInt(domElement, AttrP2Line2, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolLineIntersect::GetP2Line2() const
|
quint32 VToolLineIntersect::GetP2Line2() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief p1Line1 id first point first line. */
|
/** @brief p1Line1 id first point first line. */
|
||||||
quint32 p1Line1;
|
quint32 p1Line1;
|
||||||
|
|
|
@ -68,6 +68,7 @@ void VToolLineIntersectAxis::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetAngle(formulaAngle);
|
dialogTool->SetAngle(formulaAngle);
|
||||||
dialogTool->SetBasePointId(basePointId);
|
dialogTool->SetBasePointId(basePointId);
|
||||||
dialogTool->SetFirstPointId(firstPointId);
|
dialogTool->SetFirstPointId(firstPointId);
|
||||||
|
@ -266,15 +267,7 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLineIntersectAxis::FullUpdateFromFile()
|
void VToolLineIntersectAxis::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
|
||||||
firstPointId = domElement.attribute(AttrP1Line, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrP2Line, "").toUInt();
|
|
||||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -333,3 +326,14 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObje
|
||||||
doc->SetAttribute(tag, AttrP1Line, firstPointId);
|
doc->SetAttribute(tag, AttrP1Line, firstPointId);
|
||||||
doc->SetAttribute(tag, AttrP2Line, secondPointId);
|
doc->SetAttribute(tag, AttrP2Line, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||||
|
firstPointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
|
||||||
|
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolLineIntersectAxis)
|
Q_DISABLE_COPY(VToolLineIntersectAxis)
|
||||||
QString formulaAngle;
|
QString formulaAngle;
|
||||||
|
|
|
@ -200,15 +200,7 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
|
||||||
*/
|
*/
|
||||||
void VToolNormal::FullUpdateFromFile()
|
void VToolNormal::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formulaLength = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -300,6 +292,17 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolNormal::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
angle = doc->GetParametrDouble(domElement, AttrAngle, "0");
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolNormal::GetSecondPointId() const
|
quint32 VToolNormal::GetSecondPointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,6 +66,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief secondPointId id second line point. */
|
/** @brief secondPointId id second line point. */
|
||||||
quint32 secondPointId;
|
quint32 secondPointId;
|
||||||
|
|
|
@ -225,14 +225,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
|
||||||
*/
|
*/
|
||||||
void VToolPointOfContact::FullUpdateFromFile()
|
void VToolPointOfContact::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
arcRadius = domElement.attribute(AttrRadius, "");
|
|
||||||
center = domElement.attribute(AttrCenter, "").toUInt();
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -322,6 +315,15 @@ void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
arcRadius = doc->GetParametrString(domElement, AttrRadius, "");
|
||||||
|
center = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
|
||||||
|
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolPointOfContact::GetSecondPointId() const
|
quint32 VToolPointOfContact::GetSecondPointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,6 +78,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief radius string with formula radius arc. */
|
/** @brief radius string with formula radius arc. */
|
||||||
QString arcRadius;
|
QString arcRadius;
|
||||||
|
|
|
@ -165,12 +165,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
|
||||||
*/
|
*/
|
||||||
void VToolPointOfIntersection::FullUpdateFromFile()
|
void VToolPointOfIntersection::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
}
|
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -242,6 +237,13 @@ void VToolPointOfIntersection::SaveOptions(QDomElement &tag, QSharedPointer<VGOb
|
||||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolPointOfIntersection::GetSecondPointId() const
|
quint32 VToolPointOfIntersection::GetSecondPointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolPointOfIntersection)
|
Q_DISABLE_COPY(VToolPointOfIntersection)
|
||||||
/** @brief firstPointId id first line point. */
|
/** @brief firstPointId id first line point. */
|
||||||
|
|
|
@ -75,6 +75,7 @@ void VToolShoulderPoint::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
dialogTool->SetTypeLine(typeLine);
|
dialogTool->SetTypeLine(typeLine);
|
||||||
|
dialogTool->SetLineColor(lineColor);
|
||||||
dialogTool->SetFormula(formulaLength);
|
dialogTool->SetFormula(formulaLength);
|
||||||
dialogTool->SetP1Line(basePointId);
|
dialogTool->SetP1Line(basePointId);
|
||||||
dialogTool->SetP2Line(p2Line);
|
dialogTool->SetP2Line(p2Line);
|
||||||
|
@ -225,15 +226,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
|
||||||
*/
|
*/
|
||||||
void VToolShoulderPoint::FullUpdateFromFile()
|
void VToolShoulderPoint::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
|
||||||
formulaLength = domElement.attribute(AttrLength, "");
|
|
||||||
basePointId = domElement.attribute(AttrP1Line, "").toUInt();
|
|
||||||
p2Line = domElement.attribute(AttrP2Line, "").toUInt();
|
|
||||||
pShoulder = domElement.attribute(AttrPShoulder, "").toUInt();
|
|
||||||
}
|
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -326,6 +319,17 @@ void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
||||||
doc->SetAttribute(tag, AttrPShoulder, pShoulder);
|
doc->SetAttribute(tag, AttrPShoulder, pShoulder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
|
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
|
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||||
|
basePointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
|
||||||
|
p2Line = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
|
||||||
|
pShoulder = doc->GetParametrUInt(domElement, AttrPShoulder, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolShoulderPoint::getPShoulder() const
|
quint32 VToolShoulderPoint::getPShoulder() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,7 @@ protected:
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
/** @brief p2Line id second line point. */
|
/** @brief p2Line id second line point. */
|
||||||
quint32 p2Line;
|
quint32 p2Line;
|
||||||
|
|
|
@ -264,6 +264,13 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &o
|
||||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
Q_UNUSED(domElement);
|
||||||
|
// This tool doesn't need read attributes from file.
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
|
|
@ -67,6 +67,7 @@ protected:
|
||||||
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
QString namePP;
|
QString namePP;
|
||||||
QString mPath;
|
QString mPath;
|
||||||
|
|
|
@ -105,6 +105,7 @@ void VToolSpline::setDialog()
|
||||||
dialogTool->SetKAsm1(spl->GetKasm1());
|
dialogTool->SetKAsm1(spl->GetKasm1());
|
||||||
dialogTool->SetKAsm2(spl->GetKasm2());
|
dialogTool->SetKAsm2(spl->GetKasm2());
|
||||||
dialogTool->SetKCurve(spl->GetKcurve());
|
dialogTool->SetKCurve(spl->GetKcurve());
|
||||||
|
dialogTool->SetColor(lineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -98,6 +98,7 @@ void VToolSplinePath::setDialog()
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||||
dialogTool->SetPath(*splPath);
|
dialogTool->SetPath(*splPath);
|
||||||
|
dialogTool->SetColor(lineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -220,14 +220,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
|
||||||
*/
|
*/
|
||||||
void VToolTriangle::FullUpdateFromFile()
|
void VToolTriangle::FullUpdateFromFile()
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
ReadAttributes();
|
||||||
if (domElement.isElement())
|
|
||||||
{
|
|
||||||
axisP1Id = domElement.attribute(AttrAxisP1, "").toUInt();
|
|
||||||
axisP2Id = domElement.attribute(AttrAxisP2, "").toUInt();
|
|
||||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
|
||||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
|
||||||
}
|
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||||
|
|
||||||
if (vis != nullptr)
|
if (vis != nullptr)
|
||||||
|
@ -307,6 +300,15 @@ void VToolTriangle::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolTriangle::ReadToolAttributes(const QDomElement &domElement)
|
||||||
|
{
|
||||||
|
axisP1Id = doc->GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR);
|
||||||
|
axisP2Id = doc->GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR);
|
||||||
|
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||||
|
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VToolTriangle::GetSecondPointId() const
|
quint32 VToolTriangle::GetSecondPointId() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,6 +75,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
|
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolTriangle)
|
Q_DISABLE_COPY(VToolTriangle)
|
||||||
/** @brief axisP1Id id first axis point. */
|
/** @brief axisP1Id id first axis point. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user