Resolved issue #984. Special variable "CurrentLength" for tools Cut Arc, Cut
Spline and Cut Spline Path. --HG-- branch : develop
This commit is contained in:
parent
9846d5a91f
commit
e04f5c70f5
|
@ -33,6 +33,7 @@
|
|||
- Improve for recent files list. Show duplicate file names with unique path section.
|
||||
- New command line option --cropWidth. Helps to crop unused width of paper.
|
||||
- New feature Pattern Messages.
|
||||
- [#984] Special variable "CurrentLength" for tools Cut Arc, Cut Spline and Cut Spline Path.
|
||||
|
||||
# Version 0.6.2 (unreleased)
|
||||
- [#903] Bug in tool Cut Spline path.
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/variables/vcurvelength.h"
|
||||
#include "../../visualization/path/vistoolcutarc.h"
|
||||
#include "../../visualization/visualization.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "ui_dialogcutarc.h"
|
||||
#include "../vgeometry/varc.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -90,6 +92,8 @@ DialogCutArc::DialogCutArc(const VContainer *data, quint32 toolId, QWidget *pare
|
|||
});
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit);
|
||||
|
||||
connect(ui->comboBoxArc, &QComboBox::currentTextChanged, this, &DialogCutArc::ArcChanged);
|
||||
|
||||
vis = new VisToolCutArc(data);
|
||||
}
|
||||
|
||||
|
@ -189,6 +193,19 @@ void DialogCutArc::closeEvent(QCloseEvent *event)
|
|||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::ArcChanged()
|
||||
{
|
||||
vidtype arcId = getArcId();
|
||||
const QSharedPointer<VAbstractCurve> arc = data->GeometricObject<VArc>(arcId);
|
||||
|
||||
VCurveLength *length = new VCurveLength(arcId, arcId, arc.data(), *data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
|
||||
VContainer *locData = const_cast<VContainer *> (data);
|
||||
locData->AddVariable(currentLength, length);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setArcId set id of arc
|
||||
|
|
|
@ -79,6 +79,8 @@ protected:
|
|||
virtual void SaveData() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
private slots:
|
||||
void ArcChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutArc)
|
||||
/** @brief ui keeps information about user interface */
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/variables/vcurvelength.h"
|
||||
#include "../../visualization/path/vistoolcutspline.h"
|
||||
#include "../../visualization/visualization.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "ui_dialogcutspline.h"
|
||||
#include "../vgeometry/vspline.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -89,6 +91,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, quint32 toolId, QWidget
|
|||
timerFormula->start(formulaTimerTimeout);
|
||||
});
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSpline::DeployFormulaTextEdit);
|
||||
connect(ui->comboBoxSpline, &QComboBox::currentTextChanged, this, &DialogCutSpline::SplineChanged);
|
||||
|
||||
vis = new VisToolCutSpline(data);
|
||||
}
|
||||
|
@ -197,6 +200,19 @@ void DialogCutSpline::closeEvent(QCloseEvent *event)
|
|||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSpline::SplineChanged()
|
||||
{
|
||||
vidtype splId = getSplineId();
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splId);
|
||||
|
||||
VCurveLength *length = new VCurveLength(splId, splId, spl.data(), *data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
|
||||
VContainer *locData = const_cast<VContainer *> (data);
|
||||
locData->AddVariable(currentLength, length);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSpline::DeployFormulaTextEdit()
|
||||
{
|
||||
|
|
|
@ -77,6 +77,8 @@ protected:
|
|||
virtual void SaveData() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
private slots:
|
||||
void SplineChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutSpline)
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/variables/vcurvelength.h"
|
||||
#include "../../visualization/path/vistoolcutsplinepath.h"
|
||||
#include "../../visualization/visualization.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "ui_dialogcutsplinepath.h"
|
||||
#include "../vgeometry/vsplinepath.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -89,6 +91,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId,
|
|||
timerFormula->start(formulaTimerTimeout);
|
||||
});
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit);
|
||||
connect(ui->comboBoxSplinePath, &QComboBox::currentTextChanged, this, &DialogCutSplinePath::SplinePathChanged);
|
||||
|
||||
vis = new VisToolCutSplinePath(data);
|
||||
}
|
||||
|
@ -197,6 +200,19 @@ void DialogCutSplinePath::closeEvent(QCloseEvent *event)
|
|||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SplinePathChanged()
|
||||
{
|
||||
vidtype splPathId = getSplinePathId();
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splPathId);
|
||||
|
||||
VCurveLength *length = new VCurveLength(splPathId, splPathId, splPath.data(), *data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
|
||||
VContainer *locData = const_cast<VContainer *> (data);
|
||||
locData->AddVariable(currentLength, length);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::DeployFormulaTextEdit()
|
||||
{
|
||||
|
|
|
@ -77,6 +77,8 @@ protected:
|
|||
virtual void SaveData() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
private slots:
|
||||
void SplinePathChanged();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCutSplinePath)
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box) const
|
|||
}
|
||||
}
|
||||
FillList(box, list);
|
||||
|
||||
box->setCurrentIndex(-1); // force to select
|
||||
box->blockSignals(false);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
|||
}
|
||||
}
|
||||
FillList(box, list);
|
||||
|
||||
box->setCurrentIndex(-1); // force to select
|
||||
box->blockSignals(false);
|
||||
}
|
||||
|
||||
|
@ -874,6 +874,6 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
|
|||
}
|
||||
}
|
||||
FillList(box, list);
|
||||
|
||||
box->setCurrentIndex(-1); // force to select
|
||||
box->blockSignals(false);
|
||||
}
|
||||
|
|
|
@ -125,6 +125,12 @@ VToolCutArc* VToolCutArc::Create(VToolCutArcInitData &initData)
|
|||
{
|
||||
const QSharedPointer<VArc> arc = initData.data->GeometricObject<VArc>(initData.arcId);
|
||||
|
||||
//Declare special variable "CurrentLength"
|
||||
VCurveLength *length = new VCurveLength(initData.arcId, initData.arcId, arc.data(),
|
||||
*initData.data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
initData.data->AddVariable(currentLength, length);
|
||||
|
||||
const qreal result = CheckFormula(initData.id, initData.formula, initData.data);
|
||||
|
||||
VArc arc1;
|
||||
|
@ -158,17 +164,19 @@ VToolCutArc* VToolCutArc::Create(VToolCutArcInitData &initData)
|
|||
}
|
||||
}
|
||||
|
||||
VToolCutArc *tool = nullptr;
|
||||
if (initData.parse == Document::FullParse)
|
||||
{
|
||||
VAbstractTool::AddRecord(initData.id, Tool::CutArc, initData.doc);
|
||||
VToolCutArc *point = new VToolCutArc(initData);
|
||||
initData.scene->addItem(point);
|
||||
InitToolConnections(initData.scene, point);
|
||||
VAbstractPattern::AddTool(initData.id, point);
|
||||
tool = new VToolCutArc(initData);
|
||||
initData.scene->addItem(tool);
|
||||
InitToolConnections(initData.scene, tool);
|
||||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(arc->getIdTool());
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
//Very important to delete it. Only this tool need this special variable.
|
||||
initData.data->RemoveVariable(currentLength);
|
||||
return tool;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -128,6 +128,12 @@ VToolCutSpline* VToolCutSpline::Create(VToolCutSplineInitData &initData)
|
|||
{
|
||||
const auto spl = initData.data->GeometricObject<VAbstractCubicBezier>(initData.splineId);
|
||||
|
||||
//Declare special variable "CurrentLength"
|
||||
VCurveLength *length = new VCurveLength(initData.splineId, initData.splineId, spl.data(),
|
||||
*initData.data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
initData.data->AddVariable(currentLength, length);
|
||||
|
||||
const qreal result = CheckFormula(initData.id, initData.formula, initData.data);
|
||||
|
||||
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||
|
@ -157,17 +163,19 @@ VToolCutSpline* VToolCutSpline::Create(VToolCutSplineInitData &initData)
|
|||
}
|
||||
}
|
||||
|
||||
VToolCutSpline *tool = nullptr;
|
||||
if (initData.parse == Document::FullParse)
|
||||
{
|
||||
VAbstractTool::AddRecord(initData.id, Tool::CutSpline, initData.doc);
|
||||
VToolCutSpline *point = new VToolCutSpline(initData);
|
||||
initData.scene->addItem(point);
|
||||
InitToolConnections(initData.scene, point);
|
||||
VAbstractPattern::AddTool(initData.id, point);
|
||||
tool = new VToolCutSpline(initData);
|
||||
initData.scene->addItem(tool);
|
||||
InitToolConnections(initData.scene, tool);
|
||||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(spl->getIdTool());
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
//Very important to delete it. Only this tool need this special variable.
|
||||
initData.data->RemoveVariable(currentLength);
|
||||
return tool;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -132,6 +132,12 @@ VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutSplinePathInitData &initD
|
|||
const auto splPath = initData.data->GeometricObject<VAbstractCubicBezierPath>(initData.splinePathId);
|
||||
SCASSERT(splPath != nullptr)
|
||||
|
||||
//Declare special variable "CurrentLength"
|
||||
VCurveLength *length = new VCurveLength(initData.splinePathId, initData.splinePathId, splPath.data(),
|
||||
*initData.data->GetPatternUnit());
|
||||
length->SetName(currentLength);
|
||||
initData.data->AddVariable(currentLength, length);
|
||||
|
||||
const qreal result = CheckFormula(initData.id, initData.formula, initData.data);
|
||||
|
||||
VSplinePath *splPath1 = nullptr;
|
||||
|
@ -166,17 +172,19 @@ VToolCutSplinePath* VToolCutSplinePath::Create(VToolCutSplinePathInitData &initD
|
|||
}
|
||||
}
|
||||
|
||||
VToolCutSplinePath *tool = nullptr;
|
||||
if (initData.parse == Document::FullParse)
|
||||
{
|
||||
VAbstractTool::AddRecord(initData.id, Tool::CutSplinePath, initData.doc);
|
||||
VToolCutSplinePath *point = new VToolCutSplinePath(initData);
|
||||
initData.scene->addItem(point);
|
||||
InitToolConnections(initData.scene, point);
|
||||
VAbstractPattern::AddTool(initData.id, point);
|
||||
tool = new VToolCutSplinePath(initData);
|
||||
initData.scene->addItem(tool);
|
||||
InitToolConnections(initData.scene, tool);
|
||||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(splPath->getIdTool());
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
//Very important to delete it. Only this tool need this special variable.
|
||||
initData.data->RemoveVariable(currentLength);
|
||||
return tool;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user