Merged develop into feature

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-06 17:58:17 +02:00
commit cdd3e03e53
7 changed files with 228 additions and 267 deletions

View File

@ -1703,7 +1703,6 @@ void MainWindow::ToolBarDraws()
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MainWindow::currentPPChanged); this, &MainWindow::currentPPChanged);
ui->toolBarDraws->addAction(ui->actionOptionDraw);
connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::DrawOption); connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::DrawOption);
} }
@ -1849,7 +1848,6 @@ void MainWindow::CancelTool()
pointer->setChecked(false); pointer->setChecked(false);
} }
helpLabel->setText(""); helpLabel->setText("");
ui->actionStopTool->setEnabled(true);
// Crash: using CRTL+Z while using line tool. // Crash: using CRTL+Z while using line tool.
// related bug report: // related bug report:
@ -1998,7 +1996,6 @@ void MainWindow::ArrowTool()
{ {
pointer->setChecked(true); pointer->setChecked(true);
} }
ui->actionStopTool->setEnabled(false);
currentTool = Tool::Arrow; currentTool = Tool::Arrow;
emit EnableItemMove(true); emit EnableItemMove(true);
emit ItemsSelection(SelectionType::ByMouseRelease); emit ItemsSelection(SelectionType::ByMouseRelease);
@ -3691,7 +3688,6 @@ void MainWindow::CreateActions()
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->actionStopTool, &QAction::triggered, this, &MainWindow::ArrowTool);
connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ArrowTool); connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ArrowTool);
connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw); connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw);
connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails); connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails);

View File

@ -1560,7 +1560,6 @@
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="actionZoomOriginal"/> <addaction name="actionZoomOriginal"/>
<addaction name="actionZoomFitBest"/> <addaction name="actionZoomFitBest"/>
<addaction name="actionStopTool"/>
</widget> </widget>
<widget class="QDockWidget" name="dockWidgetToolOptions"> <widget class="QDockWidget" name="dockWidgetToolOptions">
<property name="minimumSize"> <property name="minimumSize">
@ -2091,28 +2090,6 @@
<enum>QAction::NoRole</enum> <enum>QAction::NoRole</enum>
</property> </property>
</action> </action>
<action name="actionStopTool">
<property name="checkable">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="process-stop">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Stop</string>
</property>
<property name="toolTip">
<string>Stop using tool</string>
</property>
<property name="shortcut">
<string notr="true"/>
</property>
</action>
<action name="actionReportBug"> <action name="actionReportBug">
<property name="text"> <property name="text">
<string>Report Bug...</string> <string>Report Bug...</string>

View File

@ -279,6 +279,7 @@ void DialogDetail::NameDetailChanged()
void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode, void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
qreal mx, qreal my, bool reverse) qreal mx, qreal my, bool reverse)
{ {
SCASSERT(id > NULL_ID);
QString name; QString name;
switch (typeTool) switch (typeTool)
{ {
@ -306,8 +307,7 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
} }
else else
{ {
const QString previousItemName = ui.listWidget->item(ui.listWidget->count()-1)->text(); if(RowId(ui.listWidget->count()-1) != id)
if(QString::compare(previousItemName, name) != 0)
{ {
canAddNewPoint = true; canAddNewPoint = true;
} }
@ -392,6 +392,15 @@ void DialogDetail::EnableObjectGUI(bool value)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogDetail::RowId(int i) const
{
const QListWidgetItem *rowItem = ui.listWidget->item(i);
SCASSERT(rowItem != nullptr);
const VNodeDetail rowNode = qvariant_cast<VNodeDetail>(rowItem->data(Qt::UserRole));
return rowNode.getId();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief setDetails set detail * @brief setDetails set detail
@ -639,10 +648,7 @@ bool DialogDetail::DetailIsValid() const
{ {
for (int i=0, sz = ui.listWidget->count()-1; i<sz; ++i) for (int i=0, sz = ui.listWidget->count()-1; i<sz; ++i)
{ {
const QString previousRow = ui.listWidget->item(i)->text(); if (RowId(i) == RowId(i+1))
const QString nextRow = ui.listWidget->item(i+1)->text();
if (QString::compare(previousRow, nextRow) == 0)
{ {
url += tr("You have double points!"); url += tr("You have double points!");
ui.helpLabel->setText(url); ui.helpLabel->setText(url);
@ -660,10 +666,7 @@ bool DialogDetail::FirstPointEqualLast() const
{ {
if (ui.listWidget->count() > 1) if (ui.listWidget->count() > 1)
{ {
const QString firstDetailPoint = ui.listWidget->item(0)->text(); if (RowId(0) == RowId(ui.listWidget->count()-1))
const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text();
if (QString::compare(firstDetailPoint, lastDetailPoint) == 0)
{ {
return true; return true;
} }

View File

@ -86,6 +86,15 @@ private:
/** @brief closed keep option about equdistant (closed or not) */ /** @brief closed keep option about equdistant (closed or not) */
bool closed; bool closed;
bool flagWidth; bool flagWidth;
bool m_bAddMode;
QStringList m_qslMaterials;
QStringList m_qslPlacements;
// temporary container for Material/Cut/Placement 3-tuples
MCPContainer m_conMCP;
QPointF m_ptPos;
bool DetailIsValid() const; bool DetailIsValid() const;
bool FirstPointEqualLast() const; bool FirstPointEqualLast() const;
bool DetailIsClockwise() const; bool DetailIsClockwise() const;
@ -96,16 +105,9 @@ private:
void ValidObjects(bool value); void ValidObjects(bool value);
void EnableObjectGUI(bool value); void EnableObjectGUI(bool value);
bool m_bAddMode;
QStringList m_qslMaterials;
QStringList m_qslPlacements;
// temporary container for Material/Cut/Placement 3-tuples
MCPContainer m_conMCP;
QPointF m_ptPos;
void ClearFields(); void ClearFields();
quint32 RowId(int i) const;
private slots: private slots:
void SetAddMode(); void SetAddMode();

View File

@ -164,8 +164,7 @@ void VToolDetail::setDialog()
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog); DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
SCASSERT(dialogTool != nullptr); SCASSERT(dialogTool != nullptr);
VDetail detail = VAbstractTool::data.GetDetail(id); dialogTool->setDetail(VAbstractTool::data.GetDetail(id));
dialogTool->setDetail(detail);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -322,9 +321,8 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr);
DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog); DialogDetail *dialogTool = qobject_cast<DialogDetail*>(dialog);
SCASSERT(dialogTool != nullptr); SCASSERT(dialogTool != nullptr);
const VDetail newDet = dialogTool->getDetail();
VDetail newDet = dialogTool->getDetail(); const VDetail oldDet = VAbstractTool::data.GetDetail(id);
VDetail oldDet = VAbstractTool::data.GetDetail(id);
qDebug() << "VToolDetail Position" << newDet.GetPatternPieceData().GetPos(); qDebug() << "VToolDetail Position" << newDet.GetPatternPieceData().GetPos();
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
@ -342,7 +340,7 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
*/ */
void VToolDetail::AddToFile() void VToolDetail::AddToFile()
{ {
VDetail detail = VAbstractTool::data.GetDetail(id); const VDetail detail = VAbstractTool::data.GetDetail(id);
QDomElement domElement = doc->createElement(getTagName()); QDomElement domElement = doc->createElement(getTagName());
doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, VDomDocument::AttrId, id);

View File

@ -111,51 +111,45 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
switch (det.at(i).getTypeTool()) switch (det.at(i).getTypeTool())
{ {
case (Tool::NodePoint): case (Tool::NodePoint):
{
if ( qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && (pRotate == 0))
{
id = det.at(i).getId();
}
else
{ {
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId())); VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
point->setMode(Draw::Modeling); point->setMode(Draw::Modeling);
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle); BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle);
}
idObject = data->AddGObject(point); idObject = data->AddGObject(point);
children.append(idObject); children.append(idObject);
VPointF *point1 = new VPointF(*point); VPointF *point1 = new VPointF(*point);
point1->setMode(Draw::Modeling); point1->setMode(Draw::Modeling);
id = data->AddGObject(point1); id = data->AddGObject(point1);
VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, drawName, VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
idTool);
}
} }
break; break;
case (Tool::NodeArc): case (Tool::NodeArc):
{
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
{
id = det.at(i).getId();
}
else
{ {
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0); VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0);
BiasRotatePoint(&p1, dx, dy, p, angle);
VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0); VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0);
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF *center = new VPointF(arc->GetCenter()); VPointF *center = new VPointF(arc->GetCenter());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(center, dx, dy, p, angle); BiasRotatePoint(center, dx, dy, p, angle);
}
QLineF l1(*center, p1); QLineF l1(*center, p1);
QLineF l2(*center, p2); QLineF l2(*center, p2);
center->setMode(Draw::Modeling); center->setMode(Draw::Modeling);
quint32 idCenter = data->AddGObject(center); quint32 idCenter = data->AddGObject(center);
Q_UNUSED(idCenter); Q_UNUSED(idCenter);
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
QString().setNum(l2.angle()));
arc1->setMode(Draw::Modeling); arc1->setMode(Draw::Modeling);
idObject = data->AddGObject(arc1); idObject = data->AddGObject(arc1);
children.append(idObject); children.append(idObject);
@ -166,31 +160,25 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool); VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
} }
}
break; break;
case (Tool::NodeSpline): case (Tool::NodeSpline):
{
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
{
id = det.at(i).getId();
}
else
{ {
const QSharedPointer<VAbstractCubicBezier> spline = const QSharedPointer<VAbstractCubicBezier> spline =
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId()); data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
VPointF *p1 = new VPointF(spline->GetP1()); VPointF *p1 = new VPointF(spline->GetP1());
BiasRotatePoint(p1, dx, dy, p, angle);
VPointF p2 = VPointF(spline->GetP2()); VPointF p2 = VPointF(spline->GetP2());
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF p3 = VPointF(spline->GetP3()); VPointF p3 = VPointF(spline->GetP3());
BiasRotatePoint(&p3, dx, dy, p, angle);
VPointF *p4 = new VPointF(spline->GetP4()); VPointF *p4 = new VPointF(spline->GetP4());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(&p3, dx, dy, p, angle);
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
}
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling); VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
idObject = data->AddGObject(spl); idObject = data->AddGObject(spl);
@ -204,15 +192,8 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
delete p4; delete p4;
delete p1; delete p1;
} }
}
break; break;
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
{
if (qFuzzyIsNull(dx) && qFuzzyIsNull(dy) && pRotate == 0)
{
id = det.at(i).getId();
}
else
{ {
VSplinePath *path = new VSplinePath(); VSplinePath *path = new VSplinePath();
path->setMode(Draw::Modeling); path->setMode(Draw::Modeling);
@ -224,16 +205,16 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
VPointF *p1 = new VPointF(spline.GetP1()); VPointF *p1 = new VPointF(spline.GetP1());
BiasRotatePoint(p1, dx, dy, p, angle);
VPointF p2 = VPointF(spline.GetP2()); VPointF p2 = VPointF(spline.GetP2());
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF p3 = VPointF(spline.GetP3()); VPointF p3 = VPointF(spline.GetP3());
BiasRotatePoint(&p3, dx, dy, p, angle);
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(&p3, dx, dy, p, angle);
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
}
VSpline spl = VSpline(*p1, p2, p3, *p4); VSpline spl = VSpline(*p1, p2, p3, *p4);
if (i==1) if (i==1)
@ -268,9 +249,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
VSplinePath *path1 = new VSplinePath(*path); VSplinePath *path1 = new VSplinePath(*path);
path1->setMode(Draw::Modeling); path1->setMode(Draw::Modeling);
id = data->AddGObject(path1); id = data->AddGObject(path1);
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
idTool);
}
} }
break; break;
default: default:
@ -300,30 +279,30 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
switch (det.at(i).getTypeTool()) switch (det.at(i).getTypeTool())
{ {
case (Tool::NodePoint): case (Tool::NodePoint):
{
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
{ {
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId())); VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
point->setMode(Draw::Modeling); point->setMode(Draw::Modeling);
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle); BiasRotatePoint(point, dx, dy, *data->GeometricObject<VPointF>(pRotate), angle);
data->UpdateGObject(TakeNextId(children), point);
} }
data->UpdateGObject(TakeNextId(children), point);
} }
break; break;
case (Tool::NodeArc): case (Tool::NodeArc):
{
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
{ {
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
VPointF p1 = VPointF(arc->GetP1()); VPointF p1 = VPointF(arc->GetP1());
BiasRotatePoint(&p1, dx, dy, p, angle);
VPointF p2 = VPointF(arc->GetP2()); VPointF p2 = VPointF(arc->GetP2());
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF *center = new VPointF(arc->GetCenter()); VPointF *center = new VPointF(arc->GetCenter());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(center, dx, dy, p, angle); BiasRotatePoint(center, dx, dy, p, angle);
}
QLineF l1(*center, p1); QLineF l1(*center, p1);
QLineF l2(*center, p2); QLineF l2(*center, p2);
@ -334,38 +313,33 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
data->UpdateGObject(TakeNextId(children), arc1); data->UpdateGObject(TakeNextId(children), arc1);
delete center; delete center;
} }
}
break; break;
case (Tool::NodeSpline): case (Tool::NodeSpline):
{
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
{ {
const QSharedPointer<VAbstractCubicBezier> spline = const QSharedPointer<VAbstractCubicBezier> spline =
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId()); data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
VPointF *p1 = new VPointF(spline->GetP1()); VPointF *p1 = new VPointF(spline->GetP1());
BiasRotatePoint(p1, dx, dy, p, angle);
VPointF p2 = VPointF(spline->GetP2()); VPointF p2 = VPointF(spline->GetP2());
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF p3 = VPointF(spline->GetP3()); VPointF p3 = VPointF(spline->GetP3());
BiasRotatePoint(&p3, dx, dy, p, angle);
VPointF *p4 = new VPointF(spline->GetP4()); VPointF *p4 = new VPointF(spline->GetP4());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(&p3, dx, dy, p, angle);
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
}
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling); VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
data->UpdateGObject(TakeNextId(children), spl); data->UpdateGObject(TakeNextId(children), spl);
delete p1; delete p1;
delete p4; delete p4;
} }
}
break; break;
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
{
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
{ {
VSplinePath *path = new VSplinePath(); VSplinePath *path = new VSplinePath();
path->setMode(Draw::Modeling); path->setMode(Draw::Modeling);
@ -378,16 +352,17 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
const QPointF p = *data->GeometricObject<VPointF>(pRotate); const QPointF p = *data->GeometricObject<VPointF>(pRotate);
VPointF *p1 = new VPointF(spline.GetP1()); VPointF *p1 = new VPointF(spline.GetP1());
BiasRotatePoint(p1, dx, dy, p, angle);
VPointF p2 = VPointF(spline.GetP2()); VPointF p2 = VPointF(spline.GetP2());
BiasRotatePoint(&p2, dx, dy, p, angle);
VPointF p3 = VPointF(spline.GetP3()); VPointF p3 = VPointF(spline.GetP3());
BiasRotatePoint(&p3, dx, dy, p, angle);
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{
BiasRotatePoint(p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle);
BiasRotatePoint(&p3, dx, dy, p, angle);
BiasRotatePoint(p4, dx, dy, p, angle); BiasRotatePoint(p4, dx, dy, p, angle);
}
VSpline spl = VSpline(*p1, p2, p3, *p4); VSpline spl = VSpline(*p1, p2, p3, *p4);
if (i==1) if (i==1)
@ -419,7 +394,6 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
} }
data->UpdateGObject(TakeNextId(children), path); data->UpdateGObject(TakeNextId(children), path);
} }
}
break; break;
default: default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO; qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
@ -671,11 +645,17 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
qint32 i = 0; qint32 i = 0;
do do
{ {
// This check need for backward compatibility
// Remove it if min version is 0.3.2
// Instead:
// UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); // UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
++i; if (children.size() != countNodeD2)
if (i > d1.indexOfNode(det1p1.getId())) {
UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
}
++i;
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
{ {
const int childrenCount = children.size();
VDetail d2REdge = d2.RemoveEdge(indexD2); VDetail d2REdge = d2.RemoveEdge(indexD2);
qint32 j = 0; qint32 j = 0;
FindIndexJ(pointsD2, d2, indexD2, j); FindIndexJ(pointsD2, d2, indexD2, j);
@ -688,9 +668,14 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle);
++pointsD2; ++pointsD2;
++j; ++j;
} while (pointsD2 < childrenCount); } while (pointsD2 < countNodeD2-1);
// This check need for backward compatibility
// Remove it if min version is 0.3.2
if (children.size() == countNodeD2)
{
break; break;
} }
}
} while (i<countNodeD1); } while (i<countNodeD1);
} }
} }

View File

@ -72,10 +72,10 @@ public:
static void AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, static void AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool, VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
QVector<quint32> &children, const QString &drawName, const qreal &dx = 0, QVector<quint32> &children, const QString &drawName, const qreal &dx = 0,
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); const qreal &dy = 0, const quint32 &pRotate = NULL_ID, const qreal &angle = 0);
static void UpdatePoints(VContainer *data, const VDetail &det, const int &i, static void UpdatePoints(VContainer *data, const VDetail &det, const int &i,
QVector<quint32> &children, const qreal &dx = 0, const qreal &dy = 0, QVector<quint32> &children, const qreal &dx = 0, const qreal &dy = 0,
const quint32 &pRotate = 0, const qreal &angle = 0); const quint32 &pRotate = NULL_ID, const qreal &angle = 0);
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
const qreal &angle); const qreal &angle);
virtual QString getTagName() const Q_DECL_OVERRIDE; virtual QString getTagName() const Q_DECL_OVERRIDE;