2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file dialogsplinepath.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
#include "dialogsplinepath.h"
|
|
|
|
#include "ui_dialogsplinepath.h"
|
2015-05-07 14:31:53 +02:00
|
|
|
#include "../../libs/vgeometry/vsplinepoint.h"
|
2015-06-12 10:55:44 +02:00
|
|
|
#include "../../libs/vpatterndb/vcontainer.h"
|
2014-09-07 18:51:22 +02:00
|
|
|
#include "../../visualization/vistoolsplinepath.h"
|
2013-11-21 13:05:26 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief DialogSplinePath create dialog
|
|
|
|
* @param data container with data
|
|
|
|
* @param parent parent widget
|
|
|
|
*/
|
2014-07-29 14:19:11 +02:00
|
|
|
DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
2015-05-21 21:24:31 +02:00
|
|
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogSplinePath), path(VSplinePath())
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
ui->setupUi(this);
|
2014-09-07 18:51:22 +02:00
|
|
|
InitOkCancelApply(ui);
|
2014-02-14 16:16:43 +01:00
|
|
|
bOk->setEnabled(false);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
2013-12-21 12:36:51 +01:00
|
|
|
FillComboBoxPoints(ui->comboBoxPoint);
|
2015-02-02 12:10:02 +01:00
|
|
|
FillComboBoxLineColors(ui->comboBoxColor);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
2014-02-14 16:16:43 +01:00
|
|
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);
|
2013-08-09 08:49:34 +02:00
|
|
|
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &DialogSplinePath::currentPointChanged);
|
2014-02-14 16:16:43 +01:00
|
|
|
connect(ui->doubleSpinBoxAngle1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
2013-08-09 08:49:34 +02:00
|
|
|
this, &DialogSplinePath::Angle1Changed);
|
2014-02-14 16:16:43 +01:00
|
|
|
connect(ui->doubleSpinBoxAngle2, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
2013-08-09 08:49:34 +02:00
|
|
|
this, &DialogSplinePath::Angle2Changed);
|
|
|
|
connect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
|
|
|
this, &DialogSplinePath::KAsm1Changed);
|
|
|
|
connect(ui->doubleSpinBoxKasm2, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
|
|
|
this, &DialogSplinePath::KAsm2Changed);
|
2014-09-07 18:51:22 +02:00
|
|
|
|
2015-05-21 21:24:31 +02:00
|
|
|
vis = new VisToolSplinePath(data);
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-11-04 21:35:15 +01:00
|
|
|
DialogSplinePath::~DialogSplinePath()
|
|
|
|
{
|
2015-05-21 21:24:31 +02:00
|
|
|
DeleteVisualization<VisToolSplinePath>();
|
2013-08-09 08:49:34 +02:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief SetPath set spline path
|
|
|
|
* @param value path
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogSplinePath::SetPath(const VSplinePath &value)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
this->path = value;
|
2014-09-07 18:51:22 +02:00
|
|
|
ui->listWidget->blockSignals(true);
|
2013-11-04 21:35:15 +01:00
|
|
|
ui->listWidget->clear();
|
|
|
|
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
|
|
|
{
|
2014-06-09 21:11:33 +02:00
|
|
|
NewItem(path.at(i).P().id(), path.at(i).KAsm1(), path.at(i).Angle1(), path.at(i).KAsm2(), path.at(i).Angle2());
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
2015-02-03 11:17:04 +01:00
|
|
|
ui->doubleSpinBoxKcurve->setValue(path.GetKCurve());
|
2014-09-07 18:51:22 +02:00
|
|
|
|
2015-05-21 21:24:31 +02:00
|
|
|
VisToolSplinePath *visPath = qobject_cast<VisToolSplinePath *>(vis);
|
|
|
|
SCASSERT(visPath != nullptr);
|
2014-09-07 18:51:22 +02:00
|
|
|
visPath->setPath(path);
|
|
|
|
ui->listWidget->blockSignals(false);
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2015-02-03 10:27:33 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-02-03 11:17:04 +01:00
|
|
|
QString DialogSplinePath::GetColor() const
|
2015-02-03 10:27:33 +01:00
|
|
|
{
|
2015-02-03 11:17:04 +01:00
|
|
|
return GetComboBoxCurrentData(ui->comboBoxColor);
|
2015-02-03 10:27:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-02-03 11:17:04 +01:00
|
|
|
void DialogSplinePath::SetColor(const QString &value)
|
2015-02-03 10:27:33 +01:00
|
|
|
{
|
|
|
|
ChangeCurrentData(ui->comboBoxColor, value);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
|
|
|
* @param id id of point or detail
|
|
|
|
* @param type don't show this id in list
|
|
|
|
*/
|
2014-07-15 16:42:41 +02:00
|
|
|
void DialogSplinePath::ChosenObject(quint32 id, const SceneObject &type)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
if (type == SceneObject::Point)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2015-01-27 14:56:44 +01:00
|
|
|
if (path.CountPoint() >= 2 && path.at(path.CountPoint()-1).P().id() == id)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-14 16:16:43 +01:00
|
|
|
NewItem(id, 1, 0, 1, 180);
|
2013-10-07 13:11:56 +02:00
|
|
|
emit ToolTip(tr("Select point of curve path"));
|
2014-09-07 18:51:22 +02:00
|
|
|
|
|
|
|
SavePath();
|
2015-05-21 21:24:31 +02:00
|
|
|
|
|
|
|
VisToolSplinePath *visPath = qobject_cast<VisToolSplinePath *>(vis);
|
|
|
|
SCASSERT(visPath != nullptr);
|
2014-09-07 18:51:22 +02:00
|
|
|
visPath->setPath(path);
|
2015-05-21 21:24:31 +02:00
|
|
|
|
2014-09-07 18:51:22 +02:00
|
|
|
if (path.CountPoint() == 1)
|
|
|
|
{
|
|
|
|
visPath->VisualMode(NULL_ID);
|
|
|
|
connect(visPath, &VisToolSplinePath::ToolTip, this, &DialogTool::ShowVisToolTip);
|
|
|
|
connect(visPath, &VisToolSplinePath::PathChanged, this, &DialogSplinePath::PathUpdated);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
visPath->RefreshGeometry();
|
|
|
|
}
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-08-13 12:20:30 +02:00
|
|
|
void DialogSplinePath::SaveData()
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-09-07 18:51:22 +02:00
|
|
|
SavePath();
|
|
|
|
|
2015-05-21 21:24:31 +02:00
|
|
|
VisToolSplinePath *visPath = qobject_cast<VisToolSplinePath *>(vis);
|
|
|
|
SCASSERT(visPath != nullptr);
|
2014-09-07 18:51:22 +02:00
|
|
|
visPath->setPath(path);
|
|
|
|
visPath->RefreshGeometry();
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief PointChanged selected another point in list
|
|
|
|
* @param row number of row
|
|
|
|
*/
|
2014-02-14 16:16:43 +01:00
|
|
|
void DialogSplinePath::PointChanged(int row)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
|
|
|
if (ui->listWidget->count() == 0)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
2013-12-29 17:48:57 +01:00
|
|
|
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
2013-08-09 08:49:34 +02:00
|
|
|
EnableFields();
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief currentPointChanged changed point in combo box
|
|
|
|
* @param index index in list
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogSplinePath::currentPointChanged(int index)
|
|
|
|
{
|
2014-02-25 15:40:24 +01:00
|
|
|
quint32 id = qvariant_cast<quint32>(ui->comboBoxPoint->itemData(index));
|
2013-08-09 08:49:34 +02:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
2014-08-21 14:44:40 +02:00
|
|
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
2013-12-29 17:48:57 +01:00
|
|
|
p.SetP(*point);
|
|
|
|
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
2013-08-09 08:49:34 +02:00
|
|
|
EnableFields();
|
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief Angle1Changed changed first angle
|
|
|
|
* @param index index in list
|
|
|
|
*/
|
2014-02-14 16:16:43 +01:00
|
|
|
void DialogSplinePath::Angle1Changed(qreal index)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-02-14 16:16:43 +01:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
2014-05-30 21:56:05 +02:00
|
|
|
SCASSERT(item != nullptr);
|
2014-02-14 16:16:43 +01:00
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
|
|
|
p.SetAngle1(index);
|
|
|
|
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief Angle2Changed changed second angle
|
|
|
|
* @param index index in list
|
|
|
|
*/
|
2014-02-14 16:16:43 +01:00
|
|
|
void DialogSplinePath::Angle2Changed(qreal index)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-02-14 16:16:43 +01:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
2014-05-30 21:56:05 +02:00
|
|
|
SCASSERT(item != nullptr);
|
2014-02-14 16:16:43 +01:00
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
|
|
|
p.SetAngle2(index);
|
|
|
|
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief KAsm1Changed changed first coefficient asymmetry
|
|
|
|
* @param d value
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogSplinePath::KAsm1Changed(qreal d)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
|
|
|
p.SetKAsm1(d);
|
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief KAsm2Changed changed second coefficient asymmetry
|
|
|
|
* @param d value
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogSplinePath::KAsm2Changed(qreal d)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
|
|
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
|
|
|
p.SetKAsm2(d);
|
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
|
|
|
}
|
|
|
|
|
2014-09-07 18:51:22 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogSplinePath::ShowDialog(bool click)
|
|
|
|
{
|
|
|
|
if (click == false)
|
|
|
|
{
|
2014-11-21 18:24:16 +01:00
|
|
|
if (path.CountPoint() >= 3)
|
|
|
|
{
|
|
|
|
emit ToolTip("");
|
|
|
|
DialogAccepted();
|
|
|
|
}
|
2014-09-07 18:51:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogSplinePath::PathUpdated(const VSplinePath &path)
|
|
|
|
{
|
|
|
|
SetPath(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogSplinePath::ShowVisualization()
|
|
|
|
{
|
|
|
|
if (prepare == false)
|
|
|
|
{
|
2015-05-12 17:15:10 +02:00
|
|
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
2015-05-21 21:24:31 +02:00
|
|
|
SCASSERT(scene != nullptr);
|
|
|
|
|
|
|
|
VisToolSplinePath *visPath = qobject_cast<VisToolSplinePath *>(vis);
|
|
|
|
SCASSERT(visPath != nullptr);
|
|
|
|
|
2014-09-07 18:51:22 +02:00
|
|
|
connect(scene, &VMainGraphicsScene::NewFactor, visPath, &Visualization::SetFactor);
|
|
|
|
scene->addItem(visPath);
|
|
|
|
visPath->setMode(Mode::Show);
|
|
|
|
visPath->RefreshGeometry();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief NewItem add point to list
|
|
|
|
* @param id id
|
|
|
|
* @param kAsm1 first coefficient asymmetry
|
|
|
|
* @param angle1 first angle in degree
|
|
|
|
* @param kAsm2 second coefficient asymmetry
|
|
|
|
* @param angle2 second angle in degree
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-08-21 14:44:40 +02:00
|
|
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
2013-12-29 17:48:57 +01:00
|
|
|
QListWidgetItem *item = new QListWidgetItem(point->name());
|
2013-08-09 08:49:34 +02:00
|
|
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
2014-09-07 18:51:22 +02:00
|
|
|
VSplinePoint p(*point.data(), kAsm1, angle1, kAsm2, angle2);
|
2014-02-14 16:16:43 +01:00
|
|
|
DataPoint(point->id(), kAsm1, angle1, kAsm2, angle2);
|
2013-08-09 08:49:34 +02:00
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
|
|
|
ui->listWidget->addItem(item);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->listWidget->setCurrentItem(item);
|
|
|
|
if (ui->listWidget->count() >= 2)
|
|
|
|
{
|
|
|
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
bOk->setEnabled(true);
|
|
|
|
}
|
2013-08-09 08:49:34 +02:00
|
|
|
EnableFields();
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief dataPoint show data of point in fields
|
|
|
|
* @param id id
|
|
|
|
* @param kAsm1 first coefficient asymmetry
|
|
|
|
* @param angle1 first angle of spline
|
|
|
|
* @param kAsm2 second coefficient asymmetry
|
|
|
|
* @param angle2 second angle of spline
|
|
|
|
*/
|
2014-02-25 15:40:24 +01:00
|
|
|
void DialogSplinePath::DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2014-08-09 10:43:01 +02:00
|
|
|
ui->comboBoxPoint->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxAngle1->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxAngle2->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxKasm1->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxKasm2->blockSignals(true);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
|
|
|
ChangeCurrentData(ui->comboBoxPoint, id);
|
|
|
|
ui->doubleSpinBoxKasm1->setValue(kAsm1);
|
|
|
|
ui->doubleSpinBoxKasm2->setValue(kAsm2);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->doubleSpinBoxAngle2->setValue(angle2);
|
|
|
|
ui->doubleSpinBoxAngle1->setValue(angle1);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
2014-08-09 10:43:01 +02:00
|
|
|
ui->comboBoxPoint->blockSignals(false);
|
|
|
|
ui->doubleSpinBoxAngle1->blockSignals(false);
|
|
|
|
ui->doubleSpinBoxAngle2->blockSignals(false);
|
|
|
|
ui->doubleSpinBoxKasm1->blockSignals(false);
|
|
|
|
ui->doubleSpinBoxKasm2->blockSignals(false);
|
2013-08-09 08:49:34 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-02 16:28:02 +02:00
|
|
|
/**
|
|
|
|
* @brief EnableFields enable or disable fields
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogSplinePath::EnableFields()
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
ui->doubleSpinBoxKasm1->setEnabled(true);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->doubleSpinBoxAngle1->setEnabled(true);
|
2013-08-09 08:49:34 +02:00
|
|
|
ui->doubleSpinBoxKasm2->setEnabled(true);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->doubleSpinBoxAngle2->setEnabled(true);
|
2013-08-09 08:49:34 +02:00
|
|
|
qint32 row = ui->listWidget->currentRow();
|
2013-11-04 21:35:15 +01:00
|
|
|
if (row == 0)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
ui->doubleSpinBoxKasm1->setEnabled(false);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->doubleSpinBoxAngle1->setEnabled(false);
|
2013-08-09 08:49:34 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
if (row == ui->listWidget->count()-1)
|
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
ui->doubleSpinBoxKasm2->setEnabled(false);
|
2014-02-14 16:16:43 +01:00
|
|
|
ui->doubleSpinBoxAngle2->setEnabled(false);
|
2013-08-09 08:49:34 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-09-07 18:51:22 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogSplinePath::SavePath()
|
|
|
|
{
|
|
|
|
path.Clear();
|
|
|
|
for (qint32 i = 0; i < ui->listWidget->count(); ++i)
|
|
|
|
{
|
|
|
|
QListWidgetItem *item = ui->listWidget->item(i);
|
|
|
|
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
|
|
|
|
}
|
2015-02-03 11:17:04 +01:00
|
|
|
path.SetKCurve(ui->doubleSpinBoxKcurve->value());
|
2014-09-07 18:51:22 +02:00
|
|
|
}
|