New tool CutSpline (Modeling mode).
--HG-- branch : feature
This commit is contained in:
parent
13bc690f67
commit
452aec26f1
|
@ -553,6 +553,21 @@ void VContainer::PrepareDetails(QVector<VItem *> &list) const
|
|||
}
|
||||
}
|
||||
|
||||
qint64 VContainer::PointConvertToModeling(qint64 id)
|
||||
{
|
||||
QHashIterator<qint64, VPointF> pModeling(pointsModeling);
|
||||
while (pModeling.hasNext())
|
||||
{
|
||||
pModeling.next();
|
||||
VPointF p = pModeling.value();
|
||||
if(p.getIdObject() == id)
|
||||
{
|
||||
return pModeling.key();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename val>
|
||||
void VContainer::UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point)
|
||||
{
|
||||
|
|
|
@ -573,6 +573,7 @@ public:
|
|||
* @param list list of details
|
||||
*/
|
||||
void PrepareDetails(QVector<VItem *> & list) const;
|
||||
qint64 PointConvertToModeling(qint64 id);
|
||||
private:
|
||||
/**
|
||||
* @brief _id current id. New object will have value +1. For full class equal 0.
|
||||
|
|
|
@ -57,8 +57,11 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidg
|
|||
connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
ui->comboBoxLineType->setCurrentIndex(1);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogAlongLine::PutVal);
|
||||
|
@ -88,6 +91,8 @@ void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,10 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
|
|||
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
}
|
||||
|
||||
CheckState();
|
||||
|
||||
|
@ -124,6 +127,7 @@ void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,12 @@ DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
}
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere);
|
||||
|
@ -88,6 +91,9 @@ void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,10 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, Draw::Draws mode, QWidg
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogCutSpline::DialogRejected);
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
}
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
|
||||
|
@ -100,6 +103,7 @@ void DialogCutSpline::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,10 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, Draw::Draws mod
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected);
|
||||
FillComboBoxSplines(ui->comboBoxSplinePath);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxSplines(ui->comboBoxSplinePath);
|
||||
}
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
|
||||
|
@ -100,6 +103,7 @@ void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxSplines(ui->comboBoxSplinePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ void DialogDetail::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
{
|
||||
if (CheckObject(id) == false)
|
||||
{
|
||||
qDebug()<<"false";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,10 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
}
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
|
||||
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
|
||||
|
@ -98,6 +101,7 @@ void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,12 @@ DialogHeight::DialogHeight(const VContainer *data, Draw::Draws mode, QWidget *pa
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
}
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
|
||||
}
|
||||
|
@ -92,6 +95,9 @@ void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,11 @@ DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent
|
|||
connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted);
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
}
|
||||
number = 0;
|
||||
}
|
||||
|
||||
|
@ -88,6 +91,8 @@ void DialogLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,13 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mod
|
|||
flagName = false;
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line2);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line2);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line2);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line2);
|
||||
}
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged);
|
||||
}
|
||||
|
@ -63,6 +66,10 @@ void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line2);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,11 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *pa
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
}
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
|
||||
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this,
|
||||
|
@ -104,6 +107,8 @@ void DialogNormal::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,12 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws m
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected);
|
||||
FillComboBoxPoints(ui.comboBoxCenter);
|
||||
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui.comboBoxCenter);
|
||||
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
||||
}
|
||||
|
||||
connect(ui.toolButtonPutHere, &QPushButton::clicked, this, &DialogPointOfContact::PutHere);
|
||||
connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal);
|
||||
|
@ -81,6 +84,9 @@ void DialogPointOfContact::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui.comboBoxCenter);
|
||||
FillComboBoxPoints(ui.comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui.comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,11 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, Dra
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
}
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersection::NamePointChanged);
|
||||
}
|
||||
|
||||
|
@ -66,6 +69,8 @@ void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &ty
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,9 +57,12 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mod
|
|||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType);
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
FillComboBoxPoints(ui->comboBoxPShoulder);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
FillComboBoxPoints(ui->comboBoxPShoulder);
|
||||
}
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal);
|
||||
|
@ -89,6 +92,9 @@ void DialogShoulderPoint::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
FillComboBoxPoints(ui->comboBoxPShoulder);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,10 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWi
|
|||
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
}
|
||||
|
||||
path = VSplinePath(data->DataPoints());
|
||||
|
||||
|
@ -83,6 +86,7 @@ void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,13 @@ DialogTriangle::DialogTriangle(const VContainer *data, Draw::Draws mode, QWidget
|
|||
CheckState();
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected);
|
||||
FillComboBoxPoints(ui->comboBoxAxisP1);
|
||||
FillComboBoxPoints(ui->comboBoxAxisP2);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxPoints(ui->comboBoxAxisP1);
|
||||
FillComboBoxPoints(ui->comboBoxAxisP2);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
}
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogTriangle::NamePointChanged);
|
||||
}
|
||||
|
||||
|
@ -62,6 +65,10 @@ void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
FillComboBoxPoints(ui->comboBoxAxisP1);
|
||||
FillComboBoxPoints(ui->comboBoxAxisP2);
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,6 +271,7 @@ template <typename T>
|
|||
void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool, const qint64 &idDetail)
|
||||
{
|
||||
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
||||
Q_ASSERT(tools != 0);
|
||||
VToolDetail *det = qobject_cast<VToolDetail*>(tools->value(idDetail));
|
||||
Q_ASSERT(det != 0);
|
||||
det->AddTool(tool, id, typeTool);
|
||||
|
|
|
@ -77,7 +77,9 @@ namespace Tool
|
|||
NodeSplinePath,
|
||||
Height,
|
||||
Triangle,
|
||||
PointOfIntersection
|
||||
PointOfIntersection,
|
||||
SimpleSpline,
|
||||
SimpleSplinePath
|
||||
};
|
||||
Q_DECLARE_FLAGS(Tools, Tool)
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64
|
|||
Q_ASSERT_X(spl1id > 0, Q_FUNC_INFO, "spl1id <= 0");
|
||||
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||
|
||||
firstSpline = new VSimpleSpline(spl1id, &factor, ¤tColor);
|
||||
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
||||
Q_ASSERT(firstSpline != 0);
|
||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||
firstSpline->setParentItem(this);
|
||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||
|
||||
secondSpline = new VSimpleSpline(spl2id, &factor, ¤tColor);
|
||||
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
||||
Q_ASSERT(secondSpline != 0);
|
||||
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||
secondSpline->setParentItem(this);
|
||||
|
|
|
@ -27,17 +27,32 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vmodelingcutspline.h"
|
||||
#include "../../container/calculator.h"
|
||||
|
||||
const QString VModelingCutSpline::ToolType = QStringLiteral("cutSpline");
|
||||
const QString VModelingCutSpline::AttrSpline = QStringLiteral("spline");
|
||||
|
||||
VModelingCutSpline::VModelingCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &formula, const qint64 &splineId,
|
||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
||||
const QString &formula, const qint64 &splineId, const qint64 &spl1id,
|
||||
const qint64 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
||||
:VModelingPoint(doc, data, id, parent), formula(formula), splineId(splineId),
|
||||
dialogCutSpline(QSharedPointer<DialogCutSpline>())
|
||||
dialogCutSpline(QSharedPointer<DialogCutSpline>()), firstSpline(), secondSpline(), spl1id(spl1id), spl2id(spl2id)
|
||||
{
|
||||
Q_ASSERT_X(splineId > 0, Q_FUNC_INFO, "splineId <= 0");
|
||||
Q_ASSERT_X(spl1id > 0, Q_FUNC_INFO, "spl1id <= 0");
|
||||
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||
|
||||
firstSpline = new VSimpleSpline(spl1id, ¤tColor);
|
||||
Q_ASSERT(firstSpline != 0);
|
||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||
firstSpline->setParentItem(this);
|
||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VModelingCutSpline::SplineChoosed);
|
||||
|
||||
secondSpline = new VSimpleSpline(spl2id, ¤tColor);
|
||||
Q_ASSERT(secondSpline != 0);
|
||||
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||
secondSpline->setParentItem(this);
|
||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VModelingCutSpline::SplineChoosed);
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
AddToFile();
|
||||
|
@ -47,10 +62,10 @@ VModelingCutSpline::VModelingCutSpline(VDomDocument *doc, VContainer *data, cons
|
|||
void VModelingCutSpline::setDialog()
|
||||
{
|
||||
Q_ASSERT(dialogCutSpline.isNull() == false);
|
||||
VSpline spl = VAbstractTool::data.GetSplineModeling(id);
|
||||
VPointF point = VAbstractTool::data.GetPointModeling(id);
|
||||
dialogCutSpline->setFormula(formula);
|
||||
dialogCutSpline->setSplineId(splineId, id);
|
||||
dialogCutSpline->setPointName(spl.name());
|
||||
dialogCutSpline->setPointName(point.name());
|
||||
}
|
||||
|
||||
VModelingCutSpline *VModelingCutSpline::Create(QSharedPointer<DialogCutSpline> &dialog,
|
||||
|
@ -67,7 +82,81 @@ VModelingCutSpline *VModelingCutSpline::Create(const qint64 _id, const QString &
|
|||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
const Tool::Sources &typeCreation)
|
||||
{
|
||||
VModelingCutSpline *cutPoint = 0;
|
||||
VSpline spl = data->GetSplineModeling(splineId);
|
||||
Calculator cal(data);
|
||||
QString errorMsg;
|
||||
qreal result = cal.eval(formula, &errorMsg);
|
||||
if (errorMsg.isEmpty())
|
||||
{
|
||||
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||
QPointF point = spl.CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||
|
||||
qint64 splP1id, splP4id;
|
||||
Draw::Draws typeObject = spl.getMode();
|
||||
if (typeObject == Draw::Calculation)
|
||||
{
|
||||
splP1id = data->PointConvertToModeling(spl.GetP1());
|
||||
splP4id = data->PointConvertToModeling(spl.GetP4());
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
doc->IncrementReferens(splP1id);
|
||||
doc->IncrementReferens(splP4id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
splP1id = spl.GetP1();
|
||||
splP4id = spl.GetP4();
|
||||
}
|
||||
|
||||
qint64 id = _id;
|
||||
qint64 spl1id = 0;
|
||||
qint64 spl2id = 0;
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
id = data->AddPointModeling(VPointF(point.x(), point.y(), pointName, mx, my));
|
||||
|
||||
VSpline spline1 = VSpline(data->DataPointsModeling(), splP1id, spl1p2, spl1p3, id, spl.GetKcurve());
|
||||
spl1id = data->AddSplineModeling(spline1);
|
||||
data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength()));
|
||||
|
||||
VSpline spline2 = VSpline(data->DataPointsModeling(), id, spl2p2, spl2p3, splP4id, spl.GetKcurve());
|
||||
spl2id = data->AddSplineModeling(spline2);
|
||||
data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength()));
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdatePointModeling(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
||||
|
||||
spl1id = id + 1;
|
||||
spl2id = id + 2;
|
||||
|
||||
VSpline spline1 = VSpline(data->DataPointsModeling(), splP1id, spl1p2, spl1p3, id, spl.GetKcurve());
|
||||
data->UpdateSplineModeling(spl1id, spline1);
|
||||
data->AddLengthSpline(spline1.name(), toMM(spline1.GetLength()));
|
||||
|
||||
VSpline spline2 = VSpline(data->DataPointsModeling(), id, spl2p2, spl2p3, splP4id, spl.GetKcurve());
|
||||
data->UpdateSplineModeling(spl2id, spline2);
|
||||
data->AddLengthSpline(spline2.name(), toMM(spline2.GetLength()));
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
}
|
||||
//VDrawTool::AddRecord(id, Tool::CutSplineTool, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
cutPoint = new VModelingCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation);
|
||||
|
||||
doc->AddTool(id, cutPoint);
|
||||
doc->AddTool(spl1id, cutPoint);
|
||||
doc->AddTool(spl2id, cutPoint);
|
||||
doc->IncrementReferens(splineId);
|
||||
}
|
||||
}
|
||||
return cutPoint;
|
||||
}
|
||||
|
||||
void VModelingCutSpline::FullUpdateFromFile()
|
||||
|
@ -97,6 +186,11 @@ void VModelingCutSpline::FullUpdateFromGui(int result)
|
|||
dialogCutSpline.clear();
|
||||
}
|
||||
|
||||
void VModelingCutSpline::SplineChoosed(qint64 id)
|
||||
{
|
||||
emit ChoosedTool(id, Scene::Spline);
|
||||
}
|
||||
|
||||
void VModelingCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
ContextMenu(dialogCutSpline, this, event);
|
||||
|
@ -108,6 +202,7 @@ void VModelingCutSpline::AddToFile()
|
|||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
AddAttribute(domElement, AttrId, id);
|
||||
AddAttribute(domElement, AttrType, ToolType);
|
||||
AddAttribute(domElement, AttrName, point.name());
|
||||
AddAttribute(domElement, AttrMx, toMM(point.mx()));
|
||||
AddAttribute(domElement, AttrMy, toMM(point.my()));
|
||||
|
@ -120,5 +215,25 @@ void VModelingCutSpline::AddToFile()
|
|||
|
||||
void VModelingCutSpline::RefreshGeometry()
|
||||
{
|
||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPointModeling(id));
|
||||
}
|
||||
|
||||
|
||||
void VModelingCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
||||
{
|
||||
VSpline spl = VModelingTool::data.GetSplineModeling(splid);
|
||||
QPainterPath path;
|
||||
path.addPath(spl.GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
if(tr == SimpleSpline::FirstPoint)
|
||||
{
|
||||
path.translate(-spl.GetPointP1().toQPointF().x(), -spl.GetPointP1().toQPointF().y());
|
||||
}
|
||||
else
|
||||
{
|
||||
path.translate(-spl.GetPointP4().toQPointF().x(), -spl.GetPointP4().toQPointF().y());
|
||||
}
|
||||
spline->setPath(path);
|
||||
}
|
||||
|
|
|
@ -31,13 +31,15 @@
|
|||
|
||||
#include "vmodelingpoint.h"
|
||||
#include "../../dialogs/dialogcutspline.h"
|
||||
#include "../../widgets/vsimplespline.h"
|
||||
|
||||
class VModelingCutSpline: public VModelingPoint
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VModelingCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id,const QString &formula,
|
||||
const qint64 &splineId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||
VModelingCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
|
||||
const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id,
|
||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||
/**
|
||||
* @brief setDialog
|
||||
*/
|
||||
|
@ -83,6 +85,11 @@ public slots:
|
|||
* @param result
|
||||
*/
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
/**
|
||||
* @brief SplineChoosed
|
||||
* @param id
|
||||
*/
|
||||
void SplineChoosed(qint64 id);
|
||||
protected:
|
||||
/**
|
||||
* @brief contextMenuEvent
|
||||
|
@ -107,6 +114,17 @@ private:
|
|||
* @brief DialogCutSpline pointer to the tool's dialog
|
||||
*/
|
||||
QSharedPointer<DialogCutSpline> dialogCutSpline;
|
||||
/**
|
||||
* @brief firstSpline
|
||||
*/
|
||||
VSimpleSpline *firstSpline;
|
||||
/**
|
||||
* @brief secondSpline
|
||||
*/
|
||||
VSimpleSpline *secondSpline;
|
||||
const qint64 spl1id;
|
||||
const qint64 spl2id;
|
||||
void RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr);
|
||||
};
|
||||
|
||||
#endif // VMODELINGCUTSPLINE_H
|
||||
|
|
|
@ -105,6 +105,15 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|||
case (Tool::PointOfIntersection):
|
||||
InitTool<VModelingPointOfIntersection>(scene, detail[i]);
|
||||
break;
|
||||
case (Tool::CutSplineTool):
|
||||
InitTool<VModelingCutSpline>(scene, detail[i]);
|
||||
break;
|
||||
case (Tool::SimpleSpline):
|
||||
//No need init this tool. See CutSplineTool.
|
||||
break;
|
||||
case (Tool::SimpleSplinePath):
|
||||
//No need init this tool. See CutSplineTool.
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"Get wrong tool type. Ignore.";
|
||||
break;
|
||||
|
@ -455,6 +464,9 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node)
|
|||
case (Tool::PointOfIntersection):
|
||||
AddAttribute(nod, AttrType, QStringLiteral("PointOfIntersection"));
|
||||
break;
|
||||
case (Tool::CutSplineTool):
|
||||
AddAttribute(nod, AttrType, QStringLiteral("CutSplineTool"));
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||
break;
|
||||
|
|
|
@ -29,10 +29,17 @@
|
|||
#include "vsimplespline.h"
|
||||
#include "../options.h"
|
||||
|
||||
VSimpleSpline::VSimpleSpline(qint64 id, qreal *factor, Qt::GlobalColor *currentColor, QObject *parent)
|
||||
VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
|
||||
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
||||
if(factor == 0)
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine));
|
||||
}
|
||||
else
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
||||
}
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
@ -49,11 +56,25 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(*currentColor, widthMainLine/ *factor));
|
||||
if(factor == 0)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthMainLine));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthMainLine/ *factor));
|
||||
}
|
||||
}
|
||||
|
||||
void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(*currentColor, widthHairLine/ *factor));
|
||||
if(factor == 0)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthHairLine));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthHairLine/ *factor));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
* @param currentColor
|
||||
* @param parent
|
||||
*/
|
||||
VSimpleSpline(qint64 id, qreal *factor, Qt::GlobalColor *currentColor, QObject *parent = 0);
|
||||
VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0);
|
||||
signals:
|
||||
/**
|
||||
* @brief Choosed
|
||||
|
|
|
@ -671,6 +671,13 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
|||
{
|
||||
tool = Tool::PointOfIntersection;
|
||||
}
|
||||
else if (t == "CutSplineTool")
|
||||
{
|
||||
tool = Tool::CutSplineTool;
|
||||
nodeType = NodeDetail::Modeling;
|
||||
detail.append(VNodeDetail(id + 1, Tool::SimpleSpline, Draw::Modeling, nodeType, mx, my));
|
||||
detail.append(VNodeDetail(id + 2, Tool::SimpleSplinePath, Draw::Modeling, nodeType, mx, my));
|
||||
}
|
||||
detail.append(VNodeDetail(id, tool, Draw::Modeling, nodeType, mx, my));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user