parent
134269dd02
commit
7f33f1023b
|
@ -38,18 +38,19 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogSplinePath::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogSplinePath::DialogAccepted);
|
||||||
|
bOk->setEnabled(false);
|
||||||
|
|
||||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxPoint);
|
FillComboBoxPoints(ui->comboBoxPoint);
|
||||||
|
|
||||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChenged);
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);
|
||||||
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogSplinePath::currentPointChanged);
|
this, &DialogSplinePath::currentPointChanged);
|
||||||
connect(ui->spinBoxAngle1, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxAngle1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle1Changed);
|
this, &DialogSplinePath::Angle1Changed);
|
||||||
connect(ui->spinBoxAngle2, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxAngle2, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle2Changed);
|
this, &DialogSplinePath::Angle2Changed);
|
||||||
connect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::KAsm1Changed);
|
this, &DialogSplinePath::KAsm1Changed);
|
||||||
|
@ -68,7 +69,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
for (qint32 i = 0; i < path.CountPoint(); ++i)
|
||||||
{
|
{
|
||||||
NewItem(path[i].P().id(), path[i].KAsm1(), path[i].Angle2(), path[i].KAsm2());
|
NewItem(path[i].P().id(), path[i].KAsm1(), path[i].Angle1(), path[i].KAsm2(), path[i].Angle2());
|
||||||
}
|
}
|
||||||
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
||||||
ui->doubleSpinBoxKcurve->setValue(path.getKCurve());
|
ui->doubleSpinBoxKcurve->setValue(path.getKCurve());
|
||||||
|
@ -79,7 +80,7 @@ void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
{
|
{
|
||||||
if (type == Scene::Point)
|
if (type == Scene::Point)
|
||||||
{
|
{
|
||||||
NewItem(id, 1, 0, 1);
|
NewItem(id, 1, 0, 1, 180);
|
||||||
emit ToolTip(tr("Select point of curve path"));
|
emit ToolTip(tr("Select point of curve path"));
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +99,7 @@ void DialogSplinePath::DialogAccepted()
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::PointChenged(int row)
|
void DialogSplinePath::PointChanged(int row)
|
||||||
{
|
{
|
||||||
if (ui->listWidget->count() == 0)
|
if (ui->listWidget->count() == 0)
|
||||||
{
|
{
|
||||||
|
@ -123,14 +124,26 @@ void DialogSplinePath::currentPointChanged(int index)
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::Angle1Changed(int index)
|
void DialogSplinePath::Angle1Changed(qreal index)
|
||||||
{
|
{
|
||||||
SetAngle(index+180);
|
qint32 row = ui->listWidget->currentRow();
|
||||||
|
QListWidgetItem *item = ui->listWidget->item( row );
|
||||||
|
Q_CHECK_PTR(item);
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::Angle2Changed(int index)
|
void DialogSplinePath::Angle2Changed(qreal index)
|
||||||
{
|
{
|
||||||
SetAngle(index);
|
qint32 row = ui->listWidget->currentRow();
|
||||||
|
QListWidgetItem *item = ui->listWidget->item( row );
|
||||||
|
Q_CHECK_PTR(item);
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::KAsm1Changed(qreal d)
|
void DialogSplinePath::KAsm1Changed(qreal d)
|
||||||
|
@ -151,15 +164,21 @@ void DialogSplinePath::KAsm2Changed(qreal d)
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2)
|
void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
|
||||||
{
|
{
|
||||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||||
QListWidgetItem *item = new QListWidgetItem(point->name());
|
QListWidgetItem *item = new QListWidgetItem(point->name());
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
VSplinePoint p(*point, kAsm1, angle, kAsm2);
|
VSplinePoint p(*point, kAsm1, angle1, kAsm2, angle2);
|
||||||
DataPoint(point->id(), kAsm1, angle+180, kAsm2, angle);
|
DataPoint(point->id(), kAsm1, angle1, kAsm2, angle2);
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
ui->listWidget->addItem(item);
|
ui->listWidget->addItem(item);
|
||||||
|
ui->listWidget->setCurrentItem(item);
|
||||||
|
if (ui->listWidget->count() >= 2)
|
||||||
|
{
|
||||||
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
bOk->setEnabled(true);
|
||||||
|
}
|
||||||
EnableFields();
|
EnableFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +186,9 @@ void DialogSplinePath::DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAs
|
||||||
{
|
{
|
||||||
disconnect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
disconnect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogSplinePath::currentPointChanged);
|
this, &DialogSplinePath::currentPointChanged);
|
||||||
disconnect(ui->spinBoxAngle1, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
disconnect(ui->doubleSpinBoxAngle1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle1Changed);
|
this, &DialogSplinePath::Angle1Changed);
|
||||||
disconnect(ui->spinBoxAngle2, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
disconnect(ui->doubleSpinBoxAngle2, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle2Changed);
|
this, &DialogSplinePath::Angle2Changed);
|
||||||
disconnect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
disconnect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::KAsm1Changed);
|
this, &DialogSplinePath::KAsm1Changed);
|
||||||
|
@ -179,14 +198,14 @@ void DialogSplinePath::DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAs
|
||||||
ChangeCurrentData(ui->comboBoxPoint, id);
|
ChangeCurrentData(ui->comboBoxPoint, id);
|
||||||
ui->doubleSpinBoxKasm1->setValue(kAsm1);
|
ui->doubleSpinBoxKasm1->setValue(kAsm1);
|
||||||
ui->doubleSpinBoxKasm2->setValue(kAsm2);
|
ui->doubleSpinBoxKasm2->setValue(kAsm2);
|
||||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(angle2));
|
ui->doubleSpinBoxAngle2->setValue(angle2);
|
||||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(angle1));
|
ui->doubleSpinBoxAngle1->setValue(angle1);
|
||||||
|
|
||||||
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogSplinePath::currentPointChanged);
|
this, &DialogSplinePath::currentPointChanged);
|
||||||
connect(ui->spinBoxAngle1, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxAngle1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle1Changed);
|
this, &DialogSplinePath::Angle1Changed);
|
||||||
connect(ui->spinBoxAngle2, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxAngle2, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::Angle2Changed);
|
this, &DialogSplinePath::Angle2Changed);
|
||||||
connect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxKasm1, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
this, &DialogSplinePath::KAsm1Changed);
|
this, &DialogSplinePath::KAsm1Changed);
|
||||||
|
@ -197,30 +216,20 @@ void DialogSplinePath::DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAs
|
||||||
void DialogSplinePath::EnableFields()
|
void DialogSplinePath::EnableFields()
|
||||||
{
|
{
|
||||||
ui->doubleSpinBoxKasm1->setEnabled(true);
|
ui->doubleSpinBoxKasm1->setEnabled(true);
|
||||||
ui->spinBoxAngle1->setEnabled(true);
|
ui->doubleSpinBoxAngle1->setEnabled(true);
|
||||||
ui->doubleSpinBoxKasm2->setEnabled(true);
|
ui->doubleSpinBoxKasm2->setEnabled(true);
|
||||||
ui->spinBoxAngle2->setEnabled(true);
|
ui->doubleSpinBoxAngle2->setEnabled(true);
|
||||||
qint32 row = ui->listWidget->currentRow();
|
qint32 row = ui->listWidget->currentRow();
|
||||||
if (row == 0)
|
if (row == 0)
|
||||||
{
|
{
|
||||||
ui->doubleSpinBoxKasm1->setEnabled(false);
|
ui->doubleSpinBoxKasm1->setEnabled(false);
|
||||||
ui->spinBoxAngle1->setEnabled(false);
|
ui->doubleSpinBoxAngle1->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (row == ui->listWidget->count()-1)
|
if (row == ui->listWidget->count()-1)
|
||||||
{
|
{
|
||||||
ui->doubleSpinBoxKasm2->setEnabled(false);
|
ui->doubleSpinBoxKasm2->setEnabled(false);
|
||||||
ui->spinBoxAngle2->setEnabled(false);
|
ui->doubleSpinBoxAngle2->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogSplinePath::SetAngle(qint32 angle)
|
|
||||||
{
|
|
||||||
qint32 row = ui->listWidget->currentRow();
|
|
||||||
QListWidgetItem *item = ui->listWidget->item( row );
|
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
|
||||||
p.SetAngle(angle);
|
|
||||||
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
|
||||||
}
|
|
||||||
|
|
|
@ -73,10 +73,10 @@ public slots:
|
||||||
*/
|
*/
|
||||||
virtual void DialogAccepted();
|
virtual void DialogAccepted();
|
||||||
/**
|
/**
|
||||||
* @brief PointChenged selected another point in list
|
* @brief PointChanged selected another point in list
|
||||||
* @param row number of row
|
* @param row number of row
|
||||||
*/
|
*/
|
||||||
void PointChenged(int row);
|
void PointChanged(int row);
|
||||||
/**
|
/**
|
||||||
* @brief currentPointChanged changed point in combo box
|
* @brief currentPointChanged changed point in combo box
|
||||||
* @param index index in list
|
* @param index index in list
|
||||||
|
@ -86,12 +86,12 @@ public slots:
|
||||||
* @brief Angle1Changed changed first angle
|
* @brief Angle1Changed changed first angle
|
||||||
* @param index index in list
|
* @param index index in list
|
||||||
*/
|
*/
|
||||||
void Angle1Changed( int index );
|
void Angle1Changed(qreal index );
|
||||||
/**
|
/**
|
||||||
* @brief Angle2Changed changed second angle
|
* @brief Angle2Changed changed second angle
|
||||||
* @param index index in list
|
* @param index index in list
|
||||||
*/
|
*/
|
||||||
void Angle2Changed( int index );
|
void Angle2Changed( qreal index );
|
||||||
/**
|
/**
|
||||||
* @brief KAsm1Changed changed first coefficient asymmetry
|
* @brief KAsm1Changed changed first coefficient asymmetry
|
||||||
* @param d value
|
* @param d value
|
||||||
|
@ -116,10 +116,11 @@ private:
|
||||||
* @brief NewItem add point to list
|
* @brief NewItem add point to list
|
||||||
* @param id id
|
* @param id id
|
||||||
* @param kAsm1 first coefficient asymmetry
|
* @param kAsm1 first coefficient asymmetry
|
||||||
* @param angle angle in degree
|
* @param angle1 first angle in degree
|
||||||
* @param kAsm2 second coefficient asymmetry
|
* @param kAsm2 second coefficient asymmetry
|
||||||
|
* @param angle2 second angle in degree
|
||||||
*/
|
*/
|
||||||
void NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2);
|
void NewItem(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2);
|
||||||
/**
|
/**
|
||||||
* @brief dataPoint show data of point in fields
|
* @brief dataPoint show data of point in fields
|
||||||
* @param id id
|
* @param id id
|
||||||
|
@ -133,11 +134,6 @@ private:
|
||||||
* @brief EnableFields enable or disable fields
|
* @brief EnableFields enable or disable fields
|
||||||
*/
|
*/
|
||||||
void EnableFields();
|
void EnableFields();
|
||||||
/**
|
|
||||||
* @brief SetAngle set angle of point
|
|
||||||
* @param angle angle in degree
|
|
||||||
*/
|
|
||||||
void SetAngle(qint32 angle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGSPLINEPATH_H
|
#endif // DIALOGSPLINEPATH_H
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBoxAngle1">
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle1">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>360</number>
|
<double>360.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -121,9 +121,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBoxAngle2">
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle2">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>360</number>
|
<double>360.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -200,9 +200,9 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>comboBoxPoint</tabstop>
|
<tabstop>comboBoxPoint</tabstop>
|
||||||
<tabstop>doubleSpinBoxKasm1</tabstop>
|
<tabstop>doubleSpinBoxKasm1</tabstop>
|
||||||
<tabstop>spinBoxAngle1</tabstop>
|
<tabstop>doubleSpinBoxAngle1</tabstop>
|
||||||
<tabstop>doubleSpinBoxKasm2</tabstop>
|
<tabstop>doubleSpinBoxKasm2</tabstop>
|
||||||
<tabstop>spinBoxAngle2</tabstop>
|
<tabstop>doubleSpinBoxAngle2</tabstop>
|
||||||
<tabstop>doubleSpinBoxKcurve</tabstop>
|
<tabstop>doubleSpinBoxKcurve</tabstop>
|
||||||
<tabstop>listWidget</tabstop>
|
<tabstop>listWidget</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
|
|
|
@ -29,10 +29,37 @@
|
||||||
#include "vsplinepoint.h"
|
#include "vsplinepoint.h"
|
||||||
|
|
||||||
VSplinePoint::VSplinePoint()
|
VSplinePoint::VSplinePoint()
|
||||||
:pSpline(VPointF()), angle(0), kAsm1(1), kAsm2(1){}
|
:pSpline(VPointF()), angle1(0), angle2(180), kAsm1(1), kAsm2(1){}
|
||||||
|
|
||||||
VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle, qreal kAsm2)
|
VSplinePoint::VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
|
||||||
:pSpline(pSpline), angle(angle), kAsm1(kAsm1), kAsm2(kAsm2){}
|
:pSpline(pSpline), angle1(0), angle2(180), kAsm1(kAsm1), kAsm2(kAsm2)
|
||||||
|
{
|
||||||
|
if (qFuzzyCompare(qAbs(angle1-angle2), 180) == false)
|
||||||
|
{
|
||||||
|
qWarning()<<"angle1 and angle2 are not equal.";
|
||||||
|
}
|
||||||
|
SetAngle2(angle2);
|
||||||
|
}
|
||||||
|
|
||||||
VSplinePoint::VSplinePoint(const VSplinePoint &point)
|
VSplinePoint::VSplinePoint(const VSplinePoint &point)
|
||||||
:pSpline(point.P()), angle(point.Angle2()), kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){}
|
:pSpline(point.P()), angle1(point.Angle1()), angle2(point.Angle2()), kAsm1(point.KAsm1()), kAsm2(point.KAsm2()){}
|
||||||
|
|
||||||
|
void VSplinePoint::SetAngle1(const qreal &value)
|
||||||
|
{
|
||||||
|
QLineF line(0, 0, 100, 0);
|
||||||
|
line.setAngle(value);
|
||||||
|
angle1 = line.angle();
|
||||||
|
|
||||||
|
line.setAngle(value+180);
|
||||||
|
angle2 = line.angle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VSplinePoint::SetAngle2(const qreal &value)
|
||||||
|
{
|
||||||
|
QLineF line(0, 0, 100, 0);
|
||||||
|
line.setAngle(value);
|
||||||
|
angle2 = line.angle();
|
||||||
|
|
||||||
|
line.setAngle(value-180);
|
||||||
|
angle1 = line.angle();
|
||||||
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
* @param angle second angle control line.
|
* @param angle second angle control line.
|
||||||
* @param factor coefficient of length second control line.
|
* @param factor coefficient of length second control line.
|
||||||
*/
|
*/
|
||||||
VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle, qreal kAsm2);
|
VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2);
|
||||||
/**
|
/**
|
||||||
* @brief VSplinePoint copy constructor
|
* @brief VSplinePoint copy constructor
|
||||||
* @param point point
|
* @param point point
|
||||||
|
@ -70,17 +70,22 @@ public:
|
||||||
* @brief Angle1 return first angle of spline.
|
* @brief Angle1 return first angle of spline.
|
||||||
* @return angle.
|
* @return angle.
|
||||||
*/
|
*/
|
||||||
inline qreal Angle1() const {return angle+180;}
|
inline qreal Angle1() const {return angle1;}
|
||||||
/**
|
/**
|
||||||
* @brief SetAngle set first angle of spline.
|
* @brief SetAngle1 set first angle of spline.
|
||||||
* @param value angle.
|
* @param value angle.
|
||||||
*/
|
*/
|
||||||
inline void SetAngle(const qreal &value) {angle = value;}
|
void SetAngle1(const qreal &value);
|
||||||
|
/**
|
||||||
|
* @brief SetAngle2 set second angle of spline.
|
||||||
|
* @param value angle.
|
||||||
|
*/
|
||||||
|
void SetAngle2(const qreal &value);
|
||||||
/**
|
/**
|
||||||
* @brief Angle2 return second angle of spline.
|
* @brief Angle2 return second angle of spline.
|
||||||
* @return angle.
|
* @return angle.
|
||||||
*/
|
*/
|
||||||
inline qreal Angle2() const {return angle;}
|
inline qreal Angle2() const {return angle2;}
|
||||||
/**
|
/**
|
||||||
* @brief KAsm1 return coefficient of length first control line.
|
* @brief KAsm1 return coefficient of length first control line.
|
||||||
* @return coefficient.
|
* @return coefficient.
|
||||||
|
@ -107,9 +112,13 @@ protected:
|
||||||
*/
|
*/
|
||||||
VPointF pSpline;
|
VPointF pSpline;
|
||||||
/**
|
/**
|
||||||
* @brief angle first angle spline.
|
* @brief angle1 first angle spline.
|
||||||
*/
|
*/
|
||||||
qreal angle;
|
qreal angle1;
|
||||||
|
/**
|
||||||
|
* @brief angle2 second angle spline.
|
||||||
|
*/
|
||||||
|
qreal angle2;
|
||||||
/**
|
/**
|
||||||
* @brief kAsm1 coefficient of length first control line.
|
* @brief kAsm1 coefficient of length first control line.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -130,9 +130,10 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
{
|
{
|
||||||
if (i == p1)
|
if (i == p1)
|
||||||
{
|
{
|
||||||
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
|
||||||
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180,
|
spl1.GetAngle1()));
|
||||||
spl2.GetKasm1());
|
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
|
||||||
|
spl1.GetAngle2()+180, spl1.GetAngle2());
|
||||||
splPath1->append(cutPoint);
|
splPath1->append(cutPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +143,11 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
{
|
{
|
||||||
if (i == p2)
|
if (i == p2)
|
||||||
{
|
{
|
||||||
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, spl2.GetKasm1(),
|
||||||
|
spl2.GetAngle1());
|
||||||
splPath2->append(cutPoint);
|
splPath2->append(cutPoint);
|
||||||
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
|
||||||
|
spl2.GetAngle2()+180));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
splPath2->append(splPath->at(i));
|
splPath2->append(splPath->at(i));
|
||||||
|
@ -184,9 +187,10 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
{
|
{
|
||||||
if (i == p1)
|
if (i == p1)
|
||||||
{
|
{
|
||||||
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(),
|
||||||
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180,
|
spl1.GetAngle1()));
|
||||||
spl2.GetKasm1());
|
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(),
|
||||||
|
spl2.GetKasm1(), spl1.GetAngle2()+180);
|
||||||
splPath1->append(cutPoint);
|
splPath1->append(cutPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -196,9 +200,11 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
{
|
{
|
||||||
if (i == p2)
|
if (i == p2)
|
||||||
{
|
{
|
||||||
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, spl2.GetKasm1(),
|
||||||
|
spl2.GetAngle1());
|
||||||
splPath2->append(cutPoint);
|
splPath2->append(cutPoint);
|
||||||
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(),
|
||||||
|
spl2.GetAngle2()+180));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
splPath2->append(splPath->at(i));
|
splPath2->append(splPath->at(i));
|
||||||
|
|
|
@ -161,12 +161,12 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons
|
||||||
void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline)
|
void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline)
|
||||||
{
|
{
|
||||||
VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint);
|
VSplinePoint p = splPath.GetSplinePoint(indexSpline, SplinePoint::FirstPoint);
|
||||||
p.SetAngle(spl.GetAngle1());
|
p.SetAngle2(spl.GetAngle1());
|
||||||
p.SetKAsm2(spl.GetKasm1());
|
p.SetKAsm2(spl.GetKasm1());
|
||||||
splPath.UpdatePoint(indexSpline, SplinePoint::FirstPoint, p);
|
splPath.UpdatePoint(indexSpline, SplinePoint::FirstPoint, p);
|
||||||
|
|
||||||
p = splPath.GetSplinePoint(indexSpline, SplinePoint::LastPoint);
|
p = splPath.GetSplinePoint(indexSpline, SplinePoint::LastPoint);
|
||||||
p.SetAngle(spl.GetAngle2()-180);
|
p.SetAngle2(spl.GetAngle2()-180);
|
||||||
p.SetKAsm1(spl.GetKasm2());
|
p.SetKAsm1(spl.GetKasm2());
|
||||||
splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p);
|
splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,11 +207,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
{
|
{
|
||||||
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(),
|
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1()+180,
|
||||||
splinePath->at(i-1).KAsm2()));
|
splinePath->at(i-1).KAsm2(), spl.GetAngle1()));
|
||||||
}
|
}
|
||||||
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2()+180,
|
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2(),
|
||||||
splinePath->at(i).KAsm2()));
|
splinePath->at(i).KAsm2(), spl.GetAngle2()+180));
|
||||||
}
|
}
|
||||||
while (k>=0)
|
while (k>=0)
|
||||||
{
|
{
|
||||||
|
@ -364,11 +364,11 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
{
|
{
|
||||||
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(),
|
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1()+180,
|
||||||
splinePath->at(i-1).KAsm2()));
|
splinePath->at(i-1).KAsm2(), spl.GetAngle1()));
|
||||||
}
|
}
|
||||||
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2()+180,
|
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle2(),
|
||||||
splinePath->at(i).KAsm2()));
|
splinePath->at(i).KAsm2(), spl.GetAngle2()+180));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (k>=0)
|
while (k>=0)
|
||||||
|
|
|
@ -1166,7 +1166,10 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
||||||
qint64 pSpline = GetParametrLongLong(element, VAbstractTool::AttrPSpline, "0");
|
qint64 pSpline = GetParametrLongLong(element, VAbstractTool::AttrPSpline, "0");
|
||||||
VPointF p = *data->GeometricObject<const VPointF *>(pSpline);
|
VPointF p = *data->GeometricObject<const VPointF *>(pSpline);
|
||||||
|
|
||||||
VSplinePoint splPoint(p, kAsm1, angle, kAsm2);
|
QLineF line(0, 0, 100, 0);
|
||||||
|
line.setAngle(angle+180);
|
||||||
|
|
||||||
|
VSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle);
|
||||||
path->append(splPoint);
|
path->append(splPoint);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user