New tool CutSplinePath (Drawing mode).
--HG-- branch : feature
This commit is contained in:
parent
452aec26f1
commit
028f913f5c
|
@ -55,7 +55,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, Draw::Draws mod
|
|||
connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected);
|
||||
if(mode == Draw::Calculation)
|
||||
{
|
||||
FillComboBoxSplines(ui->comboBoxSplinePath);
|
||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||
}
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
|
||||
|
@ -93,7 +93,7 @@ void DialogCutSplinePath::setFormula(const QString &value)
|
|||
|
||||
void DialogCutSplinePath::setSplinePathId(const qint64 &value, const qint64 &id)
|
||||
{
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id);
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline);
|
||||
}
|
||||
|
||||
void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||
|
@ -114,7 +114,7 @@ void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (type == Scene::Spline)
|
||||
if (type == Scene::SplinePath)
|
||||
{
|
||||
VSplinePath splPath;
|
||||
if (mode == Draw::Calculation)
|
||||
|
|
|
@ -152,17 +152,28 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
|
|||
if (det[i].getTypeTool() == Tool::SplineTool ||
|
||||
det[i].getTypeTool() == Tool::NodeSpline )
|
||||
{
|
||||
if (det[i].getId() != id)
|
||||
if(cut == ComboMode::CutSpline)
|
||||
{
|
||||
VSpline spl = data->GetSplineModeling(det[i].getId());
|
||||
box->addItem(spl.name(), det[i].getId());
|
||||
if (det[i].getId() != id + 1 && det[i].getId() != id + 2)
|
||||
{
|
||||
VSpline spl = data->GetSplineModeling(det[i].getId());
|
||||
box->addItem(spl.name(), det[i].getId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (det[i].getId() != id)
|
||||
{
|
||||
VSpline spl = data->GetSplineModeling(det[i].getId());
|
||||
box->addItem(spl.name(), det[i].getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id) const
|
||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_ASSERT(box != 0);
|
||||
box->clear();
|
||||
|
@ -173,10 +184,21 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id) const
|
|||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
if (i.key() != id)
|
||||
if(cut == ComboMode::CutSpline)
|
||||
{
|
||||
VSplinePath splPath = i.value();
|
||||
box->addItem(splPath.name(), i.key());
|
||||
if (i.key() != id + 1 && i.key() != id + 2)
|
||||
{
|
||||
VSplinePath splPath = i.value();
|
||||
box->addItem(splPath.name(), i.key());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i.key() != id)
|
||||
{
|
||||
VSplinePath splPath = i.value();
|
||||
box->addItem(splPath.name(), i.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,10 +215,21 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id) const
|
|||
if (det[i].getTypeTool() == Tool::SplinePathTool ||
|
||||
det[i].getTypeTool() == Tool::NodeSplinePath )
|
||||
{
|
||||
if (det[i].getId() != id)
|
||||
if(cut == ComboMode::CutSpline)
|
||||
{
|
||||
VSplinePath splPath = data->GetSplinePathModeling(det[i].getId());
|
||||
box->addItem(splPath.name(), det[i].getId());
|
||||
if (det[i].getId() != id + 1 && det[i].getId() != id + 2)
|
||||
{
|
||||
VSplinePath splPath = data->GetSplinePathModeling(det[i].getId());
|
||||
box->addItem(splPath.name(), det[i].getId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (det[i].getId() != id)
|
||||
{
|
||||
VSplinePath splPath = data->GetSplinePathModeling(det[i].getId());
|
||||
box->addItem(splPath.name(), det[i].getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,10 +379,10 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint
|
|||
}
|
||||
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
||||
const qint64 &id) const
|
||||
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||
{
|
||||
Q_ASSERT(box != 0);
|
||||
FillComboBoxSplinesPath(box, id);
|
||||
FillComboBoxSplinesPath(box, id, cut);
|
||||
splinePathId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
|
|
@ -299,7 +299,8 @@ protected:
|
|||
*/
|
||||
void FillComboBoxSplines(QComboBox *box, const qint64 &id = 0,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||
void FillComboBoxSplinesPath(QComboBox *box, const qint64 &id = 0)const;
|
||||
void FillComboBoxSplinesPath(QComboBox *box, const qint64 &id = 0,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const;
|
||||
/**
|
||||
* @brief FillComboBoxTypeLine fill comboBox list of type lines
|
||||
* @param box comboBox
|
||||
|
@ -384,8 +385,8 @@ protected:
|
|||
* @param value splinePath id
|
||||
* @param id don't show this id in list
|
||||
*/
|
||||
void setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
||||
const qint64 &id) const;
|
||||
void setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value, const qint64 &id,
|
||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
||||
/**
|
||||
* @brief getCurrentPointId return current point id in combobox
|
||||
* @param box combobox
|
||||
|
|
|
@ -247,12 +247,10 @@ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPo
|
|||
if(length < GetLength()*0.02)
|
||||
{
|
||||
length = GetLength()*0.02;
|
||||
qWarning()<<"Warning!!! Correction length of cutting. Length too small.";
|
||||
}
|
||||
else if ( length > GetLength()*0.98)
|
||||
{
|
||||
length = GetLength()*0.98;
|
||||
qWarning()<<"Warning!!! Correction length of cutting. Length too small.";
|
||||
}
|
||||
|
||||
// Very stupid way find correct value of t.
|
||||
|
|
|
@ -170,7 +170,8 @@ VSplinePoint & VSplinePath::operator[](ptrdiff_t indx)
|
|||
return path[indx];
|
||||
}
|
||||
|
||||
QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p3, QPointF &spl2p2) const
|
||||
QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3,
|
||||
QPointF &spl2p2, QPointF &spl2p3) const
|
||||
{
|
||||
if(Count() < 2)
|
||||
{
|
||||
|
@ -182,27 +183,35 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
|
|||
if(length < fullLength * 0.02)
|
||||
{
|
||||
length = fullLength * 0.02;
|
||||
qWarning()<<"Warning!!! Correction length of cutting. Length too small.";
|
||||
}
|
||||
else if ( length > fullLength * 0.98)
|
||||
{
|
||||
length = fullLength * 0.98;
|
||||
qWarning()<<"Warning!!! Correction length of cutting. Length too small.";
|
||||
}
|
||||
|
||||
fullLength = 0;
|
||||
for (qint32 i = 1; i <= Count(); ++i)
|
||||
{
|
||||
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
||||
path[i].KAsm1(), kCurve);
|
||||
VSpline spl = VSpline(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||
path[i-1].KAsm2(), path[i].KAsm1(), kCurve);
|
||||
fullLength += spl.GetLength();
|
||||
if(fullLength > length)
|
||||
{
|
||||
p1 = i-1;
|
||||
p2 = i;
|
||||
QPointF spl1p2, spl2p3;
|
||||
return spl.CutSpline(length - (fullLength - spl.GetLength()), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||
}
|
||||
}
|
||||
return QPointF();
|
||||
}
|
||||
|
||||
QHash<qint64, VPointF> VSplinePath::getPoints() const
|
||||
{
|
||||
return points;
|
||||
}
|
||||
|
||||
void VSplinePath::setPoints(const QHash<qint64, VPointF> *value)
|
||||
{
|
||||
points = *value;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,10 @@ public:
|
|||
* @param spl2p2
|
||||
* @return
|
||||
*/
|
||||
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p3, QPointF &spl2p2) const;
|
||||
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
||||
QPointF &spl2p3) const;
|
||||
QHash<qint64, VPointF> getPoints() const;
|
||||
void setPoints(const QHash<qint64, VPointF> *value);
|
||||
protected:
|
||||
/**
|
||||
* @brief path вектор з точок сплайна.
|
||||
|
|
|
@ -27,17 +27,35 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vtoolcutsplinepath.h"
|
||||
#include "../../container/calculator.h"
|
||||
|
||||
const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath");
|
||||
const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
||||
|
||||
VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &formula, const qint64 &splinePathId,
|
||||
const qint64 &splPath1id, const qint64 &splPath2id,
|
||||
const Tool::Sources &typeCreation, QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), formula(formula), splinePathId(splinePathId),
|
||||
dialogCutSplinePath(QSharedPointer<DialogCutSplinePath>()), firstSplinePath(), secondSplinePath()
|
||||
dialogCutSplinePath(QSharedPointer<DialogCutSplinePath>()), firstSpline(), secondSpline(),
|
||||
splPath1id (splPath1id), splPath2id(splPath2id)
|
||||
{
|
||||
Q_ASSERT_X(splinePathId > 0, Q_FUNC_INFO, "splinePathId <= 0");
|
||||
Q_ASSERT_X(splPath1id > 0, Q_FUNC_INFO, "spl1id <= 0");
|
||||
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||
|
||||
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
||||
Q_ASSERT(firstSpline != 0);
|
||||
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||
firstSpline->setParentItem(this);
|
||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||
|
||||
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
||||
Q_ASSERT(secondSpline != 0);
|
||||
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||
secondSpline->setParentItem(this);
|
||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
AddToFile();
|
||||
|
@ -67,7 +85,132 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
|||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
||||
{
|
||||
VSplinePath splPath = data->GetSplinePath(splinePathId);
|
||||
Calculator cal(data);
|
||||
QString errorMsg;
|
||||
qreal result = cal.eval(formula, &errorMsg);
|
||||
if (errorMsg.isEmpty())
|
||||
{
|
||||
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||
qint32 p1 = 0, p2 = 0;
|
||||
QPointF point = splPath.CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3);
|
||||
qDebug()<<p1<<p2;
|
||||
|
||||
qint64 id = _id;
|
||||
qint64 splPath1id = 0;
|
||||
qint64 splPath2id = 0;
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
id = data->AddPoint(VPointF(point.x(), point.y(), pointName, mx, my));
|
||||
splPath1id = id + 1;
|
||||
splPath2id = id + 2;
|
||||
|
||||
VSplinePoint splP1 = splPath[p1];
|
||||
VSplinePoint splP2 = splPath[p2];
|
||||
VSpline spl1 = VSpline(data->DataPoints(), splP1.P(), spl1p2, spl1p3, id, splPath.getKCurve());
|
||||
VSpline spl2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, splP2.P(), splPath.getKCurve());
|
||||
|
||||
|
||||
VSplinePath splPath1, splPath2;
|
||||
splPath1.setPoints(data->DataPoints());
|
||||
splPath2.setPoints(data->DataPoints());
|
||||
for(qint32 i = 0; i < splPath.CountPoint(); i++)
|
||||
{
|
||||
if(i <= p1 && i < p2){
|
||||
if(i == p1)
|
||||
{
|
||||
splPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
||||
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1());
|
||||
splPath1.append(cutPoint);
|
||||
continue;
|
||||
}
|
||||
splPath1.append(splPath[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(i == p2)
|
||||
{
|
||||
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
||||
splPath2.append(cutPoint);
|
||||
splPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
||||
continue;
|
||||
}
|
||||
splPath2.append(splPath[i]);
|
||||
}
|
||||
}
|
||||
|
||||
splPath1id = data->AddSplinePath(splPath1);
|
||||
data->AddLengthSpline(splPath1.name(), toMM(splPath1.GetLength()));
|
||||
|
||||
splPath2id = data->AddSplinePath(splPath2);
|
||||
data->AddLengthSpline(splPath2.name(), toMM(splPath2.GetLength()));
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdatePoint(id, VPointF(point.x(), point.y(), pointName, mx, my));
|
||||
|
||||
splPath1id = id + 1;
|
||||
splPath2id = id + 2;
|
||||
|
||||
VSplinePoint splP1 = splPath[p1];
|
||||
VSplinePoint splP2 = splPath[p2];
|
||||
VSpline spl1 = VSpline(data->DataPoints(), splP1.P(), spl1p2, spl1p3, id, splPath.getKCurve());
|
||||
VSpline spl2 = VSpline(data->DataPoints(), id, spl2p2, spl2p3, splP2.P(), splPath.getKCurve());
|
||||
|
||||
VSplinePath splPath1, splPath2;
|
||||
splPath1.setPoints(data->DataPoints());
|
||||
splPath2.setPoints(data->DataPoints());
|
||||
for(qint32 i = 0; i < splPath.CountPoint(); i++)
|
||||
{
|
||||
if(i <= p1 && i < p2){
|
||||
if(i == p1)
|
||||
{
|
||||
splPath1.append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
|
||||
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1());
|
||||
splPath1.append(cutPoint);
|
||||
continue;
|
||||
}
|
||||
splPath1.append(splPath[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(i == p2)
|
||||
{
|
||||
VSplinePoint cutPoint = VSplinePoint(id, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
|
||||
splPath2.append(cutPoint);
|
||||
splPath2.append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2()+180, splP2.KAsm2()));
|
||||
continue;
|
||||
}
|
||||
splPath2.append(splPath[i]);
|
||||
}
|
||||
}
|
||||
|
||||
data->UpdateSplinePath(splPath1id, splPath1);
|
||||
data->AddLengthSpline(splPath1.name(), toMM(splPath1.GetLength()));
|
||||
|
||||
data->UpdateSplinePath(splPath2id, splPath2);
|
||||
data->AddLengthSpline(splPath2.name(), toMM(splPath2.GetLength()));
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
}
|
||||
//VDrawTool::AddRecord(id, Tool::CutSplineTool, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
||||
splPath2id, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(splPath1id, point);
|
||||
doc->AddTool(splPath2id, point);
|
||||
doc->IncrementReferens(splinePathId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::FullUpdateFromFile()
|
||||
|
@ -97,6 +240,34 @@ void VToolCutSplinePath::FullUpdateFromGui(int result)
|
|||
dialogCutSplinePath.clear();
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::SplineChoosed(qint64 id)
|
||||
{
|
||||
emit ChoosedTool(id, Scene::SplinePath);
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
if (nameActivDraw == newName)
|
||||
{
|
||||
currentColor = Qt::black;
|
||||
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
firstSpline->setAcceptHoverEvents(true);
|
||||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
secondSpline->setAcceptHoverEvents(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentColor = Qt::gray;
|
||||
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
firstSpline->setAcceptHoverEvents(false);
|
||||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
secondSpline->setAcceptHoverEvents(false);
|
||||
}
|
||||
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
ContextMenu(dialogCutSplinePath, this, event);
|
||||
|
@ -108,6 +279,7 @@ void VToolCutSplinePath::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 +292,26 @@ void VToolCutSplinePath::AddToFile()
|
|||
|
||||
void VToolCutSplinePath::RefreshGeometry()
|
||||
{
|
||||
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||
}
|
||||
|
||||
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
||||
{
|
||||
VSplinePath splPath = VAbstractTool::data.GetSplinePath(splPathid);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath.GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
if(tr == SimpleSpline::FirstPoint)
|
||||
{
|
||||
VSpline spl = splPath.GetSpline(1);
|
||||
path.translate(-spl.GetPointP1().toQPointF().x(), -spl.GetPointP1().toQPointF().y());
|
||||
}
|
||||
else
|
||||
{
|
||||
VSpline spl = splPath.GetSpline(splPath.Count());
|
||||
path.translate(-spl.GetPointP4().toQPointF().x(), -spl.GetPointP4().toQPointF().y());
|
||||
}
|
||||
spline->setPath(path);
|
||||
}
|
||||
|
|
|
@ -31,14 +31,18 @@
|
|||
|
||||
#include "vtoolpoint.h"
|
||||
#include "../../dialogs/dialogcutsplinepath.h"
|
||||
#include "../../widgets/vsimplesplinepath.h"
|
||||
#include "../../widgets/vsimplespline.h"
|
||||
|
||||
/**
|
||||
* @brief The VToolCutSplinePath class
|
||||
*/
|
||||
class VToolCutSplinePath : public VToolPoint
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
|
||||
const qint64 &splinePathId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||
const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id,
|
||||
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
|
||||
/**
|
||||
* @brief setDialog
|
||||
*/
|
||||
|
@ -85,6 +89,16 @@ public slots:
|
|||
* @param result
|
||||
*/
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
/**
|
||||
* @brief SplineChoosed
|
||||
* @param id
|
||||
*/
|
||||
void SplineChoosed(qint64 id);
|
||||
/**
|
||||
* @brief ChangedActivDraw
|
||||
* @param newName
|
||||
*/
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
protected:
|
||||
/**
|
||||
* @brief contextMenuEvent
|
||||
|
@ -110,13 +124,16 @@ private:
|
|||
*/
|
||||
QSharedPointer<DialogCutSplinePath> dialogCutSplinePath;
|
||||
/**
|
||||
* @brief firstSplinePath
|
||||
* @brief firstSpline
|
||||
*/
|
||||
VSimpleSplinePath *firstSplinePath;
|
||||
VSimpleSpline *firstSpline;
|
||||
/**
|
||||
* @brief secondSplinePath
|
||||
* @brief secondSpline
|
||||
*/
|
||||
VSimpleSplinePath *secondSplinePath;
|
||||
VSimpleSpline *secondSpline;
|
||||
const qint64 splPath1id;
|
||||
const qint64 splPath2id;
|
||||
void RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr);
|
||||
};
|
||||
|
||||
#endif // VTOOLCUTSPLINEPATH_H
|
||||
|
|
|
@ -108,11 +108,14 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
|
|||
case (Tool::CutSplineTool):
|
||||
InitTool<VModelingCutSpline>(scene, detail[i]);
|
||||
break;
|
||||
case (Tool::CutSplinePathTool):
|
||||
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.
|
||||
//No need init this tool. See CutSplinePathTool.
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"Get wrong tool type. Ignore.";
|
||||
|
@ -467,6 +470,9 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node)
|
|||
case (Tool::CutSplineTool):
|
||||
AddAttribute(nod, AttrType, QStringLiteral("CutSplineTool"));
|
||||
break;
|
||||
case (Tool::CutSplinePathTool):
|
||||
AddAttribute(nod, AttrType, QStringLiteral("CutSplinePathTool"));
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user