Refactoring. New parent class VInteractiveTool.

Helps to share info about tool dialog.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-15 17:39:59 +03:00
parent e8917bd10d
commit c5957846b6
82 changed files with 649 additions and 586 deletions

View File

@ -107,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent)
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), mChanges(false), mChangesAsked(true),
patternReadOnly(false),
dialogTable(nullptr),
dialogTool(nullptr),
dialogTool(),
dialogHistory(nullptr), comboBoxDraws(nullptr), patternPieceLabel(nullptr), mode(Draw::Calculation),
currentDrawIndex(0), currentToolBoxIndex(0),
isDockToolOptionsVisible(true),
@ -566,7 +566,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
ui->view->setCursor(cur);
helpLabel->setText(toolTip);
ui->view->setShowToolOptions(false);
dialogTool = new Dialog(pattern, 0, this);
dialogTool = QSharedPointer<Dialog>(new Dialog(pattern, 0, this));
switch(t)
{
@ -1134,7 +1134,7 @@ void MainWindow::ClosedDialogGroup(int result)
SCASSERT(dialogTool != nullptr)
if (result == QDialog::Accepted)
{
DialogGroup *dialog = qobject_cast<DialogGroup*>(dialogTool);
QSharedPointer<DialogGroup> dialog = dialogTool.objectCast<DialogGroup>();
SCASSERT(dialog != nullptr)
const QDomElement group = doc->CreateGroup(VContainer::getNextId(), dialog->GetName(), dialog->GetGroup());
if (not group.isNull())
@ -1177,8 +1177,8 @@ void MainWindow::ClosedDialogInsertNode(int result)
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
DialogInsertNode *dTool = qobject_cast<DialogInsertNode*>(dialogTool);
SCASSERT(dTool != nullptr);
QSharedPointer<DialogInsertNode> dTool = dialogTool.objectCast<DialogInsertNode>();
SCASSERT(dTool != nullptr)
VToolSeamAllowance::InsertNode(dTool->GetNode(), dTool->GetPieceId(), sceneDetails, pattern, doc);
}
ArrowTool();
@ -1910,7 +1910,7 @@ void MainWindow::CancelTool()
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
dialogTool.clear();
qCDebug(vMainWindow, "Dialog closed.");
currentScene->setFocus(Qt::OtherFocusReason);

View File

@ -224,7 +224,7 @@ private:
bool patternReadOnly;
QPointer<DialogIncrements> dialogTable;
QPointer<DialogTool> dialogTool;
QSharedPointer<DialogTool> dialogTool;
QPointer<DialogHistory> dialogHistory;
/** @brief comboBoxDraws comboc who show name of pattern peaces. */

View File

@ -69,21 +69,21 @@ const QString VToolFlippingByAxis::ToolType = QStringLiteral("flippingByAxis");
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::setDialog()
{
SCASSERT(dialog != nullptr)
DialogFlippingByAxis *dialogTool = qobject_cast<DialogFlippingByAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByAxis> dialogTool = m_dialog.objectCast<DialogFlippingByAxis>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetOriginPointId(m_originPointId);
dialogTool->SetAxisType(m_axisType);
dialogTool->SetSuffix(suffix);
}
//---------------------------------------------------------------------------------------------------------------------
VToolFlippingByAxis *VToolFlippingByAxis::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolFlippingByAxis *VToolFlippingByAxis::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogFlippingByAxis *dialogTool = qobject_cast<DialogFlippingByAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogFlippingByAxis> dialogTool = dialog.objectCast<DialogFlippingByAxis>();
SCASSERT(not dialogTool.isNull())
const quint32 originPointId = dialogTool->GetOriginPointId();
const AxisType axisType = dialogTool->GetAxisType();
const QString suffix = dialogTool->GetSuffix();
@ -92,7 +92,7 @@ VToolFlippingByAxis *VToolFlippingByAxis::Create(DialogTool *dialog, VMainGraphi
scene, doc, data, Document::FullParse, Source::FromGui);
if (operation != nullptr)
{
operation->dialog = dialogTool;
operation->m_dialog = dialogTool;
}
return operation;
}
@ -185,9 +185,9 @@ void VToolFlippingByAxis::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogFlippingByAxis *dialogTool = qobject_cast<DialogFlippingByAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByAxis> dialogTool = m_dialog.objectCast<DialogFlippingByAxis>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOriginPointId()));
doc->SetAttribute(domElement, AttrAxisType, QString().setNum(static_cast<int>(dialogTool->GetAxisType())));

View File

@ -39,8 +39,8 @@ class VToolFlippingByAxis : public VAbstractFlipping
public:
virtual ~VToolFlippingByAxis() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolFlippingByAxis* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolFlippingByAxis* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolFlippingByAxis* Create(const quint32 _id, quint32 originPointId, AxisType axisType,
const QString &suffix, const QVector<quint32> &source,
const QVector<DestinationItem> &destination, VMainGraphicsScene *scene,

View File

@ -69,21 +69,21 @@ const QString VToolFlippingByLine::ToolType = QStringLiteral("flippingByLine");
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::setDialog()
{
SCASSERT(dialog != nullptr)
DialogFlippingByLine *dialogTool = qobject_cast<DialogFlippingByLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByLine> dialogTool = m_dialog.objectCast<DialogFlippingByLine>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetFirstLinePointId(m_firstLinePointId);
dialogTool->SetSecondLinePointId(m_secondLinePointId);
dialogTool->SetSuffix(suffix);
}
//---------------------------------------------------------------------------------------------------------------------
VToolFlippingByLine *VToolFlippingByLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolFlippingByLine *VToolFlippingByLine::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogFlippingByLine *dialogTool = qobject_cast<DialogFlippingByLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogFlippingByLine> dialogTool = dialog.objectCast<DialogFlippingByLine>();
SCASSERT(not dialogTool.isNull())
const quint32 firstLinePointId = dialogTool->GetFirstLinePointId();
const quint32 secondLinePointId = dialogTool->GetSecondLinePointId();
const QString suffix = dialogTool->GetSuffix();
@ -93,7 +93,7 @@ VToolFlippingByLine *VToolFlippingByLine::Create(DialogTool *dialog, VMainGraphi
Source::FromGui);
if (operation != nullptr)
{
operation->dialog = dialogTool;
operation->m_dialog = dialogTool;
}
return operation;
}
@ -171,9 +171,9 @@ void VToolFlippingByLine::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogFlippingByLine *dialogTool = qobject_cast<DialogFlippingByLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByLine> dialogTool = m_dialog.objectCast<DialogFlippingByLine>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetFirstLinePointId()));
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetSecondLinePointId()));

View File

@ -39,8 +39,8 @@ class VToolFlippingByLine : public VAbstractFlipping
public:
virtual ~VToolFlippingByLine() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolFlippingByLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolFlippingByLine* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolFlippingByLine* Create(const quint32 _id, quint32 firstLinePointId, quint32 secondLinePointId,
const QString &suffix, const QVector<quint32> &source,
const QVector<DestinationItem> &destination, VMainGraphicsScene *scene,

View File

@ -77,21 +77,21 @@ const QString VToolMove::ToolType = QStringLiteral("moving");
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::setDialog()
{
SCASSERT(dialog != nullptr)
DialogMove *dialogTool = qobject_cast<DialogMove*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogMove> dialogTool = m_dialog.objectCast<DialogMove>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetAngle(formulaAngle);
dialogTool->SetLength(formulaLength);
dialogTool->SetSuffix(suffix);
}
//---------------------------------------------------------------------------------------------------------------------
VToolMove *VToolMove::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolMove *VToolMove::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogMove *dialogTool = qobject_cast<DialogMove*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogMove> dialogTool = dialog.objectCast<DialogMove>();
SCASSERT(not dialogTool.isNull())
QString angle = dialogTool->GetAngle();
QString length = dialogTool->GetLength();
const QString suffix = dialogTool->GetSuffix();
@ -100,7 +100,7 @@ VToolMove *VToolMove::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbs
Document::FullParse, Source::FromGui);
if (operation != nullptr)
{
operation->dialog = dialogTool;
operation->m_dialog = dialogTool;
}
return operation;
}
@ -302,9 +302,9 @@ void VToolMove::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogMove *dialogTool = qobject_cast<DialogMove*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogMove> dialogTool = m_dialog.objectCast<DialogMove>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
QString length = dialogTool->GetLength();

View File

@ -51,8 +51,8 @@ class VToolMove : public VAbstractOperation
public:
virtual ~VToolMove() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolMove* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolMove* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolMove* Create(quint32 _id, QString &formulaAngle, QString &formulaLength, const QString &suffix,
const QVector<quint32> &source, const QVector<DestinationItem> &destination,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,

View File

@ -95,21 +95,21 @@ VToolRotation::VToolRotation(VAbstractPattern *doc, VContainer *data, quint32 id
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::setDialog()
{
SCASSERT(dialog != nullptr)
DialogRotation *dialogTool = qobject_cast<DialogRotation*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetOrigPointId(origPointId);
dialogTool->SetAngle(formulaAngle);
dialogTool->SetSuffix(suffix);
}
//---------------------------------------------------------------------------------------------------------------------
VToolRotation *VToolRotation::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolRotation *VToolRotation::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogRotation *dialogTool = qobject_cast<DialogRotation*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogRotation> dialogTool = dialog.objectCast<DialogRotation>();
SCASSERT(not dialogTool.isNull())
const quint32 originPointId = dialogTool->GetOrigPointId();
QString angle = dialogTool->GetAngle();
const QString suffix = dialogTool->GetSuffix();
@ -118,7 +118,7 @@ VToolRotation *VToolRotation::Create(DialogTool *dialog, VMainGraphicsScene *sce
scene, doc, data, Document::FullParse, Source::FromGui);
if (operation != nullptr)
{
operation->dialog = dialogTool;
operation->m_dialog = dialogTool;
}
return operation;
}
@ -303,9 +303,9 @@ void VToolRotation::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogRotation *dialogTool = qobject_cast<DialogRotation*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOrigPointId()));
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());

View File

@ -51,7 +51,7 @@ class VToolRotation : public VAbstractOperation
public:
virtual ~VToolRotation() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolRotation* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolRotation* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolRotation* Create(const quint32 _id, const quint32 &origin, QString &angle, const QString &suffix,
const QVector<quint32> &source, const QVector<DestinationItem> &destination,

View File

@ -86,9 +86,9 @@ VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const So
*/
void VToolArc::setDialog()
{
SCASSERT(dialog != nullptr)
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArc> dialogTool = m_dialog.objectCast<DialogArc>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
dialogTool->SetCenter(arc->GetCenter().id());
dialogTool->SetF1(arc->GetFormulaF1());
@ -105,11 +105,12 @@ void VToolArc::setDialog()
* @param doc dom document container
* @param data container with variables
*/
VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolArc* VToolArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogArc> dialogTool = dialog.objectCast<DialogArc>();
SCASSERT(not dialogTool.isNull())
const quint32 center = dialogTool->GetCenter();
QString radius = dialogTool->GetRadius();
QString f1 = dialogTool->GetF1();
@ -119,7 +120,7 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstr
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -341,9 +342,9 @@ void VToolArc::RemoveReferens()
*/
void VToolArc::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArc> dialogTool = m_dialog.objectCast<DialogArc>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());

View File

@ -51,7 +51,8 @@ class VToolArc :public VAbstractSpline
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolArc* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolArc* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);

View File

@ -75,9 +75,9 @@ VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data,
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::setDialog()
{
SCASSERT(dialog != nullptr)
DialogArcWithLength *dialogTool = qobject_cast<DialogArcWithLength*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArcWithLength> dialogTool = m_dialog.objectCast<DialogArcWithLength>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
dialogTool->SetCenter(arc->GetCenter().id());
dialogTool->SetF1(arc->GetFormulaF1());
@ -87,12 +87,12 @@ void VToolArcWithLength::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolArcWithLength *VToolArcWithLength::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogArcWithLength *dialogTool = qobject_cast<DialogArcWithLength*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogArcWithLength> dialogTool = dialog.objectCast<DialogArcWithLength>();
SCASSERT(not dialogTool.isNull())
const quint32 center = dialogTool->GetCenter();
QString radius = dialogTool->GetRadius();
QString f1 = dialogTool->GetF1();
@ -102,7 +102,7 @@ VToolArcWithLength *VToolArcWithLength::Create(DialogTool *dialog, VMainGraphics
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -298,9 +298,9 @@ void VToolArcWithLength::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogArcWithLength *dialogTool = qobject_cast<DialogArcWithLength*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArcWithLength> dialogTool = m_dialog.objectCast<DialogArcWithLength>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());

View File

@ -48,8 +48,8 @@ class VToolArcWithLength : public VAbstractSpline
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolArcWithLength* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolArcWithLength* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolArcWithLength* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1,
QString &length, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,

View File

@ -73,8 +73,8 @@ VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quin
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezier::setDialog()
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogCubicBezier*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogCubicBezier*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
dialogTool->SetSpline(*spl);
@ -82,19 +82,19 @@ void VToolCubicBezier::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezier *VToolCubicBezier::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogCubicBezier*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCubicBezier> dialogTool = dialog.objectCast<DialogCubicBezier>();
SCASSERT(not dialogTool.isNull())
auto spl = Create(0, new VCubicBezier(dialogTool->GetSpline()), dialogTool->GetColor(), scene, doc, data,
Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;
spl->m_dialog = dialogTool;
}
return spl;
}
@ -214,8 +214,8 @@ void VToolCubicBezier::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezier::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogCubicBezier*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogCubicBezier*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const VCubicBezier spl = dialogTool->GetSpline();

View File

@ -49,8 +49,8 @@ class VToolCubicBezier : public VAbstractSpline
public:
virtual ~VToolCubicBezier() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCubicBezier *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCubicBezier *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCubicBezier *Create(const quint32 _id, VCubicBezier *spline, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);

View File

@ -75,8 +75,8 @@ VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *da
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezierPath::setDialog()
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogCubicBezierPath*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
dialogTool->SetPath(*splPath);
@ -84,12 +84,12 @@ void VToolCubicBezierPath::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezierPath *VToolCubicBezierPath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogCubicBezierPath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCubicBezierPath> dialogTool = dialog.objectCast<DialogCubicBezierPath>();
SCASSERT(not dialogTool.isNull())
auto path = new VCubicBezierPath(dialogTool->GetPath());
const QString color = dialogTool->GetColor();
for (qint32 i = 0; i < path->CountPoints(); ++i)
@ -99,7 +99,7 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(DialogTool *dialog, VMainGrap
VToolCubicBezierPath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;
spl->m_dialog = dialogTool;
}
return spl;
}
@ -197,8 +197,8 @@ void VToolCubicBezierPath::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezierPath::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(dialog);
SCASSERT(not m_dialog.isNull())
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
SCASSERT(dialogTool != nullptr)
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());

View File

@ -49,8 +49,8 @@ class VToolCubicBezierPath:public VAbstractSpline
public:
virtual ~VToolCubicBezierPath() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCubicBezierPath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCubicBezierPath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCubicBezierPath *Create(const quint32 _id, VCubicBezierPath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);

View File

@ -86,9 +86,9 @@ VToolEllipticalArc::VToolEllipticalArc(VAbstractPattern *doc, VContainer *data,
*/
void VToolEllipticalArc::setDialog()
{
SCASSERT(dialog != nullptr)
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogEllipticalArc> dialogTool = m_dialog.objectCast<DialogEllipticalArc>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
dialogTool->SetCenter(elArc->GetCenter().id());
dialogTool->SetF1(elArc->GetFormulaF1());
@ -108,12 +108,12 @@ void VToolEllipticalArc::setDialog()
* @param doc dom document container
* @param data container with variables
*/
VToolEllipticalArc* VToolEllipticalArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolEllipticalArc* VToolEllipticalArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogEllipticalArc> dialogTool = dialog.objectCast<DialogEllipticalArc>();
SCASSERT(not dialogTool.isNull())
const quint32 center = dialogTool->GetCenter();
QString radius1 = dialogTool->GetRadius1();
@ -126,7 +126,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(DialogTool *dialog, VMainGraphics
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -408,9 +408,9 @@ void VToolEllipticalArc::RemoveReferens()
*/
void VToolEllipticalArc::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogEllipticalArc> dialogTool = m_dialog.objectCast<DialogEllipticalArc>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1());
doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2());

View File

@ -51,8 +51,8 @@ class VToolEllipticalArc : public VAbstractSpline
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolEllipticalArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolEllipticalArc* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolEllipticalArc* Create(const quint32 _id, const quint32 &center, QString &radius1, QString &radius2,
QString &f1, QString &f2, QString &rotationAngle, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,

View File

@ -138,9 +138,9 @@ VToolSpline::~VToolSpline()
*/
void VToolSpline::setDialog()
{
SCASSERT(dialog != nullptr)
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSpline> dialogTool = m_dialog.objectCast<DialogSpline>();
SCASSERT(not dialogTool.isNull())
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(spl->GetColor());
@ -155,11 +155,12 @@ void VToolSpline::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolSpline* VToolSpline::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogSpline*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogSpline> dialogTool = dialog.objectCast<DialogSpline>();
SCASSERT(not dialogTool.isNull())
VSpline *spline = new VSpline(dialogTool->GetSpline());
@ -167,7 +168,7 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
if (spl != nullptr)
{
spl->dialog=dialogTool;
spl->m_dialog = dialogTool;
}
return spl;
}
@ -325,8 +326,8 @@ void VToolSpline::RemoveReferens()
*/
void VToolSpline::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogSpline*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogSpline*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const VSpline spl = dialogTool->GetSpline();

View File

@ -53,7 +53,8 @@ class VToolSpline:public VAbstractSpline
public:
virtual ~VToolSpline() Q_DECL_OVERRIDE;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolSpline *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolSpline *Create(const quint32 _id, VSpline *spline, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);

View File

@ -148,9 +148,9 @@ VToolSplinePath::~VToolSplinePath()
*/
void VToolSplinePath::setDialog()
{
SCASSERT(dialog != nullptr)
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSplinePath> dialogTool = m_dialog.objectCast<DialogSplinePath>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(splPath->GetColor());
@ -164,12 +164,12 @@ void VToolSplinePath::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolSplinePath* VToolSplinePath::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogSplinePath> dialogTool = dialog.objectCast<DialogSplinePath>();
SCASSERT(not dialogTool.isNull())
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
for (qint32 i = 0; i < path->CountPoints(); ++i)
{
@ -179,7 +179,7 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;
spl->m_dialog = dialogTool;
}
return spl;
}
@ -440,9 +440,9 @@ void VToolSplinePath::RemoveReferens()
*/
void VToolSplinePath::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSplinePath> dialogTool = m_dialog.objectCast<DialogSplinePath>();
SCASSERT(not dialogTool.isNull())
const VSplinePath splPath = dialogTool->GetPath();
for (qint32 i = 1; i <= splPath.CountSubSpl(); ++i)

View File

@ -55,8 +55,8 @@ class VToolSplinePath:public VAbstractSpline
public:
virtual ~VToolSplinePath() Q_DECL_OVERRIDE;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolSplinePath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);

View File

@ -104,9 +104,9 @@ void VToolTrueDarts::FindPoint(const QPointF &baseLineP1, const QPointF &baseLin
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::setDialog()
{
SCASSERT(dialog != nullptr)
DialogTrueDarts *dialogTool = qobject_cast<DialogTrueDarts*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTrueDarts> dialogTool = m_dialog.objectCast<DialogTrueDarts>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p1 = VAbstractTool::data.GeometricObject<VPointF>(p1id);
const QSharedPointer<VPointF> p2 = VAbstractTool::data.GeometricObject<VPointF>(p2id);
@ -121,12 +121,12 @@ void VToolTrueDarts::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolTrueDarts *VToolTrueDarts::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolTrueDarts *VToolTrueDarts::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogTrueDarts *dialogTool = qobject_cast<DialogTrueDarts*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogTrueDarts> dialogTool = dialog.objectCast<DialogTrueDarts>();
SCASSERT(not dialogTool.isNull())
const QString point1Name = dialogTool->GetFirstNewDartPointName();
const QString point2Name = dialogTool->GetSecondNewDartPointName();
@ -141,7 +141,7 @@ VToolTrueDarts *VToolTrueDarts::Create(DialogTool *dialog, VMainGraphicsScene *s
Source::FromGui);
if (point != nullptr)
{
point->dialog = dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -367,9 +367,9 @@ void VToolTrueDarts::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogTrueDarts *dialogTool = qobject_cast<DialogTrueDarts*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTrueDarts> dialogTool = m_dialog.objectCast<DialogTrueDarts>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName1, dialogTool->GetFirstNewDartPointName());
doc->SetAttribute(domElement, AttrName2, dialogTool->GetSecondNewDartPointName());

View File

@ -51,7 +51,7 @@ public:
static void FindPoint(const QPointF &baseLineP1, const QPointF &baseLineP2, const QPointF &dartP1,
const QPointF &dartP2, const QPointF &dartP3, QPointF &p1, QPointF &p2);
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolTrueDarts* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolTrueDarts* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolTrueDarts* Create(quint32 _id,
const quint32 &_p1id, const quint32 &_p2id,

View File

@ -80,9 +80,9 @@ VToolCutArc::VToolCutArc(VAbstractPattern *doc, VContainer *data, const quint32
*/
void VToolCutArc::setDialog()
{
SCASSERT(dialog != nullptr)
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutArc> dialogTool = m_dialog.objectCast<DialogCutArc>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFormula(formula);
dialogTool->setArcId(curveCutId);
@ -97,11 +97,12 @@ void VToolCutArc::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolCutArc* VToolCutArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCutArc> dialogTool = dialog.objectCast<DialogCutArc>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 arcId = dialogTool->getArcId();
@ -109,7 +110,7 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -210,9 +211,9 @@ void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolCutArc::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutArc> dialogTool = m_dialog.objectCast<DialogCutArc>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));

View File

@ -51,7 +51,8 @@ class VToolCutArc : public VToolCut
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolCutArc* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,

View File

@ -83,9 +83,9 @@ VToolCutSpline::VToolCutSpline(VAbstractPattern *doc, VContainer *data, const qu
*/
void VToolCutSpline::setDialog()
{
SCASSERT(dialog != nullptr)
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSpline> dialogTool = m_dialog.objectCast<DialogCutSpline>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFormula(formula);
dialogTool->setSplineId(curveCutId);
@ -100,12 +100,12 @@ void VToolCutSpline::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
VToolCutSpline* VToolCutSpline::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCutSpline> dialogTool = dialog.objectCast<DialogCutSpline>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splineId = dialogTool->getSplineId();
@ -113,7 +113,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -211,9 +211,9 @@ void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolCutSpline::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSpline> dialogTool = m_dialog.objectCast<DialogCutSpline>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));

View File

@ -51,7 +51,7 @@ class VToolCutSpline : public VToolCut
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolCutSpline *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my,

View File

@ -87,9 +87,9 @@ VToolCutSplinePath::VToolCutSplinePath(VAbstractPattern *doc, VContainer *data,
*/
void VToolCutSplinePath::setDialog()
{
SCASSERT(dialog != nullptr)
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSplinePath> dialogTool = m_dialog.objectCast<DialogCutSplinePath>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFormula(formula);
dialogTool->setSplinePathId(curveCutId);
@ -104,12 +104,12 @@ void VToolCutSplinePath::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolCutSplinePath* VToolCutSplinePath::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCutSplinePath> dialogTool = dialog.objectCast<DialogCutSplinePath>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splinePathId = dialogTool->getSplinePathId();
@ -117,7 +117,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -298,9 +298,9 @@ void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSplinePath> dialogTool = m_dialog.objectCast<DialogCutSplinePath>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));

View File

@ -53,8 +53,8 @@ class VToolCutSplinePath : public VToolCut
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutSplinePath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,

View File

@ -127,9 +127,9 @@ void VToolAlongLine::RemoveReferens()
*/
void VToolAlongLine::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogAlongLine> dialogTool = m_dialog.objectCast<DialogAlongLine>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -204,9 +204,9 @@ void VToolAlongLine::ShowVisualization(bool show)
*/
void VToolAlongLine::setDialog()
{
SCASSERT(dialog != nullptr)
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogAlongLine> dialogTool = m_dialog.objectCast<DialogAlongLine>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -224,12 +224,12 @@ void VToolAlongLine::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolAlongLine* VToolAlongLine::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogAlongLine> dialogTool = dialog.objectCast<DialogAlongLine>();
SCASSERT(not dialogTool.isNull())
QString formula = dialogTool->GetFormula();
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
@ -240,7 +240,7 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}

View File

@ -51,8 +51,8 @@ class VToolAlongLine : public VToolLinePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolAlongLine* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,

View File

@ -121,9 +121,9 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
*/
void VToolBisector::setDialog()
{
SCASSERT(dialog != nullptr)
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogBisector> dialogTool = m_dialog.objectCast<DialogBisector>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -142,12 +142,12 @@ void VToolBisector::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolBisector* VToolBisector::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogBisector> dialogTool = dialog.objectCast<DialogBisector>();
SCASSERT(not dialogTool.isNull())
QString formula = dialogTool->GetFormula();
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
@ -159,7 +159,7 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
pointName, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -290,9 +290,9 @@ void VToolBisector::RemoveReferens()
*/
void VToolBisector::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogBisector> dialogTool = m_dialog.objectCast<DialogBisector>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -55,7 +55,7 @@ public:
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint,
const qreal& length);
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolBisector* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,

View File

@ -84,10 +84,10 @@ VToolCurveIntersectAxis::VToolCurveIntersectAxis(VAbstractPattern *doc, VContain
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::setDialog()
{
SCASSERT(dialog != nullptr)
dialog->setModal(true);
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
m_dialog->setModal(true);
QSharedPointer<DialogCurveIntersectAxis> dialogTool = m_dialog.objectCast<DialogCurveIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -98,13 +98,13 @@ void VToolCurveIntersectAxis::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
SCASSERT(dialogTool)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogCurveIntersectAxis> dialogTool = dialog.objectCast<DialogCurveIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
@ -113,11 +113,10 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
const quint32 curveId = dialogTool->getCurveId();
VToolCurveIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId,
curveId, 5, 10, scene, doc, data, Document::FullParse,
Source::FromGui);
curveId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -279,9 +278,9 @@ void VToolCurveIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *e
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCurveIntersectAxis> dialogTool = m_dialog.objectCast<DialogCurveIntersectAxis>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -53,8 +53,8 @@ public:
virtual ~VToolCurveIntersectAxis() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCurveIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCurveIntersectAxis *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCurveIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const qreal &mx, const qreal &my,

View File

@ -84,10 +84,10 @@ VToolEndLine::VToolEndLine(VAbstractPattern *doc, VContainer *data, const quint3
*/
void VToolEndLine::setDialog()
{
SCASSERT(dialog != nullptr)
dialog->setModal(true);
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
m_dialog->setModal(true);
QSharedPointer<DialogEndLine> dialogTool = m_dialog.objectCast<DialogEndLine>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -106,12 +106,12 @@ void VToolEndLine::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VToolEndLine* VToolEndLine::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
SCASSERT(dialogTool)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogEndLine> dialogTool = dialog.objectCast<DialogEndLine>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
@ -123,7 +123,7 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
basePointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -213,9 +213,9 @@ void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolEndLine::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogEndLine> dialogTool = m_dialog.objectCast<DialogEndLine>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -53,7 +53,7 @@ class VToolEndLine : public VToolLinePoint
public:
virtual ~VToolEndLine() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolEndLine *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaLength, QString &formulaAngle,

View File

@ -80,9 +80,9 @@ VToolHeight::VToolHeight(VAbstractPattern *doc, VContainer *data, const quint32
*/
void VToolHeight::setDialog()
{
SCASSERT(dialog != nullptr)
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogHeight> dialogTool = m_dialog.objectCast<DialogHeight>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -101,11 +101,12 @@ void VToolHeight::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolHeight* VToolHeight::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogHeight> dialogTool = dialog.objectCast<DialogHeight>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
@ -117,7 +118,7 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -236,9 +237,9 @@ void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolHeight::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogHeight> dialogTool = m_dialog.objectCast<DialogHeight>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -53,7 +53,8 @@ class VToolHeight: public VToolLinePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolHeight *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolHeight *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolHeight *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,

View File

@ -70,10 +70,10 @@ VToolLineIntersectAxis::VToolLineIntersectAxis(VAbstractPattern *doc, VContainer
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::setDialog()
{
SCASSERT(dialog != nullptr)
dialog->setModal(true);
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
m_dialog->setModal(true);
QSharedPointer<DialogLineIntersectAxis> dialogTool = m_dialog.objectCast<DialogLineIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -85,13 +85,12 @@ void VToolLineIntersectAxis::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data)
VToolLineIntersectAxis *VToolLineIntersectAxis::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
SCASSERT(dialogTool)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogLineIntersectAxis> dialogTool = dialog.objectCast<DialogLineIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
@ -105,7 +104,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -281,9 +280,9 @@ void VToolLineIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLineIntersectAxis> dialogTool = m_dialog.objectCast<DialogLineIntersectAxis>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -53,8 +53,8 @@ public:
virtual ~VToolLineIntersectAxis() Q_DECL_EQ_DEFAULT;
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolLineIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolLineIntersectAxis *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolLineIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,

View File

@ -87,9 +87,9 @@ VToolNormal::VToolNormal(VAbstractPattern *doc, VContainer *data, const quint32
*/
void VToolNormal::setDialog()
{
SCASSERT(dialog != nullptr)
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogNormal> dialogTool = m_dialog.objectCast<DialogNormal>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetFormula(formulaLength);
@ -107,11 +107,12 @@ void VToolNormal::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolNormal* VToolNormal::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogNormal> dialogTool = dialog.objectCast<DialogNormal>();
SCASSERT(not dialogTool.isNull())
QString formula = dialogTool->GetFormula();
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
@ -123,7 +124,7 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -262,9 +263,9 @@ void VToolNormal::RemoveReferens()
*/
void VToolNormal::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogNormal> dialogTool = m_dialog.objectCast<DialogNormal>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -52,7 +52,8 @@ class VToolNormal : public VToolLinePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolNormal* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolNormal* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,

View File

@ -89,9 +89,9 @@ VToolShoulderPoint::VToolShoulderPoint(VAbstractPattern *doc, VContainer *data,
*/
void VToolShoulderPoint::setDialog()
{
SCASSERT(dialog != nullptr)
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogShoulderPoint> dialogTool = m_dialog.objectCast<DialogShoulderPoint>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetLineColor(lineColor);
@ -156,12 +156,12 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
* @param data container with variables.
* @return the created tool
*/
VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
SCASSERT(dialogTool)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogShoulderPoint> dialogTool = dialog.objectCast<DialogShoulderPoint>();
SCASSERT(not dialogTool.isNull())
QString formula = dialogTool->GetFormula();
const quint32 p1Line = dialogTool->GetP1Line();
const quint32 p2Line = dialogTool->GetP2Line();
@ -173,7 +173,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -308,9 +308,9 @@ void VToolShoulderPoint::RemoveReferens()
*/
void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogShoulderPoint> dialogTool = m_dialog.objectCast<DialogShoulderPoint>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -55,8 +55,8 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
const qreal &length);
static VToolShoulderPoint* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolShoulderPoint* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolShoulderPoint* Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal &mx, const qreal &my,

View File

@ -104,9 +104,9 @@ VToolBasePoint::~VToolBasePoint()
*/
void VToolBasePoint::setDialog()
{
SCASSERT(dialog != nullptr)
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSinglePoint> dialogTool = m_dialog.objectCast<DialogSinglePoint>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetData(p->name(), static_cast<QPointF>(*p));
}
@ -280,11 +280,11 @@ void VToolBasePoint::DeleteTool(bool ask)
*/
void VToolBasePoint::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
SCASSERT(dialogTool != nullptr)
QPointF p = dialogTool->GetPoint();
QString name = dialogTool->getPointName();
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSinglePoint> dialogTool = m_dialog.objectCast<DialogSinglePoint>();
SCASSERT(not dialogTool.isNull())
const QPointF p = dialogTool->GetPoint();
const QString name = dialogTool->getPointName();
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())));

View File

@ -84,9 +84,9 @@ VToolLineIntersect::VToolLineIntersect(VAbstractPattern *doc, VContainer *data,
*/
void VToolLineIntersect::setDialog()
{
SCASSERT(dialog != nullptr)
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLineIntersect> dialogTool = m_dialog.objectCast<DialogLineIntersect>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetP1Line1(p1Line1);
dialogTool->SetP2Line1(p2Line1);
@ -104,12 +104,12 @@ void VToolLineIntersect::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolLineIntersect* VToolLineIntersect::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogLineIntersect> dialogTool = dialog.objectCast<DialogLineIntersect>();
SCASSERT(not dialogTool.isNull())
const quint32 p1Line1Id = dialogTool->GetP1Line1();
const quint32 p2Line1Id = dialogTool->GetP2Line1();
const quint32 p1Line2Id = dialogTool->GetP1Line2();
@ -119,7 +119,7 @@ VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphics
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -275,9 +275,9 @@ void VToolLineIntersect::RemoveReferens()
*/
void VToolLineIntersect::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLineIntersect> dialogTool = m_dialog.objectCast<DialogLineIntersect>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->GetP1Line1()));
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->GetP2Line1()));

View File

@ -51,8 +51,8 @@ class VToolLineIntersect:public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolLineIntersect *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolLineIntersect *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolLineIntersect *Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,

View File

@ -67,9 +67,9 @@ VToolPointFromArcAndTangent::VToolPointFromArcAndTangent(VAbstractPattern *doc,
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointFromArcAndTangent *dialogTool = qobject_cast<DialogPointFromArcAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromArcAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromArcAndTangent>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetArcId(arcId);
dialogTool->SetCrossCirclesPoint(crossPoint);
@ -78,12 +78,13 @@ void VToolPointFromArcAndTangent::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(QSharedPointer<DialogTool> dialog,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointFromArcAndTangent *dialogTool = qobject_cast<DialogPointFromArcAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointFromArcAndTangent> dialogTool = dialog.objectCast<DialogPointFromArcAndTangent>();
SCASSERT(not dialogTool.isNull())
const quint32 arcId = dialogTool->GetArcId();
const quint32 tangentPointId = dialogTool->GetTangentPointId();
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
@ -92,7 +93,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(DialogTool *dia
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -310,9 +311,9 @@ void VToolPointFromArcAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEven
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointFromArcAndTangent *dialogTool = qobject_cast<DialogPointFromArcAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromArcAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromArcAndTangent>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->GetArcId()));
doc->SetAttribute(domElement, AttrTangent, QString().setNum(dialogTool->GetTangentPointId()));

View File

@ -49,8 +49,8 @@ class VToolPointFromArcAndTangent : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointFromArcAndTangent *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPointFromArcAndTangent *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointFromArcAndTangent *Create(const quint32 _id, const QString &pointName, quint32 arcId,
quint32 tangentPointId, CrossCirclesPoint crossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,

View File

@ -70,9 +70,9 @@ VToolPointFromCircleAndTangent::VToolPointFromCircleAndTangent(VAbstractPattern
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromCircleAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromCircleAndTangent>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetCircleCenterId(circleCenterId);
dialogTool->SetCircleRadius(circleRadius);
@ -82,12 +82,13 @@ void VToolPointFromCircleAndTangent::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(QSharedPointer<DialogTool> dialog,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointFromCircleAndTangent> dialogTool = dialog.objectCast<DialogPointFromCircleAndTangent>();
SCASSERT(not dialogTool.isNull())
const quint32 circleCenterId = dialogTool->GetCircleCenterId();
QString circleRadius = dialogTool->GetCircleRadius();
const quint32 tangentPointId = dialogTool->GetTangentPointId();
@ -97,7 +98,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(DialogToo
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -295,9 +296,9 @@ void VToolPointFromCircleAndTangent::contextMenuEvent(QGraphicsSceneContextMenuE
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointFromCircleAndTangent *dialogTool = qobject_cast<DialogPointFromCircleAndTangent*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromCircleAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromCircleAndTangent>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrCCenter, QString().setNum(dialogTool->GetCircleCenterId()));
doc->SetAttribute(domElement, AttrTangent, QString().setNum(dialogTool->GetTangentPointId()));

View File

@ -50,8 +50,8 @@ class VToolPointFromCircleAndTangent : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointFromCircleAndTangent *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPointFromCircleAndTangent *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointFromCircleAndTangent *Create(const quint32 _id, const QString &pointName,
quint32 circleCenterId, QString &circleRadius, quint32 tangentPointId,
CrossCirclesPoint crossPoint, const qreal &mx, const qreal &my,

View File

@ -89,9 +89,9 @@ VToolPointOfContact::VToolPointOfContact(VAbstractPattern *doc, VContainer *data
*/
void VToolPointOfContact::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfContact> dialogTool = m_dialog.objectCast<DialogPointOfContact>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->setRadius(arcRadius);
dialogTool->setCenter(center);
@ -164,12 +164,12 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF &cente
* @param doc dom document container.
* @param data container with variables.
*/
VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolPointOfContact* VToolPointOfContact::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointOfContact> dialogTool = dialog.objectCast<DialogPointOfContact>();
SCASSERT(not dialogTool.isNull())
QString radius = dialogTool->getRadius();
const quint32 center = dialogTool->getCenter();
const quint32 firstPointId = dialogTool->GetFirstPoint();
@ -179,7 +179,7 @@ VToolPointOfContact* VToolPointOfContact::Create(DialogTool *dialog, VMainGraphi
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -319,9 +319,9 @@ void VToolPointOfContact::RemoveReferens()
*/
void VToolPointOfContact::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfContact> dialogTool = m_dialog.objectCast<DialogPointOfContact>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));

View File

@ -55,8 +55,8 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static QPointF FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint,
const QPointF &secondPoint);
static VToolPointOfContact* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPointOfContact* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfContact* Create(const quint32 _id, QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId,
const QString &pointName,

View File

@ -78,9 +78,9 @@ VToolPointOfIntersection::VToolPointOfIntersection(VAbstractPattern *doc, VConta
*/
void VToolPointOfIntersection::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersection> dialogTool = m_dialog.objectCast<DialogPointOfIntersection>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFirstPointId(firstPointId);
dialogTool->SetSecondPointId(secondPointId);
@ -96,13 +96,12 @@ void VToolPointOfIntersection::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data)
VToolPointOfIntersection *VToolPointOfIntersection::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointOfIntersection> dialogTool = dialog.objectCast<DialogPointOfIntersection>();
SCASSERT(not dialogTool.isNull())
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString pointName = dialogTool->getPointName();
@ -110,7 +109,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, V
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -220,9 +219,9 @@ void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *
*/
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersection> dialogTool = m_dialog.objectCast<DialogPointOfIntersection>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPointId()));

View File

@ -51,8 +51,8 @@ class VToolPointOfIntersection : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersection *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPointOfIntersection *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersection *Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,

View File

@ -67,9 +67,9 @@ VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(VAbstractPattern *doc
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionArcs> dialogTool = m_dialog.objectCast<DialogPointOfIntersectionArcs>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFirstArcId(firstArcId);
dialogTool->SetSecondArcId(secondArcId);
@ -78,12 +78,13 @@ void VToolPointOfIntersectionArcs::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(QSharedPointer<DialogTool> dialog,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointOfIntersectionArcs> dialogTool = dialog.objectCast<DialogPointOfIntersectionArcs>();
SCASSERT(not dialogTool.isNull())
const quint32 firstArcId = dialogTool->GetFirstArcId();
const quint32 secondArcId = dialogTool->GetSecondArcId();
const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint();
@ -92,7 +93,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *d
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -317,9 +318,9 @@ void VToolPointOfIntersectionArcs::contextMenuEvent(QGraphicsSceneContextMenuEve
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionArcs> dialogTool = m_dialog.objectCast<DialogPointOfIntersectionArcs>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstArc, QString().setNum(dialogTool->GetFirstArcId()));
doc->SetAttribute(domElement, AttrSecondArc, QString().setNum(dialogTool->GetSecondArcId()));

View File

@ -50,8 +50,8 @@ class VToolPointOfIntersectionArcs : public VToolSinglePoint
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersectionArcs *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPointOfIntersectionArcs *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersectionArcs *Create(const quint32 _id, const QString &pointName, const quint32 &firstArcId,
const quint32 &secondArcId, CrossCirclesPoint pType,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,

View File

@ -74,9 +74,10 @@ VToolPointOfIntersectionCircles::VToolPointOfIntersectionCircles(VAbstractPatter
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::setDialog()
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionCircles *dialogTool = qobject_cast<DialogPointOfIntersectionCircles*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionCircles> dialogTool =
m_dialog.objectCast<DialogPointOfIntersectionCircles>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFirstCircleCenterId(firstCircleCenterId);
dialogTool->SetSecondCircleCenterId(secondCircleCenterId);
@ -87,12 +88,14 @@ void VToolPointOfIntersectionCircles::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(QSharedPointer<DialogTool> dialog,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionCircles *dialogTool = qobject_cast<DialogPointOfIntersectionCircles*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointOfIntersectionCircles> dialogTool =
dialog.objectCast<DialogPointOfIntersectionCircles>();
SCASSERT(not dialogTool.isNull())
const quint32 firstCircleCenterId = dialogTool->GetFirstCircleCenterId();
const quint32 secondCircleCenterId = dialogTool->GetSecondCircleCenterId();
QString firstCircleRadius = dialogTool->GetFirstCircleRadius();
@ -104,7 +107,7 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(DialogT
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -332,9 +335,10 @@ void VToolPointOfIntersectionCircles::contextMenuEvent(QGraphicsSceneContextMenu
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogPointOfIntersectionCircles *dialogTool = qobject_cast<DialogPointOfIntersectionCircles*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionCircles> dialogTool =
m_dialog.objectCast<DialogPointOfIntersectionCircles>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrC1Center, QString().setNum(dialogTool->GetFirstCircleCenterId()));
doc->SetAttribute(domElement, AttrC2Center, QString().setNum(dialogTool->GetSecondCircleCenterId()));

View File

@ -50,9 +50,8 @@ class VToolPointOfIntersectionCircles : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersectionCircles *Create(DialogTool *dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data);
static VToolPointOfIntersectionCircles *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersectionCircles *Create(const quint32 _id, const QString &pointName,
quint32 firstCircleCenterId, quint32 secondCircleCenterId,
QString &firstCircleRadius, QString &secondCircleRadius,

View File

@ -72,8 +72,8 @@ VToolPointOfIntersectionCurves::VToolPointOfIntersectionCurves(VAbstractPattern
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::setDialog()
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(m_dialog);
SCASSERT(dialogTool != nullptr)
auto p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetFirstCurveId(firstCurveId);
@ -84,12 +84,13 @@ void VToolPointOfIntersectionCurves::setDialog()
}
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(DialogTool *dialog, VMainGraphicsScene *scene,
VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(QSharedPointer<DialogTool> dialog,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogPointOfIntersectionCurves> dialogTool = dialog.objectCast<DialogPointOfIntersectionCurves>();
SCASSERT(not dialogTool.isNull())
const quint32 firstCurveId = dialogTool->GetFirstCurveId();
const quint32 secondCurveId = dialogTool->GetSecondCurveId();
const VCrossCurvesPoint vCrossPoint = dialogTool->GetVCrossPoint();
@ -99,7 +100,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(DialogToo
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -380,8 +381,8 @@ void VToolPointOfIntersectionCurves::contextMenuEvent(QGraphicsSceneContextMenuE
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(dialog);
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(m_dialog);
SCASSERT(dialogTool != nullptr)
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrCurve1, QString().setNum(dialogTool->GetFirstCurveId()));

View File

@ -50,7 +50,7 @@ class VToolPointOfIntersectionCurves : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersectionCurves *Create(DialogTool *dialog, VMainGraphicsScene *scene,
static VToolPointOfIntersectionCurves *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersectionCurves *Create(const quint32 _id, const QString &pointName,
quint32 firstCurveId, quint32 secondCurveId,

View File

@ -83,9 +83,9 @@ VToolTriangle::VToolTriangle(VAbstractPattern *doc, VContainer *data, const quin
*/
void VToolTriangle::setDialog()
{
SCASSERT(dialog != nullptr)
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTriangle> dialogTool = m_dialog.objectCast<DialogTriangle>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetAxisP1Id(axisP1Id);
dialogTool->SetAxisP2Id(axisP2Id);
@ -103,12 +103,12 @@ void VToolTriangle::setDialog()
* @param data container with variables.
* @return the created tool
*/
VToolTriangle* VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolTriangle* VToolTriangle::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogTriangle> dialogTool = dialog.objectCast<DialogTriangle>();
SCASSERT(not dialogTool.isNull())
const quint32 axisP1Id = dialogTool->GetAxisP1Id();
const quint32 axisP2Id = dialogTool->GetAxisP2Id();
const quint32 firstPointId = dialogTool->GetFirstPointId();
@ -118,7 +118,7 @@ VToolTriangle* VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *sce
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
point->m_dialog = dialogTool;
}
return point;
}
@ -297,9 +297,9 @@ void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolTriangle::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTriangle> dialogTool = m_dialog.objectCast<DialogTriangle>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->GetAxisP1Id()));
doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->GetAxisP2Id()));

View File

@ -53,7 +53,7 @@ class VToolTriangle : public VToolSinglePoint
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolTriangle *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolTriangle *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolTriangle *Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,

View File

@ -59,20 +59,16 @@ qreal VDrawTool::factor = 1;
* @param id object id in container.
*/
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
:VAbstractTool(doc, data, id, parent), nameActivDraw(doc->GetNameActivPP()),
dialog(nullptr), typeLine(TypeLineLine), enabled(true)
: VInteractiveTool(doc, data, id, parent),
nameActivDraw(doc->GetNameActivPP()),
typeLine(TypeLineLine),
enabled(true)
{
connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
connect(this->doc, &VAbstractPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
connect(this->doc, &VAbstractPattern::ShowTool, this, &VDrawTool::ShowTool);
}
//---------------------------------------------------------------------------------------------------------------------
VDrawTool::~VDrawTool()
{
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.
@ -109,30 +105,6 @@ void VDrawTool::ChangedNameDraw(const QString &oldName, const QString &newName)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromGuiOk refresh tool data after change in options.
* @param result keep result working dialog.
*/
void VDrawTool::FullUpdateFromGuiOk(int result)
{
if (result == QDialog::Accepted)
{
SaveDialogChange();
}
delete dialog;
dialog=nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
*/
void VDrawTool::FullUpdateFromGuiApply()
{
SaveDialogChange();
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SaveDialogChange()
{
@ -252,15 +224,6 @@ void VDrawTool::ReadAttributes()
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogLinkDestroy removes dialog pointer
*/
void VDrawTool::DialogLinkDestroy()
{
this->dialog=nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.

View File

@ -42,9 +42,8 @@
#include <QString>
#include <QtGlobal>
#include "../../dialogs/tools/dialogtool.h"
#include "../ifc/exception/vexceptionbadid.h"
#include "../vabstracttool.h"
#include "../vinteractivetool.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/def.h"
#include "../vwidgets/vmaingraphicsscene.h"
@ -56,22 +55,17 @@ template <class T> class QSharedPointer;
/**
* @brief The VDrawTool abstract class for all draw tool.
*/
class VDrawTool : public VAbstractTool
class VDrawTool : public VInteractiveTool
{
Q_OBJECT
public:
VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
virtual ~VDrawTool() Q_DECL_OVERRIDE;
virtual ~VDrawTool() Q_DECL_EQ_DEFAULT;
/** @brief factor scene scale factor. */
static qreal factor;
/** @brief setDialog set dialog when user want change tool option. */
virtual void setDialog() {}
void DialogLinkDestroy();
QString getLineType() const;
virtual void SetTypeLine(const QString &value);
@ -82,8 +76,6 @@ public slots:
virtual void ShowTool(quint32 id, bool enable);
virtual void ChangedActivDraw(const QString &newName);
void ChangedNameDraw(const QString &oldName, const QString &newName);
virtual void FullUpdateFromGuiOk(int result);
virtual void FullUpdateFromGuiApply();
virtual void SetFactor(qreal factor);
virtual void EnableToolMove(bool move);
virtual void Disable(bool disable, const QString &namePP)=0;
@ -96,9 +88,6 @@ protected:
/** @brief nameActivDraw name of tool's pattern peace. */
QString nameActivDraw;
/** @brief dialog dialog options.*/
DialogTool *dialog;
/** @brief typeLine line type. */
QString typeLine;
@ -108,7 +97,7 @@ protected:
/** @brief SaveDialog save options into file after change in dialog. */
virtual void SaveDialog(QDomElement &domElement)=0;
void SaveDialogChange();
virtual void SaveDialogChange() Q_DECL_FINAL;
virtual void AddToFile() Q_DECL_OVERRIDE;
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
void SaveOption(QSharedPointer<VGObject> &obj);
@ -188,15 +177,15 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, c
{
qCDebug(vTool, "Show options.");
qApp->getSceneView()->itemClicked(nullptr);
dialog = new Dialog(getData(), id, qApp->getMainWindow());
dialog->setModal(true);
m_dialog = QSharedPointer<Dialog>(new Dialog(getData(), id, qApp->getMainWindow()));
m_dialog->setModal(true);
connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk);
connect(dialog, &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply);
connect(m_dialog.data(), &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGuiOk);
connect(m_dialog.data(), &DialogTool::DialogApplied, tool, &Tool::FullUpdateFromGuiApply);
tool->setDialog();
dialog->show();
m_dialog->show();
}
if (selectedAction == actionRemove)
{

View File

@ -93,9 +93,9 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
*/
void VToolLine::setDialog()
{
SCASSERT(dialog != nullptr)
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLine> dialogTool = m_dialog.objectCast<DialogLine>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetFirstPoint(firstPoint);
dialogTool->SetSecondPoint(secondPoint);
dialogTool->SetTypeLine(typeLine);
@ -110,11 +110,12 @@ void VToolLine::setDialog()
* @param doc dom document container.
* @param data container with variables.
*/
VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
VToolLine *VToolLine::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr)
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogLine> dialogTool = dialog.objectCast<DialogLine>();
SCASSERT(not dialogTool.isNull())
const quint32 firstPoint = dialogTool->GetFirstPoint();
const quint32 secondPoint = dialogTool->GetSecondPoint();
const QString typeLine = dialogTool->GetTypeLine();
@ -124,7 +125,7 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbs
Source::FromGui);
if (line != nullptr)
{
line->dialog=dialogTool;
line->m_dialog = dialogTool;
}
return line;
}
@ -398,9 +399,9 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
*/
void VToolLine::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr)
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLine> dialogTool = m_dialog.objectCast<DialogLine>();
SCASSERT(not dialogTool.isNull())
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPoint()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPoint()));
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());

View File

@ -53,7 +53,8 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static VToolLine *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolLine *Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, const QString &lineColor, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,

View File

@ -34,12 +34,12 @@
#include "../vtoolseamallowance.h"
//---------------------------------------------------------------------------------------------------------------------
VToolPiecePath *VToolPiecePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolPiecePath *VToolPiecePath::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr);
DialogPiecePath *dialogTool = qobject_cast<DialogPiecePath*>(dialog);
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialog.isNull());
QSharedPointer<DialogPiecePath> dialogTool = dialog.objectCast<DialogPiecePath>();
SCASSERT(not dialogTool.isNull())
VPiecePath path = dialogTool->GetPiecePath();
const quint32 pieceId = dialogTool->GetPieceId();
qApp->getUndoStack()->beginMacro("add path");

View File

@ -39,7 +39,7 @@ class VToolPiecePath : public VAbstractNode, public QGraphicsPathItem
{
Q_OBJECT
public:
static VToolPiecePath* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolPiecePath* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolPiecePath *Create(quint32 _id, const VPiecePath &path, quint32 pieceId, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,

View File

@ -35,11 +35,11 @@
const QString VToolPin::ToolType = QStringLiteral("pin");
//---------------------------------------------------------------------------------------------------------------------
VToolPin *VToolPin::Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data)
VToolPin *VToolPin::Create(QSharedPointer<DialogTool> dialog, VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr);
DialogPin *dialogTool = qobject_cast<DialogPin*>(dialog);
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialog.isNull());
QSharedPointer<DialogPin> dialogTool = dialog.objectCast<DialogPin>();
SCASSERT(not dialogTool.isNull())
const quint32 pointId = dialogTool->GetPointId();
const quint32 pieceId = dialogTool->GetPieceId();

View File

@ -39,7 +39,7 @@ class VToolPin : public VAbstractNode
{
Q_OBJECT
public:
static VToolPin* Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data);
static VToolPin* Create(QSharedPointer<DialogTool> dialog, VAbstractPattern *doc, VContainer *data);
static VToolPin *Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation, const QString &drawName = QString(),
const quint32 &idTool = 0);

View File

@ -59,7 +59,8 @@ HEADERS += \
$$PWD/nodeDetails/vnodeellipticalarc.h \
$$PWD/vtoolseamallowance.h \
$$PWD/nodeDetails/vtoolpiecepath.h \
$$PWD/nodeDetails/vtoolpin.h
$$PWD/nodeDetails/vtoolpin.h \
$$PWD/vinteractivetool.h
SOURCES += \
$$PWD/vdatatool.cpp \
@ -116,4 +117,5 @@ SOURCES += \
$$PWD/nodeDetails/vnodeellipticalarc.cpp \
$$PWD/vtoolseamallowance.cpp \
$$PWD/nodeDetails/vtoolpiecepath.cpp \
$$PWD/nodeDetails/vtoolpin.cpp
$$PWD/nodeDetails/vtoolpin.cpp \
$$PWD/vinteractivetool.cpp

View File

@ -0,0 +1,65 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 4, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "vinteractivetool.h"
//---------------------------------------------------------------------------------------------------------------------
VInteractiveTool::VInteractiveTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
: VAbstractTool(doc, data, id),
m_dialog()
{
}
//---------------------------------------------------------------------------------------------------------------------
void VInteractiveTool::DialogLinkDestroy()
{
m_dialog.clear();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromGuiOk refresh tool data after change in options.
* @param result keep result working dialog.
*/
void VInteractiveTool::FullUpdateFromGuiOk(int result)
{
if (result == QDialog::Accepted)
{
SaveDialogChange();
}
m_dialog.clear();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
*/
void VInteractiveTool::FullUpdateFromGuiApply()
{
SaveDialogChange();
}

View File

@ -0,0 +1,62 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 4, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VINTERACTIVETOOL_H
#define VINTERACTIVETOOL_H
#include "vabstracttool.h"
#include "../dialogs/tools/dialogtool.h"
#include <QtCore/qglobal.h>
class VInteractiveTool : public VAbstractTool
{
Q_OBJECT
public:
VInteractiveTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
virtual ~VInteractiveTool() Q_DECL_EQ_DEFAULT;
void DialogLinkDestroy();
public slots:
void FullUpdateFromGuiOk(int result);
void FullUpdateFromGuiApply();
protected:
/** @brief m_dialog tool's dialog options.*/
QSharedPointer<DialogTool> m_dialog;
/** @brief setDialog set dialog when user want change tool option. */
virtual void setDialog() {}
virtual void SaveDialogChange()=0;
private:
Q_DISABLE_COPY(VInteractiveTool)
};
#endif // VINTERACTIVETOOL_H

View File

@ -84,18 +84,12 @@ const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("top
const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin");
//---------------------------------------------------------------------------------------------------------------------
VToolSeamAllowance::~VToolSeamAllowance()
VToolSeamAllowance *VToolSeamAllowance::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
delete m_dialog;
}
//---------------------------------------------------------------------------------------------------------------------
VToolSeamAllowance *VToolSeamAllowance::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr);
DialogSeamAllowance *dialogTool = qobject_cast<DialogSeamAllowance*>(dialog);
SCASSERT(dialogTool != nullptr);
SCASSERT(not dialog.isNull());
QSharedPointer<DialogSeamAllowance> dialogTool = dialog.objectCast<DialogSeamAllowance>();
SCASSERT(not dialogTool.isNull())
VPiece detail = dialogTool->GetPiece();
QString width = detail.GetFormulaSAWidth();
qApp->getUndoStack()->beginMacro("add detail");
@ -167,12 +161,6 @@ void VToolSeamAllowance::Remove(bool ask)
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::DialogLinkDestroy()
{
m_dialog=nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene,
VContainer *data, VAbstractPattern *doc)
@ -475,22 +463,6 @@ void VToolSeamAllowance::FullUpdateFromFile()
RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::FullUpdateFromGuiOk(int result)
{
if (result == QDialog::Accepted)
{
SaveDialogChange();
}
delete m_dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::FullUpdateFromGuiApply()
{
SaveDialogChange();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::EnableToolMove(bool move)
{
@ -1103,7 +1075,8 @@ void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QAction *selectedAction = menu.exec(event->screenPos());
if (selectedAction == actionOption)
{
auto *dialog = new DialogSeamAllowance(getData(), id, qApp->getMainWindow());
QSharedPointer<DialogSeamAllowance> dialog =
QSharedPointer<DialogSeamAllowance>(new DialogSeamAllowance(getData(), id, qApp->getMainWindow()));
dialog->EnableApply(true);
m_dialog = dialog;
m_dialog->setModal(true);
@ -1161,8 +1134,8 @@ void VToolSeamAllowance::keyReleaseEvent(QKeyEvent *event)
void VToolSeamAllowance::SetDialog()
{
SCASSERT(not m_dialog.isNull());
DialogSeamAllowance *dialogTool = qobject_cast<DialogSeamAllowance*>(m_dialog);
SCASSERT(dialogTool != nullptr);
QSharedPointer<DialogSeamAllowance> dialogTool = m_dialog.objectCast<DialogSeamAllowance>();
SCASSERT(not dialogTool.isNull())
dialogTool->SetPiece(VAbstractTool::data.GetPiece(id));
dialogTool->EnableApply(true);
}
@ -1171,9 +1144,8 @@ void VToolSeamAllowance::SetDialog()
VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, const quint32 &id,
const Source &typeCreation, VMainGraphicsScene *scene,
const QString &drawName, QGraphicsItem *parent)
: VAbstractTool(doc, data, id),
: VInteractiveTool(doc, data, id),
QGraphicsPathItem(parent),
m_dialog(),
m_sceneDetails(scene),
m_drawName(drawName),
m_seamAllowance(new VNoBrushScalePathItem(this)),

View File

@ -34,21 +34,21 @@
#include <QObject>
#include <QGraphicsPathItem>
#include "vabstracttool.h"
#include "vinteractivetool.h"
#include "../vwidgets/vtextgraphicsitem.h"
#include "../vwidgets/vgrainlineitem.h"
class DialogTool;
class VNoBrushScalePathItem;
class VToolSeamAllowance : public VAbstractTool, public QGraphicsPathItem
class VToolSeamAllowance : public VInteractiveTool, public QGraphicsPathItem
{
Q_OBJECT
public:
virtual ~VToolSeamAllowance();
virtual ~VToolSeamAllowance() Q_DECL_EQ_DEFAULT;
static VToolSeamAllowance* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolSeamAllowance* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolSeamAllowance* Create(quint32 id, VPiece newPiece, QString &width, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation, const QString &drawName = QString());
@ -74,7 +74,6 @@ public:
static const QString AttrBottomPin;
void Remove(bool ask);
void DialogLinkDestroy();
static void InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene, VContainer *data,
VAbstractPattern *doc);
@ -96,8 +95,6 @@ public:
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
public slots:
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
virtual void FullUpdateFromGuiOk(int result);
void FullUpdateFromGuiApply();
void EnableToolMove(bool move);
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
@ -134,13 +131,12 @@ protected:
virtual void SetVisualization() Q_DECL_OVERRIDE {}
virtual void DeleteTool(bool ask = true) Q_DECL_OVERRIDE;
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
virtual void SetDialog() Q_DECL_FINAL;
virtual void SaveDialogChange() Q_DECL_FINAL;
private:
Q_DISABLE_COPY(VToolSeamAllowance)
/** @brief dialog dialog options. */
QPointer<DialogTool> m_dialog;
/** @brief sceneDetails pointer to the scene. */
VMainGraphicsScene *m_sceneDetails;
QString m_drawName;
@ -150,14 +146,12 @@ private:
VTextGraphicsItem *m_patternInfo;
VGrainlineItem *m_grainLine;
void SetDialog();
VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr);
void UpdateExcludeState();
void RefreshGeometry();
void SaveDialogChange();
VPieceItem::MoveTypes FindLabelGeometry(const VPatternLabelData &labelData, qreal &rotationAngle, qreal &labelWidth,
qreal &labelHeight, QPointF &pos);
VPieceItem::MoveTypes FindGrainlineGeometry(const VGrainlineData &geom, qreal &length, qreal &rotationAngle,

View File

@ -1437,12 +1437,12 @@ void VToolUnionDetails::GroupVisibility(quint32 object, bool visible)
* @param doc dom document container.
* @param data container with variables.
*/
VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
VToolUnionDetails* VToolUnionDetails::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(dialog != nullptr)
const DialogUnionDetails *dialogTool = qobject_cast<DialogUnionDetails*>(dialog);
SCASSERT(dialogTool != nullptr)
SCASSERT(not dialog.isNull())
QSharedPointer<DialogUnionDetails> dialogTool = dialog.objectCast<DialogUnionDetails>();
SCASSERT(not dialogTool.isNull())
VToolUnionDetailsInitData initData;
initData.d1id = dialogTool->getD1();

View File

@ -85,8 +85,8 @@ public:
* @brief setDialog set dialog when user want change tool option.
*/
virtual void setDialog() {}
static VToolUnionDetails *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolUnionDetails *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolUnionDetails *Create(const quint32 _id, const VToolUnionDetailsInitData &initData);
static const QString ToolType;