From 74bc4179efa7a5d7570fd2a0e3a15feaed324769 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 17 Sep 2016 12:10:03 +0300 Subject: [PATCH] New tool Flipping by axis. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 88 ++++- .../core/vtooloptionspropertybrowser.h | 9 + src/app/valentina/dialogs/dialoghistory.cpp | 3 +- src/app/valentina/mainwindow.cpp | 27 +- src/app/valentina/mainwindow.h | 1 + src/app/valentina/mainwindow.ui | 155 +++++---- src/app/valentina/share/resources/cursor.qrc | 2 + .../resources/cursor/flipping_axis_cursor.png | Bin 0 -> 700 bytes .../cursor/flipping_axis_cursor@2x.png | Bin 0 -> 1610 bytes .../valentina/share/resources/toolicon.qrc | 2 + .../toolicon/32x32/flipping_axis.png | Bin 0 -> 1050 bytes .../toolicon/32x32/flipping_axis@2x.png | Bin 0 -> 2310 bytes .../resources/toolicon/svg/flipping_axis.svg | 85 +++++ src/app/valentina/xml/vpattern.cpp | 41 ++- src/app/valentina/xml/vpattern.h | 1 + src/libs/ifc/ifcdef.cpp | 1 + src/libs/ifc/ifcdef.h | 1 + src/libs/ifc/schema/pattern/v0.3.5.xsd | 9 +- src/libs/ifc/xml/vabstractpattern.cpp | 8 +- src/libs/ifc/xml/vabstractpattern.h | 1 + src/libs/vmisc/def.h | 4 +- src/libs/vtools/dialogs/dialogs.pri | 9 +- src/libs/vtools/dialogs/tooldialogs.h | 1 + .../dialogs/tools/dialogflippingbyaxis.cpp | 325 ++++++++++++++++++ .../dialogs/tools/dialogflippingbyaxis.h | 104 ++++++ .../dialogs/tools/dialogflippingbyaxis.ui | 98 ++++++ .../dialogs/tools/dialogflippingbyline.cpp | 3 + .../dialogs/tools/dialogflippingbyline.ui | 8 +- src/libs/vtools/tools/drawTools/drawtools.h | 1 + .../operation/flipping/vabstractflipping.cpp | 195 +++++++++++ .../operation/flipping/vabstractflipping.h | 151 ++++++++ .../flipping/vtoolflippingbyaxis.cpp | 248 +++++++++++++ .../operation/flipping/vtoolflippingbyaxis.h | 77 +++++ .../flipping/vtoolflippingbyline.cpp | 215 +----------- .../operation/flipping/vtoolflippingbyline.h | 34 +- src/libs/vtools/tools/tools.pri | 8 +- .../line/operation/visoperation.cpp | 80 +++++ .../line/operation/visoperation.h | 26 ++ .../line/operation/vistoolflippingbyaxis.cpp | 87 +++++ .../line/operation/vistoolflippingbyaxis.h | 59 ++++ .../line/operation/vistoolflippingbyline.cpp | 97 +----- .../line/operation/vistoolflippingbyline.h | 3 - .../vtools/visualization/visualization.pri | 6 +- 43 files changed, 1840 insertions(+), 433 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/flipping_axis_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/flipping_axis_cursor@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/flipping_axis.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/flipping_axis@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/svg/flipping_axis.svg create mode 100644 src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp create mode 100644 src/libs/vtools/dialogs/tools/dialogflippingbyaxis.h create mode 100644 src/libs/vtools/dialogs/tools/dialogflippingbyaxis.ui create mode 100644 src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.cpp create mode 100644 src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h create mode 100644 src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp create mode 100644 src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h create mode 100644 src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.cpp create mode 100644 src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.h diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 8c2bca58f..3d38dda94 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -75,7 +75,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was used in switch."); switch (item->type()) { @@ -188,6 +188,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) case VToolFlippingByLine::Type: ShowOptionsToolFlippingByLine(item); break; + case VToolFlippingByAxis::Type: + ShowOptionsToolFlippingByAxis(item); + break; default: break; } @@ -202,7 +205,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was used in switch."); switch (currentItem->type()) { @@ -305,6 +308,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions() case VToolFlippingByLine::Type: UpdateOptionsToolFlippingByLine(); break; + case VToolFlippingByAxis::Type: + UpdateOptionsToolFlippingByAxis(); + break; default: break; } @@ -340,7 +346,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was used in switch."); switch (currentItem->type()) { @@ -437,6 +443,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) case VToolFlippingByLine::Type: ChangeDataToolFlippingByLine(prop); break; + case VToolFlippingByAxis::Type: + ChangeDataToolFlippingByAxis(prop); + break; default: break; } @@ -565,6 +574,16 @@ void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString AddProperty(itemProperty, AttrHCrossPoint); } +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName) +{ + auto itemProperty = new VEnumProperty(propertyName); + itemProperty->setLiterals(QStringList()<< tr("Vertical axis") << tr("Horizontal axis")); + itemProperty->setValue(static_cast(i->GetAxisType())-1); + AddProperty(itemProperty, AttrAxisType); +} + //--------------------------------------------------------------------------------------------------------------------- template void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName, @@ -781,6 +800,20 @@ void VToolOptionsPropertyBrowser::SetHCrossCurvesPoint(const QVariant &value) } } +//--------------------------------------------------------------------------------------------------------------------- +template +void VToolOptionsPropertyBrowser::SetAxisType(const QVariant &value) +{ + if (auto i = qgraphicsitem_cast(currentItem)) + { + i->SetAxisType(GetCrossPoint(value)); + } + else + { + qWarning()<<"Can't cast item"; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::AddProperty(VProperty *property, const QString &id) { @@ -1631,6 +1664,33 @@ void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByLine(VProperty *proper } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VProperty *property) +{ + SCASSERT(property != nullptr) + + QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); + const QString id = propertyToId[property]; + + VToolFlippingByAxis *i = qgraphicsitem_cast(currentItem); + SCASSERT(i != nullptr); + switch (PropertiesList().indexOf(id)) + { + case 39: // AttrAxisType + { + const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); + SetAxisType(value); + break; + } + case 38: // AttrSuffix + SetOperationSuffix(value.toString()); + break; + default: + qWarning()<<"Unknown property type. id = "<(item); + i->ShowVisualization(true); + formView->setTitle(tr("Tool flipping by axis")); + + AddPropertyAxisType(i, tr("Axis type")); + AddPropertyOperationSuffix(i, tr("Suffix")); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint() { @@ -2498,6 +2569,14 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolFlippingByLine() idToProperty[AttrSuffix]->setValue(i->Suffix()); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolOptionsPropertyBrowser::UpdateOptionsToolFlippingByAxis() +{ + VToolFlippingByAxis *i = qgraphicsitem_cast(currentItem); + idToProperty[AttrAxisType]->setValue(static_cast(i->GetAxisType())-1); + idToProperty[AttrSuffix]->setValue(i->Suffix()); +} + //--------------------------------------------------------------------------------------------------------------------- QStringList VToolOptionsPropertyBrowser::PropertiesList() const { @@ -2539,6 +2618,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const << AttrHCrossPoint /* 35 */ << AttrLength1 /* 36 */ << AttrLength2 /* 37 */ - << AttrSuffix; /* 38 */ + << AttrSuffix /* 38 */ + << AttrAxisType; /* 39 */ return attr; } diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.h b/src/app/valentina/core/vtooloptionspropertybrowser.h index 5c521ab47..f23185bd2 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.h +++ b/src/app/valentina/core/vtooloptionspropertybrowser.h @@ -90,6 +90,9 @@ private: template void SetHCrossCurvesPoint(const QVariant &value); + template + void SetAxisType(const QVariant &value); + template void AddPropertyObjectName(Tool *i, const QString &propertyName, bool readOnly = false); @@ -111,6 +114,9 @@ private: template void AddPropertyHCrossPoint(Tool *i, const QString &propertyName); + template + void AddPropertyAxisType(Tool *i, const QString &propertyName); + template void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap &styles); @@ -153,6 +159,7 @@ private: void ChangeDataToolCurveIntersectAxis(VPE::VProperty *property); void ChangeDataToolRotation(VPE::VProperty *property); void ChangeDataToolFlippingByLine(VPE::VProperty *property); + void ChangeDataToolFlippingByAxis(VPE::VProperty *property); void ShowOptionsToolSinglePoint(QGraphicsItem *item); void ShowOptionsToolEndLine(QGraphicsItem *item); @@ -185,6 +192,7 @@ private: void ShowOptionsToolCurveIntersectAxis(QGraphicsItem *item); void ShowOptionsToolRotation(QGraphicsItem *item); void ShowOptionsToolFlippingByLine(QGraphicsItem *item); + void ShowOptionsToolFlippingByAxis(QGraphicsItem *item); void UpdateOptionsToolSinglePoint(); void UpdateOptionsToolEndLine(); @@ -217,6 +225,7 @@ private: void UpdateOptionsToolCurveIntersectAxis(); void UpdateOptionsToolRotation(); void UpdateOptionsToolFlippingByLine(); + void UpdateOptionsToolFlippingByAxis(); }; #endif // VTOOLOPTIONSPROPERTYBROWSER_H diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 2d5ac5ab9..c73d7fb19 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -207,7 +207,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -388,6 +388,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::Group: case Tool::Rotation: case Tool::FlippingByLine: + case Tool::FlippingByAxis: return QString(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 1618916c8..3f0b08067 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1044,6 +1044,17 @@ void MainWindow::ToolFlippingByLine(bool checked) &MainWindow::ApplyDialog); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolFlippingByAxis(bool checked) +{ + ToolSelectOperationObjects(); + SetToolButtonWithApply(checked, Tool::FlippingByAxis, + ":/cursor/flipping_axis_cursor.png", + tr("Select one or more objects, Enter - confirm selection"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ClosedDialogGroup(int result) { @@ -1714,6 +1725,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonGroup, &QToolButton::clicked, this, &MainWindow::ToolGroup); connect(ui->toolButtonRotation, &QToolButton::clicked, this, &MainWindow::ToolRotation); connect(ui->toolButtonFlippingByLine, &QToolButton::clicked, this, &MainWindow::ToolFlippingByLine); + connect(ui->toolButtonFlippingByAxis, &QToolButton::clicked, this, &MainWindow::ToolFlippingByAxis); connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint); connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs); } @@ -1743,7 +1755,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1886,6 +1898,9 @@ void MainWindow::CancelTool() case Tool::FlippingByLine: ui->toolButtonFlippingByLine->setChecked(false); break; + case Tool::FlippingByAxis: + ui->toolButtonFlippingByAxis->setChecked(false); + break; } // Crash: using CRTL+Z while using line tool. @@ -2934,6 +2949,9 @@ void MainWindow::SetEnableTool(bool enable) break; } + // This check helps to find missed tools + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools were handled."); + //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); ui->toolButtonLine->setEnabled(drawTools); @@ -2968,6 +2986,7 @@ void MainWindow::SetEnableTool(bool enable) ui->toolButtonGroup->setEnabled(drawTools); ui->toolButtonRotation->setEnabled(drawTools); ui->toolButtonFlippingByLine->setEnabled(drawTools); + ui->toolButtonFlippingByAxis->setEnabled(drawTools); ui->toolButtonMidpoint->setEnabled(drawTools); ui->actionLast_tool->setEnabled(drawTools); @@ -3250,7 +3269,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was handled."); if (currentTool == lastUsedTool) { @@ -3420,6 +3439,10 @@ void MainWindow::LastUsedTool() ui->toolButtonFlippingByLine->setChecked(true); ToolFlippingByLine(true); break; + case Tool::FlippingByAxis: + ui->toolButtonFlippingByAxis->setChecked(true); + ToolFlippingByAxis(true); + break; } } diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 1bb634d1e..3361c8ecd 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -140,6 +140,7 @@ private slots: void ToolGroup(bool checked); void ToolRotation(bool checked); void ToolFlippingByLine(bool checked); + void ToolFlippingByAxis(bool checked); void ToolCutArc(bool checked); void ToolLineIntersectAxis(bool checked); void ToolCurveIntersectAxis(bool checked); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 295cb3186..aa0b01eed 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -14,7 +14,7 @@ Valentina - + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png @@ -69,7 +69,7 @@ Tools for creating points. - + :/icon/16x16/toolsectionpoint.png:/icon/16x16/toolsectionpoint.png @@ -94,7 +94,7 @@ ... - + :/toolicon/32x32/along_line.png:/toolicon/32x32/along_line.png @@ -120,7 +120,7 @@ ... - + :/toolicon/32x32/normal.png:/toolicon/32x32/normal.png @@ -146,7 +146,7 @@ ... - + :/toolicon/32x32/bisector.png:/toolicon/32x32/bisector.png @@ -172,7 +172,7 @@ ... - + :/toolicon/32x32/shoulder.png:/toolicon/32x32/shoulder.png @@ -198,7 +198,7 @@ ... - + :/toolicon/32x32/point_of_contact.png:/toolicon/32x32/point_of_contact.png @@ -224,7 +224,7 @@ ... - + :/toolicon/32x32/triangle.png:/toolicon/32x32/triangle.png @@ -250,7 +250,7 @@ ... - + :/toolicon/32x32/point_of_intersection.png:/toolicon/32x32/point_of_intersection.png @@ -276,7 +276,7 @@ ... - + :/toolicon/32x32/height.png:/toolicon/32x32/height.png @@ -302,7 +302,7 @@ ... - + :/toolicon/32x32/line_intersect_axis.png:/toolicon/32x32/line_intersect_axis.png @@ -328,7 +328,7 @@ ... - + :/toolicon/32x32/true_darts.png:/toolicon/32x32/true_darts.png @@ -354,7 +354,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -380,7 +380,7 @@ ... - + :/toolicon/32x32/midpoint.png:/toolicon/32x32/midpoint.png @@ -406,7 +406,7 @@ ... - + :/toolicon/32x32/segment.png:/toolicon/32x32/segment.png @@ -441,7 +441,7 @@ Tools for creating lines. - + :/icon/16x16/toolsectionline.png:/icon/16x16/toolsectionline.png @@ -463,7 +463,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -489,7 +489,7 @@ ... - + :/toolicon/32x32/line.png:/toolicon/32x32/line.png @@ -515,7 +515,7 @@ ... - + :/toolicon/32x32/intersect.png:/toolicon/32x32/intersect.png @@ -550,7 +550,7 @@ Tools for creating curves. - + :/icon/16x16/toolsectioncurve.png:/icon/16x16/toolsectioncurve.png @@ -572,7 +572,7 @@ ... - + :/toolicon/32x32/spline_cut_point.png:/toolicon/32x32/spline_cut_point.png @@ -598,7 +598,7 @@ ... - + :/toolicon/32x32/cubic_bezier.png:/toolicon/32x32/cubic_bezier.png @@ -624,7 +624,7 @@ ... - + :/toolicon/32x32/splinePath.png:/toolicon/32x32/splinePath.png @@ -650,7 +650,7 @@ ... - + :/toolicon/32x32/splinePath_cut_point.png:/toolicon/32x32/splinePath_cut_point.png @@ -673,7 +673,7 @@ ... - + :/toolicon/32x32/cubic_bezier_path.png:/toolicon/32x32/cubic_bezier_path.png @@ -699,7 +699,7 @@ ... - + :/toolicon/32x32/intersection_curves.png:/toolicon/32x32/intersection_curves.png @@ -725,7 +725,7 @@ ... - + :/toolicon/32x32/curve_intersect_axis.png:/toolicon/32x32/curve_intersect_axis.png @@ -751,7 +751,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -777,7 +777,7 @@ ... - + :/toolicon/32x32/spline.png:/toolicon/32x32/spline.png @@ -812,7 +812,7 @@ Tools for creating arcs. - + :/icon/16x16/toolsectionarc.png:/icon/16x16/toolsectionarc.png @@ -834,7 +834,7 @@ ... - + :/toolicon/32x32/arc.png:/toolicon/32x32/arc.png @@ -860,7 +860,7 @@ ... - + :/toolicon/32x32/arc_cut.png:/toolicon/32x32/arc_cut.png @@ -886,7 +886,7 @@ ... - + :/toolicon/32x32/arc_intersect_axis.png:/toolicon/32x32/arc_intersect_axis.png @@ -912,7 +912,7 @@ ... - + :/toolicon/32x32/point_of_intersection_arcs.png:/toolicon/32x32/point_of_intersection_arcs.png @@ -938,7 +938,7 @@ ... - + :/toolicon/32x32/point_of_intersection_circles.png:/toolicon/32x32/point_of_intersection_circles.png @@ -964,7 +964,7 @@ ... - + :/toolicon/32x32/point_from_circle_and_tangent.png:/toolicon/32x32/point_from_circle_and_tangent.png @@ -990,7 +990,7 @@ ... - + :/toolicon/32x32/point_from_arc_and_tangent.png:/toolicon/32x32/point_from_arc_and_tangent.png @@ -1016,7 +1016,7 @@ ... - + :/toolicon/32x32/arc_with_length.png:/toolicon/32x32/arc_with_length.png @@ -1042,7 +1042,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -1068,7 +1068,7 @@ - + :/icon/16x16/operations.png:/icon/16x16/operations.png @@ -1090,7 +1090,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -1116,7 +1116,7 @@ ... - + :/toolicon/32x32/group_plus.png:/toolicon/32x32/group_plus.png @@ -1142,7 +1142,7 @@ ... - + :/toolicon/32x32/rotation.png:/toolicon/32x32/rotation.png @@ -1165,10 +1165,10 @@ Flipping objects by line - ... + ... - + :/toolicon/32x32/flipping_line.png:/toolicon/32x32/flipping_line.png @@ -1182,6 +1182,32 @@ + + + + false + + + Flipping objects by axis + + + ... + + + + :/toolicon/32x32/flipping_axis.png:/toolicon/32x32/flipping_axis.png + + + + 32 + 32 + + + + true + + + @@ -1203,7 +1229,7 @@ Tools for creating details. - + :/icon/16x16/toolsectiondetail.png:/icon/16x16/toolsectiondetail.png @@ -1225,7 +1251,7 @@ ... - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -1251,7 +1277,7 @@ ... - + :/toolicon/32x32/new_detail.png:/toolicon/32x32/new_detail.png @@ -1277,7 +1303,7 @@ ... - + :/toolicon/32x32/union.png:/toolicon/32x32/union.png @@ -1303,7 +1329,7 @@ - + :/icon/16x16/toolsectionlayout.png:/icon/16x16/toolsectionlayout.png @@ -1354,7 +1380,7 @@ ... - + :/icon/32x32/export_to_picture_document.png:/icon/32x32/export_to_picture_document.png @@ -1800,7 +1826,7 @@ false - + :/icon/32x32/draw.png:/icon/32x32/draw.png @@ -1824,7 +1850,7 @@ false - + :/icon/32x32/kontur.png:/icon/32x32/kontur.png @@ -1848,7 +1874,7 @@ true - + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png @@ -1866,7 +1892,7 @@ false - + :/icon/32x32/new_draw.png:/icon/32x32/new_draw.png @@ -1887,7 +1913,7 @@ false - + :/icon/32x32/option_draw.png:/icon/32x32/option_draw.png @@ -1911,7 +1937,7 @@ false - + :/icon/32x32/table.png:/icon/32x32/table.png @@ -1935,7 +1961,7 @@ false - + :/icon/32x32/history.png:/icon/32x32/history.png @@ -1956,7 +1982,7 @@ false - + :/icon/32x32/layout.png:/icon/32x32/layout.png @@ -2221,7 +2247,7 @@ false - + :/icon/32x32/pdf.png:/icon/32x32/pdf.png @@ -2311,7 +2337,7 @@ false - + :/icon/32x32/export_to_picture_document.png:/icon/32x32/export_to_picture_document.png @@ -2388,7 +2414,7 @@ false - + :/icon/32x32/syncM.png:/icon/32x32/syncM.png @@ -2427,9 +2453,6 @@
vmaingraphicsview.h
- - - - + diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index cb10b4aef..0e75306b5 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -72,5 +72,7 @@ cursor/midpoint_cursor@2x.png cursor/flipping_line_cursor@2x.png cursor/flipping_line_cursor.png + cursor/flipping_axis_cursor.png + cursor/flipping_axis_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/flipping_axis_cursor.png b/src/app/valentina/share/resources/cursor/flipping_axis_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..fb31228bff515a7575181182e564929527470163 GIT binary patch literal 700 zcmV;t0z>_YP)B-EU?=NClA)xMg@HjqM5K!})6(y>INzWQ+RWIDv+0F_?*iw2 z&hMNvGyJdV`h?C}0s=;BiAXcV2#(YeP&33#Kur)+1%L%d%m!Fc#9V*{Lrne!upo$H zfT|-(0aO+7yF@_M5aj@>f+!bIam25A04j=@FJLZ23l^g#P#3hXt|p)mQHM9!hl@jY zv<2V12`Efcz4S;jS3tXc^66GdAFf zxE!Z&e8A81@%7?ilD8~7G#h{z`&FD1{~wfFr_m>FxE!wGdZ(t#2#h4SMXqNyzz1Bw zCG$Iy4d}+5>^{LqY`miN{q&g44@q|goy!XWTX1t8jq}wmPGTUt&xxm?x6z_BJ{nIF zkH$$JGtpHD_}A*e?W`#=fq;%|BLyas%yye_rjmdqIEelk&+-X;Ymy7`6trc4H7~I$ z*uSz;fZcd1ZsPoy`2@bFeq`%Ek_!&k^R5nkq{r$j1XwF3@HzwJumV4^?u%cOt(vC@ iuNa+TX-cRk-1`H9j;H(?UT(ZA@r`Qg5vlYtZ6_ zOCuLeYA_*E`{aWrCdLO}d@-WNTTIl%Cv2h*YHEcV4KV_Of{0BC!DtgxluD#npxE1V zE@%1hUwh8(>6y;;%Q<*7~mh|G)lg?R_|}^E$8dI#Z9}&$w)%E3!~Z zd3)Ltg^()S0laQut26&XX6@-}rSTqn$nmK?)0pWz%0qA)Ma{-{I zAsjb10D2a}F>?o?Cn3x=fS!Z!KXVVDry#tlI{E0PU^$;Nw< zjW;HWUIj22gl~%nxI6OxAMqdtlXqT|Y&w~2dNA2AIF-gWIvh(=xvz5^K1ly{lij=*0E~*2>g(}F zJTK~4y1--j6GpNHBpk*mnztrf`_8^)OLOT0zruxD0cx(cei8USC1C8%<&_oYzw)uNo?pe+1$@~GhHyXWa?&|-g4qIS z;&b?nc(tY*Dn##JfS-uR_hs4eW&x-#8lUpBy+MCWen{kTdr{u!-0H$`If zGwi{dd_0i~E^d-`VE{WPa)X%w_&ct{6VqwM47Cim3ZK4D1i`Y-7vL-Sp2!3C{J@bb zwDJIWh~nSa%;r^{3Ye}7Jd7=PcAD4CRO@jY{(|4-V`ZJM7HM$5NRHO;cJwA;0S$%< z_C1TAVhv*-=v2UTEa1nuNi3Pomu|!rxL-W8q}978^H!?4LXn?oG>Uv;le9OkZQPM; zUC~~^Q~`WbOgo1={MIck6TRQW1C@F;^7n)Ip$Nvq*tgy4hbfv715Rg9qkknmN!rS> zwe5vW<^scF2>OE7urps;i+2h0KTtVd*7+p9gb(8u+_1x?M@T8oxhh-1Q%7msD=g^~ z?S-7n0*>RO_|a@zGDB?@f$rBL_?4;-gH3!MU&P9s2_}lRh(G!$j#F%FPmMbP_`Qhq z*XP0)LaW8h?~n*$RaK|G#87w%3QlJzsnK!)*nddO8Q#W;YdhVns=LL!`>9zqVRm{e z-XT_co@@K9ng_rO_)lv;<=NrzIDi}s@5`6noGR_E<9fh=h&uzg*V%!$-2!%q$lh}@bfW|%k)v~Oy0Aydb7Hy58Fi2vv-1X+FfAO z_)N6w0%INA;FZ6T{)vr@Y^dI>F1ivM#3=Om1m_f5%jd*e#MiV|g>x!=Ne2M`7{+hK zLh3f^1)#vkg%#`)?=z9i5I~ma z{l5I$%OU|HCQ7StisdOLKgH{DIYuc)DaJ5D%AcN#@5KxM2Yt=3Lg+^MV*mgE07*qo IM6N<$f`>}@Z~y=R literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/toolicon.qrc b/src/app/valentina/share/resources/toolicon.qrc index 6cc54ff41..a81206cb6 100644 --- a/src/app/valentina/share/resources/toolicon.qrc +++ b/src/app/valentina/share/resources/toolicon.qrc @@ -70,5 +70,7 @@ toolicon/32x32/midpoint@2x.png toolicon/32x32/flipping_line@2x.png toolicon/32x32/flipping_line.png + toolicon/32x32/flipping_axis.png + toolicon/32x32/flipping_axis@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/flipping_axis.png b/src/app/valentina/share/resources/toolicon/32x32/flipping_axis.png new file mode 100644 index 0000000000000000000000000000000000000000..e712f780eec0c6cdb7593bf2521fb10b0cd82871 GIT binary patch literal 1050 zcmV+#1m*jQP)L(6uJQ{689fo&un`DxX_?6p7c)zcMV<*z((AJukdX)QMu1e zY{hO2%+_6B6pnw7g@Pt_ZKg5|dmT$pG%`+oyfF+Iiz|p_N`f&}# z)_wr0;m>Vn#6mNb0bLT0<&*={d1976YD;q+z&%(kzT@w8062jScnkZn4&S&Efyct)O*pF97AM_qKNZuL8gqVtDt7Nto#dulOxYOcC~{Ug^6dKm*%Tdrw7IeGTCi zypZ*iZmQz97*Fc$!IptsQw3Nn*7xsltOINhg=q1tJ7M9(Nqmi4`DsHpfHG04tM3GG z3ct+-s73&a+5;*#9L5$*_W`g*tcFQK7l6iIOi?@CN8mZ_w z!0C8W5~&^5=DJ^Wh<;1__@;fMQ#L-*Izi;<-yedC~kqJhUE+ z6SgMBt9q|;rYRmKo3g<{@peK`al zT1xM|J3h?r-I=qqyR-Y--#6LhH*@BkIeYfZ%$Yg!gTdiy;4i=d;Nu?pUBFk9=L3?c z>8;fC4rzKXYPu^1sOLa11RMf%@*MQEdC8)GK@v5+!o`agzLxWH>8iY{bTHsu( ze6FXBwtg!Q{VePELU`etHWZT>lmYG(<+y z`TZ!c*CuLu6F|qRIti0!DfYhBrm~&tCbe-J?#qMg?kRp)AxHAegyGe|kD4mx!ytyh zI!|2-LjXYgWcP)(hrmU^bDsJWz#LI`6`7~}6|*W#L(@9}%o02r^diNc=UdPfXx{@q zQ&8{ofct_g&MTn#zGhV%P&99x z2TPXKQLGGY8lcQI+cW@ePKIq6U^Z}T3Ek(;6$Vgc!{$~^cXp6w6==%w)W%=a(M342AC%^j1RSHsXMHVs?9}F*R^0 z@T}G52=3;l5}Mu-;LNNhdJn|=F*{9w7}WWSUH@pLbt<(V<^rKGk2jF(pbZ1awSR+0u5So@p6ozmiH9zDPK!Wq5N-Ni4f-`e7r59ep8y{6$n_cE zZs6O=<6GAS&s!0kdKfsC)v1d$OM5kScF?Z@`INnd6`~yY+EV z^cjSH3^0Nj|29$=4e@{~2%f3LNK*J@A)?;}fSXy7f}$q-b^`94_GV8zXe{YkehzZ8-b0$86LT3 zCbXr3CoMYjgyPwwz$0!O_1Pk&i%{19LsYxJPj31$->B$wIB8?^q$CetEJ9<! zNZt7!;EfW#SAeezo&-f60HCEV!NVZb0Pn)w_((BD{@kxjZu&L%0V^<(qr_9d$H-2T zN|!+wo%?}Ft75rk$pt0)6)IYUaon%^IPlLJa_yJdfm!RX!lcN*2wV;<$8}|CfI?jr zJO2gz-l>A1m>?uQuJ9jwm7yvWj)CpTQv|^?RPnLYy`XQ*%6grKZ>oy($Pf>>99U$P zj{%zt+D>aD%04AF1J5VVmp$~#WzfZ(Er5M_;zHA`&%)o43Y*e|wPj1zLhz~V~0FYam)Edo)+~$jRWBQIAW~@n#qRC67c@p;vNVNOB~-f519`=Q zwJfsgrNCuY`AzcM&N2)jF%s3-x14wgchB*DP46;a%Oauj>pz0oqK2Xc1IPmr9c%!_ zzBfQ`5!K!el22%dd>mcJ{f!PTd_!Ox*@5V{JR)i@gMwe46O3!R!?Kl6=yf<36F7po z%UcJ7SOscc=Ggs5z`8u4-wx6BvX##O(p5I%ZZ$*DLTaq}5J&{Zpf(B_xnUrMjsc$% zbw91sae>?h257bnx|ot-`%2AHCx;=0uExFTy%+Phm%6B%8}vcY>ka`>JbeHYZ=@K3 zsoU%}(g6Le{bh0+%mMuk0Sj`2R%FMkn(l8vecGyB3w#Z-FXcP- zYU=*B+!QSYLVew76z`(frzx~l(PhB-Rtrz!u@*uMun2R@tc$s9DIkYHGY?4cYv4bY z>~rA7t07a=m-0H_yMpxdA^b-w>1ZVV$TG*y^M(oBFs(i)qx*Qz^477b2e@^>lTB=0Q)2!vFmLBZm&tZrl` zME05AC`={kan*syx^)uI!JHbW{Bz*c%^mWS-+aQ({fh7!#(*|jxFn@FL2pxKGspIo zvDUf{CL_}(#yoWm_X30XU#EjBB8oG-ZQ`(}u4)MQ{&3wkwkyn?zc1k~MPrsy^T_;a zE?Mw&8kwul#^eyd{MRqtPsG3znAG~Kbu`l~o)0sA0xSn*8Au + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 46c7c42fc..c779f1896 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -2574,6 +2574,36 @@ void VPattern::ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &d } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) +{ + SCASSERT(scene != nullptr); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + + try + { + quint32 id = NULL_ID; + + ToolsCommonAttributes(domElement, id); + const quint32 origin = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); + const auto axisType = static_cast(GetParametrUInt(domElement, AttrAxisType, "1")); + const QString suffix = GetParametrString(domElement, AttrSuffix, ""); + + QVector source; + QVector destination; + VAbstractOperation::ExtractData(this, domElement, source, destination); + + VToolFlippingByAxis::Create(id, origin, axisType, suffix, source, destination, scene, this, data, parse, + Source::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating operation of flipping by axis"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + //--------------------------------------------------------------------------------------------------------------------- qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok) const { @@ -2825,7 +2855,8 @@ void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &dom Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of operation is empty"); const QStringList opers = QStringList() << VToolRotation::ToolType /*0*/ - << VToolFlippingByLine::ToolType; /*1*/ + << VToolFlippingByLine::ToolType /*1*/ + << VToolFlippingByAxis::ToolType; /*2*/ switch (opers.indexOf(type)) { @@ -2835,6 +2866,9 @@ void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &dom case 1: //VToolFlippingByLine::ToolType ParseToolFlippingByLine(scene, domElement, parse); break; + case 2: //VToolFlippingByAxis::ToolType + ParseToolFlippingByAxis(scene, domElement, parse); + break; default: VException e(tr("Unknown operation type '%1'.").arg(type)); throw e; @@ -3340,7 +3374,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QRectF VPattern::ActiveDrawBoundingRect() const { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46, "Not all tools was used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47, "Not all tools was used."); QRectF rec; @@ -3455,6 +3489,9 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::FlippingByLine: rec = ToolBoundingRect(rec, tool.getId()); break; + case Tool::FlippingByAxis: + rec = ToolBoundingRect(rec, tool.getId()); + break; //These tools are not accesseble in Draw mode, but still 'history' contains them. case Tool::Detail: case Tool::UnionDetails: diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 5ab917405..a67d9c76e 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -195,6 +195,7 @@ private: void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); + void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const; diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 59ef40b5d..5a47465c1 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -124,6 +124,7 @@ const QString AttrSecondArc = QStringLiteral("secondArc"); const QString AttrCrossPoint = QStringLiteral("crossPoint"); const QString AttrVCrossPoint = QStringLiteral("vCrossPoint"); const QString AttrHCrossPoint = QStringLiteral("hCrossPoint"); +const QString AttrAxisType = QStringLiteral("axisType"); const QString AttrC1Center = QStringLiteral("c1Center"); const QString AttrC2Center = QStringLiteral("c2Center"); const QString AttrC1Radius = QStringLiteral("c1Radius"); diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 750372b2e..900c31aa6 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -125,6 +125,7 @@ extern const QString AttrSecondArc; extern const QString AttrCrossPoint; extern const QString AttrVCrossPoint; extern const QString AttrHCrossPoint; +extern const QString AttrAxisType; extern const QString AttrC1Center; extern const QString AttrC2Center; extern const QString AttrC1Radius; diff --git a/src/libs/ifc/schema/pattern/v0.3.5.xsd b/src/libs/ifc/schema/pattern/v0.3.5.xsd index b54271a63..8499e9604 100644 --- a/src/libs/ifc/schema/pattern/v0.3.5.xsd +++ b/src/libs/ifc/schema/pattern/v0.3.5.xsd @@ -211,6 +211,7 @@ + @@ -364,7 +365,7 @@ - + @@ -556,6 +557,12 @@ + + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 4c0c34ed5..83b85ff4a 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1372,7 +1372,7 @@ QStringList VAbstractPattern::ListPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1443,7 +1443,7 @@ QStringList VAbstractPattern::ListArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1504,7 +1504,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1570,7 +1570,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 46); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 47); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 467eb6da5..d13d8f718 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -53,6 +53,7 @@ enum class LabelType : char {NewPatternPiece, NewLabel}; enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2}; enum class VCrossCurvesPoint : char {HighestPoint = 1, LowestPoint = 2}; enum class HCrossCurvesPoint : char {LeftmostPoint = 1, RightmostPoint = 2}; +enum class AxisType : char {VerticalAxis = 1, HorizontalAxis = 2}; class VContainer; class VDataTool; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 0a51f4199..31b04099f 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -110,6 +110,7 @@ enum class Tool : ToolVisHolderType Group, Rotation, FlippingByLine, + FlippingByAxis, Midpoint, LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used }; @@ -152,7 +153,8 @@ enum class Vis : ToolVisHolderType ToolCurveIntersectAxis, ToolTrueDarts, ToolRotation, - ToolFlippingByLine + ToolFlippingByLine, + ToolFlippingByAxis }; enum class VarType : char { Measurement, Increment, LineLength, CurveLength, LineAngle, CurveAngle, ArcRadius, diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 8b51c331b..167b8580d 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -39,7 +39,8 @@ HEADERS += \ $$PWD/tools/dialogcubicbezierpath.h \ $$PWD/tools/dialoggroup.h \ $$PWD/tools/dialogrotation.h \ - $$PWD/tools/dialogflippingbyline.h + $$PWD/tools/dialogflippingbyline.h \ + $$PWD/tools/dialogflippingbyaxis.h SOURCES += \ @@ -79,7 +80,8 @@ SOURCES += \ $$PWD/tools/dialogcubicbezierpath.cpp \ $$PWD/tools/dialoggroup.cpp \ $$PWD/tools/dialogrotation.cpp \ - $$PWD/tools/dialogflippingbyline.cpp + $$PWD/tools/dialogflippingbyline.cpp \ + $$PWD/tools/dialogflippingbyaxis.cpp FORMS += \ $$PWD/tools/dialogalongline.ui \ @@ -117,4 +119,5 @@ FORMS += \ $$PWD/tools/dialogcubicbezierpath.ui \ $$PWD/tools/dialoggroup.ui \ $$PWD/tools/dialogrotation.ui \ - $$PWD/tools/dialogflippingbyline.ui + $$PWD/tools/dialogflippingbyline.ui \ + $$PWD/tools/dialogflippingbyaxis.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index 9a2e0d09d..7a884ce90 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -63,6 +63,7 @@ #include "tools/dialoggroup.h" #include "tools/dialogrotation.h" #include "tools/dialogflippingbyline.h" +#include "tools/dialogflippingbyaxis.h" #include "support/dialogeditwrongformula.h" #include "support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp new file mode 100644 index 000000000..a49fd2e82 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp @@ -0,0 +1,325 @@ +/************************************************************************ + ** + ** @file dialogflippingbyaxis.cpp + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "dialogflippingbyaxis.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../visualization/visualization.h" +#include "../../visualization/line/operation/vistoolflippingbyaxis.h" +#include "../ifc/xml/vabstractpattern.h" +#include "../ifc/xml/vdomdocument.h" +#include "../qmuparser/qmudef.h" +#include "../vgeometry/vpointf.h" +#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vcommonsettings.h" +#include "../vpatterndb/vcontainer.h" +#include "../vwidgets/vabstractmainwindow.h" +#include "../vwidgets/vmaingraphicsscene.h" +#include "ui_dialogflippingbyaxis.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, const quint32 &toolId, QWidget *parent) + : DialogTool(data, toolId, parent), + ui(new Ui::DialogFlippingByAxis), + objects(), + stage1(true), + m_suffix() +{ + ui->setupUi(this); + + ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix()); + + InitOkCancelApply(ui); + + FillComboBoxPoints(ui->comboBoxOriginPoint); + FillComboBoxAxisType(ui->comboBoxAxisType); + + flagName = true; + CheckState(); + + connect(ui->lineEditSuffix, &QLineEdit::textChanged, this, &DialogFlippingByAxis::SuffixChanged); + connect(ui->comboBoxOriginPoint, static_cast(&QComboBox::currentIndexChanged), + this, &DialogFlippingByAxis::PointChanged); + + vis = new VisToolFlippingByAxis(data); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogFlippingByAxis::~DialogFlippingByAxis() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogFlippingByAxis::GetOriginPointId() const +{ + return getCurrentObjectId(ui->comboBoxOriginPoint); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SetOriginPointId(quint32 value) +{ + ChangeCurrentData(ui->comboBoxOriginPoint, value); + VisToolFlippingByAxis *operation = qobject_cast(vis); + SCASSERT(operation != nullptr); + operation->SetOriginPointId(value); +} + +//--------------------------------------------------------------------------------------------------------------------- +AxisType DialogFlippingByAxis::GetAxisType() const +{ + return getCurrentCrossPoint(ui->comboBoxAxisType); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SetAxisType(AxisType type) +{ + auto index = ui->comboBoxAxisType->findData(static_cast(type)); + if (index != -1) + { + ui->comboBoxAxisType->setCurrentIndex(index); + + auto operation = qobject_cast(vis); + SCASSERT(operation != nullptr); + operation->SetAxisType(type); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QString DialogFlippingByAxis::GetSuffix() const +{ + return m_suffix; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SetSuffix(const QString &value) +{ + m_suffix = value; + ui->lineEditSuffix->setText(value); +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector DialogFlippingByAxis::GetObjects() const +{ + return objects.toVector(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::ShowDialog(bool click) +{ + if (stage1 && not click) + { + if (objects.isEmpty()) + { + return; + } + + stage1 = false; + + VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene()); + SCASSERT(scene != nullptr); + scene->clearSelection(); + + VisToolFlippingByAxis *operation = qobject_cast(vis); + SCASSERT(operation != nullptr); + operation->SetObjects(objects.toVector()); + operation->VisualMode(); + + scene->ToggleArcSelection(false); + scene->ToggleSplineSelection(false); + scene->ToggleSplinePathSelection(false); + + scene->ToggleArcHover(false); + scene->ToggleSplineHover(false); + scene->ToggleSplinePathHover(false); + + emit ToolTip("Select origin point"); + } + else if (not stage1 && prepare && click) + { + setModal(true); + emit ToolTip(""); + show(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::ChosenObject(quint32 id, const SceneObject &type) +{ + if (not stage1 && not prepare)// After first choose we ignore all objects + { + if (type == SceneObject::Point) + { + if (objects.contains(id)) + { + return; + } + + if (SetObject(id, ui->comboBoxOriginPoint, "")) + { + VisToolFlippingByAxis *operation = qobject_cast(vis); + SCASSERT(operation != nullptr); + operation->SetOriginPointId(id); + operation->RefreshGeometry(); + + prepare = true; + } + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SelectedObject(bool selected, quint32 object, quint32 tool) +{ + Q_UNUSED(tool) + if (stage1) + { + if (selected) + { + if (not objects.contains(object)) + { + objects.append(object); + } + } + else + { + objects.removeOne(object); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SuffixChanged() +{ + QLineEdit* edit = qobject_cast(sender()); + if (edit) + { + const QString suffix = edit->text(); + if (suffix.isEmpty()) + { + flagName = false; + ChangeColor(ui->labelSuffix, Qt::red); + CheckState(); + return; + } + else + { + if (m_suffix != suffix) + { + QRegularExpression rx(NameRegExp()); + const QStringList uniqueNames = data->AllUniqueNames(); + for (int i=0; i < uniqueNames.size(); ++i) + { + const QString name = uniqueNames.at(i) + suffix; + if (not rx.match(name).hasMatch() || not data->IsUnique(name)) + { + flagName = false; + ChangeColor(ui->labelSuffix, Qt::red); + CheckState(); + return; + } + } + } + } + + flagName = true; + ChangeColor(ui->labelSuffix, okColor); + } + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::CheckState() +{ + SCASSERT(bOk != nullptr); + bOk->setEnabled(flagError && flagName); + SCASSERT(bApply != nullptr); + bApply->setEnabled(bOk->isEnabled()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::ShowVisualization() +{ + AddVisualization(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::SaveData() +{ + m_suffix = ui->lineEditSuffix->text(); + + VisToolFlippingByAxis *operation = qobject_cast(vis); + SCASSERT(operation != nullptr); + + operation->SetObjects(objects.toVector()); + operation->SetOriginPointId(GetOriginPointId()); + operation->SetAxisType(GetAxisType()); + operation->RefreshGeometry(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::PointChanged() +{ + QColor color = okColor; + if (objects.contains(getCurrentObjectId(ui->comboBoxOriginPoint))) + { + flagError = false; + color = errorColor; + } + else + { + flagError = true; + color = okColor; + } + ChangeColor(ui->labelOriginPoint, color); + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogFlippingByAxis::FillComboBoxAxisType(QComboBox *box) +{ + SCASSERT(box != nullptr); + + box->addItem(tr("Vertical axis"), QVariant(static_cast(AxisType::VerticalAxis))); + box->addItem(tr("Horizontal axis"), QVariant(static_cast(AxisType::HorizontalAxis))); +} diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.h b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.h new file mode 100644 index 000000000..ac456dcc9 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.h @@ -0,0 +1,104 @@ +/************************************************************************ + ** + ** @file dialogflippingbyaxis.h + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef DIALOGFLIPPINGBYAXIS_H +#define DIALOGFLIPPINGBYAXIS_H + +#include "dialogtool.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "../vmisc/def.h" + +class QWidget; +class VContainer; + +namespace Ui +{ + class DialogFlippingByAxis; +} + +class DialogFlippingByAxis : public DialogTool +{ + Q_OBJECT + +public: + explicit DialogFlippingByAxis(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); + virtual ~DialogFlippingByAxis(); + + quint32 GetOriginPointId() const; + void SetOriginPointId(quint32 value); + + AxisType GetAxisType() const; + void SetAxisType(AxisType type); + + QString GetSuffix() const; + void SetSuffix(const QString &value); + + QVector GetObjects() const; + + virtual void ShowDialog(bool click) Q_DECL_OVERRIDE; + +public slots: + virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; + virtual void SelectedObject(bool selected, quint32 object, quint32 tool) Q_DECL_OVERRIDE; + +private slots: + void SuffixChanged(); + +protected: + virtual void CheckState() Q_DECL_OVERRIDE; + virtual void ShowVisualization() Q_DECL_OVERRIDE; + + /** @brief SaveData Put dialog data in local variables */ + virtual void SaveData() Q_DECL_OVERRIDE; + +private slots: + void PointChanged(); + +private: + Q_DISABLE_COPY(DialogFlippingByAxis) + + Ui::DialogFlippingByAxis *ui; + + QList objects; + + bool stage1; + + QString m_suffix; + + static void FillComboBoxAxisType(QComboBox *box); +}; + +#endif // DIALOGFLIPPINGBYAXIS_H diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.ui b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.ui new file mode 100644 index 000000000..d80fc67e4 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.ui @@ -0,0 +1,98 @@ + + + DialogFlippingByAxis + + + + 0 + 0 + 285 + 146 + + + + Dialog + + + + + + + + Origin point: + + + + + + + + + + Suffix: + + + + + + + + + + Axis type: + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogFlippingByAxis + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogFlippingByAxis + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp index 39d92d6d6..78ca2ae88 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp @@ -81,6 +81,9 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, const quint32 connect(ui->comboBoxFirstLinePoint, static_cast(&QComboBox::currentIndexChanged), this, &DialogFlippingByLine::PointChanged); + connect(ui->comboBoxSecondLinePoint, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogFlippingByLine::PointChanged); vis = new VisToolFlippingByLine(data); } diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.ui b/src/libs/vtools/dialogs/tools/dialogflippingbyline.ui index cee345f19..81d43f46f 100644 --- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.ui +++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.ui @@ -13,6 +13,10 @@ Dialog + + + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png + @@ -60,7 +64,9 @@
- + + + buttonBox diff --git a/src/libs/vtools/tools/drawTools/drawtools.h b/src/libs/vtools/tools/drawTools/drawtools.h index 93142cf64..6adaecdd3 100644 --- a/src/libs/vtools/tools/drawTools/drawtools.h +++ b/src/libs/vtools/tools/drawTools/drawtools.h @@ -60,5 +60,6 @@ #include "toolpoint/tooldoublepoint/vtooltruedarts.h" #include "operation/vtoolrotation.h" #include "operation/flipping/vtoolflippingbyline.h" +#include "operation/flipping/vtoolflippingbyaxis.h" #endif // DRAWTOOLS_H diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.cpp new file mode 100644 index 000000000..8cbd99b95 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.cpp @@ -0,0 +1,195 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vabstractflipping.h" +#include "../vgeometry/vabstractcurve.h" +#include "../vgeometry/varc.h" +#include "../vgeometry/vcubicbezier.h" +#include "../vgeometry/vcubicbezierpath.h" +#include "../vgeometry/vgobject.h" +#include "../vgeometry/vpointf.h" +#include "../vgeometry/vspline.h" +#include "../vgeometry/vsplinepath.h" + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFlipping::~VAbstractFlipping() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFlipping::VAbstractFlipping(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &suffix, + const QVector &source, const QVector &destination, + QGraphicsItem *parent) + : VAbstractOperation(doc, data, id, suffix, source, destination, parent) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractFlipping::CreateDestination(Source typeCreation, quint32 &id, QVector &dest, + const QVector &source, const QPointF &fPoint, const QPointF &sPoint, + const QString &suffix, VAbstractPattern *doc, VContainer *data, + const Document &parse) +{ + if (typeCreation == Source::FromGui) + { + dest.clear();// Try to avoid mistake, value must be empty + + id = data->getNextId();//Just reserve id for tool + + for (int i = 0; i < source.size(); ++i) + { + const quint32 idObject = source.at(i); + const QSharedPointer obj = data->GetGObject(idObject); + + // This check helps to find missed objects in the switch + Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wswitch-default") + switch(static_cast(obj->getType())) + { + case GOType::Point: + dest.append(CreatePoint(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::Arc: + dest.append(CreateArc(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::EllipticalArc: + //dest.append(CreateItem(id, idObject, fPoint, sPoint, suffix)); + break; + case GOType::Spline: + dest.append(CreateCurve(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::SplinePath: + dest.append(CreateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::CubicBezier: + dest.append(CreateCurve(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::CubicBezierPath: + dest.append(CreateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::Unknown: + break; + } +QT_WARNING_POP + } + } + else + { + for (int i = 0; i < source.size(); ++i) + { + const quint32 idObject = source.at(i); + const QSharedPointer obj = data->GetGObject(idObject); + + // This check helps to find missed objects in the switch + Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wswitch-default") + switch(static_cast(obj->getType())) + { + case GOType::Point: + UpdatePoint(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id, dest.at(i).mx, + dest.at(i).my); + break; + case GOType::Arc: + UpdateArc(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); + break; + case GOType::EllipticalArc: + //dest.append(UpdateItem(id, idObject, fPoint, sPoint, suffix, data)); + break; + case GOType::Spline: + UpdateCurve(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); + break; + case GOType::SplinePath: + UpdateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); + break; + case GOType::CubicBezier: + UpdateCurve(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); + break; + case GOType::CubicBezierPath: + UpdateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data, + dest.at(i).id); + break; + case GOType::Unknown: + break; + } +QT_WARNING_POP + } + if (parse != Document::FullParse) + { + doc->UpdateToolData(id, data); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +DestinationItem VAbstractFlipping::CreatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data) +{ + const QSharedPointer point = data->GeometricObject(idItem); + VPointF rotated = point->Flip(QLineF(firstPoint, secondPoint), suffix); + rotated.setIdObject(idTool); + + DestinationItem item; + item.mx = rotated.mx(); + item.my = rotated.my(); + item.id = data->AddGObject(new VPointF(rotated)); + return item; +} + +//--------------------------------------------------------------------------------------------------------------------- +DestinationItem VAbstractFlipping::CreateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data) +{ + const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); + data->AddArc(data->GeometricObject(item.id), item.id); + return item; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractFlipping::UpdatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id, + qreal mx, qreal my) +{ + const QSharedPointer point = data->GeometricObject(idItem); + VPointF rotated = point->Flip(QLineF(firstPoint, secondPoint), suffix); + rotated.setIdObject(idTool); + rotated.setMx(mx); + rotated.setMy(my); + data->UpdateGObject(id, new VPointF(rotated)); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractFlipping::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, + const QString &suffix, VContainer *data, quint32 id) +{ + UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); + data->AddArc(data->GeometricObject(id), id); +} diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h new file mode 100644 index 000000000..0bc98b1be --- /dev/null +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h @@ -0,0 +1,151 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VABSTRACTFLIPPING_H +#define VABSTRACTFLIPPING_H + +#include + +#include "../vabstractoperation.h" + +class VAbstractFlipping : public VAbstractOperation +{ + Q_OBJECT +public: + virtual ~VAbstractFlipping(); +protected: + VAbstractFlipping(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &suffix, + const QVector &source, const QVector &destination, + QGraphicsItem *parent = nullptr); + + static void CreateDestination(Source typeCreation, quint32 &id, QVector &dest, + const QVector &source, const QPointF &fPoint, const QPointF &sPoint, + const QString &suffix, VAbstractPattern *doc, VContainer *data, + const Document &parse); + + static DestinationItem CreatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data); + + template + static DestinationItem CreateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data); + static DestinationItem CreateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data); + template + static DestinationItem CreateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data); + template + static DestinationItem CreateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data); + + static void UpdatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, + const QString &suffix, VContainer *data, quint32 id, qreal mx, qreal my); + template + static void UpdateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, + const QString &suffix, VContainer *data, quint32 id); + static void UpdateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, + const QString &suffix, VContainer *data, quint32 id); + template + static void UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, + const QString &suffix, VContainer *data, quint32 id); + template + static void UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data, + quint32 id); +private: + Q_DISABLE_COPY(VAbstractFlipping) +}; + +//--------------------------------------------------------------------------------------------------------------------- +template +DestinationItem VAbstractFlipping::CreateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data) +{ + const QSharedPointer i = data->GeometricObject(idItem); + Item rotated = i->Flip(QLineF(firstPoint, secondPoint), suffix); + rotated.setIdObject(idTool); + + DestinationItem item; + item.mx = INT_MAX; + item.my = INT_MAX; + item.id = data->AddGObject(new Item(rotated)); + return item; +} + +//--------------------------------------------------------------------------------------------------------------------- +template +DestinationItem VAbstractFlipping::CreateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data) +{ + const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); + data->AddCurve(data->GeometricObject(item.id), item.id); + return item; +} + +//--------------------------------------------------------------------------------------------------------------------- +template +DestinationItem VAbstractFlipping::CreateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, + VContainer *data) +{ + const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); + data->AddCurveWithSegments(data->GeometricObject(item.id), item.id); + return item; +} + +//--------------------------------------------------------------------------------------------------------------------- +template +void VAbstractFlipping::UpdateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) +{ + const QSharedPointer i = data->GeometricObject(idItem); + Item rotated = i->Flip(QLineF(firstPoint, secondPoint), suffix); + rotated.setIdObject(idTool); + data->UpdateGObject(id, new Item(rotated)); +} + +//--------------------------------------------------------------------------------------------------------------------- +template +void VAbstractFlipping::UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) +{ + UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); + data->AddCurve(data->GeometricObject(id), id); +} + +//--------------------------------------------------------------------------------------------------------------------- +template +void VAbstractFlipping::UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, + const QPointF &secondPoint, const QString &suffix, VContainer *data, + quint32 id) +{ + UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); + data->AddCurveWithSegments(data->GeometricObject(id), id); +} + +#endif // VABSTRACTFLIPPING_H diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp new file mode 100644 index 000000000..42d22be86 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -0,0 +1,248 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vtoolflippingbyaxis.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../../../dialogs/tools/dialogtool.h" +#include "../../../../dialogs/tools/dialogflippingbyaxis.h" +#include "../../../../visualization/line/operation/vistoolflippingbyaxis.h" +#include "../../../../visualization/visualization.h" +#include "../vgeometry/vpointf.h" +#include "../vpatterndb/vtranslatevars.h" +#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vcommonsettings.h" +#include "../vmisc/diagnostic.h" +#include "../vmisc/logging.h" +#include "../vpatterndb/vcontainer.h" +#include "../vpatterndb/vformula.h" +#include "../ifc/ifcdef.h" +#include "../ifc/exception/vexception.h" +#include "../vwidgets/vabstractsimple.h" +#include "../vwidgets/vmaingraphicsscene.h" +#include "../../../vabstracttool.h" +#include "../../../vdatatool.h" +#include "../../vdrawtool.h" + +class QDomElement; +class QGraphicsSceneContextMenuEvent; +class QPainter; +class QStyleOptionGraphicsItem; +class QWidget; +template class QSharedPointer; + +const QString VToolFlippingByAxis::ToolType = QStringLiteral("flippingByAxis"); + +//--------------------------------------------------------------------------------------------------------------------- +VToolFlippingByAxis::~VToolFlippingByAxis() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::setDialog() +{ + SCASSERT(dialog != nullptr); + DialogFlippingByAxis *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + dialogTool->SetOriginPointId(m_originPointId); + dialogTool->SetAxisType(m_axisType); + dialogTool->SetSuffix(suffix); +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolFlippingByAxis *VToolFlippingByAxis::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data) +{ + SCASSERT(dialog != nullptr); + DialogFlippingByAxis *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + const quint32 originPointId = dialogTool->GetOriginPointId(); + const AxisType axisType = dialogTool->GetAxisType(); + const QString suffix = dialogTool->GetSuffix(); + const QVector source = dialogTool->GetObjects(); + VToolFlippingByAxis* operation = Create(0, originPointId, axisType, suffix, source, QVector(), + scene, doc, data, Document::FullParse, Source::FromGui); + if (operation != nullptr) + { + operation->dialog = dialogTool; + } + return operation; +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolFlippingByAxis *VToolFlippingByAxis::Create(const quint32 _id, quint32 originPointId, AxisType axisType, + const QString &suffix, const QVector &source, + const QVector &destination, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data, const Document &parse, + const Source &typeCreation) +{ + const auto originPoint = *data->GeometricObject(originPointId); + const QPointF fPoint = originPoint; + + QPointF sPoint; + if (axisType == AxisType::VerticalAxis) + { + sPoint = QPointF(fPoint.x(), fPoint.y() + 100); + } + else + { + sPoint = QPointF(fPoint.x() + 100, fPoint.y()); + } + + QVector dest = destination; + + quint32 id = _id; + CreateDestination(typeCreation, id, dest, source, fPoint, sPoint, suffix, doc, data, parse); + + VDrawTool::AddRecord(id, Tool::FlippingByAxis, doc); + if (parse == Document::FullParse) + { + VToolFlippingByAxis *tool = new VToolFlippingByAxis(doc, data, id, originPointId, axisType, suffix, source, + dest, typeCreation); + scene->addItem(tool); + InitOperationToolConnections(scene, tool); + doc->AddTool(id, tool); + doc->IncrementReferens(originPoint.getIdTool()); + for (int i = 0; i < source.size(); ++i) + { + doc->IncrementReferens(data->GetGObject(source.at(i))->getIdTool()); + } + return tool; + } + return nullptr; +} + +//--------------------------------------------------------------------------------------------------------------------- +AxisType VToolFlippingByAxis::GetAxisType() const +{ + return m_axisType; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::SetAxisType(AxisType value) +{ + m_axisType = value; + + QSharedPointer obj = VAbstractTool::data.GetFakeGObject(id); + SaveOption(obj); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::ShowVisualization(bool show) +{ + ShowToolVisualization(show); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::SetVisualization() +{ + if (vis != nullptr) + { + VisToolFlippingByAxis *visual = qobject_cast(vis); + SCASSERT(visual != nullptr); + + visual->SetObjects(source); + visual->SetOriginPointId(m_originPointId); + visual->SetAxisType(m_axisType); + visual->RefreshGeometry(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::SaveDialog(QDomElement &domElement) +{ + SCASSERT(dialog != nullptr); + DialogFlippingByAxis *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + + doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOriginPointId())); + doc->SetAttribute(domElement, AttrAxisType, QString().setNum(static_cast(dialogTool->GetAxisType()))); + doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::ReadToolAttributes(const QDomElement &domElement) +{ + m_originPointId = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); + m_axisType = static_cast(doc->GetParametrUInt(domElement, AttrAxisType, "1")); + suffix = doc->GetParametrString(domElement, AttrSuffix); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer &obj) +{ + VDrawTool::SaveOptions(tag, obj); + + doc->SetAttribute(tag, AttrType, ToolType); + doc->SetAttribute(tag, AttrCenter, QString().setNum(m_originPointId)); + doc->SetAttribute(tag, AttrAxisType, QString().setNum(static_cast(m_axisType))); + doc->SetAttribute(tag, AttrSuffix, suffix); + + SaveSourceDestination(tag); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolFlippingByAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + try + { + ContextMenu(this, event); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e); + return;//Leave this method immediately!!! + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolFlippingByAxis::VToolFlippingByAxis(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId, + AxisType axisType, const QString &suffix, + const QVector &source, const QVector &destination, + const Source &typeCreation, QGraphicsItem *parent) + : VAbstractFlipping(doc, data, id, suffix, source, destination, parent), + m_originPointId(originPointId), + m_axisType(axisType) +{ + InitOperatedObjects(); + ToolCreation(typeCreation); +} + diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h new file mode 100644 index 000000000..5159446e1 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h @@ -0,0 +1,77 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VTOOLFLIPPINGBYAXIS_H +#define VTOOLFLIPPINGBYAXIS_H + +#include + +#include "vabstractflipping.h" + +class VToolFlippingByAxis : public VAbstractFlipping +{ + Q_OBJECT +public: + virtual ~VToolFlippingByAxis(); + virtual void setDialog() Q_DECL_OVERRIDE; + static VToolFlippingByAxis* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data); + static VToolFlippingByAxis* Create(const quint32 _id, quint32 originPointId, AxisType axisType, + const QString &suffix, const QVector &source, + const QVector &destination, VMainGraphicsScene *scene, + VAbstractPattern *doc, VContainer *data, const Document &parse, + const Source &typeCreation); + + static const QString ToolType; + + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Tool::FlippingByAxis)}; + + AxisType GetAxisType() const; + void SetAxisType(AxisType value); + + virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; +protected: + virtual void SetVisualization() Q_DECL_OVERRIDE; + virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; + virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE; + virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; +private: + Q_DISABLE_COPY(VToolFlippingByAxis) + + quint32 m_originPointId; + AxisType m_axisType; + + VToolFlippingByAxis(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId, + AxisType axisType, const QString &suffix, const QVector &source, + const QVector &destination, const Source &typeCreation, + QGraphicsItem *parent = nullptr); +}; + +#endif // VTOOLFLIPPINGBYAXIS_H diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index 1f22e274d..3b2165e14 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -44,17 +44,9 @@ #include "../../../../dialogs/tools/dialogtool.h" #include "../../../../dialogs/tools/dialogflippingbyline.h" -#include "../../../../undocommands/label/operationmovelabel.h" #include "../../../../visualization/line/operation/vistoolflippingbyline.h" #include "../../../../visualization/visualization.h" -#include "../vgeometry/vabstractcurve.h" -#include "../vgeometry/varc.h" -#include "../vgeometry/vcubicbezier.h" -#include "../vgeometry/vcubicbezierpath.h" -#include "../vgeometry/vgobject.h" #include "../vgeometry/vpointf.h" -#include "../vgeometry/vspline.h" -#include "../vgeometry/vsplinepath.h" #include "../vpatterndb/vtranslatevars.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vcommonsettings.h" @@ -132,98 +124,7 @@ VToolFlippingByLine *VToolFlippingByLine::Create(const quint32 _id, quint32 firs QVector dest = destination; quint32 id = _id; - if (typeCreation == Source::FromGui) - { - dest.clear();// Try to avoid mistake, value must be empty - - id = data->getNextId();//Just reserve id for tool - - for (int i = 0; i < source.size(); ++i) - { - const quint32 idObject = source.at(i); - const QSharedPointer obj = data->GetGObject(idObject); - - // This check helps to find missed objects in the switch - Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); - -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wswitch-default") - switch(static_cast(obj->getType())) - { - case GOType::Point: - dest.append(CreatePoint(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::Arc: - dest.append(CreateArc(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::EllipticalArc: - //dest.append(CreateItem(id, idObject, fPoint, sPoint, suffix)); - break; - case GOType::Spline: - dest.append(CreateCurve(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::SplinePath: - dest.append(CreateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::CubicBezier: - dest.append(CreateCurve(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::CubicBezierPath: - dest.append(CreateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::Unknown: - break; - } -QT_WARNING_POP - } - } - else - { - for (int i = 0; i < source.size(); ++i) - { - const quint32 idObject = source.at(i); - const QSharedPointer obj = data->GetGObject(idObject); - - // This check helps to find missed objects in the switch - Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); - -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wswitch-default") - switch(static_cast(obj->getType())) - { - case GOType::Point: - UpdatePoint(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id, dest.at(i).mx, - dest.at(i).my); - break; - case GOType::Arc: - UpdateArc(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); - break; - case GOType::EllipticalArc: - //dest.append(UpdateItem(id, idObject, fPoint, sPoint, suffix, data)); - break; - case GOType::Spline: - UpdateCurve(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); - break; - case GOType::SplinePath: - UpdateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); - break; - case GOType::CubicBezier: - UpdateCurve(id, idObject, fPoint, sPoint, suffix, data, dest.at(i).id); - break; - case GOType::CubicBezierPath: - UpdateCurveWithSegments(id, idObject, fPoint, sPoint, suffix, data, - dest.at(i).id); - break; - case GOType::Unknown: - break; - } -QT_WARNING_POP - } - if (parse != Document::FullParse) - { - doc->UpdateToolData(id, data); - } - } + CreateDestination(typeCreation, id, dest, source, fPoint, sPoint, suffix, doc, data, parse); VDrawTool::AddRecord(id, Tool::FlippingByLine, doc); if (parse == Document::FullParse) @@ -317,122 +218,10 @@ VToolFlippingByLine::VToolFlippingByLine(VAbstractPattern *doc, VContainer *data quint32 secondLinePointId, const QString &suffix, const QVector &source, const QVector &destination, const Source &typeCreation, QGraphicsItem *parent) - : VAbstractOperation(doc, data, id, suffix, source, destination, parent), + : VAbstractFlipping(doc, data, id, suffix, source, destination, parent), m_firstLinePointId(firstLinePointId), m_secondLinePointId(secondLinePointId) { InitOperatedObjects(); ToolCreation(typeCreation); } - -//--------------------------------------------------------------------------------------------------------------------- -DestinationItem VToolFlippingByLine::CreatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data) -{ - const QSharedPointer point = data->GeometricObject(idItem); - VPointF rotated = point->Flip(QLineF(firstPoint, secondPoint), suffix); - rotated.setIdObject(idTool); - - DestinationItem item; - item.mx = rotated.mx(); - item.my = rotated.my(); - item.id = data->AddGObject(new VPointF(rotated)); - return item; -} - -//--------------------------------------------------------------------------------------------------------------------- -DestinationItem VToolFlippingByLine::CreateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data) -{ - const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); - data->AddArc(data->GeometricObject(item.id), item.id); - return item; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolFlippingByLine::UpdatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id, - qreal mx, qreal my) -{ - const QSharedPointer point = data->GeometricObject(idItem); - VPointF rotated = point->Flip(QLineF(firstPoint, secondPoint), suffix); - rotated.setIdObject(idTool); - rotated.setMx(mx); - rotated.setMy(my); - data->UpdateGObject(id, new VPointF(rotated)); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VToolFlippingByLine::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) -{ - UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); - data->AddArc(data->GeometricObject(id), id); -} - -//--------------------------------------------------------------------------------------------------------------------- -template -DestinationItem VToolFlippingByLine::CreateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data) -{ - const QSharedPointer i = data->GeometricObject(idItem); - Item rotated = i->Flip(QLineF(firstPoint, secondPoint), suffix); - rotated.setIdObject(idTool); - - DestinationItem item; - item.mx = INT_MAX; - item.my = INT_MAX; - item.id = data->AddGObject(new Item(rotated)); - return item; -} - -//--------------------------------------------------------------------------------------------------------------------- -template -DestinationItem VToolFlippingByLine::CreateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data) -{ - const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); - data->AddCurve(data->GeometricObject(item.id), item.id); - return item; -} - -//--------------------------------------------------------------------------------------------------------------------- -template -DestinationItem VToolFlippingByLine::CreateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, - VContainer *data) -{ - const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); - data->AddCurveWithSegments(data->GeometricObject(item.id), item.id); - return item; -} - -//--------------------------------------------------------------------------------------------------------------------- -template -void VToolFlippingByLine::UpdateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) -{ - const QSharedPointer i = data->GeometricObject(idItem); - Item rotated = i->Flip(QLineF(firstPoint, secondPoint), suffix); - rotated.setIdObject(idTool); - data->UpdateGObject(id, new Item(rotated)); -} - -//--------------------------------------------------------------------------------------------------------------------- -template -void VToolFlippingByLine::UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) -{ - UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); - data->AddCurve(data->GeometricObject(id), id); -} - -//--------------------------------------------------------------------------------------------------------------------- -template -void VToolFlippingByLine::UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, - quint32 id) -{ - UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); - data->AddCurveWithSegments(data->GeometricObject(id), id); -} diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h index 485998b8f..6d11c77c5 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h @@ -31,9 +31,9 @@ #include -#include "../vabstractoperation.h" +#include "vabstractflipping.h" -class VToolFlippingByLine : public VAbstractOperation +class VToolFlippingByLine : public VAbstractFlipping { Q_OBJECT public: @@ -69,36 +69,6 @@ private: quint32 secondLinePointId, const QString &suffix, const QVector &source, const QVector &destination, const Source &typeCreation, QGraphicsItem *parent = nullptr); - - static DestinationItem CreatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data); - - template - static DestinationItem CreateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data); - static DestinationItem CreateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data); - template - static DestinationItem CreateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data); - template - static DestinationItem CreateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data); - - static void UpdatePoint(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, - const QString &suffix, VContainer *data, quint32 id, qreal mx, qreal my); - template - static void UpdateItem(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, - const QString &suffix, VContainer *data, quint32 id); - static void UpdateArc(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, - const QString &suffix, VContainer *data, quint32 id); - template - static void UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &firstPoint, const QPointF &secondPoint, - const QString &suffix, VContainer *data, quint32 id); - template - static void UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &firstPoint, - const QPointF &secondPoint, const QString &suffix, VContainer *data, - quint32 id); }; #endif // VTOOLFLIPPINGBYLINE_H diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index f50749a81..d84f0ff2a 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -53,7 +53,9 @@ HEADERS += \ $$PWD/drawTools/operation/vtoolrotation.h \ $$PWD/vtextgraphicsitem.h \ $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ - $$PWD/drawTools/operation/vabstractoperation.h + $$PWD/drawTools/operation/vabstractoperation.h \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ + $$PWD/drawTools/operation/flipping/vabstractflipping.h SOURCES += \ $$PWD/vtooldetail.cpp \ @@ -104,4 +106,6 @@ SOURCES += \ $$PWD/drawTools/operation/vtoolrotation.cpp \ $$PWD/vtextgraphicsitem.cpp \ $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ - $$PWD/drawTools/operation/vabstractoperation.cpp + $$PWD/drawTools/operation/vabstractoperation.cpp \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ + $$PWD/drawTools/operation/flipping/vabstractflipping.cpp diff --git a/src/libs/vtools/visualization/line/operation/visoperation.cpp b/src/libs/vtools/visualization/line/operation/visoperation.cpp index 56628e3cb..03d3aa7a9 100644 --- a/src/libs/vtools/visualization/line/operation/visoperation.cpp +++ b/src/libs/vtools/visualization/line/operation/visoperation.cpp @@ -27,6 +27,16 @@ *************************************************************************/ #include "visoperation.h" +#include "../vgeometry/vabstractcurve.h" +#include "../vgeometry/varc.h" +#include "../vgeometry/vcubicbezier.h" +#include "../vgeometry/vcubicbezierpath.h" +#include "../vgeometry/vellipticalarc.h" +#include "../vgeometry/vgeometrydef.h" +#include "../vgeometry/vgobject.h" +#include "../vgeometry/vpointf.h" +#include "../vgeometry/vspline.h" +#include "../vgeometry/vsplinepath.h" //--------------------------------------------------------------------------------------------------------------------- VisOperation::VisOperation(const VContainer *data, QGraphicsItem *parent) @@ -97,3 +107,73 @@ QGraphicsPathItem *VisOperation::GetCurve(quint32 i, const QColor &color) return nullptr; } +//--------------------------------------------------------------------------------------------------------------------- +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wswitch-default") +void VisOperation::RefreshFlippedObjects(const QPointF &firstPoint, const QPointF &secondPoint) +{ + int iPoint = -1; + int iCurve = -1; + for (int i = 0; i < objects.size(); ++i) + { + const quint32 id = objects.at(i); + const QSharedPointer obj = Visualization::data->GetGObject(id); + + // This check helps to find missed objects in the switch + Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); + + switch(static_cast(obj->getType())) + { + case GOType::Point: + { + const QSharedPointer p = Visualization::data->GeometricObject(id); + + ++iPoint; + QGraphicsEllipseItem *point = GetPoint(iPoint, supportColor2); + DrawPoint(point, *p, supportColor2); + + ++iPoint; + point = GetPoint(iPoint, supportColor); + + if (object1Id != NULL_ID) + { + DrawPoint(point, p->Flip(QLineF(firstPoint, secondPoint)), supportColor); + } + break; + } + case GOType::Arc: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::EllipticalArc: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::Spline: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::SplinePath: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::CubicBezier: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::CubicBezierPath: + { + iCurve = AddFlippedCurve(firstPoint, secondPoint, id, iCurve); + break; + } + case GOType::Unknown: + break; + } + } +} +QT_WARNING_POP diff --git a/src/libs/vtools/visualization/line/operation/visoperation.h b/src/libs/vtools/visualization/line/operation/visoperation.h index fe4628f04..6e698e81d 100644 --- a/src/libs/vtools/visualization/line/operation/visoperation.h +++ b/src/libs/vtools/visualization/line/operation/visoperation.h @@ -55,8 +55,34 @@ protected: QGraphicsEllipseItem * GetPoint(quint32 i, const QColor &color); QGraphicsPathItem * GetCurve(quint32 i, const QColor &color); + + template + int AddFlippedCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i); + + void RefreshFlippedObjects(const QPointF &firstPoint, const QPointF &secondPoint); private: Q_DISABLE_COPY(VisOperation) }; +//--------------------------------------------------------------------------------------------------------------------- +template +int VisOperation::AddFlippedCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i) +{ + const QSharedPointer curve = Visualization::data->template GeometricObject(id); + + ++i; + QGraphicsPathItem *path = GetCurve(i, supportColor2); + DrawPath(path, curve->GetPath(PathDirection::Show), supportColor2, Qt::SolidLine, Qt::RoundCap); + + ++i; + path = GetCurve(i, supportColor); + if (object1Id != NULL_ID) + { + const Item flipped = curve->Flip(QLineF(firstPoint, secondPoint)); + DrawPath(path, flipped.GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); + } + + return i; +} + #endif // VISOPERATION_H diff --git a/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.cpp b/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.cpp new file mode 100644 index 000000000..2b20e984f --- /dev/null +++ b/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.cpp @@ -0,0 +1,87 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vistoolflippingbyaxis.h" +#include "../vgeometry/vpointf.h" + +//--------------------------------------------------------------------------------------------------------------------- +VisToolFlippingByAxis::VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent) + : VisOperation(data, parent), + m_axisType(AxisType::VerticalAxis), + point1(nullptr) +{ + point1 = InitPoint(supportColor2, this); +} + +//--------------------------------------------------------------------------------------------------------------------- +VisToolFlippingByAxis::~VisToolFlippingByAxis() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolFlippingByAxis::RefreshGeometry() +{ + if (objects.isEmpty()) + { + return; + } + + QPointF firstPoint; + QPointF secondPoint; + + if (object1Id != NULL_ID) + { + firstPoint = *Visualization::data->GeometricObject(object1Id); + DrawPoint(point1, firstPoint, supportColor2); + + if (m_axisType == AxisType::VerticalAxis) + { + secondPoint = QPointF(firstPoint.x(), firstPoint.y() + 100); + } + else + { + secondPoint = QPointF(firstPoint.x() + 100, firstPoint.y()); + } + + DrawLine(this, Axis(firstPoint, secondPoint), supportColor2, Qt::DashLine); + } + + RefreshFlippedObjects(firstPoint, secondPoint); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolFlippingByAxis::SetOriginPointId(quint32 value) +{ + object1Id = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolFlippingByAxis::SetAxisType(AxisType value) +{ + m_axisType = value; +} diff --git a/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.h b/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.h new file mode 100644 index 000000000..301f33dcd --- /dev/null +++ b/src/libs/vtools/visualization/line/operation/vistoolflippingbyaxis.h @@ -0,0 +1,59 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 16 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VISTOOLFLIPPINGBYAXIS_H +#define VISTOOLFLIPPINGBYAXIS_H + +#include + +#include "visoperation.h" +#include "../ifc/xml/vabstractpattern.h" + +class VisToolFlippingByAxis : public VisOperation +{ + Q_OBJECT +public: + explicit VisToolFlippingByAxis(const VContainer *data, QGraphicsItem *parent = nullptr); + virtual ~VisToolFlippingByAxis(); + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + + void SetOriginPointId(quint32 value); + void SetAxisType(AxisType value); + + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::ToolFlippingByAxis)}; +private: + Q_DISABLE_COPY(VisToolFlippingByAxis) + + AxisType m_axisType; + + QGraphicsEllipseItem *point1; +}; + +#endif // VISTOOLFLIPPINGBYAXIS_H diff --git a/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.cpp b/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.cpp index 0e66bf5b9..ce808d1b0 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.cpp @@ -27,16 +27,7 @@ *************************************************************************/ #include "vistoolflippingbyline.h" -#include "../vgeometry/vabstractcurve.h" -#include "../vgeometry/varc.h" -#include "../vgeometry/vcubicbezier.h" -#include "../vgeometry/vcubicbezierpath.h" -#include "../vgeometry/vellipticalarc.h" -#include "../vgeometry/vgeometrydef.h" -#include "../vgeometry/vgobject.h" #include "../vgeometry/vpointf.h" -#include "../vgeometry/vspline.h" -#include "../vgeometry/vsplinepath.h" //--------------------------------------------------------------------------------------------------------------------- VisToolFlippingByLine::VisToolFlippingByLine(const VContainer *data, QGraphicsItem *parent) @@ -55,8 +46,6 @@ VisToolFlippingByLine::~VisToolFlippingByLine() } //--------------------------------------------------------------------------------------------------------------------- -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wswitch-default") void VisToolFlippingByLine::RefreshGeometry() { if (objects.isEmpty()) @@ -85,71 +74,8 @@ void VisToolFlippingByLine::RefreshGeometry() DrawLine(this, QLineF(firstPoint, secondPoint), supportColor2, Qt::DashLine); } - int iPoint = -1; - int iCurve = -1; - for (int i = 0; i < objects.size(); ++i) - { - const quint32 id = objects.at(i); - const QSharedPointer obj = Visualization::data->GetGObject(id); - - // This check helps to find missed objects in the switch - Q_STATIC_ASSERT_X(static_cast(GOType::Unknown) == 7, "Not all objects were handled."); - - switch(static_cast(obj->getType())) - { - case GOType::Point: - { - const QSharedPointer p = Visualization::data->GeometricObject(id); - - ++iPoint; - QGraphicsEllipseItem *point = GetPoint(iPoint, supportColor2); - DrawPoint(point, *p, supportColor2); - - ++iPoint; - point = GetPoint(iPoint, supportColor); - - if (object1Id != NULL_ID) - { - DrawPoint(point, p->Flip(QLineF(firstPoint, secondPoint)), supportColor); - } - break; - } - case GOType::Arc: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::EllipticalArc: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::Spline: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::SplinePath: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::CubicBezier: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::CubicBezierPath: - { - iCurve = AddCurve(firstPoint, secondPoint, id, iCurve); - break; - } - case GOType::Unknown: - break; - } - } + RefreshFlippedObjects(firstPoint, secondPoint); } -QT_WARNING_POP //--------------------------------------------------------------------------------------------------------------------- void VisToolFlippingByLine::SetFirstLinePointId(quint32 value) @@ -162,24 +88,3 @@ void VisToolFlippingByLine::SetSecondLinePointId(quint32 value) { object2Id = value; } - -//--------------------------------------------------------------------------------------------------------------------- -template -int VisToolFlippingByLine::AddCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i) -{ - const QSharedPointer curve = Visualization::data->template GeometricObject(id); - - ++i; - QGraphicsPathItem *path = GetCurve(i, supportColor2); - DrawPath(path, curve->GetPath(PathDirection::Show), supportColor2, Qt::SolidLine, Qt::RoundCap); - - ++i; - path = GetCurve(i, supportColor); - if (object1Id != NULL_ID) - { - const Item flipped = curve->Flip(QLineF(firstPoint, secondPoint)); - DrawPath(path, flipped.GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap); - } - - return i; -} diff --git a/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.h b/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.h index 4e9160654..21768a03a 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.h +++ b/src/libs/vtools/visualization/line/operation/vistoolflippingbyline.h @@ -52,9 +52,6 @@ private: quint32 object2Id; QGraphicsEllipseItem *point1; QGraphicsEllipseItem *point2; - - template - int AddCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i); }; #endif // VISTOOLFLIPPINGBYLINE_H diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 6de291625..4e2775d3f 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -35,7 +35,8 @@ HEADERS += \ $$PWD/path/vistoolpointofintersectioncurves.h \ $$PWD/path/vistoolcubicbezier.h \ $$PWD/path/vistoolcubicbezierpath.h \ - $$PWD/line/operation/visoperation.h + $$PWD/line/operation/visoperation.h \ + $$PWD/line/operation/vistoolflippingbyaxis.h SOURCES += \ $$PWD/visualization.cpp \ @@ -71,4 +72,5 @@ SOURCES += \ $$PWD/path/vistoolpointofintersectioncurves.cpp \ $$PWD/path/vistoolcubicbezier.cpp \ $$PWD/path/vistoolcubicbezierpath.cpp \ - $$PWD/line/operation/visoperation.cpp + $$PWD/line/operation/visoperation.cpp \ + $$PWD/line/operation/vistoolflippingbyaxis.cpp