Notes for tool Base point.

This commit is contained in:
Roman Telezhynskyi 2020-10-27 16:21:51 +02:00
parent 1e04dda335
commit b820107b4d
45 changed files with 255 additions and 101 deletions

View File

@ -1166,7 +1166,7 @@ void VPattern::PointsWithLineCommonAttributes(const QDomElement &domElement, VTo
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData)
{
PointsCommonAttributes(domElement, initData.id, initData.mx, initData.my);
DrawPointsCommonAttributes(domElement, initData.id, initData.mx, initData.my, initData.notes);
initData.name = GetParametrString(domElement, AttrName, QChar('A'));
initData.showLabel = GetParametrBool(domElement, AttrShowLabel, trueStr);
}
@ -1179,6 +1179,15 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0")));
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my,
QString &notes)
{
DrawToolsCommonAttributes(domElement, id, notes);
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0")));
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0")));
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ParsePointElement parse point tag.
@ -4298,6 +4307,13 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
id = GetParametrId(domElement);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &notes)
{
ToolsCommonAttributes(domElement, id);
notes = GetParametrEmptyString(domElement, AttrNotes);
}
//---------------------------------------------------------------------------------------------------------------------
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")

View File

@ -169,9 +169,12 @@ private:
void ParseIncrementsElement(const QDomNode& node, const Document &parse);
void PrepareForParse(const Document &parse);
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &notes);
void PointsWithLineCommonAttributes(const QDomElement &domElement, VToolLinePointInitData &initData);
void PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
void DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my,
QString &notes);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);
template <typename T>

View File

@ -133,6 +133,7 @@ const QString AttrPlaceLabelType = QStringLiteral("placeLabelType");
const QString AttrVersion = QStringLiteral("version");
const QString AttrFirstToCountour = QStringLiteral("firstToCountour");
const QString AttrLastToCountour = QStringLiteral("lastToCountour");
const QString AttrNotes = QStringLiteral("notes");
const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair");

View File

@ -151,6 +151,7 @@ extern const QString AttrPlaceLabelType;
extern const QString AttrVersion;
extern const QString AttrFirstToCountour;
extern const QString AttrLastToCountour;
extern const QString AttrNotes;
extern const QString TypeLineNone;
extern const QString TypeLineLine;

View File

@ -62,6 +62,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, quint32 toolId, QWi
CheckPointLabel(this, ui->lineEditName, ui->labelEditName, pointName, this->data, flagName);
CheckState();
});
ui->tabWidget->setCurrentIndex(0);
}
//---------------------------------------------------------------------------------------------------------------------
@ -128,3 +130,15 @@ QString DialogSinglePoint::GetPointName() const
{
return pointName;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSinglePoint::SetNotes(const QString &notes)
{
ui->textEditToolNotes->setText(notes);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSinglePoint::GetNotes() const
{
return ui->textEditToolNotes->toPlainText();
}

View File

@ -58,6 +58,9 @@ public:
QString GetPointName() const;
void SetNotes(const QString &notes);
QString GetNotes() const;
public slots:
void mousePress(const QPointF &scenePos);
protected:

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>202</height>
<width>329</width>
<height>244</height>
</rect>
</property>
<property name="windowTitle">
@ -28,71 +28,108 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEditName">
<property name="toolTip">
<string>Unique label</string>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Choose unique label.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelEditName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point label</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="maximumSize">
<size>
<width>241</width>
<height>129</height>
</size>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="toolTip">
<string>Coordinates on the sheet</string>
</property>
<property name="title">
<string>Coordinates</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLabel" name="labelYCor">
<property name="text">
<string>Y coordinate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelXCor">
<property name="text">
<string>X coordinate</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBoxX"/>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBoxY"/>
</item>
</layout>
<widget class="QWidget" name="tabTool">
<attribute name="title">
<string>Tool</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEditName">
<property name="toolTip">
<string>Unique label</string>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Choose unique label.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelEditName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point label</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="maximumSize">
<size>
<width>241</width>
<height>129</height>
</size>
</property>
<property name="toolTip">
<string>Coordinates on the sheet</string>
</property>
<property name="title">
<string>Coordinates</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLabel" name="labelYCor">
<property name="text">
<string>Y coordinate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelXCor">
<property name="text">
<string>X coordinate</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBoxX"/>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="doubleSpinBoxY"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabNotes">
<attribute name="title">
<string>Notes</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextEdit" name="textEditToolNotes"/>
</item>
</layout>
</widget>
</widget>
</item>
<item>

View File

@ -233,6 +233,8 @@ void VToolFlippingByAxis::SaveDialog(QDomElement &domElement, QList<quint32> &ol
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::ReadToolAttributes(const QDomElement &domElement)
{
VAbstractFlipping::ReadToolAttributes(domElement);
m_originPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
m_axisType = static_cast<AxisType>(doc->GetParametrUInt(domElement, AttrAxisType, QChar('1')));
suffix = doc->GetParametrString(domElement, AttrSuffix);
@ -241,7 +243,7 @@ void VToolFlippingByAxis::ReadToolAttributes(const QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
VAbstractFlipping::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrCenter, QString().setNum(m_originPointId));

View File

@ -220,6 +220,8 @@ void VToolFlippingByLine::SaveDialog(QDomElement &domElement, QList<quint32> &ol
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::ReadToolAttributes(const QDomElement &domElement)
{
VAbstractFlipping::ReadToolAttributes(domElement);
m_firstLinePointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
m_secondLinePointId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
suffix = doc->GetParametrString(domElement, AttrSuffix);
@ -228,7 +230,7 @@ void VToolFlippingByLine::ReadToolAttributes(const QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
VAbstractFlipping::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrP1Line, QString().setNum(m_firstLinePointId));

View File

@ -50,10 +50,10 @@ struct DestinationItem
bool showLabel;
};
struct VAbstractOperationInitData : VAbstractToolInitData
struct VAbstractOperationInitData : VDrawToolInitData
{
VAbstractOperationInitData()
: VAbstractToolInitData()
: VDrawToolInitData()
{}
QString suffix{};

View File

@ -489,6 +489,8 @@ void VToolMove::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependenc
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::ReadToolAttributes(const QDomElement &domElement)
{
VAbstractOperation::ReadToolAttributes(domElement);
origPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
formulaAngle = doc->GetParametrString(domElement, AttrAngle, QChar('0'));
formulaRotationAngle = doc->GetParametrString(domElement, AttrRotationAngle, QChar('0'));
@ -499,7 +501,7 @@ void VToolMove::ReadToolAttributes(const QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
VAbstractOperation::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrAngle, formulaAngle);

View File

@ -369,6 +369,8 @@ void VToolRotation::SaveDialog(QDomElement &domElement, QList<quint32> &oldDepen
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::ReadToolAttributes(const QDomElement &domElement)
{
VAbstractOperation::ReadToolAttributes(domElement);
origPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
formulaAngle = doc->GetParametrString(domElement, AttrAngle, QChar('0'));
suffix = doc->GetParametrString(domElement, AttrSuffix);
@ -377,7 +379,7 @@ void VToolRotation::ReadToolAttributes(const QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
VAbstractOperation::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrCenter, QString().setNum(origPointId));

View File

@ -322,12 +322,6 @@ void VAbstractSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsPathItem::mouseReleaseEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
{
Q_UNUSED(domElement)
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{

View File

@ -54,10 +54,10 @@
class VControlPointSpline;
template <class T> class QSharedPointer;
struct VAbstractSplineInitData : VAbstractToolInitData
struct VAbstractSplineInitData : VDrawToolInitData
{
VAbstractSplineInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
color(ColorBlack),
penStyle(TypeLineLine),
approximationScale(defCurveApproximationScale)
@ -129,7 +129,6 @@ protected:
virtual void keyReleaseEvent(QKeyEvent * event) override;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) override;
virtual void ReadToolAttributes(const QDomElement &domElement) override;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
virtual void RefreshCtrlPoints();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) override;

View File

@ -46,10 +46,10 @@ template <class T> class QSharedPointer;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
struct VToolCubicBezierInitData : VAbstractToolInitData
struct VToolCubicBezierInitData : VDrawToolInitData
{
VToolCubicBezierInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
spline(nullptr)
{}

View File

@ -46,10 +46,10 @@ template <class T> class QSharedPointer;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
struct VToolCubicBezierPathInitData : VAbstractToolInitData
struct VToolCubicBezierPathInitData : VDrawToolInitData
{
VToolCubicBezierPathInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
path(nullptr)
{}

View File

@ -306,6 +306,8 @@ void VToolTrueDarts::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::ReadToolAttributes(const QDomElement &domElement)
{
VToolDoublePoint::ReadToolAttributes(domElement);
baseLineP1Id = doc->GetParametrUInt(domElement, AttrBaseLineP1, NULL_ID_STR);
baseLineP2Id = doc->GetParametrUInt(domElement, AttrBaseLineP2, NULL_ID_STR);
dartP1Id = doc->GetParametrUInt(domElement, AttrDartP1, NULL_ID_STR);

View File

@ -44,10 +44,10 @@
template <class T> class QSharedPointer;
struct VToolTrueDartsInitData : VAbstractToolInitData
struct VToolTrueDartsInitData : VDrawToolInitData
{
VToolTrueDartsInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
p1id(NULL_ID),
p2id(NULL_ID),
baseLineP1Id(NULL_ID),

View File

@ -231,6 +231,8 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
{
VToolCut::ReadToolAttributes(domElement);
formula = doc->GetParametrString(domElement, AttrLength, QString());
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
}

View File

@ -230,6 +230,8 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
{
VToolCut::ReadToolAttributes(domElement);
formula = doc->GetParametrString(domElement, AttrLength, QString());
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
}

View File

@ -321,6 +321,8 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
{
VToolCut::ReadToolAttributes(domElement);
formula = doc->GetParametrString(domElement, AttrLength, QString());
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
}

View File

@ -121,6 +121,8 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, QString());

View File

@ -278,6 +278,8 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, QString());

View File

@ -278,6 +278,8 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObj
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);

View File

@ -206,6 +206,8 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, QString());

View File

@ -237,6 +237,8 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);

View File

@ -296,6 +296,8 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObje
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);

View File

@ -249,6 +249,8 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, QString());

View File

@ -296,6 +296,8 @@ void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement)
{
VToolLinePoint::ReadToolAttributes(domElement);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, QString());

View File

@ -78,6 +78,7 @@ const QString VToolBasePoint::ToolType = QStringLiteral("single");
VToolBasePoint::VToolBasePoint (const VToolBasePointInitData &initData, QGraphicsItem * parent )
:VToolSinglePoint(initData.doc, initData.data, initData.id, parent), namePP(initData.nameActivPP)
{
m_notes = initData.notes;
m_baseColor = Qt::red;
this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
@ -96,6 +97,7 @@ void VToolBasePoint::setDialog()
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(m_id);
dialogTool->SetData(p->name(), static_cast<QPointF>(*p));
dialogTool->SetNotes(m_notes);
}
//---------------------------------------------------------------------------------------------------------------------
@ -267,6 +269,9 @@ void VToolBasePoint::SaveDialog(QDomElement &domElement, QList<quint32> &oldDepe
doc->SetAttribute(domElement, AttrName, name);
doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(p.x())));
doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y())));
const QString notes = dialogTool->GetNotes();
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
}
//---------------------------------------------------------------------------------------------------------------------
@ -320,13 +325,6 @@ void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
doc->SetAttribute(tag, AttrY, qApp->fromPixel(point->y()));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBasePoint::ReadToolAttributes(const QDomElement &domElement)
{
Q_UNUSED(domElement)
// This tool doesn't need read attributes from file.
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolBasePoint::MakeToolTip() const
{

View File

@ -95,7 +95,6 @@ protected:
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ) override;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) override;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
virtual void ReadToolAttributes(const QDomElement &domElement) override;
virtual void SetVisualization() override {}
virtual QString MakeToolTip() const override;
private slots:

View File

@ -276,6 +276,8 @@ void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(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);

View File

@ -314,6 +314,8 @@ void VToolPointFromArcAndTangent::SaveOptions(QDomElement &tag, QSharedPointer<V
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
arcId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
tangentPointId = doc->GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
crossPoint = static_cast<CrossCirclesPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, QChar('1')));

View File

@ -307,6 +307,8 @@ void VToolPointFromCircleAndTangent::SaveOptions(QDomElement &tag, QSharedPointe
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
circleCenterId = doc->GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR);
tangentPointId = doc->GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
circleRadius = doc->GetParametrString(domElement, AttrCRadius);

View File

@ -330,6 +330,8 @@ void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
arcRadius = doc->GetParametrString(domElement, AttrRadius, QString());
center = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);

View File

@ -220,6 +220,8 @@ void VToolPointOfIntersection::SaveOptions(QDomElement &tag, QSharedPointer<VGOb
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
}

View File

@ -335,6 +335,8 @@ void VToolPointOfIntersectionArcs::SaveOptions(QDomElement &tag, QSharedPointer<
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
firstArcId = doc->GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR);
secondArcId = doc->GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR);
crossPoint = static_cast<CrossCirclesPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, QChar('1')));

View File

@ -347,6 +347,8 @@ void VToolPointOfIntersectionCircles::SaveOptions(QDomElement &tag, QSharedPoint
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
firstCircleCenterId = doc->GetParametrUInt(domElement, AttrC1Center, NULL_ID_STR);
secondCircleCenterId = doc->GetParametrUInt(domElement, AttrC2Center, NULL_ID_STR);
firstCircleRadius = doc->GetParametrString(domElement, AttrC1Radius);

View File

@ -385,6 +385,8 @@ void VToolPointOfIntersectionCurves::SaveOptions(QDomElement &tag, QSharedPointe
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(domElement);
firstCurveId = doc->GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
secondCurveId = doc->GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
vCrossPoint = static_cast<VCrossCurvesPoint>(doc->GetParametrUInt(domElement, AttrVCrossPoint, QChar('1')));

View File

@ -44,10 +44,10 @@
template <class T> class QSharedPointer;
struct VToolSinglePointInitData : VAbstractToolInitData
struct VToolSinglePointInitData : VDrawToolInitData
{
VToolSinglePointInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
name(),
mx(5),
my(10),

View File

@ -319,6 +319,8 @@ void VToolTriangle::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::ReadToolAttributes(const QDomElement &domElement)
{
VToolSinglePoint::ReadToolAttributes(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);

View File

@ -175,6 +175,7 @@ void VDrawTool::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
Q_UNUSED(obj)
doc->SetAttribute(tag, VDomDocument::AttrId, m_id);
doc->SetAttributeOrRemoveIf(tag, AttrNotes, m_notes, m_notes.isEmpty());
}
//---------------------------------------------------------------------------------------------------------------------
@ -210,6 +211,12 @@ void VDrawTool::ReadAttributes()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::ReadToolAttributes(const QDomElement &domElement)
{
m_notes = doc->GetParametrEmptyString(domElement, AttrNotes);
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::EnableToolMove(bool move)
{
@ -280,3 +287,18 @@ bool VDrawTool::IsLabelVisible(quint32 id) const
Q_UNUSED(id)
return false;
}
//---------------------------------------------------------------------------------------------------------------------
QString VDrawTool::GetNotes() const
{
return m_notes;
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetNotes(const QString &notes)
{
m_notes = notes;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}

View File

@ -53,6 +53,16 @@
#include "../vgeometry/vpointf.h"
#include "../vtools/undocommands/undogroup.h"
struct VDrawToolInitData : VAbstractToolInitData
{
VDrawToolInitData()
: VAbstractToolInitData(),
notes()
{}
QString notes;
};
/**
* @brief The VDrawTool abstract class for all draw tool.
*/
@ -69,6 +79,9 @@ public:
virtual bool IsLabelVisible(quint32 id) const;
QString GetNotes() const;
void SetNotes(const QString &notes);
signals:
void ChangedToolSelection(bool selected, quint32 object, quint32 tool);
@ -92,6 +105,8 @@ protected:
/** @brief typeLine line type. */
QString m_lineType;
QString m_notes{};
void AddToCalculation(const QDomElement &domElement);
void AddDependence(QList<quint32> &list, quint32 objectId) const;
@ -109,7 +124,7 @@ protected:
bool CorrectDisable(bool disable, const QString &namePP) const;
void ReadAttributes();
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
virtual void ReadToolAttributes(const QDomElement &domElement);
virtual void ChangeLabelVisibility(quint32 id, bool visible);
template <class Dialog>

View File

@ -407,6 +407,8 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::ReadToolAttributes(const QDomElement &domElement)
{
VDrawTool::ReadToolAttributes(domElement);
firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);

View File

@ -44,10 +44,10 @@
template <class T> class QSharedPointer;
struct VToolLineInitData : VAbstractToolInitData
struct VToolLineInitData : VDrawToolInitData
{
VToolLineInitData()
: VAbstractToolInitData(),
: VDrawToolInitData(),
firstPoint(NULL_ID),
secondPoint(NULL_ID),
typeLine(TypeLineLine),