Visualization for VToolSpline.
--HG-- branch : develop
This commit is contained in:
parent
aec154e43c
commit
6ed576a71e
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../visualization/vistoolspline.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -40,10 +41,10 @@
|
|||
*/
|
||||
DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), p1(NULL_ID), p4(NULL_ID), angle1(0),
|
||||
angle2(0), kAsm1(1), kAsm2(1), kCurve(1)
|
||||
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), path(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxP1);
|
||||
FillComboBoxPoints(ui->comboBoxP4);
|
||||
|
@ -51,11 +52,14 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
|
|||
this, &DialogSpline::PointNameChanged);
|
||||
connect(ui->comboBoxP4, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSpline::PointNameChanged);
|
||||
|
||||
path = new VisToolSpline(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSpline::~DialogSpline()
|
||||
{
|
||||
delete path;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -77,44 +81,50 @@ quint32 DialogSpline::getP1() const
|
|||
*/
|
||||
void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (type == SceneObject::Point)
|
||||
if (prepare == false)// After first choose we ignore all objects
|
||||
{
|
||||
switch (number)
|
||||
if (type == SceneObject::Point)
|
||||
{
|
||||
case 0:
|
||||
if (SetObject(id, ui->comboBoxP1, tr("Select last point of curve")))
|
||||
{
|
||||
number++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (number)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
qint32 index = ui->comboBoxP4->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui->comboBoxP4->setCurrentIndex(index);
|
||||
emit ToolTip("");
|
||||
index = ui->comboBoxP1->currentIndex();
|
||||
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
|
||||
|
||||
QPointF p1 = data->GeometricObject<const VPointF *>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
else
|
||||
case 0:
|
||||
if (SetObject(id, ui->comboBoxP1, tr("Select last point of curve")))
|
||||
{
|
||||
number++;
|
||||
path->VisualMode(id);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
qWarning()<<"Can't find object by name"<<point->name();
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
qint32 index = ui->comboBoxP4->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
ui->comboBoxP4->setCurrentIndex(index);
|
||||
emit ToolTip("");
|
||||
index = ui->comboBoxP1->currentIndex();
|
||||
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
|
||||
|
||||
QPointF p1 = data->GeometricObject<const VPointF *>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
||||
path->setPoint4Id(id);
|
||||
path->RefreshGeometry();
|
||||
prepare = true;
|
||||
DialogAccepted();
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning()<<"Can't find object by name"<<point->name();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +139,15 @@ void DialogSpline::SaveData()
|
|||
kAsm1 = ui->doubleSpinBoxKasm1->value();
|
||||
kAsm2 = ui->doubleSpinBoxKasm2->value();
|
||||
kCurve = ui->doubleSpinBoxKcurve->value();
|
||||
|
||||
path->setPoint1Id(p1);
|
||||
path->setPoint4Id(p4);
|
||||
path->setAngle1(angle1);
|
||||
path->setAngle2(angle2);
|
||||
path->setKAsm1(kAsm1);
|
||||
path->setKAsm2(kAsm2);
|
||||
path->setKCurve(kCurve);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -163,6 +182,18 @@ void DialogSpline::UpdateList()
|
|||
*/
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSpline::ShowVisualization()
|
||||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setKCurve set coefficient curve
|
||||
|
@ -172,6 +203,7 @@ void DialogSpline::setKCurve(const qreal &value)
|
|||
{
|
||||
kCurve = value;
|
||||
ui->doubleSpinBoxKcurve->setValue(value);
|
||||
path->setKCurve(kCurve);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -183,6 +215,7 @@ void DialogSpline::setKAsm2(const qreal &value)
|
|||
{
|
||||
kAsm2 = value;
|
||||
ui->doubleSpinBoxKasm2->setValue(value);
|
||||
path->setKAsm2(kAsm2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -194,6 +227,7 @@ void DialogSpline::setKAsm1(const qreal &value)
|
|||
{
|
||||
kAsm1 = value;
|
||||
ui->doubleSpinBoxKasm1->setValue(value);
|
||||
path->setKAsm1(kAsm1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -205,6 +239,7 @@ void DialogSpline::setAngle2(const qreal &value)
|
|||
{
|
||||
angle2 = value;
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(value));
|
||||
path->setAngle2(angle2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -216,6 +251,7 @@ void DialogSpline::setAngle1(const qreal &value)
|
|||
{
|
||||
angle1 = value;
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(value));
|
||||
path->setAngle1(angle1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -226,6 +262,7 @@ void DialogSpline::setAngle1(const qreal &value)
|
|||
void DialogSpline::setP4(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP4, p4, value);
|
||||
path->setPoint4Id(p4);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -236,6 +273,7 @@ void DialogSpline::setP4(const quint32 &value)
|
|||
void DialogSpline::setP1(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1, p1, value);
|
||||
path->setPoint1Id(p1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace Ui
|
|||
class DialogSpline;
|
||||
}
|
||||
|
||||
class VisToolSpline;
|
||||
|
||||
/**
|
||||
* @brief The DialogSpline class dialog for ToolSpline. Help create spline and edit option.
|
||||
*/
|
||||
|
@ -71,6 +73,7 @@ public slots:
|
|||
virtual void PointNameChanged();
|
||||
virtual void UpdateList();
|
||||
protected:
|
||||
virtual void ShowVisualization();
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
|
@ -104,6 +107,8 @@ private:
|
|||
|
||||
/** @brief kCurve coefficient curve */
|
||||
qreal kCurve;
|
||||
|
||||
VisToolSpline *path;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -473,8 +473,10 @@ void MainWindow::ToolLineIntersect(bool checked)
|
|||
*/
|
||||
void MainWindow::ToolSpline(bool checked)
|
||||
{
|
||||
SetToolButton<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png",
|
||||
tr("Select first point curve"), &MainWindow::ClosedDialog<VToolSpline>);
|
||||
SetToolButtonWithApply<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png",
|
||||
tr("Select first point curve"),
|
||||
&MainWindow::ClosedDialogWithApply<VToolSpline>,
|
||||
&MainWindow::ApplyDialog<VToolSpline>);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -107,8 +107,9 @@ void VToolSpline::setDialog()
|
|||
* @param scene pointer to scene.
|
||||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
* @return the created tool
|
||||
*/
|
||||
void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
|
||||
|
@ -120,8 +121,14 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
|
|||
const qreal angle1 = dialogTool->getAngle1();
|
||||
const qreal angle2 = dialogTool->getAngle2();
|
||||
const qreal kCurve = dialogTool->getKCurve();
|
||||
Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
VToolSpline *spl = nullptr;
|
||||
spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
if (spl != nullptr)
|
||||
{
|
||||
spl->dialog=dialogTool;
|
||||
}
|
||||
return spl;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -140,11 +147,12 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
|
|||
* @param data container with variables.
|
||||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
* @return the created tool
|
||||
*/
|
||||
void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
|
||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
|
||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
||||
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
||||
|
@ -175,7 +183,9 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
|
|||
doc->AddTool(id, spl);
|
||||
doc->IncrementReferens(p1);
|
||||
doc->IncrementReferens(p4);
|
||||
return spl;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -42,11 +42,11 @@ public:
|
|||
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr );
|
||||
virtual void setDialog();
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static void Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
|
||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static VToolSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolSpline *Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
|
||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
public slots:
|
||||
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
|
||||
|
|
|
@ -41,15 +41,6 @@ VisLine::VisLine(const VContainer *data, QGraphicsItem *parent)
|
|||
VisLine::~VisLine()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisLine::DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color, Qt::PenStyle style)
|
||||
{
|
||||
SCASSERT (lineItem != nullptr);
|
||||
|
||||
lineItem->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor, style));
|
||||
lineItem->setLine(line);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QLineF VisLine::Line(const QPointF &p1, const qreal &length, const qreal &angle)
|
||||
{
|
||||
|
|
|
@ -43,8 +43,6 @@ public:
|
|||
virtual ~VisLine();
|
||||
|
||||
protected:
|
||||
void DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color,
|
||||
Qt::PenStyle style = Qt::SolidLine);
|
||||
QLineF Line(const QPointF &p1, const qreal& length, const qreal &angle);
|
||||
qreal CorrectAngle(const qreal &angle) const;
|
||||
QPointF Ray(const QPointF &firstPoint, const qreal &angle) const;
|
||||
|
|
119
src/app/visualization/vistoolspline.cpp
Normal file
119
src/app/visualization/vistoolspline.cpp
Normal file
|
@ -0,0 +1,119 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolspline.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 18 8, 2014
|
||||
**
|
||||
** @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) 2014 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 "vistoolspline.h"
|
||||
#include "../geometry/vpointf.h"
|
||||
#include "../geometry/vspline.h"
|
||||
#include "../container/vcontainer.h"
|
||||
|
||||
const int EMPTY_ANGLE = -1;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolSpline::VisToolSpline(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisPath(data, parent), point4Id(NULL_ID), lineP1(nullptr), lineP4(nullptr), line(nullptr), angle1(EMPTY_ANGLE),
|
||||
angle2(EMPTY_ANGLE), kAsm1(1), kAsm2(1), kCurve(1)
|
||||
{
|
||||
lineP1 = InitPoint(supportColor, this);
|
||||
lineP4 = InitPoint(supportColor, this);
|
||||
line = InitItem<QGraphicsLineItem>(mainColor, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolSpline::~VisToolSpline()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::RefreshGeometry()
|
||||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point4Id <= 0)
|
||||
{
|
||||
DrawLine(line, QLineF(first->toQPointF(), Visualization::scenePos), mainColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point4Id);
|
||||
DrawPoint(lineP4, second->toQPointF(), supportColor);
|
||||
|
||||
if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE))
|
||||
{
|
||||
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), mainColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
VSpline spline(*first, *second, angle1, angle2, kAsm1, kAsm2, kCurve);
|
||||
DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setPoint4Id(const quint32 &value)
|
||||
{
|
||||
point4Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setAngle1(const qreal &value)
|
||||
{
|
||||
angle1 = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setAngle2(const qreal &value)
|
||||
{
|
||||
angle2 = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setKAsm1(const qreal &value)
|
||||
{
|
||||
kAsm1 = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setKAsm2(const qreal &value)
|
||||
{
|
||||
kAsm2 = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolSpline::setKCurve(const qreal &value)
|
||||
{
|
||||
kCurve = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
62
src/app/visualization/vistoolspline.h
Normal file
62
src/app/visualization/vistoolspline.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolspline.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 18 8, 2014
|
||||
**
|
||||
** @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) 2014 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 VISTOOLSPLINE_H
|
||||
#define VISTOOLSPLINE_H
|
||||
|
||||
#include "vispath.h"
|
||||
|
||||
class VisToolSpline : public VisPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VisToolSpline(const VContainer *data, QGraphicsItem *parent = 0);
|
||||
virtual ~VisToolSpline();
|
||||
|
||||
virtual void RefreshGeometry();
|
||||
|
||||
void setPoint4Id(const quint32 &value);
|
||||
void setAngle1(const qreal &value);
|
||||
void setAngle2(const qreal &value);
|
||||
void setKAsm1(const qreal &value);
|
||||
void setKAsm2(const qreal &value);
|
||||
void setKCurve(const qreal &value);
|
||||
protected:
|
||||
Q_DISABLE_COPY(VisToolSpline)
|
||||
quint32 point4Id;
|
||||
QGraphicsEllipseItem *lineP1;
|
||||
QGraphicsEllipseItem *lineP4;
|
||||
QGraphicsLineItem *line;
|
||||
qreal angle1;
|
||||
qreal angle2;
|
||||
qreal kAsm1;
|
||||
qreal kAsm2;
|
||||
qreal kCurve;
|
||||
};
|
||||
|
||||
#endif // VISTOOLSPLINE_H
|
|
@ -168,3 +168,12 @@ void Visualization::DrawPoint(QGraphicsEllipseItem *point, const QPointF &pos, c
|
|||
point->setPen(QPen(color, qApp->toPixel(qApp->widthMainLine())/factor, style));
|
||||
point->setVisible(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void Visualization::DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color, Qt::PenStyle style)
|
||||
{
|
||||
SCASSERT (lineItem != nullptr);
|
||||
|
||||
lineItem->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor, style));
|
||||
lineItem->setLine(line);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ protected:
|
|||
qreal FindVal(const QString &expression);
|
||||
void DrawPoint(QGraphicsEllipseItem *point, const QPointF &pos, const QColor &color,
|
||||
Qt::PenStyle style = Qt::SolidLine);
|
||||
void DrawLine(QGraphicsLineItem *lineItem, const QLineF &line, const QColor &color,
|
||||
Qt::PenStyle style = Qt::SolidLine);
|
||||
|
||||
template <typename Item>
|
||||
void AddItem(Item *item)
|
||||
|
|
|
@ -18,7 +18,8 @@ HEADERS += \
|
|||
visualization/visualization.h \
|
||||
visualization/vistoolarc.h \
|
||||
visualization/vispath.h \
|
||||
visualization/vistoolcutarc.h
|
||||
visualization/vistoolcutarc.h \
|
||||
visualization/vistoolspline.h
|
||||
|
||||
SOURCES += \
|
||||
visualization/vgraphicssimpletextitem.cpp \
|
||||
|
@ -40,4 +41,5 @@ SOURCES += \
|
|||
visualization/visualization.cpp \
|
||||
visualization/vistoolarc.cpp \
|
||||
visualization/vispath.cpp \
|
||||
visualization/vistoolcutarc.cpp
|
||||
visualization/vistoolcutarc.cpp \
|
||||
visualization/vistoolspline.cpp
|
||||
|
|
Loading…
Reference in New Issue
Block a user