Resolved issue #772. New tool Duplicate detail.
--HG-- branch : develop
This commit is contained in:
commit
003d7e7483
|
@ -29,6 +29,7 @@
|
||||||
- [#768] New feature. Custom curve approximation scale.
|
- [#768] New feature. Custom curve approximation scale.
|
||||||
- [#759] Add place label tool.
|
- [#759] Add place label tool.
|
||||||
- [#771] Improve tool Point at intersection of arc and line.
|
- [#771] Improve tool Point at intersection of arc and line.
|
||||||
|
- [#772] New tool Duplicate detail.
|
||||||
|
|
||||||
# Version 0.5.1
|
# Version 0.5.1
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
|
@ -78,7 +78,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
|
||||||
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (item->type())
|
switch (item->type())
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
QString DialogHistory::Record(const VToolRecord &tool)
|
QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used in history.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in history.");
|
||||||
|
|
||||||
const QDomElement domElem = doc->elementById(tool.getId());
|
const QDomElement domElem = doc->elementById(tool.getId());
|
||||||
if (domElem.isElement() == false)
|
if (domElem.isElement() == false)
|
||||||
|
@ -408,6 +408,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::Pin:
|
case Tool::Pin:
|
||||||
case Tool::PlaceLabel:
|
case Tool::PlaceLabel:
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
|
case Tool::DuplicateDetail:
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ void MainWindow::AddPP(const QString &PPName)
|
||||||
comboBoxDraws->blockSignals(true);
|
comboBoxDraws->blockSignals(true);
|
||||||
comboBoxDraws->addItem(PPName);
|
comboBoxDraws->addItem(PPName);
|
||||||
|
|
||||||
pattern->ClearGObjects();
|
pattern->ClearCalculationGObjects();
|
||||||
//Create single point
|
//Create single point
|
||||||
ui->view->itemClicked(nullptr);//hide options previous tool
|
ui->view->itemClicked(nullptr);//hide options previous tool
|
||||||
const QString label = doc->GenerateLabel(LabelType::NewPatternPiece);
|
const QString label = doc->GenerateLabel(LabelType::NewPatternPiece);
|
||||||
|
@ -613,7 +613,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
dialogTool = QSharedPointer<Dialog>(new Dialog(pattern, 0, this));
|
dialogTool = QSharedPointer<Dialog>(new Dialog(pattern, 0, this));
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if need to extend.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if need to extend.");
|
||||||
|
|
||||||
switch(t)
|
switch(t)
|
||||||
{
|
{
|
||||||
|
@ -1107,8 +1107,31 @@ void MainWindow::ToolUnionDetails(bool checked)
|
||||||
*/
|
*/
|
||||||
void MainWindow::ClosedDialogUnionDetails(int result)
|
void MainWindow::ClosedDialogUnionDetails(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolUnionDetails>(result);
|
ClosedDialog<VToolUnionDetails>(result);// Avoid error: Template function as signal or slot
|
||||||
doc->LiteParseTree(Document::LiteParse);
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ToolDuplicateDetail(bool checked)
|
||||||
|
{
|
||||||
|
ToolSelectDetail();
|
||||||
|
SetToolButton<DialogDuplicateDetail>(checked, Tool::DuplicateDetail, ":/cursor/duplicate_detail_cursor.png",
|
||||||
|
tr("Select detail"), &MainWindow::ClosedDialogDuplicateDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ClosedDialogDuplicateDetail(int result)
|
||||||
|
{
|
||||||
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
|
|
||||||
|
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(VToolSeamAllowance::Duplicate(dialogTool, scene, doc));
|
||||||
|
// Do not check for nullptr! See issue #719.
|
||||||
|
ui->view->itemClicked(tool);
|
||||||
|
}
|
||||||
|
ArrowTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1985,7 +2008,7 @@ void MainWindow::InitToolButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools
|
// This check helps to find missed tools
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if all tools were connected.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Check if all tools were connected.");
|
||||||
|
|
||||||
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
||||||
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
||||||
|
@ -2008,6 +2031,7 @@ void MainWindow::InitToolButtons()
|
||||||
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
||||||
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
||||||
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
|
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
|
||||||
|
connect(ui->toolButtonDuplicateDetail, &QToolButton::clicked, this, &MainWindow::ToolDuplicateDetail);
|
||||||
connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
|
connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
|
||||||
connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis);
|
connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis);
|
||||||
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||||
|
@ -2062,7 +2086,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
void MainWindow::CancelTool()
|
void MainWindow::CancelTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled.");
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Canceling tool.");
|
qCDebug(vMainWindow, "Canceling tool.");
|
||||||
dialogTool.clear();
|
dialogTool.clear();
|
||||||
|
@ -2172,6 +2196,9 @@ void MainWindow::CancelTool()
|
||||||
case Tool::UnionDetails:
|
case Tool::UnionDetails:
|
||||||
ui->toolButtonUnionDetails->setChecked(false);
|
ui->toolButtonUnionDetails->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
case Tool::DuplicateDetail:
|
||||||
|
ui->toolButtonDuplicateDetail->setChecked(false);
|
||||||
|
break;
|
||||||
case Tool::CutArc:
|
case Tool::CutArc:
|
||||||
ui->toolButtonArcCutPoint->setChecked(false);
|
ui->toolButtonArcCutPoint->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
@ -3424,7 +3451,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
// This check helps to find missed tools
|
// This check helps to find missed tools
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled.");
|
||||||
|
|
||||||
//Drawing Tools
|
//Drawing Tools
|
||||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||||
|
@ -3480,6 +3507,7 @@ QT_WARNING_POP
|
||||||
//Modeling Tools
|
//Modeling Tools
|
||||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||||
ui->toolButtonDetailExportAs->setEnabled(modelingTools);
|
ui->toolButtonDetailExportAs->setEnabled(modelingTools);
|
||||||
|
ui->toolButtonDuplicateDetail->setEnabled(modelingTools);
|
||||||
|
|
||||||
//Layout tools
|
//Layout tools
|
||||||
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
||||||
|
@ -3752,7 +3780,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
void MainWindow::LastUsedTool()
|
void MainWindow::LastUsedTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were handled.");
|
||||||
|
|
||||||
if (currentTool == lastUsedTool)
|
if (currentTool == lastUsedTool)
|
||||||
{
|
{
|
||||||
|
@ -3875,6 +3903,10 @@ void MainWindow::LastUsedTool()
|
||||||
ui->toolButtonUnionDetails->setChecked(true);
|
ui->toolButtonUnionDetails->setChecked(true);
|
||||||
ToolUnionDetails(true);
|
ToolUnionDetails(true);
|
||||||
break;
|
break;
|
||||||
|
case Tool::DuplicateDetail:
|
||||||
|
ui->toolButtonDuplicateDetail->setChecked(true);
|
||||||
|
ToolDuplicateDetail(true);
|
||||||
|
break;
|
||||||
case Tool::CutArc:
|
case Tool::CutArc:
|
||||||
ui->toolButtonArcCutPoint->setChecked(true);
|
ui->toolButtonArcCutPoint->setChecked(true);
|
||||||
ToolCutArc(true);
|
ToolCutArc(true);
|
||||||
|
|
|
@ -150,6 +150,7 @@ private slots:
|
||||||
void ToolTriangle(bool checked);
|
void ToolTriangle(bool checked);
|
||||||
void ToolPointOfIntersection(bool checked);
|
void ToolPointOfIntersection(bool checked);
|
||||||
void ToolUnionDetails(bool checked);
|
void ToolUnionDetails(bool checked);
|
||||||
|
void ToolDuplicateDetail(bool checked);
|
||||||
void ToolGroup(bool checked);
|
void ToolGroup(bool checked);
|
||||||
void ToolRotation(bool checked);
|
void ToolRotation(bool checked);
|
||||||
void ToolFlippingByLine(bool checked);
|
void ToolFlippingByLine(bool checked);
|
||||||
|
@ -178,6 +179,7 @@ private slots:
|
||||||
void Open();
|
void Open();
|
||||||
|
|
||||||
void ClosedDialogUnionDetails(int result);
|
void ClosedDialogUnionDetails(int result);
|
||||||
|
void ClosedDialogDuplicateDetail(int result);
|
||||||
void ClosedDialogGroup(int result);
|
void ClosedDialogGroup(int result);
|
||||||
void ClosedDialogPiecePath(int result);
|
void ClosedDialogPiecePath(int result);
|
||||||
void ClosedDialogPin(int result);
|
void ClosedDialogPin(int result);
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<string>Export details skiping the Layout stage</string>
|
<string>Export details skiping the Layout stage</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>7</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -1550,6 +1550,32 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonDuplicateDetail">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Duplicate detail tool</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/toolicon.qrc">
|
||||||
|
<normaloff>:/toolicon/32x32/duplicate_detail.png</normaloff>:/toolicon/32x32/duplicate_detail.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutPage">
|
<widget class="QWidget" name="layoutPage">
|
||||||
|
|
|
@ -86,5 +86,7 @@
|
||||||
<file>cursor/insert_node_cursor@2x.png</file>
|
<file>cursor/insert_node_cursor@2x.png</file>
|
||||||
<file>cursor/place_label_cursor@2x.png</file>
|
<file>cursor/place_label_cursor@2x.png</file>
|
||||||
<file>cursor/place_label_cursor.png</file>
|
<file>cursor/place_label_cursor.png</file>
|
||||||
|
<file>cursor/duplicate_detail_cursor.png</file>
|
||||||
|
<file>cursor/duplicate_detail_cursor@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 902 B |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -84,5 +84,7 @@
|
||||||
<file>toolicon/32x32/insert_node@2x.png</file>
|
<file>toolicon/32x32/insert_node@2x.png</file>
|
||||||
<file>toolicon/32x32/place_label@2x.png</file>
|
<file>toolicon/32x32/place_label@2x.png</file>
|
||||||
<file>toolicon/32x32/place_label.png</file>
|
<file>toolicon/32x32/place_label.png</file>
|
||||||
|
<file>toolicon/32x32/duplicate_detail.png</file>
|
||||||
|
<file>toolicon/32x32/duplicate_detail@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -0,0 +1,194 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="32"
|
||||||
|
height="32"
|
||||||
|
viewBox="0 0 32 32.000001"
|
||||||
|
id="svg8396"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.92.2 (unknown)"
|
||||||
|
sodipodi:docname="duplicate_detail.svg"
|
||||||
|
inkscape:export-filename="/home/dismine/CAD/Valentina_0.6.x/valentina/src/app/valentina/share/resources/toolicon/32x32/duplicate_detail.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96">
|
||||||
|
<defs
|
||||||
|
id="defs8398">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient2464"
|
||||||
|
osb:paint="solid">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#000000;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop2462" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient9078">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#84ab5a;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop9080" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#3b560b;stop-opacity:0.96078432"
|
||||||
|
offset="1"
|
||||||
|
id="stop9082" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient9060"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop9070"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#bfd190;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop9072"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#648e2c;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9060"
|
||||||
|
id="linearGradient9066"
|
||||||
|
x1="24.510012"
|
||||||
|
y1="1037.5343"
|
||||||
|
x2="24.510012"
|
||||||
|
y2="1050.8309"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9060"
|
||||||
|
id="linearGradient9076"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="24.189611"
|
||||||
|
y1="17.372341"
|
||||||
|
x2="24.189611"
|
||||||
|
y2="30.428661"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9078"
|
||||||
|
id="linearGradient9084"
|
||||||
|
x1="27.273466"
|
||||||
|
y1="16.050688"
|
||||||
|
x2="27.453691"
|
||||||
|
y2="30.668961"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9060"
|
||||||
|
id="linearGradient9086"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="24.510012"
|
||||||
|
y1="1037.5343"
|
||||||
|
x2="24.510012"
|
||||||
|
y2="1050.8309"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9060"
|
||||||
|
id="linearGradient9088"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="24.510012"
|
||||||
|
y1="1037.5343"
|
||||||
|
x2="24.510012"
|
||||||
|
y2="1050.8309"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient9060"
|
||||||
|
id="linearGradient9090"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="24.510012"
|
||||||
|
y1="1037.5343"
|
||||||
|
x2="24.510012"
|
||||||
|
y2="1050.8309"
|
||||||
|
gradientTransform="translate(-9.5,-0.5)" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="8.8277862"
|
||||||
|
inkscape:cx="-30.633024"
|
||||||
|
inkscape:cy="14.30082"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:window-width="1855"
|
||||||
|
inkscape:window-height="1056"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata8401">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1020.3622)">
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
|
||||||
|
d="m 18.253934,1026.4091 c -2.709075,-1.0524 -3.884497,-2.8171 -4.25,-6 l -8.9999995,4 c 1.6204375,5.4081 2.7946849,13.9946 -4,13 l -1.00000002,12.097 9.00000002,1.903 2.9999995,-10 2,10.25 h 4.25 z"
|
||||||
|
id="path8501"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cccccccccc" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 27.503934,1026.6591 c -2.709075,-1.0524 -3.884497,-2.8171 -4.25,-6 l -9,4 c 1.620438,5.4081 2.794685,13.9946 -4,13 l -1,12.097 9,1.903 3,-10 2,10.25 h 4.25 z"
|
||||||
|
id="path8501-3"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cccccccccc" />
|
||||||
|
<g
|
||||||
|
id="g9054"
|
||||||
|
style="fill:url(#linearGradient9066);fill-opacity:1;fill-rule:nonzero"
|
||||||
|
transform="translate(-0.42188663,0.7488442)">
|
||||||
|
<path
|
||||||
|
id="rect9043"
|
||||||
|
transform="translate(0,1020.3622)"
|
||||||
|
d="M 22.761719,16 C 22.340152,16 22,16.340152 22,16.761719 V 21 H 17.761719 C 17.340152,21 17,21.340152 17,21.761719 v 3.476562 C 17,25.659848 17.340152,26 17.761719,26 H 22 v 4.238281 C 22,30.659848 22.340152,31 22.761719,31 h 3.476562 C 26.659848,31 27,30.659848 27,30.238281 V 26 h 4.238281 C 31.659848,26 32,25.659848 32,25.238281 V 21.761719 C 32,21.340152 31.659848,21 31.238281,21 H 27 V 16.761719 C 27,16.340152 26.659848,16 26.238281,16 Z"
|
||||||
|
style="fill:url(#linearGradient9076);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient9084);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path9048"
|
||||||
|
d="m 17.902378,1042.2696 h 4.165206"
|
||||||
|
style="fill:url(#linearGradient9086);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
<path
|
||||||
|
style="fill:url(#linearGradient9088);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 26.953692,1042.2696 h 4.165206"
|
||||||
|
id="path9050"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path9052"
|
||||||
|
d="m 22.922949,1037.1832 h 3.175378"
|
||||||
|
style="fill:url(#linearGradient9090);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 7.3 KiB |
|
@ -4166,7 +4166,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
QRectF VPattern::ActiveDrawBoundingRect() const
|
QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used.");
|
||||||
|
|
||||||
QRectF rec;
|
QRectF rec;
|
||||||
|
|
||||||
|
@ -4247,6 +4247,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
case Tool::Pin:
|
case Tool::Pin:
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
case Tool::PlaceLabel:
|
case Tool::PlaceLabel:
|
||||||
|
case Tool::DuplicateDetail:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1771,7 +1771,7 @@ QVector<VFormulaField> VAbstractPattern::ListPointExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment a number.
|
// If no just increment a number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPoint);
|
const QDomNodeList list = elementsByTagName(TagPoint);
|
||||||
|
@ -1799,7 +1799,7 @@ QVector<VFormulaField> VAbstractPattern::ListArcExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagArc);
|
const QDomNodeList list = elementsByTagName(TagArc);
|
||||||
|
@ -1823,7 +1823,7 @@ QVector<VFormulaField> VAbstractPattern::ListElArcExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagElArc);
|
const QDomNodeList list = elementsByTagName(TagElArc);
|
||||||
|
@ -1856,7 +1856,7 @@ QVector<VFormulaField> VAbstractPattern::ListPathPointExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
||||||
|
@ -1894,7 +1894,7 @@ QVector<VFormulaField> VAbstractPattern::ListOperationExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagOperation);
|
const QDomNodeList list = elementsByTagName(TagOperation);
|
||||||
|
@ -1916,7 +1916,7 @@ QVector<VFormulaField> VAbstractPattern::ListNodesExpressions(const QDomElement
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
|
|
||||||
|
@ -1939,7 +1939,7 @@ QVector<VFormulaField> VAbstractPattern::ListPathExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPath);
|
const QDomNodeList list = elementsByTagName(TagPath);
|
||||||
|
@ -1977,7 +1977,7 @@ QVector<VFormulaField> VAbstractPattern::ListPieceExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagDetail);
|
const QDomNodeList list = elementsByTagName(TagDetail);
|
||||||
|
@ -2420,3 +2420,21 @@ void VAbstractPattern::SetGroupVisivility(quint32 id, bool visible)
|
||||||
qDebug("Can't get group by id = %u.", id);
|
qDebug("Can't get group by id = %u.", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::PieceDrawName(quint32 id)
|
||||||
|
{
|
||||||
|
const QDomElement detail = elementById(id, VAbstractPattern::TagDetail);
|
||||||
|
if (detail.isNull())
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDomElement draw = detail.parentNode().parentNode().toElement();
|
||||||
|
if (draw.isNull() || not draw.hasAttribute(VAbstractPattern::AttrName))
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return draw.attribute(VAbstractPattern::AttrName);
|
||||||
|
}
|
||||||
|
|
|
@ -198,6 +198,8 @@ public:
|
||||||
bool GetGroupVisivility(quint32 id);
|
bool GetGroupVisivility(quint32 id);
|
||||||
void SetGroupVisivility(quint32 id, bool visible);
|
void SetGroupVisivility(quint32 id, bool visible);
|
||||||
|
|
||||||
|
QString PieceDrawName(quint32 id);
|
||||||
|
|
||||||
static const QString TagPattern;
|
static const QString TagPattern;
|
||||||
static const QString TagCalculation;
|
static const QString TagCalculation;
|
||||||
static const QString TagModeling;
|
static const QString TagModeling;
|
||||||
|
|
|
@ -171,6 +171,7 @@ enum class Tool : ToolVisHolderType
|
||||||
Pin,
|
Pin,
|
||||||
InsertNode,
|
InsertNode,
|
||||||
PlaceLabel,
|
PlaceLabel,
|
||||||
|
DuplicateDetail,
|
||||||
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
|
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -222,6 +223,7 @@ enum class Vis : ToolVisHolderType
|
||||||
ToolPiecePath,
|
ToolPiecePath,
|
||||||
ToolSpecialPoint,
|
ToolSpecialPoint,
|
||||||
ToolPlaceLabel,
|
ToolPlaceLabel,
|
||||||
|
ToolDuplicateDetail,
|
||||||
PieceSpecialPoints,
|
PieceSpecialPoints,
|
||||||
NoBrush,
|
NoBrush,
|
||||||
CurvePathItem,
|
CurvePathItem,
|
||||||
|
|
|
@ -103,10 +103,7 @@ VContainer::VContainer(const VContainer &data)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer::~VContainer()
|
VContainer::~VContainer()
|
||||||
{
|
{}
|
||||||
ClearGObjects();
|
|
||||||
ClearVariables();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -115,9 +112,20 @@ VContainer::~VContainer()
|
||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
const QSharedPointer<VGObject> VContainer::GetGObject(quint32 id)const
|
const QSharedPointer<VGObject> VContainer::GetGObject(quint32 id) const
|
||||||
{
|
{
|
||||||
return GetObject(d->gObjects, id);
|
if (d->calculationObjects.contains(id))
|
||||||
|
{
|
||||||
|
return d->calculationObjects.value(id);
|
||||||
|
}
|
||||||
|
else if (d->modelingObjects->contains(id))
|
||||||
|
{
|
||||||
|
return d->modelingObjects->value(id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -129,26 +137,6 @@ const QSharedPointer<VGObject> VContainer::GetFakeGObject(quint32 id)
|
||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetObject return object from container
|
|
||||||
* @param obj container
|
|
||||||
* @param id id of object
|
|
||||||
* @return Object
|
|
||||||
*/
|
|
||||||
template <typename key, typename val>
|
|
||||||
const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
|
|
||||||
{
|
|
||||||
if (obj.contains(id))
|
|
||||||
{
|
|
||||||
return obj.value(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiece VContainer::GetPiece(quint32 id) const
|
VPiece VContainer::GetPiece(quint32 id) const
|
||||||
{
|
{
|
||||||
|
@ -192,8 +180,27 @@ quint32 VContainer::AddGObject(VGObject *obj)
|
||||||
quint32 VContainer::AddGObject(const QSharedPointer<VGObject> &obj)
|
quint32 VContainer::AddGObject(const QSharedPointer<VGObject> &obj)
|
||||||
{
|
{
|
||||||
SCASSERT(not obj.isNull())
|
SCASSERT(not obj.isNull())
|
||||||
|
|
||||||
|
if (obj->getMode() == Draw::Layout)
|
||||||
|
{
|
||||||
|
qWarning("Can't add an object with mode 'Layout'");
|
||||||
|
return NULL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
uniqueNames.insert(obj->name());
|
uniqueNames.insert(obj->name());
|
||||||
return AddObject(d->gObjects, obj);
|
const quint32 id = getNextId();
|
||||||
|
obj->setId(id);
|
||||||
|
|
||||||
|
if (obj->getMode() == Draw::Calculation)
|
||||||
|
{
|
||||||
|
d->calculationObjects.insert(id, obj);
|
||||||
|
}
|
||||||
|
else if (obj->getMode() == Draw::Modeling)
|
||||||
|
{
|
||||||
|
d->modelingObjects->insert(id, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -290,33 +297,14 @@ void VContainer::ClearForFullParse()
|
||||||
*/
|
*/
|
||||||
void VContainer::ClearGObjects()
|
void VContainer::ClearGObjects()
|
||||||
{
|
{
|
||||||
d->gObjects.clear();
|
d->calculationObjects.clear();
|
||||||
|
d->modelingObjects->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::ClearCalculationGObjects()
|
void VContainer::ClearCalculationGObjects()
|
||||||
{
|
{
|
||||||
if (not d->gObjects.isEmpty()) //-V807
|
d->calculationObjects.clear();
|
||||||
{
|
|
||||||
QVector<quint32> keys;
|
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
|
||||||
for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i)
|
|
||||||
{
|
|
||||||
if (i.value()->getMode() == Draw::Calculation)
|
|
||||||
{
|
|
||||||
i.value().clear();
|
|
||||||
keys.append(i.key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// We can't delete objects in previous loop it will destroy the iterator.
|
|
||||||
if (not keys.isEmpty())
|
|
||||||
{
|
|
||||||
for (int i = 0; i < keys.size(); ++i)
|
|
||||||
{
|
|
||||||
d->gObjects.remove(keys.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -464,23 +452,6 @@ void VContainer::RemovePiece(quint32 id)
|
||||||
d->pieces->remove(id);
|
d->pieces->remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief AddObject add object to container
|
|
||||||
* @param obj container
|
|
||||||
* @param value object
|
|
||||||
* @return id of object in container
|
|
||||||
*/
|
|
||||||
template <typename key, typename val>
|
|
||||||
quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
|
|
||||||
{
|
|
||||||
SCASSERT(value != nullptr)
|
|
||||||
const quint32 id = getNextId();
|
|
||||||
value->setId(id);
|
|
||||||
obj[id] = value;
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::UpdatePiece(quint32 id, const VPiece &detail)
|
void VContainer::UpdatePiece(quint32 id, const VPiece &detail)
|
||||||
{
|
{
|
||||||
|
@ -678,9 +649,9 @@ qreal *VContainer::rheight()
|
||||||
* @brief data container with datagObjects return container of gObjects
|
* @brief data container with datagObjects return container of gObjects
|
||||||
* @return pointer on container of gObjects
|
* @return pointer on container of gObjects
|
||||||
*/
|
*/
|
||||||
const QHash<quint32, QSharedPointer<VGObject> > *VContainer::DataGObjects() const
|
const QHash<quint32, QSharedPointer<VGObject> > *VContainer::CalculationGObjects() const
|
||||||
{
|
{
|
||||||
return &d->gObjects;
|
return &d->calculationObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -69,7 +69,8 @@ class VContainerData : public QSharedData //-V690
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit)
|
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit)
|
||||||
: gObjects(QHash<quint32, QSharedPointer<VGObject> >()),
|
: calculationObjects(QHash<quint32, QSharedPointer<VGObject> >()),
|
||||||
|
modelingObjects(QSharedPointer<QHash<quint32, QSharedPointer<VGObject>>>::create()),
|
||||||
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()),
|
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()),
|
||||||
pieces(QSharedPointer<QHash<quint32, VPiece>>::create()),
|
pieces(QSharedPointer<QHash<quint32, VPiece>>::create()),
|
||||||
piecePaths(QSharedPointer<QHash<quint32, VPiecePath>>::create()),
|
piecePaths(QSharedPointer<QHash<quint32, VPiecePath>>::create()),
|
||||||
|
@ -79,7 +80,8 @@ public:
|
||||||
|
|
||||||
VContainerData(const VContainerData &data)
|
VContainerData(const VContainerData &data)
|
||||||
: QSharedData(data),
|
: QSharedData(data),
|
||||||
gObjects(data.gObjects),
|
calculationObjects(data.calculationObjects),
|
||||||
|
modelingObjects(data.modelingObjects),
|
||||||
variables(data.variables),
|
variables(data.variables),
|
||||||
pieces(data.pieces),
|
pieces(data.pieces),
|
||||||
piecePaths(data.piecePaths),
|
piecePaths(data.piecePaths),
|
||||||
|
@ -89,10 +91,8 @@ public:
|
||||||
|
|
||||||
virtual ~VContainerData();
|
virtual ~VContainerData();
|
||||||
|
|
||||||
/**
|
QHash<quint32, QSharedPointer<VGObject> > calculationObjects;
|
||||||
* @brief gObjects graphicals objects of pattern.
|
QSharedPointer<QHash<quint32, QSharedPointer<VGObject>>> modelingObjects;
|
||||||
*/
|
|
||||||
QHash<quint32, QSharedPointer<VGObject> > gObjects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
|
* @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
|
|
||||||
void RemoveIncrement(const QString& name);
|
void RemoveIncrement(const QString& name);
|
||||||
|
|
||||||
const QHash<quint32, QSharedPointer<VGObject> > *DataGObjects() const;
|
const QHash<quint32, QSharedPointer<VGObject> > *CalculationGObjects() const;
|
||||||
const QHash<quint32, VPiece> *DataPieces() const;
|
const QHash<quint32, VPiece> *DataPieces() const;
|
||||||
const QHash<QString, QSharedPointer<VInternalVariable>> *DataVariables() const;
|
const QHash<QString, QSharedPointer<VInternalVariable>> *DataVariables() const;
|
||||||
|
|
||||||
|
@ -219,16 +219,9 @@ private:
|
||||||
template <class T>
|
template <class T>
|
||||||
uint qHash( const QSharedPointer<T> &p );
|
uint qHash( const QSharedPointer<T> &p );
|
||||||
|
|
||||||
template <typename key, typename val>
|
|
||||||
// cppcheck-suppress functionStatic
|
|
||||||
const val GetObject(const QHash<key, val> &obj, key id) const;
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
|
void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
|
||||||
|
|
||||||
template <typename key, typename val>
|
|
||||||
static quint32 AddObject(QHash<key, val> &obj, val value);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const QMap<QString, QSharedPointer<T> > DataVar(const VarType &type) const;
|
const QMap<QString, QSharedPointer<T> > DataVar(const VarType &type) const;
|
||||||
};
|
};
|
||||||
|
@ -248,25 +241,23 @@ const QSharedPointer<T> VContainer::GeometricObject(const quint32 &id) const
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<VGObject> gObj = QSharedPointer<VGObject>();
|
QSharedPointer<VGObject> gObj;
|
||||||
if (d->gObjects.contains(id))
|
if (d->calculationObjects.contains(id))
|
||||||
{
|
{
|
||||||
gObj = d->gObjects.value(id);
|
gObj = d->calculationObjects.value(id);
|
||||||
|
}
|
||||||
|
else if (d->modelingObjects->contains(id))
|
||||||
|
{
|
||||||
|
gObj = d->modelingObjects->value(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
}
|
}
|
||||||
try
|
|
||||||
{
|
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(gObj);
|
||||||
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(gObj);
|
SCASSERT(obj.isNull() == false)
|
||||||
SCASSERT(obj.isNull() == false)
|
return obj;
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc &)
|
|
||||||
{
|
|
||||||
throw VExceptionBadId(tr("Can't cast object"), id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,19 +366,39 @@ void VContainer::UpdateObject(const quint32 &id, const QSharedPointer<T> &point)
|
||||||
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||||
SCASSERT(point.isNull() == false)
|
SCASSERT(point.isNull() == false)
|
||||||
point->setId(id);
|
point->setId(id);
|
||||||
if (d->gObjects.contains(id))
|
|
||||||
|
if (d->calculationObjects.contains(id) && point->getMode() == Draw::Calculation)
|
||||||
{
|
{
|
||||||
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(d->gObjects.value(id));
|
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(d->calculationObjects.value(id));
|
||||||
if (obj.isNull())
|
if (obj.isNull())
|
||||||
{
|
{
|
||||||
throw VExceptionBadId(tr("Can't cast object"), id);
|
throw VExceptionBadId(tr("Can't cast object"), id);
|
||||||
}
|
}
|
||||||
*obj = *point;
|
*obj = *point;
|
||||||
}
|
}
|
||||||
|
else if (d->modelingObjects->contains(id) && point->getMode() == Draw::Modeling)
|
||||||
|
{
|
||||||
|
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(d->modelingObjects->value(id));
|
||||||
|
if (obj.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't cast object"), id);
|
||||||
|
}
|
||||||
|
*obj = *point;
|
||||||
|
}
|
||||||
|
else if (point->getMode() == Draw::Calculation)
|
||||||
|
{
|
||||||
|
d->calculationObjects.insert(id, point);
|
||||||
|
}
|
||||||
|
else if (point->getMode() == Draw::Modeling)
|
||||||
|
{
|
||||||
|
d->modelingObjects->insert(id, point);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->gObjects.insert(id, point);
|
qWarning("Can't update an object with mode 'Layout'");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateId(id);
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
#endif // VCONTAINER_H
|
#endif // VCONTAINER_H
|
||||||
|
|
|
@ -47,7 +47,8 @@ HEADERS += \
|
||||||
$$PWD/tools/piece/dialogpin.h \
|
$$PWD/tools/piece/dialogpin.h \
|
||||||
$$PWD/tools/piece/dialoginsertnode.h \
|
$$PWD/tools/piece/dialoginsertnode.h \
|
||||||
$$PWD/support/dialogeditlabel.h \
|
$$PWD/support/dialogeditlabel.h \
|
||||||
$$PWD/tools/piece/dialogplacelabel.h
|
$$PWD/tools/piece/dialogplacelabel.h \
|
||||||
|
$$PWD/tools/piece/dialogduplicatedetail.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/tools/dialogalongline.cpp \
|
$$PWD/tools/dialogalongline.cpp \
|
||||||
|
@ -94,7 +95,8 @@ SOURCES += \
|
||||||
$$PWD/tools/piece/dialogpin.cpp \
|
$$PWD/tools/piece/dialogpin.cpp \
|
||||||
$$PWD/tools/piece/dialoginsertnode.cpp \
|
$$PWD/tools/piece/dialoginsertnode.cpp \
|
||||||
$$PWD/support/dialogeditlabel.cpp \
|
$$PWD/support/dialogeditlabel.cpp \
|
||||||
$$PWD/tools/piece/dialogplacelabel.cpp
|
$$PWD/tools/piece/dialogplacelabel.cpp \
|
||||||
|
$$PWD/tools/piece/dialogduplicatedetail.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tools/dialogalongline.ui \
|
$$PWD/tools/dialogalongline.ui \
|
||||||
|
@ -146,4 +148,5 @@ FORMS += \
|
||||||
$$PWD/tools/piece/tabs/tabpassmarks.ui \
|
$$PWD/tools/piece/tabs/tabpassmarks.ui \
|
||||||
$$PWD/support/dialogeditlabel.ui \
|
$$PWD/support/dialogeditlabel.ui \
|
||||||
$$PWD/tools/piece/dialogplacelabel.ui \
|
$$PWD/tools/piece/dialogplacelabel.ui \
|
||||||
$$PWD/tools/piece/tabs/tabplacelabels.ui
|
$$PWD/tools/piece/tabs/tabplacelabels.ui \
|
||||||
|
$$PWD/tools/piece/dialogduplicatedetail.ui
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
#include "tools/piece/dialogpin.h"
|
#include "tools/piece/dialogpin.h"
|
||||||
#include "tools/piece/dialoginsertnode.h"
|
#include "tools/piece/dialoginsertnode.h"
|
||||||
#include "tools/piece/dialogplacelabel.h"
|
#include "tools/piece/dialogplacelabel.h"
|
||||||
|
#include "tools/piece/dialogduplicatedetail.h"
|
||||||
|
|
||||||
#include "support/dialogeditwrongformula.h"
|
#include "support/dialogeditwrongformula.h"
|
||||||
#include "support/dialogundo.h"
|
#include "support/dialogundo.h"
|
||||||
|
|
|
@ -215,7 +215,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box) const
|
||||||
SCASSERT(box != nullptr)
|
SCASSERT(box != nullptr)
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
|
||||||
const auto objs = data->DataGObjects();
|
const auto objs = data->CalculationGObjects();
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
|
@ -239,7 +239,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
||||||
SCASSERT(box != nullptr)
|
SCASSERT(box != nullptr)
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
|
||||||
const auto objs = data->DataGObjects();
|
const auto objs = data->CalculationGObjects();
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
|
@ -261,7 +261,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
||||||
void DialogTool::FillComboBoxCurves(QComboBox *box) const
|
void DialogTool::FillComboBoxCurves(QComboBox *box) const
|
||||||
{
|
{
|
||||||
SCASSERT(box != nullptr)
|
SCASSERT(box != nullptr)
|
||||||
const auto objs = data->DataGObjects();
|
const auto objs = data->CalculationGObjects();
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
|
@ -269,12 +269,12 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const
|
||||||
if (i.key() != toolId)
|
if (i.key() != toolId)
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = i.value();
|
QSharedPointer<VGObject> obj = i.value();
|
||||||
if ((obj->getType() == GOType::Arc
|
if (obj->getType() == GOType::Arc
|
||||||
|| obj->getType() == GOType::EllipticalArc
|
|| obj->getType() == GOType::EllipticalArc
|
||||||
|| obj->getType() == GOType::Spline
|
|| obj->getType() == GOType::Spline
|
||||||
|| obj->getType() == GOType::SplinePath
|
|| obj->getType() == GOType::SplinePath
|
||||||
|| obj->getType() == GOType::CubicBezier
|
|| obj->getType() == GOType::CubicBezier
|
||||||
|| obj->getType() == GOType::CubicBezierPath) && obj->getMode() == Draw::Calculation)
|
|| obj->getType() == GOType::CubicBezierPath)
|
||||||
{
|
{
|
||||||
PrepareList<VAbstractCurve>(list, i.key());
|
PrepareList<VAbstractCurve>(list, i.key());
|
||||||
}
|
}
|
||||||
|
@ -683,8 +683,7 @@ void DialogTool::InitNodeAngles(QComboBox *box)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogTool::IsSplinePath(const QSharedPointer<VGObject> &obj) const
|
bool DialogTool::IsSplinePath(const QSharedPointer<VGObject> &obj) const
|
||||||
{
|
{
|
||||||
return (obj->getType() == GOType::SplinePath || obj->getType() == GOType::CubicBezierPath) &&
|
return obj->getType() == GOType::SplinePath || obj->getType() == GOType::CubicBezierPath;
|
||||||
obj->getMode() == Draw::Calculation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1010,8 +1009,7 @@ void DialogTool::PrepareList(QMap<QString, quint32> &list, quint32 id) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogTool::IsSpline(const QSharedPointer<VGObject> &obj) const
|
bool DialogTool::IsSpline(const QSharedPointer<VGObject> &obj) const
|
||||||
{
|
{
|
||||||
return (obj->getType() == GOType::Spline || obj->getType() == GOType::CubicBezier) &&
|
return obj->getType() == GOType::Spline || obj->getType() == GOType::CubicBezier;
|
||||||
obj->getMode() == Draw::Calculation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1290,7 +1288,7 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
|
||||||
SCASSERT(box != nullptr)
|
SCASSERT(box != nullptr)
|
||||||
box->blockSignals(true);
|
box->blockSignals(true);
|
||||||
|
|
||||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->DataGObjects();
|
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->CalculationGObjects();
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
|
@ -1300,7 +1298,7 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
|
||||||
if (i.key() != toolId && i.key() != ch1 && i.key() != ch2)
|
if (i.key() != toolId && i.key() != ch1 && i.key() != ch2)
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = i.value();
|
QSharedPointer<VGObject> obj = i.value();
|
||||||
if (obj->getType() == gType && obj->getMode() == Draw::Calculation)
|
if (obj->getType() == gType)
|
||||||
{
|
{
|
||||||
PrepareList<GObject>(list, i.key());
|
PrepareList<GObject>(list, i.key());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogduplicatedetail.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 10, 2017
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2017 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#include "dialogduplicatedetail.h"
|
||||||
|
#include "ui_dialogduplicatedetail.h"
|
||||||
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
|
#include "../../../visualization/path/vistoolduplicatedetail.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogDuplicateDetail::DialogDuplicateDetail(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
|
: DialogTool(data, toolId, parent),
|
||||||
|
ui(new Ui::DialogDuplicateDetail),
|
||||||
|
m_idDetail(NULL_ID),
|
||||||
|
m_mx(0),
|
||||||
|
m_my(0),
|
||||||
|
m_firstRelease(false)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
InitOkCancel(ui);
|
||||||
|
|
||||||
|
vis = new VisToolDuplicateDetail(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogDuplicateDetail::~DialogDuplicateDetail()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogDuplicateDetail::ShowDialog(bool click)
|
||||||
|
{
|
||||||
|
if (prepare)
|
||||||
|
{
|
||||||
|
if (click)
|
||||||
|
{
|
||||||
|
// The check need to ignore first release of mouse button.
|
||||||
|
// User should have chance to place piece.
|
||||||
|
if (not m_firstRelease)
|
||||||
|
{
|
||||||
|
m_firstRelease = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VisToolDuplicateDetail *piece = qobject_cast<VisToolDuplicateDetail *>(vis);
|
||||||
|
SCASSERT(piece != nullptr)
|
||||||
|
|
||||||
|
m_mx = piece->Mx();
|
||||||
|
m_my = piece->My();
|
||||||
|
emit ToolTip("");
|
||||||
|
DialogAccepted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogDuplicateDetail::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
|
{
|
||||||
|
if (prepare == false)// After first choose we ignore all objects
|
||||||
|
{
|
||||||
|
if (type == SceneObject::Detail && id > NULL_ID)
|
||||||
|
{
|
||||||
|
m_idDetail = id;
|
||||||
|
emit ToolTip(tr("Click to place duplicate"));
|
||||||
|
vis->VisualMode(id);
|
||||||
|
prepare = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
80
src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h
Normal file
80
src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.h
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogduplicatedetail.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 10, 2017
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2017 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#ifndef DIALOGDUPLICATEDETAIL_H
|
||||||
|
#define DIALOGDUPLICATEDETAIL_H
|
||||||
|
|
||||||
|
#include "../dialogtool.h"
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class DialogDuplicateDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogDuplicateDetail : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DialogDuplicateDetail(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||||
|
virtual ~DialogDuplicateDetail();
|
||||||
|
|
||||||
|
quint32 Duplicate() const;
|
||||||
|
qreal MoveDuplicateX() const;
|
||||||
|
qreal MoveDuplicateY() const;
|
||||||
|
|
||||||
|
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
|
||||||
|
public slots:
|
||||||
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogDuplicateDetail)
|
||||||
|
Ui::DialogDuplicateDetail *ui;
|
||||||
|
quint32 m_idDetail;
|
||||||
|
qreal m_mx;
|
||||||
|
qreal m_my;
|
||||||
|
bool m_firstRelease;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline quint32 DialogDuplicateDetail::Duplicate() const
|
||||||
|
{
|
||||||
|
return m_idDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal DialogDuplicateDetail::MoveDuplicateX() const
|
||||||
|
{
|
||||||
|
return m_mx;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal DialogDuplicateDetail::MoveDuplicateY() const
|
||||||
|
{
|
||||||
|
return m_my;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DIALOGDUPLICATEDETAIL_H
|
80
src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui
Normal file
80
src/libs/vtools/dialogs/tools/piece/dialogduplicatedetail.ui
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogDuplicateDetail</class>
|
||||||
|
<widget class="QDialog" name="DialogDuplicateDetail">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>184</width>
|
||||||
|
<height>66</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog duplicate detail</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../../../../vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">The dialog is never shown.</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../../../vmisc/share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogDuplicateDetail</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogDuplicateDetail</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -59,7 +59,7 @@ VNodeArc::VNodeArc(const VAbstractNodeInitData &initData, QObject *qoParent)
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
void VNodeArc::Create(VAbstractNodeInitData initData)
|
void VNodeArc::Create(const VAbstractNodeInitData &initData)
|
||||||
{
|
{
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ class VNodeArc :public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractNodeInitData initData);
|
static void Create(const VAbstractNodeInitData &initData);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
const QString VNodeEllipticalArc::ToolType = QStringLiteral("modeling");
|
const QString VNodeEllipticalArc::ToolType = QStringLiteral("modeling");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VNodeEllipticalArc::Create(VAbstractNodeInitData initData)
|
void VNodeEllipticalArc::Create(const VAbstractNodeInitData &initData)
|
||||||
{
|
{
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ class VNodeEllipticalArc :public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractNodeInitData initData);
|
static void Create(const VAbstractNodeInitData &initData);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -85,7 +85,7 @@ VNodePoint::VNodePoint(const VAbstractNodeInitData &initData, QObject *qoParent,
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
void VNodePoint::Create(VAbstractNodeInitData initData)
|
void VNodePoint::Create(const VAbstractNodeInitData &initData)
|
||||||
{
|
{
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ class VNodePoint: public VAbstractNode, public VScenePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractNodeInitData initData);
|
static void Create(const VAbstractNodeInitData &initData);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
|
|
@ -60,7 +60,7 @@ VNodeSpline::VNodeSpline(const VAbstractNodeInitData &initData, QObject *qoParen
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
* @return pointer to node.
|
* @return pointer to node.
|
||||||
*/
|
*/
|
||||||
VNodeSpline *VNodeSpline::Create(VAbstractNodeInitData initData)
|
VNodeSpline *VNodeSpline::Create(const VAbstractNodeInitData &initData)
|
||||||
{
|
{
|
||||||
VNodeSpline *spl = nullptr;
|
VNodeSpline *spl = nullptr;
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class VNodeSpline:public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static VNodeSpline *Create(VAbstractNodeInitData initData);
|
static VNodeSpline *Create(const VAbstractNodeInitData &initData);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -59,7 +59,7 @@ VNodeSplinePath::VNodeSplinePath(const VAbstractNodeInitData &initData, QObject
|
||||||
* @brief Create help create tool.
|
* @brief Create help create tool.
|
||||||
* @param initData init data.
|
* @param initData init data.
|
||||||
*/
|
*/
|
||||||
void VNodeSplinePath::Create(VAbstractNodeInitData initData)
|
void VNodeSplinePath::Create(const VAbstractNodeInitData &initData)
|
||||||
{
|
{
|
||||||
if (initData.parse == Document::FullParse)
|
if (initData.parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ class VNodeSplinePath : public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractNodeInitData initData);
|
static void Create(const VAbstractNodeInitData &initData);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -83,35 +83,6 @@ template <class T> class QSharedPointer;
|
||||||
|
|
||||||
const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 CreateNodeSpline(VContainer *data, quint32 id)
|
|
||||||
{
|
|
||||||
if (data->GetGObject(id)->getType() == GOType::Spline)
|
|
||||||
{
|
|
||||||
return VAbstractTool::CreateNode<VSpline>(data, id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return VAbstractTool::CreateNode<VCubicBezier>(data, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 CreateNodeSplinePath(VContainer *data, quint32 id)
|
|
||||||
{
|
|
||||||
if (data->GetGObject(id)->getType() == GOType::SplinePath)
|
|
||||||
{
|
|
||||||
return VAbstractTool::CreateNode<VSplinePath>(data, id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return VAbstractTool::CreateNode<VCubicBezierPath>(data, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//static functions
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VAbstractTool container.
|
* @brief VAbstractTool container.
|
||||||
|
@ -379,7 +350,7 @@ QMap<QString, QString> VAbstractTool::ColorsList()
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QMap<QString, quint32> VAbstractTool::PointsList() const
|
QMap<QString, quint32> VAbstractTool::PointsList() const
|
||||||
{
|
{
|
||||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data.DataGObjects();
|
const QHash<quint32, QSharedPointer<VGObject> > *objs = data.CalculationGObjects();
|
||||||
QMap<QString, quint32> list;
|
QMap<QString, quint32> list;
|
||||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||||
|
@ -387,7 +358,7 @@ QMap<QString, quint32> VAbstractTool::PointsList() const
|
||||||
if (i.key() != m_id)
|
if (i.key() != m_id)
|
||||||
{
|
{
|
||||||
QSharedPointer<VGObject> obj = i.value();
|
QSharedPointer<VGObject> obj = i.value();
|
||||||
if (obj->getType() == GOType::Point && obj->getMode() == Draw::Calculation)
|
if (obj->getType() == GOType::Point)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = data.GeometricObject<VPointF>(i.key());
|
const QSharedPointer<VPointF> point = data.GeometricObject<VPointF>(i.key());
|
||||||
list[point->name()] = i.key();
|
list[point->name()] = i.key();
|
||||||
|
@ -694,3 +665,29 @@ quint32 VAbstractTool::PrepareNode(const VPieceNode &node, VMainGraphicsScene *s
|
||||||
}
|
}
|
||||||
return initData.id;
|
return initData.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VAbstractTool::CreateNodeSpline(VContainer *data, quint32 id)
|
||||||
|
{
|
||||||
|
if (data->GetGObject(id)->getType() == GOType::Spline)
|
||||||
|
{
|
||||||
|
return VAbstractTool::CreateNode<VSpline>(data, id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return VAbstractTool::CreateNode<VCubicBezier>(data, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VAbstractTool::CreateNodeSplinePath(VContainer *data, quint32 id)
|
||||||
|
{
|
||||||
|
if (data->GetGObject(id)->getType() == GOType::SplinePath)
|
||||||
|
{
|
||||||
|
return VAbstractTool::CreateNode<VSplinePath>(data, id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return VAbstractTool::CreateNode<VCubicBezierPath>(data, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -110,8 +110,6 @@ public:
|
||||||
virtual void ShowVisualization(bool show) =0;
|
virtual void ShowVisualization(bool show) =0;
|
||||||
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos);
|
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos);
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static quint32 CreateNode(VContainer *data, quint32 id);
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
* @brief FullUpdateFromFile update tool data form file.
|
||||||
|
@ -162,6 +160,11 @@ protected:
|
||||||
virtual void DeleteToolWithConfirm(bool ask = true);
|
virtual void DeleteToolWithConfirm(bool ask = true);
|
||||||
static int ConfirmDeletion();
|
static int ConfirmDeletion();
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static quint32 CreateNode(VContainer *data, quint32 id);
|
||||||
|
static quint32 CreateNodeSpline(VContainer *data, quint32 id);
|
||||||
|
static quint32 CreateNodeSplinePath(VContainer *data, quint32 id);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVisualization();
|
void AddVisualization();
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,13 @@
|
||||||
|
|
||||||
#include "vtoolseamallowance.h"
|
#include "vtoolseamallowance.h"
|
||||||
#include "../dialogs/tools/piece/dialogseamallowance.h"
|
#include "../dialogs/tools/piece/dialogseamallowance.h"
|
||||||
|
#include "../dialogs/tools/piece/dialogduplicatedetail.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
#include "../vpatterndb/vpiecepath.h"
|
#include "../vpatterndb/vpiecepath.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "nodeDetails/vnodearc.h"
|
#include "nodeDetails/nodedetails.h"
|
||||||
#include "nodeDetails/vnodeellipticalarc.h"
|
|
||||||
#include "nodeDetails/vnodepoint.h"
|
|
||||||
#include "nodeDetails/vnodespline.h"
|
|
||||||
#include "nodeDetails/vnodesplinepath.h"
|
|
||||||
#include "nodeDetails/vtoolpiecepath.h"
|
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
#include "../vgeometry/vellipticalarc.h"
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
|
@ -46,6 +42,7 @@
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vgeometry/vspline.h"
|
#include "../vgeometry/vspline.h"
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
#include "../undocommands/addpiece.h"
|
#include "../undocommands/addpiece.h"
|
||||||
#include "../undocommands/deletepiece.h"
|
#include "../undocommands/deletepiece.h"
|
||||||
|
@ -151,6 +148,50 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD
|
||||||
return piece;
|
return piece;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VToolSeamAllowance *VToolSeamAllowance::Duplicate(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
|
||||||
|
VAbstractPattern *doc)
|
||||||
|
{
|
||||||
|
SCASSERT(not dialog.isNull());
|
||||||
|
QSharedPointer<DialogDuplicateDetail> dialogTool = dialog.objectCast<DialogDuplicateDetail>();
|
||||||
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
VToolSeamAllowanceInitData initData;
|
||||||
|
initData.scene = scene;
|
||||||
|
initData.doc = doc;
|
||||||
|
initData.parse = Document::FullParse;
|
||||||
|
initData.typeCreation = Source::FromGui;
|
||||||
|
initData.drawName = doc->PieceDrawName(dialogTool->Duplicate());
|
||||||
|
|
||||||
|
VContainer toolData = VAbstractPattern::getTool(dialogTool->Duplicate())->getData();
|
||||||
|
initData.data = &toolData;
|
||||||
|
|
||||||
|
VPiece detail = initData.data->GetPiece(dialogTool->Duplicate());
|
||||||
|
detail.SetMx(dialogTool->MoveDuplicateX());
|
||||||
|
detail.SetMy(dialogTool->MoveDuplicateY());
|
||||||
|
initData.detail = detail;
|
||||||
|
initData.width = initData.detail.GetFormulaSAWidth();
|
||||||
|
|
||||||
|
return Duplicate(initData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VToolSeamAllowance *VToolSeamAllowance::Duplicate(VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
VPiece dupDetail = initData.detail;
|
||||||
|
|
||||||
|
QMap<quint32, quint32> replacements;
|
||||||
|
dupDetail.GetPath().SetNodes(DuplicateNodes(initData.detail.GetPath(), initData, replacements));
|
||||||
|
dupDetail.SetCustomSARecords(DuplicateCustomSARecords(initData.detail.GetCustomSARecords(), initData,
|
||||||
|
replacements));
|
||||||
|
dupDetail.SetInternalPaths(DuplicateInternalPaths(initData.detail.GetInternalPaths(), initData));
|
||||||
|
dupDetail.SetPins(DuplicatePins(initData.detail.GetPins(), initData));
|
||||||
|
dupDetail.SetPlaceLabels(DuplicatePlaceLabels(initData.detail.GetPlaceLabels(), initData));
|
||||||
|
|
||||||
|
initData.detail = dupDetail;
|
||||||
|
return VToolSeamAllowance::Create(initData);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::RemoveWithConfirm(bool ask)
|
void VToolSeamAllowance::RemoveWithConfirm(bool ask)
|
||||||
{
|
{
|
||||||
|
@ -1005,11 +1046,6 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't forget to update geometry, because first change never call full parse
|
|
||||||
VPiece detail = VAbstractTool::data.GetPiece(m_id);
|
|
||||||
detail.SetMx(newPos.x());
|
|
||||||
detail.SetMy(newPos.y());
|
|
||||||
VAbstractTool::data.UpdatePiece(m_id, detail);
|
|
||||||
|
|
||||||
changeFinished = true;
|
changeFinished = true;
|
||||||
}
|
}
|
||||||
|
@ -1741,3 +1777,179 @@ void VToolSeamAllowance::AddPointRecords(VAbstractPattern *doc, QDomElement &dom
|
||||||
domElement.appendChild(pinsElement);
|
domElement.appendChild(pinsElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VToolSeamAllowance::DuplicateNode(const VPieceNode &node, const VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
SCASSERT(initData.scene != nullptr)
|
||||||
|
SCASSERT(initData.doc != nullptr)
|
||||||
|
SCASSERT(initData.data != nullptr)
|
||||||
|
|
||||||
|
const QSharedPointer<VGObject> gobj = initData.data->GetGObject(node.GetId());
|
||||||
|
|
||||||
|
VAbstractNodeInitData initNodeData;
|
||||||
|
initNodeData.idObject = gobj->getIdObject();
|
||||||
|
initNodeData.doc = initData.doc;
|
||||||
|
initNodeData.data = initData.data;
|
||||||
|
initNodeData.parse = Document::FullParse;
|
||||||
|
initNodeData.typeCreation = Source::FromGui;
|
||||||
|
initNodeData.scene = initData.scene;
|
||||||
|
initNodeData.drawName = initData.drawName;
|
||||||
|
|
||||||
|
switch (node.GetTypeTool())
|
||||||
|
{
|
||||||
|
case (Tool::NodePoint):
|
||||||
|
initNodeData.id = VAbstractTool::CreateNode<VPointF>(initData.data, gobj->getIdObject());
|
||||||
|
VNodePoint::Create(initNodeData);
|
||||||
|
break;
|
||||||
|
case (Tool::NodeArc):
|
||||||
|
initNodeData.id = VAbstractTool::CreateNode<VArc>(initData.data, gobj->getIdObject());
|
||||||
|
VNodeArc::Create(initNodeData);
|
||||||
|
break;
|
||||||
|
case (Tool::NodeElArc):
|
||||||
|
initNodeData.id = VAbstractTool::CreateNode<VEllipticalArc>(initData.data, gobj->getIdObject());
|
||||||
|
VNodeEllipticalArc::Create(initNodeData);
|
||||||
|
break;
|
||||||
|
case (Tool::NodeSpline):
|
||||||
|
initNodeData.id = VAbstractTool::CreateNodeSpline(initData.data, gobj->getIdObject());
|
||||||
|
VNodeSpline::Create(initNodeData);
|
||||||
|
break;
|
||||||
|
case (Tool::NodeSplinePath):
|
||||||
|
initNodeData.id = VAbstractTool::CreateNodeSplinePath(initData.data, gobj->getIdObject());
|
||||||
|
VNodeSplinePath::Create(initNodeData);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return initNodeData.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VToolSeamAllowance::DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
VPiecePath path = initData.data->GetPiecePath(id);
|
||||||
|
VPiecePath newPath = path;
|
||||||
|
QMap<quint32, quint32> recordReplacements; // Not used
|
||||||
|
newPath.SetNodes(DuplicateNodes(path, initData, recordReplacements));
|
||||||
|
|
||||||
|
const quint32 idPath = initData.data->AddPiecePath(newPath);
|
||||||
|
|
||||||
|
VToolPiecePathInitData initNodeData;
|
||||||
|
initNodeData.id = idPath;
|
||||||
|
initNodeData.idObject = NULL_ID; // piece id
|
||||||
|
initNodeData.scene = initData.scene;
|
||||||
|
initNodeData.doc = initData.doc;
|
||||||
|
initNodeData.data = initData.data;
|
||||||
|
initNodeData.parse = Document::FullParse;
|
||||||
|
initNodeData.typeCreation = Source::FromTool;
|
||||||
|
initNodeData.drawName = initData.drawName;
|
||||||
|
initNodeData.path = newPath;
|
||||||
|
|
||||||
|
VToolPiecePath::Create(initNodeData);
|
||||||
|
return idPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<CustomSARecord> VToolSeamAllowance::DuplicateCustomSARecords(const QVector<CustomSARecord> &records,
|
||||||
|
const VToolSeamAllowanceInitData &initData,
|
||||||
|
const QMap<quint32, quint32> &replacements)
|
||||||
|
{
|
||||||
|
QVector<CustomSARecord> newRecords;
|
||||||
|
for(int i=0; i < records.size(); ++i)
|
||||||
|
{
|
||||||
|
CustomSARecord record = records.at(i);
|
||||||
|
record.path = DuplicatePiecePath(record.path, initData);
|
||||||
|
record.startPoint = replacements.value(record.startPoint, NULL_ID);
|
||||||
|
record.endPoint = replacements.value(record.endPoint, NULL_ID);
|
||||||
|
newRecords.append(record);
|
||||||
|
}
|
||||||
|
return newRecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VToolSeamAllowance::DuplicateInternalPaths(const QVector<quint32> &iPaths,
|
||||||
|
const VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
QVector<quint32> newPaths;
|
||||||
|
for(int i=0; i < iPaths.size(); ++i)
|
||||||
|
{
|
||||||
|
newPaths.append(DuplicatePiecePath(iPaths.at(i), initData));
|
||||||
|
}
|
||||||
|
return newPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VToolSeamAllowance::DuplicatePins(const QVector<quint32> &pins,
|
||||||
|
const VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
QVector<quint32> newPins;
|
||||||
|
for(int i=0; i < pins.size(); ++i)
|
||||||
|
{
|
||||||
|
QSharedPointer<VPointF> pin = initData.data->GeometricObject<VPointF>(pins.at(i));
|
||||||
|
|
||||||
|
VToolPinInitData initNodeData;
|
||||||
|
initNodeData.id = initData.data->AddGObject(new VPointF(*pin));
|
||||||
|
initNodeData.pointId = pin->getIdObject();
|
||||||
|
initNodeData.idObject = NULL_ID; // piece id
|
||||||
|
initNodeData.doc = initData.doc;
|
||||||
|
initNodeData.data = initData.data;
|
||||||
|
initNodeData.parse = Document::FullParse;
|
||||||
|
initNodeData.typeCreation = Source::FromTool;
|
||||||
|
initNodeData.drawName = initData.drawName;
|
||||||
|
|
||||||
|
VToolPin::Create(initNodeData);
|
||||||
|
newPins.append(initNodeData.id);
|
||||||
|
}
|
||||||
|
return newPins;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32> &placeLabels,
|
||||||
|
const VToolSeamAllowanceInitData &initData)
|
||||||
|
{
|
||||||
|
QVector<quint32> newPlaceLabels;
|
||||||
|
for(int i=0; i < placeLabels.size(); ++i)
|
||||||
|
{
|
||||||
|
QSharedPointer<VPlaceLabelItem> label = initData.data->GeometricObject<VPlaceLabelItem>(placeLabels.at(i));
|
||||||
|
|
||||||
|
VToolPlaceLabelInitData initNodeData;
|
||||||
|
initNodeData.idObject = NULL_ID; // piece id
|
||||||
|
initNodeData.doc = initData.doc;
|
||||||
|
initNodeData.data = initData.data;
|
||||||
|
initNodeData.parse = Document::FullParse;
|
||||||
|
initNodeData.typeCreation = Source::FromTool;
|
||||||
|
initNodeData.drawName = initData.drawName;
|
||||||
|
initNodeData.width = label->GetWidthFormula();
|
||||||
|
initNodeData.height = label->GetHeightFormula();
|
||||||
|
initNodeData.angle = label->GetAngleFormula();
|
||||||
|
initNodeData.type = label->GetLabelType();
|
||||||
|
initNodeData.centerPoint = label->GetCenterPoint();
|
||||||
|
initNodeData.id = initNodeData.data->AddGObject(new VPlaceLabelItem(*label));
|
||||||
|
|
||||||
|
VToolPlaceLabel::Create(initNodeData);
|
||||||
|
newPlaceLabels.append(initNodeData.id);
|
||||||
|
}
|
||||||
|
return newPlaceLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VPieceNode> VToolSeamAllowance::DuplicateNodes(const VPiecePath &path,
|
||||||
|
const VToolSeamAllowanceInitData &initData,
|
||||||
|
QMap<quint32, quint32> &replacements)
|
||||||
|
{
|
||||||
|
QVector<VPieceNode> nodes;
|
||||||
|
for (int i = 0; i< path.CountNodes(); ++i)
|
||||||
|
{
|
||||||
|
VPieceNode nodeD = path.at(i);
|
||||||
|
const quint32 oldId = nodeD.GetId();
|
||||||
|
const quint32 id = DuplicateNode(nodeD, initData);
|
||||||
|
if (id > NULL_ID)
|
||||||
|
{
|
||||||
|
nodeD.SetId(id);
|
||||||
|
nodes.append(nodeD);
|
||||||
|
replacements.insert(oldId, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ public:
|
||||||
static VToolSeamAllowance* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
|
static VToolSeamAllowance* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
|
||||||
VAbstractPattern *doc, VContainer *data);
|
VAbstractPattern *doc, VContainer *data);
|
||||||
static VToolSeamAllowance* Create(VToolSeamAllowanceInitData &initData);
|
static VToolSeamAllowance* Create(VToolSeamAllowanceInitData &initData);
|
||||||
|
static VToolSeamAllowance* Duplicate(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
|
||||||
|
VAbstractPattern *doc);
|
||||||
|
static VToolSeamAllowance* Duplicate(VToolSeamAllowanceInitData &initData);
|
||||||
|
|
||||||
static const quint8 pieceVersion;
|
static const quint8 pieceVersion;
|
||||||
|
|
||||||
|
@ -197,6 +200,22 @@ private:
|
||||||
|
|
||||||
static void AddPointRecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &records,
|
static void AddPointRecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &records,
|
||||||
const QString &tag);
|
const QString &tag);
|
||||||
|
|
||||||
|
static QVector<VPieceNode> DuplicateNodes(const VPiecePath &path, const VToolSeamAllowanceInitData &initData,
|
||||||
|
QMap<quint32, quint32> &replacements);
|
||||||
|
static quint32 DuplicateNode(const VPieceNode &node, const VToolSeamAllowanceInitData &initData);
|
||||||
|
|
||||||
|
static quint32 DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData);
|
||||||
|
|
||||||
|
static QVector<CustomSARecord> DuplicateCustomSARecords(const QVector<CustomSARecord> &records,
|
||||||
|
const VToolSeamAllowanceInitData &initData,
|
||||||
|
const QMap<quint32, quint32> &replacements);
|
||||||
|
|
||||||
|
static QVector<quint32> DuplicateInternalPaths(const QVector<quint32> &iPaths,
|
||||||
|
const VToolSeamAllowanceInitData &initData);
|
||||||
|
static QVector<quint32> DuplicatePins(const QVector<quint32> &pins, const VToolSeamAllowanceInitData &initData);
|
||||||
|
static QVector<quint32> DuplicatePlaceLabels(const QVector<quint32> &placeLabels,
|
||||||
|
const VToolSeamAllowanceInitData &initData);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLSEAMALLOWANCE_H
|
#endif // VTOOLSEAMALLOWANCE_H
|
||||||
|
|
|
@ -1538,19 +1538,38 @@ void CreateUnitedDetail(const VToolUnionDetailsInitData &initData, qreal dx, qre
|
||||||
|
|
||||||
VToolSeamAllowance::Create(pieceInitData);
|
VToolSeamAllowance::Create(pieceInitData);
|
||||||
|
|
||||||
auto RemoveDetail = [initData](quint32 id)
|
auto DuplicateDetail = [initData](quint32 id)
|
||||||
|
{
|
||||||
|
VToolSeamAllowanceInitData initPieceData;
|
||||||
|
initPieceData.scene = initData.scene;
|
||||||
|
initPieceData.doc = initData.doc;
|
||||||
|
initPieceData.parse = Document::FullParse;
|
||||||
|
initPieceData.typeCreation = Source::FromGui;
|
||||||
|
initPieceData.drawName = initData.doc->PieceDrawName(id);
|
||||||
|
|
||||||
|
VContainer toolData = VAbstractPattern::getTool(id)->getData();
|
||||||
|
initPieceData.data = &toolData;
|
||||||
|
|
||||||
|
initPieceData.detail = initData.data->GetPiece(id);
|
||||||
|
initPieceData.width = initPieceData.detail.GetFormulaSAWidth();
|
||||||
|
VToolSeamAllowance::Duplicate(initPieceData);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (initData.retainPieces)
|
||||||
|
{
|
||||||
|
DuplicateDetail(initData.d1id);
|
||||||
|
DuplicateDetail(initData.d2id);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto RemoveDetail = [](quint32 id)
|
||||||
{
|
{
|
||||||
VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(id));
|
VToolSeamAllowance *toolDet = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(id));
|
||||||
SCASSERT(toolDet != nullptr);
|
SCASSERT(toolDet != nullptr);
|
||||||
bool ask = false;
|
toolDet->RemoveWithConfirm(false);
|
||||||
toolDet->RemoveWithConfirm(ask);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (not initData.retainPieces)
|
RemoveDetail(initData.d1id);
|
||||||
{
|
RemoveDetail(initData.d2id);
|
||||||
RemoveDetail(initData.d1id);
|
|
||||||
RemoveDetail(initData.d2id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vistoolduplicatedetail.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 10, 2017
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2017 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#include "vistoolduplicatedetail.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VisToolDuplicateDetail::VisToolDuplicateDetail(const VContainer *data, QGraphicsItem *parent)
|
||||||
|
: VisPath(data, parent),
|
||||||
|
m_start(),
|
||||||
|
m_started(false),
|
||||||
|
m_diff()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolDuplicateDetail::RefreshGeometry()
|
||||||
|
{
|
||||||
|
const VPiece piece = Visualization::data->GetPiece(object1Id);
|
||||||
|
|
||||||
|
if (not m_started)
|
||||||
|
{
|
||||||
|
m_start = Visualization::scenePos;
|
||||||
|
m_started = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_diff = Visualization::scenePos - m_start;
|
||||||
|
setPos(m_diff);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawPath(this, PiecePath(piece), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VisToolDuplicateDetail::PiecePath(const VPiece &piece) const
|
||||||
|
{
|
||||||
|
if (not piece.IsHideMainPath() || not piece.IsSeamAllowance() || piece.IsSeamAllowanceBuiltIn())
|
||||||
|
{
|
||||||
|
return piece.MainPathPath(Visualization::data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return piece.SeamAllowancePath(Visualization::data);
|
||||||
|
}
|
||||||
|
}
|
68
src/libs/vtools/visualization/path/vistoolduplicatedetail.h
Normal file
68
src/libs/vtools/visualization/path/vistoolduplicatedetail.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vistoolduplicatedetail.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 10, 2017
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2017 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#ifndef VISTOOLDUPLICATEDETAIL_H
|
||||||
|
#define VISTOOLDUPLICATEDETAIL_H
|
||||||
|
|
||||||
|
#include "vispath.h"
|
||||||
|
#include "../vpatterndb/vpiece.h"
|
||||||
|
|
||||||
|
class VisToolDuplicateDetail : public VisPath
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VisToolDuplicateDetail(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||||
|
virtual ~VisToolDuplicateDetail() = default;
|
||||||
|
|
||||||
|
qreal Mx() const;
|
||||||
|
qreal My() const;
|
||||||
|
|
||||||
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
enum { Type = UserType + static_cast<int>(Vis::ToolDuplicateDetail)};
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VisToolDuplicateDetail)
|
||||||
|
QPointF m_start;
|
||||||
|
bool m_started;
|
||||||
|
QPointF m_diff;
|
||||||
|
|
||||||
|
QPainterPath PiecePath(const VPiece &piece) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal VisToolDuplicateDetail::Mx() const
|
||||||
|
{
|
||||||
|
return m_diff.x();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal VisToolDuplicateDetail::My() const
|
||||||
|
{
|
||||||
|
return m_diff.y();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VISTOOLDUPLICATEDETAIL_H
|
|
@ -42,7 +42,8 @@ HEADERS += \
|
||||||
$$PWD/path/vistoolpiece.h \
|
$$PWD/path/vistoolpiece.h \
|
||||||
$$PWD/path/vistoolpiecepath.h \
|
$$PWD/path/vistoolpiecepath.h \
|
||||||
$$PWD/path/vispiecespecialpoints.h \
|
$$PWD/path/vispiecespecialpoints.h \
|
||||||
$$PWD/line/vistoolspecialpoint.h
|
$$PWD/line/vistoolspecialpoint.h \
|
||||||
|
$$PWD/path/vistoolduplicatedetail.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/visualization.cpp \
|
$$PWD/visualization.cpp \
|
||||||
|
@ -85,4 +86,5 @@ SOURCES += \
|
||||||
$$PWD/path/vistoolpiece.cpp \
|
$$PWD/path/vistoolpiece.cpp \
|
||||||
$$PWD/path/vistoolpiecepath.cpp \
|
$$PWD/path/vistoolpiecepath.cpp \
|
||||||
$$PWD/path/vispiecespecialpoints.cpp \
|
$$PWD/path/vispiecespecialpoints.cpp \
|
||||||
$$PWD/line/vistoolspecialpoint.cpp
|
$$PWD/line/vistoolspecialpoint.cpp \
|
||||||
|
$$PWD/path/vistoolduplicatedetail.cpp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user