Refactoring. More switch tests. Added tool button for tool Cubic bezier path.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-03-17 20:12:48 +02:00
parent 54294f1a71
commit 56496aaa59
16 changed files with 201 additions and 131 deletions

View file

@ -31,6 +31,7 @@
#include "../vgeometry/varc.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h"
#include "../vgeometry/vpointf.h"
#include "../vtools/tools/vabstracttool.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
@ -194,12 +195,11 @@ void DialogHistory::FillTable()
ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_CC_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Record return description for record
* @param tool record data
@ -208,7 +208,7 @@ void DialogHistory::FillTable()
QString DialogHistory::Record(const VToolRecord &tool)
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 40, "Not all tools was used in history.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used in history.");
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
@ -268,49 +268,39 @@ QString DialogHistory::Record(const VToolRecord &tool)
{
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
SCASSERT(spl != nullptr);
return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id()));
return spl->NameForHistory(tr("Curve"));
}
case Tool::CubicBezier:
{
const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId());
SCASSERT(spl != nullptr);
return QString(tr("Cubic bezier curve %1_%2")).arg(PointName(spl->GetP1().id()))
.arg(PointName(spl->GetP4().id()));
return spl->NameForHistory(tr("Cubic bezier curve"));
}
case Tool::Arc:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr);
return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id()));
return arc->NameForHistory(tr("Arc"));
}
case Tool::ArcWithLength:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(arc != nullptr);
return QString(tr("Arc with center in point %1 and length %2")).arg(PointName(arc->GetCenter().id()))
return QString(tr("%1 with length %2"))
.arg(arc->NameForHistory(tr("Arc")))
.arg(arc->GetLength());
}
case Tool::SplinePath:
{
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
SCASSERT(splPath != nullptr);
const QVector<VSplinePoint> points = splPath->GetSplinePath();
QString record;
if (points.size() != 0 )
{
// We use only first and last point name in curve
record = QString(tr("Curve point %1")).arg(PointName(points.at(0).P().id()));
if (points.size() > 1)
{
record.append(QString("_%1").arg(PointName(points.last().P().id())));
}
}
else
{
qDebug()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
return tr("Can't create record.");
}
return record;
return splPath->NameForHistory(tr("Spline path"));
}
case Tool::CubicBezierPath:
{
const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId());
SCASSERT(splPath != nullptr);
return splPath->NameForHistory(tr("Cubic bezier curve path"));
}
case Tool::PointOfContact:
return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3"))
@ -338,43 +328,27 @@ QString DialogHistory::Record(const VToolRecord &tool)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
SCASSERT(arc != nullptr);
return QString(tr("%1 - cut arc with center %2"))
return QString(tr("%1 - cut %2"))
.arg(PointName(tool.getId()))
.arg(PointName(arc->GetCenter().id()));
.arg(arc->NameForHistory(tr("arc")));
}
case Tool::CutSpline:
{
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId);
SCASSERT(spl != nullptr);
return QString(tr("%1 - cut curve %2_%3"))
return QString(tr("%1 - cut %2"))
.arg(PointName(tool.getId()))
.arg(PointName(spl->GetP1().id()))
.arg(PointName(spl->GetP4().id()));
.arg(spl->NameForHistory(tr("curve")));
}
case Tool::CutSplinePath:
{
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
SCASSERT(splPath != nullptr);
const QVector<VSplinePoint> points = splPath->GetSplinePath();
QString record;
if (points.size() != 0 )
{
record = QString(tr("%1 - cut curve path %2"))
.arg(PointName(tool.getId()))
.arg(PointName(points.at(0).P().id()));
if (points.size() > 1)
{
record.append(QString("_%1").arg(PointName(points.last().P().id())));
}
}
else
{
qDebug()<<"Not enough points in splinepath"<<Q_FUNC_INFO;
return QString(tr("Can't create record."));
}
return record;
return QString(tr("%1 - cut %2"))
.arg(PointName(tool.getId()))
.arg(splPath->NameForHistory(tr("curve path")));
}
case Tool::LineIntersectAxis:
return QString(tr("%1 - point of intersection line %2_%3 and axis through point %4"))

View file

@ -830,6 +830,12 @@ void MainWindow::ToolSplinePath(bool checked)
&MainWindow::ApplyDialog<VToolSplinePath>);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolCubicBezierPath(bool checked)
{
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolCutSplinePath handler tool CutSplinePath.
@ -1615,6 +1621,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonCubicBezier, &QToolButton::clicked, this, &MainWindow::ToolCubicBezier);
connect(ui->toolButtonArc, &QToolButton::clicked, this, &MainWindow::ToolArc);
connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath);
connect(ui->toolButtonCubicBezierPath, &QToolButton::clicked, this, &MainWindow::ToolCubicBezierPath);
connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact);
connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail);
connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight);
@ -1669,11 +1676,18 @@ void MainWindow::mouseMove(const QPointF &scenePos)
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_CC_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
/**
* @brief CancelTool cancel tool.
*/
void MainWindow::CancelTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
dialogTool = nullptr;
@ -1692,6 +1706,16 @@ void MainWindow::CancelTool()
redoAction->setEnabled(false);
return;
case Tool::BasePoint:
case Tool::SinglePoint:
case Tool::DoublePoint:
case Tool::LinePoint:
case Tool::AbstractSpline:
case Tool::Cut:
case Tool::LAST_ONE_DO_NOT_USE:
case Tool::NodePoint:
case Tool::NodeArc:
case Tool::NodeSpline:
case Tool::NodeSplinePath:
Q_UNREACHABLE(); //-V501
//Nothing to do here because we can't create this tool from main window.
break;
@ -1731,6 +1755,9 @@ void MainWindow::CancelTool()
case Tool::SplinePath:
ui->toolButtonSplinePath->setChecked(false);
break;
case Tool::CubicBezierPath:
ui->toolButtonCubicBezierPath->setChecked(false);
break;
case Tool::PointOfContact:
ui->toolButtonPointOfContact->setChecked(false);
break;
@ -1783,13 +1810,6 @@ void MainWindow::CancelTool()
case Tool::TrueDarts:
ui->toolButtonTrueDarts->setChecked(false);
break;
case Tool::NodePoint:
case Tool::NodeArc:
case Tool::NodeSpline:
case Tool::NodeSplinePath:
default:
qDebug()<<"Got wrong tool type. Ignored.";
break;
}
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
@ -1801,6 +1821,10 @@ void MainWindow::CancelTool()
redoAction->setEnabled(qApp->getUndoStack()->canRedo());
}
#if defined(Q_CC_GNU)
#pragma GCC diagnostic pop
#endif
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ArrowTool enable arrow tool.
@ -2949,6 +2973,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonCubicBezier->setEnabled(drawTools);
ui->toolButtonArc->setEnabled(drawTools);
ui->toolButtonSplinePath->setEnabled(drawTools);
ui->toolButtonCubicBezierPath->setEnabled(drawTools);
ui->toolButtonPointOfContact->setEnabled(drawTools);
ui->toolButtonNewDetail->setEnabled(drawTools);
ui->toolButtonHeight->setEnabled(drawTools);
@ -3233,8 +3258,16 @@ void MainWindow::CreateMenus()
AddDocks();
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_CC_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
void MainWindow::LastUsedTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was handled.");
if (currentTool == lastUsedTool)
{
return;
@ -3247,6 +3280,16 @@ void MainWindow::LastUsedTool()
ArrowTool();
break;
case Tool::BasePoint:
case Tool::SinglePoint:
case Tool::DoublePoint:
case Tool::LinePoint:
case Tool::AbstractSpline:
case Tool::Cut:
case Tool::LAST_ONE_DO_NOT_USE:
case Tool::NodePoint:
case Tool::NodeArc:
case Tool::NodeSpline:
case Tool::NodeSplinePath:
Q_UNREACHABLE(); //-V501
//Nothing to do here because we can't create this tool from main window.
break;
@ -3282,6 +3325,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonSpline->setChecked(true);
ToolSpline(true);
break;
case Tool::CubicBezier:
ui->toolButtonCubicBezier->setChecked(true);
ToolCubicBezier(true);
break;
case Tool::Arc:
ui->toolButtonArc->setChecked(true);
ToolArc(true);
@ -3290,6 +3337,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonSplinePath->setChecked(true);
ToolSplinePath(true);
break;
case Tool::CubicBezierPath:
ui->toolButtonCubicBezierPath->setChecked(true);
ToolCubicBezierPath(true);
break;
case Tool::PointOfContact:
ui->toolButtonPointOfContact->setChecked(true);
ToolPointOfContact(true);
@ -3362,16 +3413,13 @@ void MainWindow::LastUsedTool()
ui->toolButtonTrueDarts->setChecked(true);
ToolTrueDarts(true);
break;
case Tool::NodePoint:
case Tool::NodeArc:
case Tool::NodeSpline:
case Tool::NodeSplinePath:
default:
qDebug()<<"Got wrong tool type. Ignored.";
break;
}
}
#if defined(Q_CC_GNU)
#pragma GCC diagnostic pop
#endif
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::AddDocks()
{

View file

@ -112,6 +112,7 @@ public slots:
void ToolCutSpline(bool checked);
void ToolArc(bool checked);
void ToolSplinePath(bool checked);
void ToolCubicBezierPath(bool checked);
void ToolCutSplinePath(bool checked);
void ToolPointOfContact(bool checked);
void ToolDetail(bool checked);

View file

@ -618,7 +618,33 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="0">
<widget class="QToolButton" name="toolButtonIntersectionCurves">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Point intersection curves</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/intersection_curves.png</normaloff>:/toolicon/32x32/intersection_curves.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="toolButtonCurveIntersectAxis">
<property name="enabled">
<bool>false</bool>
@ -644,20 +670,17 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QToolButton" name="toolButtonIntersectionCurves">
<item row="2" column="1">
<widget class="QToolButton" name="toolButtonCubicBezierPath">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Point intersection curves</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/intersection_curves.png</normaloff>:/toolicon/32x32/intersection_curves.png</iconset>
<normaloff>:/toolicon/32x32/cubic_bezier_path.png</normaloff>:/toolicon/32x32/cubic_bezier_path.png</iconset>
</property>
<property name="iconSize">
<size>

View file

@ -3036,7 +3036,7 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
QRectF VPattern::ActiveDrawBoundingRect() const
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 40, "Not all tools was used.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 41, "Not all tools was used.");
QRectF rec;
@ -3057,91 +3057,37 @@ QRectF VPattern::ActiveDrawBoundingRect() const
Q_UNREACHABLE();
break;
case Tool::BasePoint:
rec = ToolBoundingRect<VToolBasePoint>(rec, tool.getId());
break;
case Tool::EndLine:
rec = ToolBoundingRect<VToolEndLine>(rec, tool.getId());
break;
case Tool::Line:
rec = ToolBoundingRect<VToolLine>(rec, tool.getId());
break;
case Tool::AlongLine:
rec = ToolBoundingRect<VToolAlongLine>(rec, tool.getId());
break;
case Tool::ShoulderPoint:
rec = ToolBoundingRect<VToolShoulderPoint>(rec, tool.getId());
break;
case Tool::Normal:
rec = ToolBoundingRect<VToolNormal>(rec, tool.getId());
break;
case Tool::Bisector:
rec = ToolBoundingRect<VToolBisector>(rec, tool.getId());
break;
case Tool::LineIntersect:
rec = ToolBoundingRect<VToolLineIntersect>(rec, tool.getId());
break;
case Tool::Spline:
rec = ToolBoundingRect<VToolSpline>(rec, tool.getId());
break;
case Tool::CubicBezier:
rec = ToolBoundingRect<VToolCubicBezier>(rec, tool.getId());
break;
case Tool::Arc:
rec = ToolBoundingRect<VToolArc>(rec, tool.getId());
break;
case Tool::SplinePath:
rec = ToolBoundingRect<VToolSplinePath>(rec, tool.getId());
break;
case Tool::CubicBezierPath:
case Tool::PointOfContact:
rec = ToolBoundingRect<VToolPointOfContact>(rec, tool.getId());
break;
case Tool::Height:
rec = ToolBoundingRect<VToolHeight>(rec, tool.getId());
break;
case Tool::Triangle:
rec = ToolBoundingRect<VToolTriangle>(rec, tool.getId());
break;
case Tool::PointOfIntersection:
rec = ToolBoundingRect<VToolPointOfIntersection>(rec, tool.getId());
break;
case Tool::CutArc:
rec = ToolBoundingRect<VToolCutArc>(rec, tool.getId());
break;
case Tool::CutSpline:
rec = ToolBoundingRect<VToolCutSpline>(rec, tool.getId());
break;
case Tool::CutSplinePath:
rec = ToolBoundingRect<VToolCutSplinePath>(rec, tool.getId());
break;
case Tool::ArcWithLength:
rec = ToolBoundingRect<VToolArcWithLength>(rec, tool.getId());
break;
case Tool::LineIntersectAxis:
rec = ToolBoundingRect<VToolLineIntersectAxis>(rec, tool.getId());
break;
case Tool::PointOfIntersectionArcs:
rec = ToolBoundingRect<VToolPointOfIntersectionArcs>(rec, tool.getId());
break;
case Tool::PointOfIntersectionCircles:
rec = ToolBoundingRect<VToolPointOfIntersectionCircles>(rec, tool.getId());
break;
case Tool::PointOfIntersectionCurves:
rec = ToolBoundingRect<VToolPointOfIntersectionCurves>(rec, tool.getId());
break;
case Tool::CurveIntersectAxis:
rec = ToolBoundingRect<VToolCurveIntersectAxis>(rec, tool.getId());
break;
case Tool::PointFromCircleAndTangent:
rec = ToolBoundingRect<VToolPointFromCircleAndTangent>(rec, tool.getId());
break;
case Tool::PointFromArcAndTangent:
rec = ToolBoundingRect<VToolPointFromArcAndTangent>(rec, tool.getId());
break;
case Tool::TrueDarts:
rec = ToolBoundingRect<VToolTrueDarts>(rec, tool.getId());
rec = ToolBoundingRect(rec, tool.getId());
break;
//Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them.
//These tools are not accesseble in Draw mode, but still 'history' contains them.
case Tool::Detail:
case Tool::UnionDetails:
case Tool::NodeArc:
@ -3160,13 +3106,12 @@ QRectF VPattern::ActiveDrawBoundingRect() const
#endif
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const
{
QRectF recTool = rec;
if (tools.contains(id))
{
T *vTool = qobject_cast<T *>(tools.value(id));
const QGraphicsItem *vTool = qobject_cast<QGraphicsItem *>(tools.value(id));
SCASSERT(vTool != nullptr);
QRectF childrenRect = vTool->childrenBoundingRect();

View file

@ -135,8 +135,7 @@ private:
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);
template <typename T>
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
void ParseCurrentPP();
QString GetLabelBase(quint32 index)const;

View file

@ -126,6 +126,17 @@ QPointF VAbstractCubicBezier::CutSpline(qreal length, QPointF &spl1p2, QPointF &
return p1234;
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractCubicBezier::NameForHistory(const QString &toolName) const
{
QString name = toolName + QString(" %1_%2").arg(GetP1().name()).arg(GetP4().name());
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
return name;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezier::CreateName()
{

View file

@ -46,6 +46,8 @@ public:
QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;

View file

@ -181,6 +181,31 @@ QPointF VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32
return QPointF();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief NameForHistory helps to create name for dialog History.
* @param toolName first part of name. Like 'Spline path' or 'Cubic Bezier path'.
* @return name of curve for history records.
*/
QString VAbstractCubicBezierPath::NameForHistory(const QString &toolName) const
{
QString name = toolName;
if (CountPoints() > 0)
{
name += QString(" %1").arg(FirstPoint().name());
if (CountSubSpl() >= 1)
{
name += QString("_%1").arg(LastPoint().name());
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
}
return name;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezierPath::CreateName()
{

View file

@ -60,6 +60,8 @@ public:
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
QPointF &spl2p3) const;
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;

View file

@ -65,6 +65,8 @@ public:
void SetDuplicate(quint32 number);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
virtual QString NameForHistory(const QString &toolName) const=0;
protected:
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
virtual void CreateName() =0;

View file

@ -315,6 +315,23 @@ void VArc::setId(const quint32 &id)
CreateName();
}
//---------------------------------------------------------------------------------------------------------------------
QString VArc::NameForHistory(const QString &toolName) const
{
QString name = toolName + QString(" %1").arg(this->GetCenter().name());
if (VAbstractCurve::id() != NULL_ID)
{
name += QString("_%1").arg(VAbstractCurve::id());
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
return name;
}
//---------------------------------------------------------------------------------------------------------------------
void VArc::CreateName()
{

View file

@ -80,6 +80,7 @@ public:
QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
QPointF CutArc (const qreal &length) const;
virtual void setId(const quint32 &id) Q_DECL_OVERRIDE;
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;
private:

View file

@ -375,6 +375,23 @@ void VEllipticalArc::setId(const quint32 &id)
CreateName();
}
//---------------------------------------------------------------------------------------------------------------------
QString VEllipticalArc::NameForHistory(const QString &toolName) const
{
QString name = toolName + QString(" %1").arg(this->GetCenter().name());
if (VAbstractCurve::id() != NULL_ID)
{
name += QString("_%1").arg(VAbstractCurve::id());
}
if (GetDuplicate() > 0)
{
name += QString("_%1").arg(GetDuplicate());
}
return name;
}
//---------------------------------------------------------------------------------------------------------------------
void VEllipticalArc::CreateName()
{

View file

@ -92,6 +92,7 @@ public:
QPointF CutArc (const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2) const;
QPointF CutArc (const qreal &length) const;
virtual void setId(const quint32 &id) Q_DECL_OVERRIDE;
virtual QString NameForHistory(const QString &toolName) const Q_DECL_OVERRIDE;
protected:
virtual void CreateName() Q_DECL_OVERRIDE;
private:

View file

@ -80,6 +80,7 @@ enum class Tool : ToolVisHolderType
Arc,
ArcWithLength,
SplinePath,
CubicBezierPath,
CutSplinePath,
PointOfContact,
Detail,
@ -129,6 +130,7 @@ enum class Vis : ToolVisHolderType
ToolShoulderPoint,
ToolSpline,
ToolCubicBezier,
ToolCubicBezierPath,
ToolTriangle,
ToolCutSpline,
ToolSplinePath,