Refactoring.
This commit is contained in:
parent
63cd0e7b5d
commit
c136a716f6
|
@ -351,13 +351,10 @@ void DialogAlongLine::ShowDialog(bool click)
|
|||
return;
|
||||
}
|
||||
|
||||
auto *lineVis = qobject_cast<VisToolAlongLine *>(vis);
|
||||
SCASSERT(lineVis != nullptr)
|
||||
|
||||
auto FinishCreating = [this, lineVis]()
|
||||
auto FinishCreating = [this]()
|
||||
{
|
||||
lineVis->SetMode(Mode::Show);
|
||||
lineVis->RefreshGeometry();
|
||||
vis->SetMode(Mode::Show);
|
||||
vis->RefreshGeometry();
|
||||
|
||||
emit ToolTip(QString());
|
||||
|
||||
|
|
|
@ -282,13 +282,10 @@ void DialogArcWithLength::ShowDialog(bool click)
|
|||
{
|
||||
if (prepare)
|
||||
{
|
||||
auto *arcVis = qobject_cast<VisToolArcWithLength *>(vis);
|
||||
SCASSERT(arcVis != nullptr)
|
||||
|
||||
auto FinishCreating = [this, arcVis]()
|
||||
auto FinishCreating = [this]()
|
||||
{
|
||||
arcVis->SetMode(Mode::Show);
|
||||
arcVis->RefreshGeometry();
|
||||
vis->SetMode(Mode::Show);
|
||||
vis->RefreshGeometry();
|
||||
|
||||
emit ToolTip(QString());
|
||||
|
||||
|
@ -333,7 +330,7 @@ void DialogArcWithLength::ShowDialog(bool click)
|
|||
}
|
||||
|
||||
SetRadius(QString::number(VAbstractValApplication::VApp()->fromPixel(line.length())));
|
||||
arcVis->RefreshGeometry();
|
||||
vis->RefreshGeometry();
|
||||
|
||||
stageRadius = false;
|
||||
stageF1 = true;
|
||||
|
@ -342,7 +339,7 @@ void DialogArcWithLength::ShowDialog(bool click)
|
|||
{
|
||||
|
||||
SetF1(QString::number(Angle()));
|
||||
arcVis->RefreshGeometry();
|
||||
vis->RefreshGeometry();
|
||||
|
||||
stageF1 = false;
|
||||
}
|
||||
|
|
|
@ -351,13 +351,10 @@ void DialogBisector::ShowDialog(bool click)
|
|||
return;
|
||||
}
|
||||
|
||||
auto *lineVis = qobject_cast<VisToolBisector *>(vis);
|
||||
SCASSERT(lineVis != nullptr)
|
||||
|
||||
auto FinishCreating = [this, lineVis]()
|
||||
auto FinishCreating = [this]()
|
||||
{
|
||||
lineVis->SetMode(Mode::Show);
|
||||
lineVis->RefreshGeometry();
|
||||
vis->SetMode(Mode::Show);
|
||||
vis->RefreshGeometry();
|
||||
|
||||
emit ToolTip(QString());
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "../../visualization/path/vistoolcutsplinepath.h"
|
||||
#include "../../visualization/visualization.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../ifc/xml/vdomdocument.h"
|
||||
#include "../support/dialogeditwrongformula.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
|
@ -58,23 +57,18 @@
|
|||
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogCutSplinePath),
|
||||
formula(),
|
||||
pointName(),
|
||||
formulaBaseHeight(0),
|
||||
timerFormula(new QTimer(this)),
|
||||
flagFormula(false),
|
||||
flagName(true)
|
||||
m_timerFormula(new QTimer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
timerFormula->setSingleShot(true);
|
||||
connect(timerFormula, &QTimer::timeout, this, &DialogCutSplinePath::EvalFormula);
|
||||
m_timerFormula->setSingleShot(true);
|
||||
connect(m_timerFormula, &QTimer::timeout, this, &DialogCutSplinePath::EvalFormula);
|
||||
|
||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||
|
||||
ui->lineEditNamePoint->setText(
|
||||
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
this->m_formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
ui->plainTextEditFormula->installEventFilter(this);
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
|
@ -84,12 +78,12 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId,
|
|||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogCutSplinePath::FXLength);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
|
||||
{
|
||||
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
|
||||
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, m_pointName, this->data, m_flagName);
|
||||
CheckState();
|
||||
});
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
timerFormula->start(formulaTimerTimeout);
|
||||
m_timerFormula->start(formulaTimerTimeout);
|
||||
});
|
||||
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit);
|
||||
connect(ui->comboBoxSplinePath, &QComboBox::currentTextChanged, this, &DialogCutSplinePath::SplinePathChanged);
|
||||
|
@ -110,9 +104,9 @@ DialogCutSplinePath::~DialogCutSplinePath()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSplinePath::GetPointName() const
|
||||
auto DialogCutSplinePath::GetPointName() const -> QString
|
||||
{
|
||||
return pointName;
|
||||
return m_pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -122,8 +116,8 @@ QString DialogCutSplinePath::GetPointName() const
|
|||
*/
|
||||
void DialogCutSplinePath::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
m_pointName = value;
|
||||
ui->lineEditNamePoint->setText(m_pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -133,19 +127,19 @@ void DialogCutSplinePath::SetPointName(const QString &value)
|
|||
*/
|
||||
void DialogCutSplinePath::SetFormula(const QString &value)
|
||||
{
|
||||
formula = VAbstractApplication::VApp()->TrVars()
|
||||
m_formula = VAbstractApplication::VApp()->TrVars()
|
||||
->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
// of this PlainTextEdit to change 80 to this value
|
||||
if (formula.length() > 80)
|
||||
if (m_formula.length() > 80)
|
||||
{
|
||||
this->DeployFormulaTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formula);
|
||||
ui->plainTextEditFormula->setPlainText(m_formula);
|
||||
|
||||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
path->setLength(formula);
|
||||
path->setLength(m_formula);
|
||||
|
||||
MoveCursorToEnd(ui->plainTextEditFormula);
|
||||
}
|
||||
|
@ -159,7 +153,7 @@ void DialogCutSplinePath::setSplinePathId(quint32 value)
|
|||
{
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, value);
|
||||
|
||||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
path->setObject1Id(value);
|
||||
}
|
||||
|
@ -172,8 +166,11 @@ void DialogCutSplinePath::setSplinePathId(quint32 value)
|
|||
*/
|
||||
void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false)// After first choose we ignore all objects
|
||||
if (prepare)// After first choose we ignore all objects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == SceneObject::SplinePath)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxSplinePath, QString()))
|
||||
|
@ -187,20 +184,19 @@ void DialogCutSplinePath::ChosenObject(quint32 id, const SceneObject &type)
|
|||
this->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
m_pointName = ui->lineEditNamePoint->text();
|
||||
m_formula = ui->plainTextEditFormula->toPlainText();
|
||||
|
||||
VisToolCutSplinePath *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
auto *path = qobject_cast<VisToolCutSplinePath *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
|
||||
path->setObject1Id(getSplinePathId());
|
||||
path->setLength(formula);
|
||||
path->setLength(m_formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -230,29 +226,29 @@ void DialogCutSplinePath::ValidateAlias()
|
|||
|
||||
if (not GetAliasSuffix1().isEmpty() &&
|
||||
(not rx.match(path1.GetAlias()).hasMatch() ||
|
||||
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(path1.GetAlias())) ||
|
||||
(m_originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(path1.GetAlias())) ||
|
||||
path1.GetAlias() == path2.GetAlias()))
|
||||
{
|
||||
flagAlias1 = false;
|
||||
m_flagAlias1 = false;
|
||||
ChangeColor(ui->labelAlias1, errorColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagAlias1 = true;
|
||||
m_flagAlias1 = true;
|
||||
ChangeColor(ui->labelAlias1, OkColor(this));
|
||||
}
|
||||
|
||||
if (not GetAliasSuffix2().isEmpty() &&
|
||||
(not rx.match(path2.GetAlias()).hasMatch() ||
|
||||
(originAliasSuffix2 != GetAliasSuffix2() && not data->IsUnique(path2.GetAlias())) ||
|
||||
(m_originAliasSuffix2 != GetAliasSuffix2() && not data->IsUnique(path2.GetAlias())) ||
|
||||
path1.GetAlias() == path2.GetAlias()))
|
||||
{
|
||||
flagAlias2 = false;
|
||||
m_flagAlias2 = false;
|
||||
ChangeColor(ui->labelAlias2, errorColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagAlias2 = true;
|
||||
m_flagAlias2 = true;
|
||||
ChangeColor(ui->labelAlias2, OkColor(this));
|
||||
}
|
||||
|
||||
|
@ -262,13 +258,13 @@ void DialogCutSplinePath::ValidateAlias()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::DeployFormulaTextEdit()
|
||||
{
|
||||
DeployFormula(this, ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
||||
DeployFormula(this, ui->plainTextEditFormula, ui->pushButtonGrowLength, m_formulaBaseHeight);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::FXLength()
|
||||
{
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
auto *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||
dialog->setWindowTitle(tr("Edit length"));
|
||||
dialog->SetFormula(GetFormula());
|
||||
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||
|
@ -290,7 +286,7 @@ void DialogCutSplinePath::EvalFormula()
|
|||
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||
formulaData.checkZero = false;
|
||||
|
||||
Eval(formulaData, flagFormula);
|
||||
Eval(formulaData, m_flagFormula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -304,9 +300,9 @@ void DialogCutSplinePath::ShowVisualization()
|
|||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogCutSplinePath::GetFormula() const
|
||||
auto DialogCutSplinePath::GetFormula() const -> QString
|
||||
{
|
||||
return VTranslateVars::TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
return VTranslateVars::TryFormulaFromUser(m_formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -314,7 +310,7 @@ QString DialogCutSplinePath::GetFormula() const
|
|||
* @brief getSplineId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogCutSplinePath::getSplinePathId() const
|
||||
auto DialogCutSplinePath::getSplinePathId() const -> quint32
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSplinePath);
|
||||
}
|
||||
|
@ -326,7 +322,7 @@ void DialogCutSplinePath::SetNotes(const QString ¬es)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSplinePath::GetNotes() const
|
||||
auto DialogCutSplinePath::GetNotes() const -> QString
|
||||
{
|
||||
return ui->plainTextEditToolNotes->toPlainText();
|
||||
}
|
||||
|
@ -334,13 +330,13 @@ QString DialogCutSplinePath::GetNotes() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SetAliasSuffix1(const QString &alias)
|
||||
{
|
||||
originAliasSuffix1 = alias;
|
||||
ui->lineEditAlias1->setText(originAliasSuffix1);
|
||||
m_originAliasSuffix1 = alias;
|
||||
ui->lineEditAlias1->setText(m_originAliasSuffix1);
|
||||
ValidateAlias();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSplinePath::GetAliasSuffix1() const
|
||||
auto DialogCutSplinePath::GetAliasSuffix1() const -> QString
|
||||
{
|
||||
return ui->lineEditAlias1->text();
|
||||
}
|
||||
|
@ -348,13 +344,13 @@ QString DialogCutSplinePath::GetAliasSuffix1() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SetAliasSuffix2(const QString &alias)
|
||||
{
|
||||
originAliasSuffix2 = alias;
|
||||
ui->lineEditAlias2->setText(originAliasSuffix2);
|
||||
m_originAliasSuffix2 = alias;
|
||||
ui->lineEditAlias2->setText(m_originAliasSuffix2);
|
||||
ValidateAlias();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSplinePath::GetAliasSuffix2() const
|
||||
auto DialogCutSplinePath::GetAliasSuffix2() const -> QString
|
||||
{
|
||||
return ui->lineEditAlias2->text();
|
||||
}
|
||||
|
|
|
@ -51,27 +51,27 @@ class DialogCutSplinePath final : public DialogTool
|
|||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
DialogCutSplinePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogCutSplinePath() override;
|
||||
~DialogCutSplinePath() override;
|
||||
|
||||
QString GetPointName() const;
|
||||
auto GetPointName() const -> QString;
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString GetFormula() const;
|
||||
auto GetFormula() const -> QString;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getSplinePathId() const;
|
||||
auto getSplinePathId() const -> quint32;
|
||||
void setSplinePathId(quint32 value);
|
||||
|
||||
void SetNotes(const QString ¬es);
|
||||
QString GetNotes() const;
|
||||
auto GetNotes() const -> QString;
|
||||
|
||||
void SetAliasSuffix1(const QString &alias);
|
||||
QString GetAliasSuffix1() const;
|
||||
auto GetAliasSuffix1() const -> QString;
|
||||
|
||||
void SetAliasSuffix2(const QString &alias);
|
||||
QString GetAliasSuffix2() const;
|
||||
auto GetAliasSuffix2() const -> QString;
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
/**
|
||||
* @brief DeployFormulaTextEdit grow or shrink formula input
|
||||
*/
|
||||
|
@ -79,13 +79,13 @@ public slots:
|
|||
void FXLength();
|
||||
void EvalFormula();
|
||||
protected:
|
||||
virtual void ShowVisualization() override;
|
||||
void ShowVisualization() override;
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData() override;
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
void SaveData() override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
auto IsValid() const -> bool final;
|
||||
private slots:
|
||||
void SplinePathChanged();
|
||||
void ValidateAlias();
|
||||
|
@ -96,27 +96,27 @@ private:
|
|||
Ui::DialogCutSplinePath *ui;
|
||||
|
||||
/** @brief formula string with formula */
|
||||
QString formula;
|
||||
QString pointName;
|
||||
QString m_formula{};
|
||||
QString m_pointName{};
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
int m_formulaBaseHeight{0};
|
||||
|
||||
QTimer *timerFormula;
|
||||
QTimer *m_timerFormula;
|
||||
|
||||
bool flagFormula;
|
||||
bool flagName;
|
||||
bool flagAlias1{true};
|
||||
bool flagAlias2{true};
|
||||
bool m_flagFormula{false};
|
||||
bool m_flagName{true};
|
||||
bool m_flagAlias1{true};
|
||||
bool m_flagAlias2{true};
|
||||
|
||||
QString originAliasSuffix1{};
|
||||
QString originAliasSuffix2{};
|
||||
QString m_originAliasSuffix1{};
|
||||
QString m_originAliasSuffix2{};
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogCutSplinePath::IsValid() const
|
||||
inline auto DialogCutSplinePath::IsValid() const -> bool
|
||||
{
|
||||
return flagFormula && flagAlias1 && flagAlias2 && flagName;
|
||||
return m_flagFormula && m_flagAlias1 && m_flagAlias2 && m_flagName;
|
||||
}
|
||||
|
||||
#endif // DIALOGCUTSPLINEPATH_H
|
||||
|
|
|
@ -429,13 +429,10 @@ void DialogNormal::ShowDialog(bool click)
|
|||
return;
|
||||
}
|
||||
|
||||
auto *lineVis = qobject_cast<VisToolNormal *>(vis);
|
||||
SCASSERT(lineVis != nullptr)
|
||||
|
||||
auto FinishCreating = [this, lineVis]()
|
||||
auto FinishCreating = [this]()
|
||||
{
|
||||
lineVis->SetMode(Mode::Show);
|
||||
lineVis->RefreshGeometry();
|
||||
vis->SetMode(Mode::Show);
|
||||
vis->RefreshGeometry();
|
||||
|
||||
emit ToolTip(QString());
|
||||
|
||||
|
|
|
@ -449,13 +449,10 @@ void DialogShoulderPoint::ShowDialog(bool click)
|
|||
return;
|
||||
}
|
||||
|
||||
auto *lineVis = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
SCASSERT(lineVis != nullptr)
|
||||
|
||||
auto FinishCreating = [this, lineVis]()
|
||||
auto FinishCreating = [this]()
|
||||
{
|
||||
lineVis->SetMode(Mode::Show);
|
||||
lineVis->RefreshGeometry();
|
||||
vis->SetMode(Mode::Show);
|
||||
vis->RefreshGeometry();
|
||||
|
||||
emit ToolTip(QString());
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <new>
|
||||
|
||||
#include "../../tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../vgeometry/vabstractcubicbezierpath.h"
|
||||
#include "../vgeometry/vabstractcurve.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
|
@ -47,16 +46,16 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolCutSplinePath::VisToolCutSplinePath(const VContainer *data, QGraphicsItem *parent)
|
||||
:VisPath(data, parent), point(nullptr), splPath1(nullptr), splPath2(nullptr), length(0)
|
||||
:VisPath(data, parent)
|
||||
{
|
||||
splPath1 = InitItem<VCurvePathItem>(Qt::darkGreen, this);
|
||||
splPath1->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
splPath2 = InitItem<VCurvePathItem>(Qt::darkRed, this);
|
||||
splPath2->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
m_splPath1 = InitItem<VCurvePathItem>(Qt::darkGreen, this);
|
||||
m_splPath1->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
m_splPath2 = InitItem<VCurvePathItem>(Qt::darkRed, this);
|
||||
m_splPath2->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
|
||||
point = InitPoint(mainColor, this);
|
||||
point->setZValue(2);
|
||||
point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
m_point = InitPoint(mainColor, this);
|
||||
m_point->setZValue(2);
|
||||
m_point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -67,20 +66,21 @@ void VisToolCutSplinePath::RefreshGeometry()
|
|||
const auto splPath = Visualization::data->GeometricObject<VAbstractCubicBezierPath>(object1Id);
|
||||
DrawPath(this, splPath->GetPath(), splPath->DirectionArrows(), supportColor, lineStyle, Qt::RoundCap);
|
||||
|
||||
if (not qFuzzyIsNull(length))
|
||||
if (not qFuzzyIsNull(m_length))
|
||||
{
|
||||
VSplinePath *spPath1 = nullptr;
|
||||
VSplinePath *spPath2 = nullptr;
|
||||
VPointF *p = VToolCutSplinePath::CutSplinePath(length, splPath, "X", &spPath1, &spPath2);
|
||||
VPointF *p = VToolCutSplinePath::CutSplinePath(m_length, splPath, QChar('X'), &spPath1, &spPath2);
|
||||
SCASSERT(p != nullptr)
|
||||
SCASSERT(spPath1 != nullptr)
|
||||
SCASSERT(spPath2 != nullptr)
|
||||
|
||||
DrawPoint(point, static_cast<QPointF>(*p), mainColor);
|
||||
DrawPoint(m_point, static_cast<QPointF>(*p), mainColor);
|
||||
delete p;
|
||||
|
||||
DrawPath(splPath1, spPath1->GetPath(), spPath1->DirectionArrows(), Qt::darkGreen, lineStyle, Qt::RoundCap);
|
||||
DrawPath(splPath2, spPath2->GetPath(), spPath2->DirectionArrows(), Qt::darkRed, lineStyle, Qt::RoundCap);
|
||||
DrawPath(m_splPath1, spPath1->GetPath(), spPath1->DirectionArrows(), Qt::darkGreen, lineStyle,
|
||||
Qt::RoundCap);
|
||||
DrawPath(m_splPath2, spPath2->GetPath(), spPath2->DirectionArrows(), Qt::darkRed, lineStyle, Qt::RoundCap);
|
||||
|
||||
delete spPath1;
|
||||
delete spPath2;
|
||||
|
@ -91,5 +91,5 @@ void VisToolCutSplinePath::RefreshGeometry()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolCutSplinePath::setLength(const QString &expression)
|
||||
{
|
||||
length = FindLengthFromUser(expression, Visualization::data->DataVariables());
|
||||
m_length = FindLengthFromUser(expression, Visualization::data->DataVariables());
|
||||
}
|
||||
|
|
|
@ -44,18 +44,18 @@ class VisToolCutSplinePath final : public VisPath
|
|||
Q_OBJECT // NOLINT
|
||||
public:
|
||||
explicit VisToolCutSplinePath(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||
virtual ~VisToolCutSplinePath() Q_DECL_EQ_DEFAULT;
|
||||
~VisToolCutSplinePath() override = default;
|
||||
|
||||
virtual void RefreshGeometry() override;
|
||||
void RefreshGeometry() override;
|
||||
void setLength(const QString &expression);
|
||||
virtual int type() const override {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolCutSpline)};
|
||||
protected:
|
||||
auto type() const -> int override {return Type;}
|
||||
enum {Type = UserType + static_cast<int>(Vis::ToolCutSpline)};
|
||||
private:
|
||||
Q_DISABLE_COPY_MOVE(VisToolCutSplinePath) // NOLINT
|
||||
VScaledEllipse *point;
|
||||
VCurvePathItem *splPath1;
|
||||
VCurvePathItem *splPath2;
|
||||
qreal length;
|
||||
VScaledEllipse *m_point{nullptr};
|
||||
VCurvePathItem *m_splPath1{nullptr};
|
||||
VCurvePathItem *m_splPath2{nullptr};
|
||||
qreal m_length{0};
|
||||
};
|
||||
|
||||
#endif // VISTOOLCUTSPLINEPATH_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user