|
@ -27,6 +27,7 @@
|
||||||
- [#765] New feature. Free curve mode.
|
- [#765] New feature. Free curve mode.
|
||||||
- [#657] Improve feature: Allow more paper formats for printing tiled PDF
|
- [#657] Improve feature: Allow more paper formats for printing tiled PDF
|
||||||
- [#768] New feature. Custom curve approximation scale.
|
- [#768] New feature. Custom curve approximation scale.
|
||||||
|
- [#759] Add place label tool.
|
||||||
|
|
||||||
# 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) == 53, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "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) == 53, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "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) == 53, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "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) == 53, "Not all tools were used in history.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "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)
|
||||||
|
@ -406,6 +406,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::Move:
|
case Tool::Move:
|
||||||
case Tool::PiecePath:
|
case Tool::PiecePath:
|
||||||
case Tool::Pin:
|
case Tool::Pin:
|
||||||
|
case Tool::PlaceLabel:
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "tools/vtoolseamallowance.h"
|
#include "tools/vtoolseamallowance.h"
|
||||||
#include "tools/nodeDetails/vtoolpiecepath.h"
|
#include "tools/nodeDetails/vtoolpiecepath.h"
|
||||||
#include "tools/nodeDetails/vtoolpin.h"
|
#include "tools/nodeDetails/vtoolpin.h"
|
||||||
|
#include "tools/nodeDetails/vtoolplacelabel.h"
|
||||||
#include "tools/vtooluniondetails.h"
|
#include "tools/vtooluniondetails.h"
|
||||||
#include "dialogs/dialogs.h"
|
#include "dialogs/dialogs.h"
|
||||||
#include "dialogs/vwidgetgroups.h"
|
#include "dialogs/vwidgetgroups.h"
|
||||||
|
@ -611,6 +612,9 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
ui->view->setShowToolOptions(false);
|
ui->view->setShowToolOptions(false);
|
||||||
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
|
||||||
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Check if need to extend.");
|
||||||
|
|
||||||
switch(t)
|
switch(t)
|
||||||
{
|
{
|
||||||
case Tool::Midpoint:
|
case Tool::Midpoint:
|
||||||
|
@ -619,6 +623,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
case Tool::PiecePath:
|
case Tool::PiecePath:
|
||||||
case Tool::Pin:
|
case Tool::Pin:
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
|
case Tool::PlaceLabel:
|
||||||
dialogTool->SetPiecesList(doc->GetActivePPPieces());
|
dialogTool->SetPiecesList(doc->GetActivePPPieces());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1033,6 +1038,14 @@ void MainWindow::ToolPin(bool checked)
|
||||||
&MainWindow::ClosedDialogPin);
|
&MainWindow::ClosedDialogPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ToolPlaceLabel(bool checked)
|
||||||
|
{
|
||||||
|
ToolSelectPointByRelease();
|
||||||
|
SetToolButton<DialogPlaceLabel>(checked, Tool::PlaceLabel, "://cursor/place_label_cursor.png",
|
||||||
|
tr("Select placelabel center point"), &MainWindow::ClosedDialogPlaceLabel);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ToolHeight handler tool height.
|
* @brief ToolHeight handler tool height.
|
||||||
|
@ -1200,6 +1213,18 @@ void MainWindow::ClosedDialogPin(int result)
|
||||||
doc->LiteParseTree(Document::LiteParse);
|
doc->LiteParseTree(Document::LiteParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ClosedDialogPlaceLabel(int result)
|
||||||
|
{
|
||||||
|
SCASSERT(dialogTool != nullptr);
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
VToolPlaceLabel::Create(dialogTool, doc, pattern);
|
||||||
|
}
|
||||||
|
ArrowTool();
|
||||||
|
doc->LiteParseTree(Document::LiteParse);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ClosedDialogInsertNode(int result)
|
void MainWindow::ClosedDialogInsertNode(int result)
|
||||||
{
|
{
|
||||||
|
@ -1960,7 +1985,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) == 53, "Check if all tools were connected.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "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);
|
||||||
|
@ -2009,6 +2034,7 @@ void MainWindow::InitToolButtons()
|
||||||
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
|
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
|
||||||
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
|
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
|
||||||
connect(ui->toolButtonInsertNode, &QToolButton::clicked, this, &MainWindow::ToolInsertNode);
|
connect(ui->toolButtonInsertNode, &QToolButton::clicked, this, &MainWindow::ToolInsertNode);
|
||||||
|
connect(ui->toolButtonPlaceLabel, &QToolButton::clicked, this, &MainWindow::ToolPlaceLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2036,7 +2062,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) == 53, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Canceling tool.");
|
qCDebug(vMainWindow, "Canceling tool.");
|
||||||
dialogTool.clear();
|
dialogTool.clear();
|
||||||
|
@ -2200,6 +2226,9 @@ void MainWindow::CancelTool()
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
ui->toolButtonInsertNode->setChecked(false);
|
ui->toolButtonInsertNode->setChecked(false);
|
||||||
break;
|
break;
|
||||||
|
case Tool::PlaceLabel:
|
||||||
|
ui->toolButtonPlaceLabel->setChecked(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crash: using CRTL+Z while using line tool.
|
// Crash: using CRTL+Z while using line tool.
|
||||||
|
@ -3378,6 +3407,8 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
bool modelingTools = false;
|
bool modelingTools = false;
|
||||||
bool layoutTools = false;
|
bool layoutTools = false;
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case Draw::Calculation:
|
case Draw::Calculation:
|
||||||
|
@ -3389,12 +3420,11 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
case Draw::Layout:
|
case Draw::Layout:
|
||||||
layoutTools = enable;
|
layoutTools = enable;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
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) == 53, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
||||||
|
|
||||||
//Drawing Tools
|
//Drawing Tools
|
||||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||||
|
@ -3437,6 +3467,7 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
ui->toolButtonEllipticalArc->setEnabled(drawTools);
|
ui->toolButtonEllipticalArc->setEnabled(drawTools);
|
||||||
ui->toolButtonPin->setEnabled(drawTools);
|
ui->toolButtonPin->setEnabled(drawTools);
|
||||||
ui->toolButtonInsertNode->setEnabled(drawTools);
|
ui->toolButtonInsertNode->setEnabled(drawTools);
|
||||||
|
ui->toolButtonPlaceLabel->setEnabled(drawTools);
|
||||||
|
|
||||||
ui->actionLast_tool->setEnabled(drawTools);
|
ui->actionLast_tool->setEnabled(drawTools);
|
||||||
|
|
||||||
|
@ -3721,7 +3752,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) == 53, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were handled.");
|
||||||
|
|
||||||
if (currentTool == lastUsedTool)
|
if (currentTool == lastUsedTool)
|
||||||
{
|
{
|
||||||
|
@ -3916,6 +3947,10 @@ void MainWindow::LastUsedTool()
|
||||||
ui->toolButtonInsertNode->setChecked(true);
|
ui->toolButtonInsertNode->setChecked(true);
|
||||||
ToolInsertNode(true);
|
ToolInsertNode(true);
|
||||||
break;
|
break;
|
||||||
|
case Tool::PlaceLabel:
|
||||||
|
ui->toolButtonPlaceLabel->setChecked(true);
|
||||||
|
ToolPlaceLabel(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@ private slots:
|
||||||
void ToolDetail(bool checked);
|
void ToolDetail(bool checked);
|
||||||
void ToolPiecePath(bool checked);
|
void ToolPiecePath(bool checked);
|
||||||
void ToolPin(bool checked);
|
void ToolPin(bool checked);
|
||||||
|
void ToolPlaceLabel(bool checked);
|
||||||
void ToolHeight(bool checked);
|
void ToolHeight(bool checked);
|
||||||
void ToolTriangle(bool checked);
|
void ToolTriangle(bool checked);
|
||||||
void ToolPointOfIntersection(bool checked);
|
void ToolPointOfIntersection(bool checked);
|
||||||
|
@ -180,6 +181,7 @@ private slots:
|
||||||
void ClosedDialogGroup(int result);
|
void ClosedDialogGroup(int result);
|
||||||
void ClosedDialogPiecePath(int result);
|
void ClosedDialogPiecePath(int result);
|
||||||
void ClosedDialogPin(int result);
|
void ClosedDialogPin(int result);
|
||||||
|
void ClosedDialogPlaceLabel(int result);
|
||||||
void ClosedDialogInsertNode(int result);
|
void ClosedDialogInsertNode(int result);
|
||||||
|
|
||||||
void ZoomFitBestCurrent();
|
void ZoomFitBestCurrent();
|
||||||
|
|
|
@ -55,8 +55,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>127</width>
|
<width>126</width>
|
||||||
<height>358</height>
|
<height>351</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -402,7 +402,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>110</height>
|
<height>108</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -511,7 +511,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>248</height>
|
<height>243</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -773,7 +773,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>248</height>
|
<height>243</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1038,7 +1038,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>104</height>
|
<height>102</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1121,7 +1121,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>328</height>
|
<height>324</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1325,7 +1325,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>196</height>
|
<height>237</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1527,6 +1527,32 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QToolButton" name="toolButtonPlaceLabel">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Place label tool</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/toolicon.qrc">
|
||||||
|
<normaloff>:/toolicon/32x32/place_label.png</normaloff>:/toolicon/32x32/place_label.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">
|
||||||
|
@ -1535,7 +1561,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>328</height>
|
<height>324</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1635,7 +1661,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1100</width>
|
<width>1100</width>
|
||||||
<height>25</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
@ -2737,8 +2763,8 @@
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
|
||||||
<include location="share/resources/toolicon.qrc"/>
|
<include location="share/resources/toolicon.qrc"/>
|
||||||
|
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -84,5 +84,7 @@
|
||||||
<file>cursor/pin_cursor@2x.png</file>
|
<file>cursor/pin_cursor@2x.png</file>
|
||||||
<file>cursor/insert_node_cursor.png</file>
|
<file>cursor/insert_node_cursor.png</file>
|
||||||
<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.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/valentina/share/resources/cursor/place_label_cursor.png
Normal file
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 1.1 KiB |
|
@ -82,5 +82,7 @@
|
||||||
<file>toolicon/32x32/pin@2x.png</file>
|
<file>toolicon/32x32/pin@2x.png</file>
|
||||||
<file>toolicon/32x32/insert_node.png</file>
|
<file>toolicon/32x32/insert_node.png</file>
|
||||||
<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.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/valentina/share/resources/toolicon/32x32/place_label.png
Normal file
After Width: | Height: | Size: 678 B |
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="64mm"
|
||||||
|
height="64mm"
|
||||||
|
viewBox="0 0 226.77165 226.77165"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.92.2 (unknown)"
|
||||||
|
sodipodi:docname="place_label.svg"
|
||||||
|
inkscape:export-filename="/home/dismine/CAD/Valentina_l/valentina/src/app/valentina/share/resources/toolicon/32x32/place_label@2x.png"
|
||||||
|
inkscape:export-xdpi="25.4"
|
||||||
|
inkscape:export-ydpi="25.4">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="2"
|
||||||
|
inkscape:cx="-22.553988"
|
||||||
|
inkscape:cy="100.48005"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:window-width="1855"
|
||||||
|
inkscape:window-height="1056"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<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(-109.37599,-227.40381)">
|
||||||
|
<circle
|
||||||
|
id="path10"
|
||||||
|
cx="223.75099"
|
||||||
|
cy="337.92545"
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:7.49999967;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
r="78.545052" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:7.49999967;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 119.68849,338.39421 H 328.28223"
|
||||||
|
id="path5970"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:7.49999967;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 223.97847,239.2938 V 445.07504"
|
||||||
|
id="path5972"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -850,7 +850,7 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
|
|
||||||
initData.width = GetParametrString(domElement, AttrWidth, "0.0");
|
initData.width = GetParametrString(domElement, AttrWidth, "0.0");
|
||||||
const QString w = initData.width;//need for saving fixed formula;
|
const QString w = initData.width;//need for saving fixed formula;
|
||||||
const uint version = GetParametrUInt(domElement, VToolSeamAllowance::AttrVersion, "1");
|
const uint version = GetParametrUInt(domElement, AttrVersion, "1");
|
||||||
|
|
||||||
const QStringList tags = QStringList() << TagNodes
|
const QStringList tags = QStringList() << TagNodes
|
||||||
<< TagData
|
<< TagData
|
||||||
|
@ -858,7 +858,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
<< TagGrainline
|
<< TagGrainline
|
||||||
<< VToolSeamAllowance::TagCSA
|
<< VToolSeamAllowance::TagCSA
|
||||||
<< VToolSeamAllowance::TagIPaths
|
<< VToolSeamAllowance::TagIPaths
|
||||||
<< VToolSeamAllowance::TagPins;
|
<< VToolSeamAllowance::TagPins
|
||||||
|
<< VToolSeamAllowance::TagPlaceLabels;
|
||||||
|
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
for (qint32 i = 0; i < nodeList.size(); ++i)
|
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||||
|
@ -899,7 +900,10 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
initData.detail.SetInternalPaths(ParsePieceInternalPaths(element));
|
initData.detail.SetInternalPaths(ParsePieceInternalPaths(element));
|
||||||
break;
|
break;
|
||||||
case 6:// VToolSeamAllowance::TagPins
|
case 6:// VToolSeamAllowance::TagPins
|
||||||
initData.detail.SetPins(ParsePiecePins(element));
|
initData.detail.SetPins(ParsePiecePointRecords(element));
|
||||||
|
break;
|
||||||
|
case 7:// VToolSeamAllowance::TagPlaceLabels
|
||||||
|
initData.detail.SetPlaceLabels(ParsePiecePointRecords(element));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -963,7 +967,7 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail)
|
||||||
ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr));
|
ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr));
|
||||||
ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, "0"), GetParametrDouble(domElement, AttrMy, "0")));
|
ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, "0"), GetParametrDouble(domElement, AttrMy, "0")));
|
||||||
ppData.SetLabelWidth(GetParametrString(domElement, AttrWidth, "1"));
|
ppData.SetLabelWidth(GetParametrString(domElement, AttrWidth, "1"));
|
||||||
ppData.SetLabelHeight(GetParametrString(domElement, VToolSeamAllowance::AttrHeight, "1"));
|
ppData.SetLabelHeight(GetParametrString(domElement, AttrHeight, "1"));
|
||||||
ppData.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")));
|
ppData.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")));
|
||||||
ppData.SetRotation(GetParametrString(domElement, AttrRotation, "0"));
|
ppData.SetRotation(GetParametrString(domElement, AttrRotation, "0"));
|
||||||
ppData.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR));
|
ppData.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR));
|
||||||
|
@ -979,7 +983,7 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta
|
||||||
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
||||||
patternInfo.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, "0"), GetParametrDouble(domElement, AttrMy, "0")));
|
patternInfo.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, "0"), GetParametrDouble(domElement, AttrMy, "0")));
|
||||||
patternInfo.SetLabelWidth(GetParametrString(domElement, AttrWidth, "1"));
|
patternInfo.SetLabelWidth(GetParametrString(domElement, AttrWidth, "1"));
|
||||||
patternInfo.SetLabelHeight(GetParametrString(domElement, VToolSeamAllowance::AttrHeight, "1"));
|
patternInfo.SetLabelHeight(GetParametrString(domElement, AttrHeight, "1"));
|
||||||
patternInfo.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")));
|
patternInfo.SetFontSize(static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0")));
|
||||||
patternInfo.SetRotation(GetParametrString(domElement, AttrRotation, "0"));
|
patternInfo.SetRotation(GetParametrString(domElement, AttrRotation, "0"));
|
||||||
patternInfo.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR));
|
patternInfo.SetCenterPin(GetParametrUInt(domElement, VToolSeamAllowance::AttrCenterPin, NULL_ID_STR));
|
||||||
|
@ -1090,7 +1094,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
<< VToolPointFromArcAndTangent::ToolType /*20*/
|
<< VToolPointFromArcAndTangent::ToolType /*20*/
|
||||||
<< VToolTrueDarts::ToolType /*21*/
|
<< VToolTrueDarts::ToolType /*21*/
|
||||||
<< VToolPointOfIntersectionCurves::ToolType /*22*/
|
<< VToolPointOfIntersectionCurves::ToolType /*22*/
|
||||||
<< VToolPin::ToolType; /*23*/
|
<< VToolPin::ToolType /*23*/
|
||||||
|
<< VToolPlaceLabel::ToolType; /*24*/
|
||||||
switch (points.indexOf(type))
|
switch (points.indexOf(type))
|
||||||
{
|
{
|
||||||
case 0: //VToolBasePoint::ToolType
|
case 0: //VToolBasePoint::ToolType
|
||||||
|
@ -1165,6 +1170,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
case 23: //VToolPin::ToolType
|
case 23: //VToolPin::ToolType
|
||||||
ParsePinPoint(domElement, parse);
|
ParsePinPoint(domElement, parse);
|
||||||
break;
|
break;
|
||||||
|
case 24: //VToolPlaceLabel::ToolType
|
||||||
|
ParsePlaceLabel(domElement, parse);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
VException e(tr("Unknown point type '%1'.").arg(type));
|
VException e(tr("Unknown point type '%1'.").arg(type));
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1696,6 +1704,60 @@ void VPattern::ParsePinPoint(const QDomElement &domElement, const Document &pars
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VToolPlaceLabelInitData initData;
|
||||||
|
initData.doc = this;
|
||||||
|
initData.data = data;
|
||||||
|
initData.parse = parse;
|
||||||
|
initData.typeCreation = Source::FromFile;
|
||||||
|
|
||||||
|
ToolsCommonAttributes(domElement, initData.id);
|
||||||
|
initData.centerPoint = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||||
|
initData.idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
|
||||||
|
|
||||||
|
initData.width = GetParametrString(domElement, AttrWidth, "1.0");
|
||||||
|
const QString w = initData.width;//need for saving fixed formula;
|
||||||
|
|
||||||
|
initData.height = GetParametrString(domElement, AttrHeight, "1.0");
|
||||||
|
const QString h = initData.height;//need for saving fixed formula;
|
||||||
|
|
||||||
|
initData.angle = GetParametrString(domElement, AttrAngle, "0.0");
|
||||||
|
const QString angle = initData.angle;//need for saving fixed formula;
|
||||||
|
|
||||||
|
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, "0"));
|
||||||
|
|
||||||
|
VToolPlaceLabel::Create(initData);
|
||||||
|
|
||||||
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
|
if (w != initData.width || h != initData.height || angle != initData.angle)
|
||||||
|
{
|
||||||
|
SetAttribute(domElement, AttrWidth, initData.width);
|
||||||
|
SetAttribute(domElement, AttrHeight, initData.height);
|
||||||
|
SetAttribute(domElement, AttrAngle, initData.angle);
|
||||||
|
modified = true;
|
||||||
|
haveLiteChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
VExceptionObjectError excep(tr("Error creating or updating place lavel"), domElement);
|
||||||
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
|
throw excep;
|
||||||
|
}
|
||||||
|
catch (qmu::QmuParserError &e)
|
||||||
|
{
|
||||||
|
VExceptionObjectError excep(tr("Error creating or updating place lavel"), domElement);
|
||||||
|
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
|
||||||
|
throw excep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
|
@ -3488,6 +3550,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
VToolUnionDetailsInitData initData;
|
VToolUnionDetailsInitData initData;
|
||||||
initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
|
initData.indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
|
||||||
initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");
|
initData.indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");
|
||||||
|
initData.version = GetParametrUInt(domElement, AttrVersion, "1");
|
||||||
initData.scene = scene;
|
initData.scene = scene;
|
||||||
initData.doc = this;
|
initData.doc = this;
|
||||||
initData.data = data;
|
initData.data = data;
|
||||||
|
@ -4103,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) == 53, "Not all tools were used.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54, "Not all tools were used.");
|
||||||
|
|
||||||
QRectF rec;
|
QRectF rec;
|
||||||
|
|
||||||
|
@ -4183,6 +4246,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
case Tool::PiecePath:
|
case Tool::PiecePath:
|
||||||
case Tool::Pin:
|
case Tool::Pin:
|
||||||
case Tool::InsertNode:
|
case Tool::InsertNode:
|
||||||
|
case Tool::PlaceLabel:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,7 @@ private:
|
||||||
void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
void ParseNodePoint(const QDomElement &domElement, const Document &parse);
|
void ParseNodePoint(const QDomElement &domElement, const Document &parse);
|
||||||
void ParsePinPoint(const QDomElement &domElement, const Document &parse);
|
void ParsePinPoint(const QDomElement &domElement, const Document &parse);
|
||||||
|
void ParsePlaceLabel(QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
void ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
void ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
void ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
const QString CustomMSign = QStringLiteral("@");
|
const QString CustomMSign = QStringLiteral("@");
|
||||||
const QString CustomIncrSign = QStringLiteral("#");
|
const QString CustomIncrSign = QStringLiteral("#");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const QString AttrType = QStringLiteral("type");
|
const QString AttrType = QStringLiteral("type");
|
||||||
const QString AttrMx = QStringLiteral("mx");
|
const QString AttrMx = QStringLiteral("mx");
|
||||||
const QString AttrMy = QStringLiteral("my");
|
const QString AttrMy = QStringLiteral("my");
|
||||||
|
@ -126,6 +124,10 @@ const QString AttrClosed = QStringLiteral("closed");
|
||||||
const QString AttrShowLabel = QStringLiteral("showLabel");
|
const QString AttrShowLabel = QStringLiteral("showLabel");
|
||||||
const QString AttrShowLabel1 = QStringLiteral("showLabel1");
|
const QString AttrShowLabel1 = QStringLiteral("showLabel1");
|
||||||
const QString AttrShowLabel2 = QStringLiteral("showLabel2");
|
const QString AttrShowLabel2 = QStringLiteral("showLabel2");
|
||||||
|
const QString AttrWidth = QStringLiteral("width");
|
||||||
|
const QString AttrHeight = QStringLiteral("height");
|
||||||
|
const QString AttrPlaceLabelType = QStringLiteral("placeLabelType");
|
||||||
|
const QString AttrVersion = QStringLiteral("version");
|
||||||
|
|
||||||
const QString TypeLineNone = QStringLiteral("none");
|
const QString TypeLineNone = QStringLiteral("none");
|
||||||
const QString TypeLineLine = QStringLiteral("hair");
|
const QString TypeLineLine = QStringLiteral("hair");
|
||||||
|
|
|
@ -145,6 +145,10 @@ extern const QString AttrClosed;
|
||||||
extern const QString AttrShowLabel;
|
extern const QString AttrShowLabel;
|
||||||
extern const QString AttrShowLabel1;
|
extern const QString AttrShowLabel1;
|
||||||
extern const QString AttrShowLabel2;
|
extern const QString AttrShowLabel2;
|
||||||
|
extern const QString AttrWidth;
|
||||||
|
extern const QString AttrHeight;
|
||||||
|
extern const QString AttrPlaceLabelType;
|
||||||
|
extern const QString AttrVersion;
|
||||||
|
|
||||||
extern const QString TypeLineNone;
|
extern const QString TypeLineNone;
|
||||||
extern const QString TypeLineLine;
|
extern const QString TypeLineLine;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<file>schema/pattern/v0.6.4.xsd</file>
|
<file>schema/pattern/v0.6.4.xsd</file>
|
||||||
<file>schema/pattern/v0.6.5.xsd</file>
|
<file>schema/pattern/v0.6.5.xsd</file>
|
||||||
<file>schema/pattern/v0.6.6.xsd</file>
|
<file>schema/pattern/v0.6.6.xsd</file>
|
||||||
|
<file>schema/pattern/v0.7.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||||
|
|
1042
src/libs/ifc/schema/pattern/v0.7.0.xsd
Normal file
|
@ -124,7 +124,6 @@ const QString VAbstractPattern::AttrStart = QStringLiteral("start");
|
||||||
const QString VAbstractPattern::AttrPath = QStringLiteral("path");
|
const QString VAbstractPattern::AttrPath = QStringLiteral("path");
|
||||||
const QString VAbstractPattern::AttrEnd = QStringLiteral("end");
|
const QString VAbstractPattern::AttrEnd = QStringLiteral("end");
|
||||||
const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs");
|
const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs");
|
||||||
const QString VAbstractPattern::AttrWidth = QStringLiteral("width");
|
|
||||||
const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
|
const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
|
||||||
const QString VAbstractPattern::AttrNumber = QStringLiteral("number");
|
const QString VAbstractPattern::AttrNumber = QStringLiteral("number");
|
||||||
|
|
||||||
|
@ -678,7 +677,7 @@ QVector<quint32> VAbstractPattern::ParsePieceInternalPaths(const QDomElement &do
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<quint32> VAbstractPattern::ParsePiecePins(const QDomElement &domElement)
|
QVector<quint32> VAbstractPattern::ParsePiecePointRecords(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
QVector<quint32> records;
|
QVector<quint32> records;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -1772,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPoint);
|
const QDomNodeList list = elementsByTagName(TagPoint);
|
||||||
|
@ -1787,6 +1786,8 @@ QVector<VFormulaField> VAbstractPattern::ListPointExpressions() const
|
||||||
ReadExpressionAttribute(expressions, dom, AttrC2Radius);
|
ReadExpressionAttribute(expressions, dom, AttrC2Radius);
|
||||||
ReadExpressionAttribute(expressions, dom, AttrCRadius);
|
ReadExpressionAttribute(expressions, dom, AttrCRadius);
|
||||||
ReadExpressionAttribute(expressions, dom, AttrRadius);
|
ReadExpressionAttribute(expressions, dom, AttrRadius);
|
||||||
|
ReadExpressionAttribute(expressions, dom, AttrWidth);
|
||||||
|
ReadExpressionAttribute(expressions, dom, AttrHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
return expressions;
|
return expressions;
|
||||||
|
@ -1798,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagArc);
|
const QDomNodeList list = elementsByTagName(TagArc);
|
||||||
|
@ -1822,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagElArc);
|
const QDomNodeList list = elementsByTagName(TagElArc);
|
||||||
|
@ -1855,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
||||||
|
@ -1893,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagOperation);
|
const QDomNodeList list = elementsByTagName(TagOperation);
|
||||||
|
@ -1915,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
|
|
||||||
|
@ -1938,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPath);
|
const QDomNodeList list = elementsByTagName(TagPath);
|
||||||
|
@ -1976,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) == 53);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 54);
|
||||||
|
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagDetail);
|
const QDomNodeList list = elementsByTagName(TagDetail);
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
static VPiecePath ParsePieceNodes(const QDomElement &domElement);
|
static VPiecePath ParsePieceNodes(const QDomElement &domElement);
|
||||||
static QVector<CustomSARecord> ParsePieceCSARecords(const QDomElement &domElement);
|
static QVector<CustomSARecord> ParsePieceCSARecords(const QDomElement &domElement);
|
||||||
static QVector<quint32> ParsePieceInternalPaths(const QDomElement &domElement);
|
static QVector<quint32> ParsePieceInternalPaths(const QDomElement &domElement);
|
||||||
static QVector<quint32> ParsePiecePins(const QDomElement &domElement);
|
static QVector<quint32> ParsePiecePointRecords(const QDomElement &domElement);
|
||||||
|
|
||||||
void AddToolOnRemove(VDataTool *tool);
|
void AddToolOnRemove(VDataTool *tool);
|
||||||
|
|
||||||
|
@ -267,7 +267,6 @@ public:
|
||||||
static const QString AttrPath;
|
static const QString AttrPath;
|
||||||
static const QString AttrEnd;
|
static const QString AttrEnd;
|
||||||
static const QString AttrIncludeAs;
|
static const QString AttrIncludeAs;
|
||||||
static const QString AttrWidth;
|
|
||||||
static const QString AttrRotation;
|
static const QString AttrRotation;
|
||||||
static const QString AttrNumber;
|
static const QString AttrNumber;
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.6");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.0");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.6.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.0.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -256,12 +256,12 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
case (0x000605):
|
case (0x000605):
|
||||||
return QStringLiteral("://schema/pattern/v0.6.5.xsd");
|
return QStringLiteral("://schema/pattern/v0.6.5.xsd");
|
||||||
case (0x000606):
|
case (0x000606):
|
||||||
|
return QStringLiteral("://schema/pattern/v0.6.6.xsd");
|
||||||
|
case (0x000700):
|
||||||
return CurrentSchema;
|
return CurrentSchema;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(ver);
|
InvalidVersion(ver);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return QString();//unreachable code
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -430,10 +430,13 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(0x000606), m_convertedFileName);
|
ValidateXML(XSDSchema(0x000606), m_convertedFileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000606):
|
case (0x000606):
|
||||||
|
ToV0_7_0();
|
||||||
|
ValidateXML(XSDSchema(0x000700), m_convertedFileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
case (0x000700):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +451,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VPatternConverter::IsReadOnly() const
|
bool VPatternConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 6),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 0),
|
||||||
"Check attribute readOnly.");
|
"Check attribute readOnly.");
|
||||||
|
|
||||||
// Possibly in future attribute readOnly will change position etc.
|
// Possibly in future attribute readOnly will change position etc.
|
||||||
|
@ -912,6 +915,16 @@ void VPatternConverter::ToV0_6_6()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_7_0()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.7.0
|
||||||
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 0),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
SetVersion(QStringLiteral("0.7.0"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
static const QString PatternMaxVerStr;
|
static const QString PatternMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 6);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const Q_DECL_OVERRIDE;
|
virtual int MinVer() const Q_DECL_OVERRIDE;
|
||||||
|
@ -112,6 +112,7 @@ private:
|
||||||
void ToV0_6_4();
|
void ToV0_6_4();
|
||||||
void ToV0_6_5();
|
void ToV0_6_5();
|
||||||
void ToV0_6_6();
|
void ToV0_6_6();
|
||||||
|
void ToV0_7_0();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -643,6 +643,7 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
|
||||||
ExportAAMANotch(detailBlock, detail);
|
ExportAAMANotch(detailBlock, detail);
|
||||||
ExportAAMAGrainline(detailBlock, detail);
|
ExportAAMAGrainline(detailBlock, detail);
|
||||||
ExportAAMAText(detailBlock, detail);
|
ExportAAMAText(detailBlock, detail);
|
||||||
|
ExportAAMADrill(detailBlock, detail);
|
||||||
|
|
||||||
input->AddBlock(detailBlock);
|
input->AddBlock(detailBlock);
|
||||||
|
|
||||||
|
@ -688,11 +689,7 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
|
||||||
{
|
|
||||||
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
||||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
for(int j = 0; j < drawIntCut.size(); ++j)
|
||||||
{
|
{
|
||||||
|
@ -703,7 +700,27 @@ void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawIntCut = detail.InternalPathsForCut(true);
|
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||||
|
foreach(const VLayoutPlaceLabel &label, labels)
|
||||||
|
{
|
||||||
|
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button)
|
||||||
|
{
|
||||||
|
foreach(const QPolygonF &p, label.shape)
|
||||||
|
{
|
||||||
|
DRW_Entity *e = AAMAPolygon(p, "8", false);
|
||||||
|
if (e)
|
||||||
|
{
|
||||||
|
detailBlock->ent.push_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
||||||
|
{
|
||||||
|
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(true);
|
||||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
for(int j = 0; j < drawIntCut.size(); ++j)
|
||||||
{
|
{
|
||||||
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "11", false);
|
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "11", false);
|
||||||
|
@ -776,6 +793,25 @@ void VDxfEngine::ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VDxfEngine::ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
||||||
|
{
|
||||||
|
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||||
|
|
||||||
|
foreach(const VLayoutPlaceLabel &label, labels)
|
||||||
|
{
|
||||||
|
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button)
|
||||||
|
{
|
||||||
|
DRW_Point *point = new DRW_Point();
|
||||||
|
point->basePoint = DRW_Coord(FromPixel(label.center.x(), varInsunits),
|
||||||
|
FromPixel(getSize().height() - label.center.y(), varInsunits), 0);
|
||||||
|
point->layer = "13";
|
||||||
|
|
||||||
|
detailBlock->ent.push_back(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DRW_Entity *VDxfEngine::AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed)
|
DRW_Entity *VDxfEngine::AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,6 +116,7 @@ private:
|
||||||
void ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
|
void ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
|
||||||
void ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
|
void ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
|
||||||
void ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details);
|
void ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details);
|
||||||
|
void ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
|
||||||
|
|
||||||
Q_REQUIRED_RESULT DRW_Entity *AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed);
|
Q_REQUIRED_RESULT DRW_Entity *AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed);
|
||||||
Q_REQUIRED_RESULT DRW_Entity *AAMALine(const QLineF &line, const QString &layer);
|
Q_REQUIRED_RESULT DRW_Entity *AAMALine(const QLineF &line, const QString &layer);
|
||||||
|
|
|
@ -266,8 +266,16 @@ QVector<QPointF> VEllipticalArc::GetPoints() const
|
||||||
|
|
||||||
path = t.map(path);
|
path = t.map(path);
|
||||||
|
|
||||||
QPolygonF polygon = path.toSubpathPolygons().first();
|
QPolygonF polygon;
|
||||||
polygon.removeFirst(); // remove point (0;0)
|
const QList<QPolygonF> sub = path.toSubpathPolygons();
|
||||||
|
if (not sub.isEmpty())
|
||||||
|
{
|
||||||
|
polygon = path.toSubpathPolygons().first();
|
||||||
|
if (not polygon.isEmpty())
|
||||||
|
{
|
||||||
|
polygon.removeFirst(); // remove point (0;0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return polygon;
|
return polygon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ SOURCES += \
|
||||||
$$PWD/vabstractcubicbezierpath.cpp \
|
$$PWD/vabstractcubicbezierpath.cpp \
|
||||||
$$PWD/vcubicbezierpath.cpp \
|
$$PWD/vcubicbezierpath.cpp \
|
||||||
$$PWD/vabstractarc.cpp \
|
$$PWD/vabstractarc.cpp \
|
||||||
$$PWD/vabstractbezier.cpp
|
$$PWD/vabstractbezier.cpp \
|
||||||
|
$$PWD/vplacelabelitem.cpp
|
||||||
|
|
||||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
|
@ -46,4 +47,6 @@ HEADERS += \
|
||||||
$$PWD/vcubicbezierpath_p.h \
|
$$PWD/vcubicbezierpath_p.h \
|
||||||
$$PWD/vabstractarc.h \
|
$$PWD/vabstractarc.h \
|
||||||
$$PWD/vabstractarc_p.h \
|
$$PWD/vabstractarc_p.h \
|
||||||
$$PWD/vabstractbezier.h
|
$$PWD/vabstractbezier.h \
|
||||||
|
$$PWD/vplacelabelitem.h \
|
||||||
|
$$PWD/vplacelabelitem_p.h
|
||||||
|
|
|
@ -29,8 +29,51 @@
|
||||||
#ifndef VGEOMETRYDEF_H
|
#ifndef VGEOMETRYDEF_H
|
||||||
#define VGEOMETRYDEF_H
|
#define VGEOMETRYDEF_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QPolygonF>
|
||||||
|
|
||||||
enum class Draw : char { Calculation, Modeling, Layout };
|
enum class Draw : char { Calculation, Modeling, Layout };
|
||||||
enum class GOType : char { Point, Arc, EllipticalArc, Spline, SplinePath, CubicBezier, CubicBezierPath, Unknown };
|
enum class GOType : char
|
||||||
|
{
|
||||||
|
Point,
|
||||||
|
Arc,
|
||||||
|
EllipticalArc,
|
||||||
|
Spline,
|
||||||
|
SplinePath,
|
||||||
|
CubicBezier,
|
||||||
|
CubicBezierPath,
|
||||||
|
PlaceLabel,
|
||||||
|
Unknown
|
||||||
|
};
|
||||||
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
||||||
|
|
||||||
|
// Keep synchronized with XSD schema
|
||||||
|
enum class PlaceLabelType : unsigned char
|
||||||
|
{
|
||||||
|
Segment= 0,
|
||||||
|
Rectangle = 1,
|
||||||
|
Cross = 2,
|
||||||
|
Tshaped = 3,
|
||||||
|
Doubletree = 4,
|
||||||
|
Corner = 5,
|
||||||
|
Triangle = 6,
|
||||||
|
Hshaped = 7,
|
||||||
|
Button = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QVector<QPolygonF> PlaceLabelImg;
|
||||||
|
|
||||||
|
struct VLayoutPlaceLabel
|
||||||
|
{
|
||||||
|
VLayoutPlaceLabel()
|
||||||
|
: center(),
|
||||||
|
type(PlaceLabelType::Button),
|
||||||
|
shape()
|
||||||
|
{}
|
||||||
|
|
||||||
|
QPointF center;
|
||||||
|
PlaceLabelType type;
|
||||||
|
PlaceLabelImg shape;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // VGEOMETRYDEF_H
|
#endif // VGEOMETRYDEF_H
|
||||||
|
|
334
src/libs/vgeometry/vplacelabelitem.cpp
Normal file
|
@ -0,0 +1,334 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vplacelabelitem.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 15 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 "vplacelabelitem.h"
|
||||||
|
#include "vplacelabelitem_p.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
#include "varc.h"
|
||||||
|
|
||||||
|
#include <QPolygonF>
|
||||||
|
#include <QTransform>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPlaceLabelItem::VPlaceLabelItem()
|
||||||
|
: VPointF(), d(new VPlaceLabelItemData)
|
||||||
|
{
|
||||||
|
setType(GOType::PlaceLabel);
|
||||||
|
setMode(Draw::Modeling);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPlaceLabelItem::VPlaceLabelItem(const VPlaceLabelItem &item)
|
||||||
|
: VPointF(item), d(item.d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPlaceLabelItem::~VPlaceLabelItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VPlaceLabelItem::GetWidthFormula() const
|
||||||
|
{
|
||||||
|
return d->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString &VPlaceLabelItem::GetWidthFormula()
|
||||||
|
{
|
||||||
|
return d->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPlaceLabelItem::GetWidth() const
|
||||||
|
{
|
||||||
|
return d->wValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetWidth(qreal value, const QString &formula)
|
||||||
|
{
|
||||||
|
d->wValue = value;
|
||||||
|
d->width = formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VPlaceLabelItem::GetHeightFormula() const
|
||||||
|
{
|
||||||
|
return d->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString &VPlaceLabelItem::GetHeightFormula()
|
||||||
|
{
|
||||||
|
return d->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPlaceLabelItem::GetHeight() const
|
||||||
|
{
|
||||||
|
return d->hValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetHeight(qreal value, const QString &formula)
|
||||||
|
{
|
||||||
|
d->hValue = value;
|
||||||
|
d->height = formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VPlaceLabelItem::GetAngleFormula() const
|
||||||
|
{
|
||||||
|
return d->angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString &VPlaceLabelItem::GetAngleFormula()
|
||||||
|
{
|
||||||
|
return d->angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPlaceLabelItem::GetAngle() const
|
||||||
|
{
|
||||||
|
return d->aValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetAngle(qreal value, const QString &formula)
|
||||||
|
{
|
||||||
|
d->aValue = value;
|
||||||
|
d->angle = formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VPlaceLabelItem::GetCorrectionAngle() const
|
||||||
|
{
|
||||||
|
return d->correctionAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetCorrectionAngle(qreal value)
|
||||||
|
{
|
||||||
|
d->correctionAngle = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VPlaceLabelItem::GetCenterPoint() const
|
||||||
|
{
|
||||||
|
return d->centerPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetCenterPoint(quint32 id)
|
||||||
|
{
|
||||||
|
d->centerPoint = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PlaceLabelType VPlaceLabelItem::GetLabelType() const
|
||||||
|
{
|
||||||
|
return d->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetLabelType(PlaceLabelType type)
|
||||||
|
{
|
||||||
|
d->type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPlaceLabelItem &VPlaceLabelItem::operator=(const VPlaceLabelItem &item)
|
||||||
|
{
|
||||||
|
if ( &item == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
VPointF::operator=(item);
|
||||||
|
d = item.d;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PlaceLabelImg VPlaceLabelItem::LabelShape() const
|
||||||
|
{
|
||||||
|
QTransform t;
|
||||||
|
t.translate(x(), y());
|
||||||
|
t.rotate(-d->aValue-d->correctionAngle);
|
||||||
|
t.translate(-x(), -y());
|
||||||
|
|
||||||
|
auto SegmentShape = [t, this]()
|
||||||
|
{
|
||||||
|
QPolygonF shape;
|
||||||
|
shape << QPointF(x(), y() - d->hValue/2.0) << QPointF(x(), y() + d->hValue/2.0);
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto RectangleShape = [t, this]()
|
||||||
|
{
|
||||||
|
QRectF rect(QPointF(x() - d->wValue/2.0, y() - d->hValue/2.0),
|
||||||
|
QPointF(x() + d->wValue/2.0, y() + d->hValue/2.0));
|
||||||
|
|
||||||
|
QPolygonF shape;
|
||||||
|
shape << rect.topLeft() << rect.topRight() << rect.bottomRight() << rect.bottomLeft() << rect.topLeft();
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto CrossShape = [t, this]()
|
||||||
|
{
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << QPointF(x(), y() - d->hValue/2.0)
|
||||||
|
<< QPointF(x(), y() + d->hValue/2.0);
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << QPointF(x() - d->wValue/2.0, y())
|
||||||
|
<< QPointF(x() + d->wValue/2.0, y());
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto TshapedShape = [t, this]()
|
||||||
|
{
|
||||||
|
QPointF center2(x(), y() + d->hValue/2.0);
|
||||||
|
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << QPointF(x(), y()) << center2;
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << QPointF(center2.x() - d->wValue/2.0, center2.y())
|
||||||
|
<< QPointF(center2.x() + d->wValue/2.0, center2.y());
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto DoubletreeShape = [t, this]()
|
||||||
|
{
|
||||||
|
QRectF rect(QPointF(x() - d->wValue/2.0, y() - d->hValue/2.0),
|
||||||
|
QPointF(x() + d->wValue/2.0, y() + d->hValue/2.0));
|
||||||
|
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << rect.topLeft() << rect.bottomRight();
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << rect.topRight() << rect.bottomLeft();
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto CornerShape = [t, this]()
|
||||||
|
{
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << QPointF(x(), y()) << QPointF(x(), y() + d->hValue/2.0);
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << QPointF(x() - d->wValue/2.0, y()) << QPointF(x(), y());
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto TriangleShape = [t, this]()
|
||||||
|
{
|
||||||
|
QRectF rect(QPointF(x() - d->wValue/2.0, y() - d->hValue/2.0),
|
||||||
|
QPointF(x() + d->wValue/2.0, y() + d->hValue/2.0));
|
||||||
|
|
||||||
|
QPolygonF shape;
|
||||||
|
shape << rect.topLeft() << rect.topRight() << rect.bottomRight() << rect.topLeft();
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto HshapedShape = [t, this]()
|
||||||
|
{
|
||||||
|
const QPointF center1 (x(), y() - d->hValue/2.0);
|
||||||
|
const QPointF center2 (x(), y() + d->hValue/2.0);
|
||||||
|
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << center1 << center2;
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << QPointF(center1.x() - d->wValue/2.0, center1.y())
|
||||||
|
<< QPointF(center1.x() + d->wValue/2.0, center1.y());
|
||||||
|
|
||||||
|
QPolygonF shape3;
|
||||||
|
shape3 << QPointF(center2.x() - d->wValue/2.0, center2.y())
|
||||||
|
<< QPointF(center2.x() + d->wValue/2.0, center2.y());
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2), t.map(shape3)});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto ButtonShape = [t, this]()
|
||||||
|
{
|
||||||
|
const qreal radius = qMin(d->wValue/2.0, d->hValue/2.0);
|
||||||
|
QPolygonF shape1;
|
||||||
|
shape1 << QPointF(x(), y() - radius)
|
||||||
|
<< QPointF(x(), y() + radius);
|
||||||
|
|
||||||
|
QPolygonF shape2;
|
||||||
|
shape2 << QPointF(x() - radius, y())
|
||||||
|
<< QPointF(x() + radius, y());
|
||||||
|
|
||||||
|
const qreal circleSize = 0.85;
|
||||||
|
VArc arc(*this, radius*circleSize, 0, 360);
|
||||||
|
arc.SetApproximationScale(10);
|
||||||
|
QPolygonF shape3(arc.GetPoints());
|
||||||
|
if (not shape3.isClosed() && not shape3.isEmpty())
|
||||||
|
{
|
||||||
|
shape3 << shape3.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(shape1), t.map(shape2), t.map(shape3)});
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
switch(d->type)
|
||||||
|
{
|
||||||
|
case PlaceLabelType::Segment:
|
||||||
|
return SegmentShape();
|
||||||
|
case PlaceLabelType::Rectangle:
|
||||||
|
return RectangleShape();
|
||||||
|
case PlaceLabelType::Cross:
|
||||||
|
return CrossShape();
|
||||||
|
case PlaceLabelType::Tshaped:
|
||||||
|
return TshapedShape();
|
||||||
|
case PlaceLabelType::Doubletree:
|
||||||
|
return DoubletreeShape();
|
||||||
|
case PlaceLabelType::Corner:
|
||||||
|
return CornerShape();
|
||||||
|
case PlaceLabelType::Triangle:
|
||||||
|
return TriangleShape();
|
||||||
|
case PlaceLabelType::Hshaped:
|
||||||
|
return HshapedShape();
|
||||||
|
case PlaceLabelType::Button:
|
||||||
|
return ButtonShape();
|
||||||
|
}
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
return PlaceLabelImg();
|
||||||
|
}
|
89
src/libs/vgeometry/vplacelabelitem.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vplacelabelitem.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 15 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 VPLACELABELITEM_H
|
||||||
|
#define VPLACELABELITEM_H
|
||||||
|
|
||||||
|
#include <QSharedDataPointer>
|
||||||
|
#include <QTypeInfo>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
|
#include "vpointf.h"
|
||||||
|
|
||||||
|
class VPlaceLabelItemData;
|
||||||
|
class VContainer;
|
||||||
|
|
||||||
|
class VPlaceLabelItem : public VPointF
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VPlaceLabelItem();
|
||||||
|
VPlaceLabelItem(const VPlaceLabelItem &item);
|
||||||
|
virtual ~VPlaceLabelItem() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
VPlaceLabelItem &operator=(const VPlaceLabelItem &item);
|
||||||
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
|
VPlaceLabelItem &operator=(VPlaceLabelItem &&item) Q_DECL_NOTHROW { Swap(item); return *this; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Swap(VPlaceLabelItem &item) Q_DECL_NOTHROW
|
||||||
|
{ VPointF::Swap(item); std::swap(d, item.d); }
|
||||||
|
|
||||||
|
QString GetWidthFormula() const;
|
||||||
|
QString& GetWidthFormula();
|
||||||
|
qreal GetWidth() const;
|
||||||
|
void SetWidth(qreal value, const QString &formula);
|
||||||
|
|
||||||
|
QString GetHeightFormula() const;
|
||||||
|
QString& GetHeightFormula();
|
||||||
|
qreal GetHeight() const;
|
||||||
|
void SetHeight(qreal value, const QString &formula);
|
||||||
|
|
||||||
|
QString GetAngleFormula() const;
|
||||||
|
QString& GetAngleFormula();
|
||||||
|
qreal GetAngle() const;
|
||||||
|
void SetAngle(qreal value, const QString &formula);
|
||||||
|
|
||||||
|
qreal GetCorrectionAngle() const;
|
||||||
|
void SetCorrectionAngle(qreal value);
|
||||||
|
|
||||||
|
quint32 GetCenterPoint() const;
|
||||||
|
void SetCenterPoint(quint32 id);
|
||||||
|
|
||||||
|
PlaceLabelType GetLabelType() const;
|
||||||
|
void SetLabelType(PlaceLabelType type);
|
||||||
|
|
||||||
|
PlaceLabelImg LabelShape() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSharedDataPointer<VPlaceLabelItemData> d;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(VPlaceLabelItem)
|
||||||
|
Q_DECLARE_TYPEINFO(VPlaceLabelItem, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
|
#endif // VPLACELABELITEM_H
|
90
src/libs/vgeometry/vplacelabelitem_p.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vplacelabelitem_p.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 15 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 VPLACELABELITEM_P_H
|
||||||
|
#define VPLACELABELITEM_P_H
|
||||||
|
|
||||||
|
#include <QSharedData>
|
||||||
|
#include "vgeometrydef.h"
|
||||||
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "../vmisc/diagnostic.h"
|
||||||
|
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
|
||||||
|
|
||||||
|
class VPlaceLabelItemData : public QSharedData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VPlaceLabelItemData()
|
||||||
|
: width(),
|
||||||
|
height(),
|
||||||
|
angle("0"),
|
||||||
|
type(PlaceLabelType::Button),
|
||||||
|
centerPoint(0),
|
||||||
|
wValue(0),
|
||||||
|
hValue(0),
|
||||||
|
aValue(0),
|
||||||
|
correctionAngle(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
VPlaceLabelItemData(const VPlaceLabelItemData &item)
|
||||||
|
: QSharedData(item),
|
||||||
|
width(item.width),
|
||||||
|
height(item.height),
|
||||||
|
angle(item.angle),
|
||||||
|
type(item.type),
|
||||||
|
centerPoint(item.centerPoint),
|
||||||
|
wValue(item.wValue),
|
||||||
|
hValue(item.hValue),
|
||||||
|
aValue(item.aValue),
|
||||||
|
correctionAngle(item.correctionAngle)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~VPlaceLabelItemData();
|
||||||
|
|
||||||
|
QString width;
|
||||||
|
QString height;
|
||||||
|
QString angle;
|
||||||
|
PlaceLabelType type;
|
||||||
|
quint32 centerPoint;
|
||||||
|
|
||||||
|
qreal wValue;
|
||||||
|
qreal hValue;
|
||||||
|
qreal aValue;
|
||||||
|
qreal correctionAngle;
|
||||||
|
|
||||||
|
private:
|
||||||
|
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;
|
||||||
|
};
|
||||||
|
|
||||||
|
VPlaceLabelItemData::~VPlaceLabelItemData()
|
||||||
|
{}
|
||||||
|
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
#endif // VPLACELABELITEM_P_H
|
|
@ -991,6 +991,21 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr
|
||||||
&& qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < VGObject::accuracyPointOnLine);
|
&& qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < VGObject::accuracyPointOnLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VAbstractPiece::PlaceLabelImgPath(const PlaceLabelImg &img) const
|
||||||
|
{
|
||||||
|
QPainterPath path;
|
||||||
|
foreach(const QPolygonF &p, img)
|
||||||
|
{
|
||||||
|
if (not p.isEmpty())
|
||||||
|
{
|
||||||
|
path.moveTo(p.first());
|
||||||
|
path.addPolygon(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VAbstractPiece::GetMx() const
|
qreal VAbstractPiece::GetMx() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
template <class T> class QVector;
|
template <class T> class QVector;
|
||||||
|
|
||||||
class VAbstractPieceData;
|
class VAbstractPieceData;
|
||||||
|
class QPainterPath;
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
@ -194,6 +195,8 @@ protected:
|
||||||
static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint);
|
static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint);
|
||||||
static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint);
|
static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint);
|
||||||
|
|
||||||
|
QPainterPath PlaceLabelImgPath(const PlaceLabelImg &img) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VAbstractPieceData> d;
|
QSharedDataPointer<VAbstractPieceData> d;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
#include "vlayoutdef.h"
|
#include "vlayoutdef.h"
|
||||||
#include "vlayoutpiece_p.h"
|
#include "vlayoutpiece_p.h"
|
||||||
#include "vtextmanager.h"
|
#include "vtextmanager.h"
|
||||||
|
@ -340,6 +341,22 @@ QStringList PieceLabelText(const QVector<QPointF> &labelShape, const VTextManage
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern)
|
||||||
|
{
|
||||||
|
QVector<VLayoutPlaceLabel> labels;
|
||||||
|
for(int i=0; i < piece.GetPlaceLabels().size(); ++i)
|
||||||
|
{
|
||||||
|
const auto label = pattern->GeometricObject<VPlaceLabelItem>(piece.GetPlaceLabels().at(i));
|
||||||
|
VLayoutPlaceLabel layoutLabel;
|
||||||
|
layoutLabel.shape = label->LabelShape();
|
||||||
|
layoutLabel.center = label->toQPointF();
|
||||||
|
layoutLabel.type = label->GetLabelType();
|
||||||
|
labels.append(layoutLabel);
|
||||||
|
}
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -381,6 +398,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
|
||||||
piece.IsSeamAllowanceBuiltIn());
|
piece.IsSeamAllowanceBuiltIn());
|
||||||
det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
|
det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
|
||||||
det.SetPassmarks(piece.PassmarksLines(pattern));
|
det.SetPassmarks(piece.PassmarksLines(pattern));
|
||||||
|
det.SetPlaceLabels(ConvertPlaceLabels(piece, pattern));
|
||||||
|
|
||||||
det.SetName(piece.GetName());
|
det.SetName(piece.GetName());
|
||||||
|
|
||||||
|
@ -415,6 +433,48 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
|
||||||
return det;
|
return det;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
|
||||||
|
{
|
||||||
|
QVector<T> p;
|
||||||
|
for (int i = 0; i < points.size(); ++i)
|
||||||
|
{
|
||||||
|
p.append(d->matrix.map(points.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->mirror)
|
||||||
|
{
|
||||||
|
QList<T> list = p.toList();
|
||||||
|
for (int k=0, s=list.size(), max=(s/2); k<max; k++)
|
||||||
|
{
|
||||||
|
list.swap(k, s-(1+k));
|
||||||
|
}
|
||||||
|
p = list.toVector();
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <>
|
||||||
|
QVector<VLayoutPlaceLabel> VLayoutPiece::Map<VLayoutPlaceLabel>(const QVector<VLayoutPlaceLabel> &points) const
|
||||||
|
{
|
||||||
|
QVector<VLayoutPlaceLabel> p;
|
||||||
|
foreach (const VLayoutPlaceLabel &label, points)
|
||||||
|
{
|
||||||
|
VLayoutPlaceLabel mappedLabel;
|
||||||
|
mappedLabel.type = label.type;
|
||||||
|
mappedLabel.center = d->matrix.map(label.center);
|
||||||
|
foreach (const QPolygonF &p, label.shape)
|
||||||
|
{
|
||||||
|
mappedLabel.shape.append(d->matrix.map(p));
|
||||||
|
}
|
||||||
|
p.append(mappedLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QVector<QPointF> VLayoutPiece::GetContourPoints() const
|
QVector<QPointF> VLayoutPiece::GetContourPoints() const
|
||||||
|
@ -853,6 +913,18 @@ void VLayoutPiece::SetPassmarks(const QVector<QLineF> &passmarks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<VLayoutPlaceLabel> VLayoutPiece::GetPlaceLabels() const
|
||||||
|
{
|
||||||
|
return Map(d->m_placeLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutPiece::SetPlaceLabels(const QVector<VLayoutPlaceLabel> &labels)
|
||||||
|
{
|
||||||
|
d->m_placeLabels = labels;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QVector<QPointF> > VLayoutPiece::InternalPathsForCut(bool cut) const
|
QVector<QVector<QPointF> > VLayoutPiece::InternalPathsForCut(bool cut) const
|
||||||
{
|
{
|
||||||
|
@ -881,28 +953,6 @@ void VLayoutPiece::SetInternalPaths(const QVector<VLayoutPiecePath> &internalPat
|
||||||
d->m_internalPaths = internalPaths;
|
d->m_internalPaths = internalPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
template <class T>
|
|
||||||
QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
|
|
||||||
{
|
|
||||||
QVector<T> p;
|
|
||||||
for (int i = 0; i < points.size(); ++i)
|
|
||||||
{
|
|
||||||
p.append(d->matrix.map(points.at(i)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->mirror)
|
|
||||||
{
|
|
||||||
QList<T> list = p.toList();
|
|
||||||
for (int k=0, s=list.size(), max=(s/2); k<max; k++)
|
|
||||||
{
|
|
||||||
list.swap(k, s-(1+k));
|
|
||||||
}
|
|
||||||
p = list.toVector();
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::ContourPath() const
|
QPainterPath VLayoutPiece::ContourPath() const
|
||||||
{
|
{
|
||||||
|
@ -960,18 +1010,6 @@ QPainterPath VLayoutPiece::ContourPath() const
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
|
||||||
{
|
|
||||||
SCASSERT(parent != nullptr)
|
|
||||||
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
|
||||||
item->setPath(d->matrix.map(d->m_internalPaths.at(i).GetPainterPath()));
|
|
||||||
|
|
||||||
QPen pen = item->pen();
|
|
||||||
pen.setStyle(d->m_internalPaths.at(i).PenStyle());
|
|
||||||
item->setPen(pen);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
||||||
{
|
{
|
||||||
|
@ -996,7 +1034,18 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
|
|
||||||
for (int i = 0; i < d->m_internalPaths.count(); ++i)
|
for (int i = 0; i < d->m_internalPaths.count(); ++i)
|
||||||
{
|
{
|
||||||
CreateInternalPathItem(i, item);
|
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
||||||
|
pathItem->setPath(d->matrix.map(d->m_internalPaths.at(i).GetPainterPath()));
|
||||||
|
|
||||||
|
QPen pen = pathItem->pen();
|
||||||
|
pen.setStyle(d->m_internalPaths.at(i).PenStyle());
|
||||||
|
pathItem->setPen(pen);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < d->m_placeLabels.count(); ++i)
|
||||||
|
{
|
||||||
|
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
||||||
|
pathItem->setPath(d->matrix.map(PlaceLabelImgPath(d->m_placeLabels.at(i).shape)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateLabelStrings(item, d->detailLabel, d->m_tmDetail, textAsPaths);
|
CreateLabelStrings(item, d->detailLabel, d->m_tmDetail, textAsPaths);
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "vabstractpiece.h"
|
#include "vabstractpiece.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
class VLayoutPieceData;
|
class VLayoutPieceData;
|
||||||
class VLayoutPiecePath;
|
class VLayoutPiecePath;
|
||||||
|
@ -85,6 +86,9 @@ public:
|
||||||
QVector<QLineF> GetPassmarks() const;
|
QVector<QLineF> GetPassmarks() const;
|
||||||
void SetPassmarks(const QVector<QLineF> &passmarks);
|
void SetPassmarks(const QVector<QLineF> &passmarks);
|
||||||
|
|
||||||
|
QVector<VLayoutPlaceLabel> GetPlaceLabels() const;
|
||||||
|
void SetPlaceLabels(const QVector<VLayoutPlaceLabel> &labels);
|
||||||
|
|
||||||
QVector<QVector<QPointF>> InternalPathsForCut(bool cut) const;
|
QVector<QVector<QPointF>> InternalPathsForCut(bool cut) const;
|
||||||
QVector<VLayoutPiecePath> GetInternalPaths() const;
|
QVector<VLayoutPiecePath> GetInternalPaths() const;
|
||||||
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
||||||
|
@ -142,7 +146,6 @@ private:
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainItem() const;
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainItem() const;
|
||||||
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainPathItem() const;
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetMainPathItem() const;
|
||||||
|
|
||||||
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
|
||||||
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
void CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape, const VTextManager &tm,
|
||||||
bool textAsPaths) const;
|
bool textAsPaths) const;
|
||||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#include "vlayoutpiecepath.h"
|
#include "vlayoutpiecepath.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
#include "vtextmanager.h"
|
#include "vtextmanager.h"
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
|
@ -62,7 +62,8 @@ public:
|
||||||
patternInfo(),
|
patternInfo(),
|
||||||
grainlinePoints(),
|
grainlinePoints(),
|
||||||
m_tmDetail(),
|
m_tmDetail(),
|
||||||
m_tmPattern()
|
m_tmPattern(),
|
||||||
|
m_placeLabels()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VLayoutPieceData(const VLayoutPieceData &detail)
|
VLayoutPieceData(const VLayoutPieceData &detail)
|
||||||
|
@ -79,7 +80,8 @@ public:
|
||||||
patternInfo(detail.patternInfo),
|
patternInfo(detail.patternInfo),
|
||||||
grainlinePoints(detail.grainlinePoints),
|
grainlinePoints(detail.grainlinePoints),
|
||||||
m_tmDetail(detail.m_tmDetail),
|
m_tmDetail(detail.m_tmDetail),
|
||||||
m_tmPattern(detail.m_tmPattern)
|
m_tmPattern(detail.m_tmPattern),
|
||||||
|
m_placeLabels(detail.m_placeLabels)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~VLayoutPieceData() {}
|
~VLayoutPieceData() {}
|
||||||
|
@ -122,6 +124,9 @@ public:
|
||||||
/** @brief m_tmPattern text manager for laying out pattern info */
|
/** @brief m_tmPattern text manager for laying out pattern info */
|
||||||
VTextManager m_tmPattern;
|
VTextManager m_tmPattern;
|
||||||
|
|
||||||
|
/** @brief m_placeLabels list of place labels. */
|
||||||
|
QVector<VLayoutPlaceLabel> m_placeLabels;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VLayoutPieceData &operator=(const VLayoutPieceData &) Q_DECL_EQ_DELETE;
|
VLayoutPieceData &operator=(const VLayoutPieceData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -170,6 +170,7 @@ enum class Tool : ToolVisHolderType
|
||||||
EllipticalArc,
|
EllipticalArc,
|
||||||
Pin,
|
Pin,
|
||||||
InsertNode,
|
InsertNode,
|
||||||
|
PlaceLabel,
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,13 +220,15 @@ enum class Vis : ToolVisHolderType
|
||||||
ToolEllipticalArc,
|
ToolEllipticalArc,
|
||||||
ToolPiece,
|
ToolPiece,
|
||||||
ToolPiecePath,
|
ToolPiecePath,
|
||||||
ToolPin,
|
ToolSpecialPoint,
|
||||||
PiecePins,
|
ToolPlaceLabel,
|
||||||
|
PieceSpecialPoints,
|
||||||
NoBrush,
|
NoBrush,
|
||||||
CurvePathItem,
|
CurvePathItem,
|
||||||
GrainlineItem,
|
GrainlineItem,
|
||||||
PieceItem,
|
PieceItem,
|
||||||
TextGraphicsItem,
|
TextGraphicsItem,
|
||||||
|
ScenePoint,
|
||||||
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -478,7 +481,6 @@ struct CustomSARecord
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(CustomSARecord)
|
Q_DECLARE_METATYPE(CustomSARecord)
|
||||||
Q_DECLARE_TYPEINFO(CustomSARecord, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(CustomSARecord, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** This file is derived from code bearing the following notice:
|
** This file is derived from code bearing the following notice:
|
||||||
** The sole author of this file, Adam Higerd, has explicitly disclaimed all
|
** The sole author of this file, Adam Higerd, has explicitly disclaimed all
|
||||||
|
|
|
@ -75,5 +75,7 @@
|
||||||
<file>icon/32x32/pins@2x.png</file>
|
<file>icon/32x32/pins@2x.png</file>
|
||||||
<file>icon/32x32/passmark.png</file>
|
<file>icon/32x32/passmark.png</file>
|
||||||
<file>icon/32x32/passmark@2x.png</file>
|
<file>icon/32x32/passmark@2x.png</file>
|
||||||
|
<file>icon/32x32/button.png</file>
|
||||||
|
<file>icon/32x32/button@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/libs/vmisc/share/resources/icon/32x32/button.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
src/libs/vmisc/share/resources/icon/32x32/button@2x.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
|
@ -185,8 +185,15 @@ quint32 VContainer::AddGObject(VGObject *obj)
|
||||||
{
|
{
|
||||||
SCASSERT(obj != nullptr)
|
SCASSERT(obj != nullptr)
|
||||||
QSharedPointer<VGObject> pointer(obj);
|
QSharedPointer<VGObject> pointer(obj);
|
||||||
|
return AddGObject(pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 VContainer::AddGObject(const QSharedPointer<VGObject> &obj)
|
||||||
|
{
|
||||||
|
SCASSERT(not obj.isNull())
|
||||||
uniqueNames.insert(obj->name());
|
uniqueNames.insert(obj->name());
|
||||||
return AddObject(d->gObjects, pointer);
|
return AddObject(d->gObjects, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -242,22 +249,6 @@ void VContainer::UpdateId(quint32 newId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief UpdateObject update object in container
|
|
||||||
* @param id id of existing object
|
|
||||||
* @param point object
|
|
||||||
*/
|
|
||||||
template <typename val>
|
|
||||||
void VContainer::UpdateObject(const quint32 &id, val point)
|
|
||||||
{
|
|
||||||
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
|
||||||
SCASSERT(point.isNull() == false)
|
|
||||||
point->setId(id);
|
|
||||||
d->gObjects.insert(id, point);
|
|
||||||
UpdateId(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Clear clear data in container. Id will be 0.
|
* @brief Clear clear data in container. Id will be 0.
|
||||||
|
@ -490,27 +481,6 @@ quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief UpdateGObject update GObject by id
|
|
||||||
* @param id id of existing GObject
|
|
||||||
* @param obj object
|
|
||||||
*/
|
|
||||||
void VContainer::UpdateGObject(quint32 id, VGObject* obj)
|
|
||||||
{
|
|
||||||
SCASSERT(obj != nullptr)
|
|
||||||
QSharedPointer<VGObject> pointer(obj);
|
|
||||||
UpdateGObject(id, pointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VContainer::UpdateGObject(quint32 id, const QSharedPointer<VGObject> &obj)
|
|
||||||
{
|
|
||||||
SCASSERT(not obj.isNull())
|
|
||||||
UpdateObject(id, obj);
|
|
||||||
uniqueNames.insert(obj->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContainer::UpdatePiece(quint32 id, const VPiece &detail)
|
void VContainer::UpdatePiece(quint32 id, const VPiece &detail)
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,6 +143,7 @@ public:
|
||||||
static void UpdateId(quint32 newId);
|
static void UpdateId(quint32 newId);
|
||||||
|
|
||||||
quint32 AddGObject(VGObject *obj);
|
quint32 AddGObject(VGObject *obj);
|
||||||
|
quint32 AddGObject(const QSharedPointer<VGObject> &obj);
|
||||||
quint32 AddPiece(const VPiece &detail);
|
quint32 AddPiece(const VPiece &detail);
|
||||||
quint32 AddPiecePath(const VPiecePath &path);
|
quint32 AddPiecePath(const VPiecePath &path);
|
||||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||||
|
@ -159,8 +160,10 @@ public:
|
||||||
void RemoveVariable(const QString& name);
|
void RemoveVariable(const QString& name);
|
||||||
void RemovePiece(quint32 id);
|
void RemovePiece(quint32 id);
|
||||||
|
|
||||||
void UpdateGObject(quint32 id, VGObject* obj);
|
template <class T>
|
||||||
void UpdateGObject(quint32 id, const QSharedPointer<VGObject> &obj);
|
void UpdateGObject(quint32 id, T* obj);
|
||||||
|
template <class T>
|
||||||
|
void UpdateGObject(quint32 id, const QSharedPointer<T> &obj);
|
||||||
void UpdatePiece(quint32 id, const VPiece &detail);
|
void UpdatePiece(quint32 id, const VPiece &detail);
|
||||||
void UpdatePiecePath(quint32 id, const VPiecePath &path);
|
void UpdatePiecePath(quint32 id, const VPiecePath &path);
|
||||||
|
|
||||||
|
@ -220,8 +223,8 @@ private:
|
||||||
// cppcheck-suppress functionStatic
|
// cppcheck-suppress functionStatic
|
||||||
const val GetObject(const QHash<key, val> &obj, key id) const;
|
const val GetObject(const QHash<key, val> &obj, key id) const;
|
||||||
|
|
||||||
template <typename val>
|
template <typename T>
|
||||||
void UpdateObject(const quint32 &id, val point);
|
void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
|
||||||
|
|
||||||
template <typename key, typename val>
|
template <typename key, typename val>
|
||||||
static quint32 AddObject(QHash<key, val> &obj, val value);
|
static quint32 AddObject(QHash<key, val> &obj, val value);
|
||||||
|
@ -311,14 +314,23 @@ void VContainer::AddVariable(const QString& name, const QSharedPointer<T> &var)
|
||||||
{
|
{
|
||||||
if (d->variables.value(name)->GetType() == var->GetType())
|
if (d->variables.value(name)->GetType() == var->GetType())
|
||||||
{
|
{
|
||||||
d->variables[name].clear();
|
QSharedPointer<T> v = qSharedPointerDynamicCast<T>(d->variables.value(name));
|
||||||
|
if (v.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't cast object."), name);
|
||||||
|
}
|
||||||
|
*v = *var;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d->variables.insert(name, var);
|
else
|
||||||
|
{
|
||||||
|
d->variables.insert(name, var);
|
||||||
|
}
|
||||||
|
|
||||||
uniqueNames.insert(name);
|
uniqueNames.insert(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,4 +340,54 @@ uint VContainer::qHash( const QSharedPointer<T> &p )
|
||||||
{
|
{
|
||||||
return qHash( p.data() );
|
return qHash( p.data() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief UpdateGObject update GObject by id
|
||||||
|
* @param id id of existing GObject
|
||||||
|
* @param obj object
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
void VContainer::UpdateGObject(quint32 id, T* obj)
|
||||||
|
{
|
||||||
|
SCASSERT(obj != nullptr)
|
||||||
|
UpdateGObject(id, QSharedPointer<T>(obj));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
void VContainer::UpdateGObject(quint32 id, const QSharedPointer<T> &obj)
|
||||||
|
{
|
||||||
|
SCASSERT(not obj.isNull())
|
||||||
|
UpdateObject(id, obj);
|
||||||
|
uniqueNames.insert(obj->name());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief UpdateObject update object in container
|
||||||
|
* @param id id of existing object
|
||||||
|
* @param point object
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void VContainer::UpdateObject(const quint32 &id, const QSharedPointer<T> &point)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||||
|
SCASSERT(point.isNull() == false)
|
||||||
|
point->setId(id);
|
||||||
|
if (d->gObjects.contains(id))
|
||||||
|
{
|
||||||
|
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(d->gObjects.value(id));
|
||||||
|
if (obj.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't cast object"), id);
|
||||||
|
}
|
||||||
|
*obj = *point;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->gObjects.insert(id, point);
|
||||||
|
}
|
||||||
|
UpdateId(id);
|
||||||
|
}
|
||||||
#endif // VCONTAINER_H
|
#endif // VCONTAINER_H
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "vpiece_p.h"
|
#include "vpiece_p.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vgeometry/vabstractcurve.h"
|
#include "../vgeometry/vabstractcurve.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
#include "vcontainer.h"
|
#include "vcontainer.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
|
|
||||||
|
@ -440,6 +441,25 @@ QVector<QLineF> VPiece::PassmarksLines(const VContainer *data, const QVector<QPo
|
||||||
return passmarks;
|
return passmarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<PlaceLabelImg> VPiece::PlaceLabelPoints(const VContainer *data) const
|
||||||
|
{
|
||||||
|
QVector<PlaceLabelImg> points;
|
||||||
|
for(int i=0; i < d->m_placeLabels.size(); ++i)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const auto label = data->GeometricObject<VPlaceLabelItem>(d->m_placeLabels.at(i));
|
||||||
|
points.append(label->LabelShape());
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
qWarning() << e.ErrorMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
||||||
{
|
{
|
||||||
|
@ -513,6 +533,25 @@ QPainterPath VPiece::PassmarksPath(const VContainer *data, const QVector<QPointF
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QPainterPath VPiece::PlaceLabelPath(const VContainer *data) const
|
||||||
|
{
|
||||||
|
const QVector<PlaceLabelImg> points = PlaceLabelPoints(data);
|
||||||
|
QPainterPath path;
|
||||||
|
|
||||||
|
if (not points.isEmpty())
|
||||||
|
{
|
||||||
|
for (qint32 i = 0; i < points.count(); ++i)
|
||||||
|
{
|
||||||
|
path.addPath(PlaceLabelImgPath(points.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
path.setFillRule(Qt::WindingFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPiece::IsInLayout() const
|
bool VPiece::IsInLayout() const
|
||||||
{
|
{
|
||||||
|
@ -605,6 +644,52 @@ void VPiece::SetPins(const QVector<quint32> &pins)
|
||||||
d->m_pins = pins;
|
d->m_pins = pins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VPiece::GetPlaceLabels() const
|
||||||
|
{
|
||||||
|
return d->m_placeLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> &VPiece::GetPlaceLabels()
|
||||||
|
{
|
||||||
|
return d->m_placeLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPiece::SetPlaceLabels(const QVector<quint32> &labels)
|
||||||
|
{
|
||||||
|
d->m_placeLabels = labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QList<quint32> VPiece::Dependencies() const
|
||||||
|
{
|
||||||
|
QList<quint32> list = d->m_path.Dependencies();
|
||||||
|
|
||||||
|
foreach (const CustomSARecord &record, d->m_customSARecords)
|
||||||
|
{
|
||||||
|
list.append(record.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const quint32 &value, d->m_internalPaths)
|
||||||
|
{
|
||||||
|
list.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const quint32 &value, d->m_pins)
|
||||||
|
{
|
||||||
|
list.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const quint32 &value, d->m_placeLabels)
|
||||||
|
{
|
||||||
|
list.append(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief MissingNodes find missing nodes in detail. When we deleted object in detail and return this detail need
|
* @brief MissingNodes find missing nodes in detail. When we deleted object in detail and return this detail need
|
||||||
|
@ -647,6 +732,12 @@ QVector<quint32> VPiece::MissingPins(const VPiece &det) const
|
||||||
return PieceMissingNodes(d->m_pins, det.GetPins());
|
return PieceMissingNodes(d->m_pins, det.GetPins());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VPiece::MissingPlaceLabels(const VPiece &det) const
|
||||||
|
{
|
||||||
|
return PieceMissingNodes(d->m_placeLabels, det.GetPlaceLabels());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPiece::SetPatternPieceData(const VPieceLabelData &data)
|
void VPiece::SetPatternPieceData(const VPieceLabelData &data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
|
|
||||||
#include "../vlayout/vabstractpiece.h"
|
#include "../vlayout/vabstractpiece.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
class VPieceData;
|
class VPieceData;
|
||||||
class VPieceNode;
|
class VPieceNode;
|
||||||
|
@ -66,17 +67,19 @@ public:
|
||||||
VPiecePath &GetPath();
|
VPiecePath &GetPath();
|
||||||
void SetPath(const VPiecePath &path);
|
void SetPath(const VPiecePath &path);
|
||||||
|
|
||||||
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
QVector<QPointF> MainPathPoints(const VContainer *data) const;
|
||||||
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
|
||||||
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
|
||||||
QVector<QLineF> PassmarksLines(const VContainer *data,
|
QVector<QLineF> PassmarksLines(const VContainer *data,
|
||||||
const QVector<QPointF> &seamAllowance = QVector<QPointF>()) const;
|
const QVector<QPointF> &seamAllowance = QVector<QPointF>()) const;
|
||||||
|
QVector<PlaceLabelImg> PlaceLabelPoints(const VContainer *data) const;
|
||||||
|
|
||||||
QPainterPath MainPathPath(const VContainer *data) const;
|
QPainterPath MainPathPath(const VContainer *data) const;
|
||||||
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
||||||
QPainterPath SeamAllowancePath(const QVector<QPointF> &points) const;
|
QPainterPath SeamAllowancePath(const QVector<QPointF> &points) const;
|
||||||
QPainterPath PassmarksPath(const VContainer *data,
|
QPainterPath PassmarksPath(const VContainer *data,
|
||||||
const QVector<QPointF> &seamAllowance = QVector<QPointF>()) const;
|
const QVector<QPointF> &seamAllowance = QVector<QPointF>()) const;
|
||||||
|
QPainterPath PlaceLabelPath(const VContainer *data) const;
|
||||||
|
|
||||||
bool IsInLayout() const;
|
bool IsInLayout() const;
|
||||||
void SetInLayout(bool inLayout);
|
void SetInLayout(bool inLayout);
|
||||||
|
@ -99,10 +102,16 @@ public:
|
||||||
QVector<quint32> &GetPins();
|
QVector<quint32> &GetPins();
|
||||||
void SetPins(const QVector<quint32> &pins);
|
void SetPins(const QVector<quint32> &pins);
|
||||||
|
|
||||||
|
QVector<quint32> GetPlaceLabels() const;
|
||||||
|
QVector<quint32> &GetPlaceLabels();
|
||||||
|
void SetPlaceLabels(const QVector<quint32> &labels);
|
||||||
|
|
||||||
|
QList<quint32> Dependencies() const;
|
||||||
QVector<quint32> MissingNodes(const VPiece &det) const;
|
QVector<quint32> MissingNodes(const VPiece &det) const;
|
||||||
QVector<quint32> MissingCSAPath(const VPiece &det) const;
|
QVector<quint32> MissingCSAPath(const VPiece &det) const;
|
||||||
QVector<quint32> MissingInternalPaths(const VPiece &det) const;
|
QVector<quint32> MissingInternalPaths(const VPiece &det) const;
|
||||||
QVector<quint32> MissingPins(const VPiece &det) const;
|
QVector<quint32> MissingPins(const VPiece &det) const;
|
||||||
|
QVector<quint32> MissingPlaceLabels(const VPiece &det) const;
|
||||||
|
|
||||||
void SetPatternPieceData(const VPieceLabelData &data);
|
void SetPatternPieceData(const VPieceLabelData &data);
|
||||||
VPieceLabelData& GetPatternPieceData();
|
VPieceLabelData& GetPatternPieceData();
|
||||||
|
@ -146,6 +155,17 @@ private:
|
||||||
const VContainer *data, int passmarkIndex) const;
|
const VContainer *data, int passmarkIndex) const;
|
||||||
|
|
||||||
static int IsCSAStart(const QVector<CustomSARecord> &records, quint32 id);
|
static int IsCSAStart(const QVector<CustomSARecord> &records, quint32 id);
|
||||||
|
|
||||||
|
PlaceLabelImg LabelShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg SegmentShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg RectangleShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg CrossShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg TshapedShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg DoubletreeShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg CornerShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg TriangleShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg HshapedShape(const VContainer *data) const;
|
||||||
|
PlaceLabelImg ButtonShape(const VContainer *data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
m_customSARecords(),
|
m_customSARecords(),
|
||||||
m_internalPaths(),
|
m_internalPaths(),
|
||||||
m_pins(),
|
m_pins(),
|
||||||
|
m_placeLabels(),
|
||||||
m_ppData(),
|
m_ppData(),
|
||||||
m_piPatternInfo(),
|
m_piPatternInfo(),
|
||||||
m_glGrainline(),
|
m_glGrainline(),
|
||||||
|
@ -68,6 +69,7 @@ public:
|
||||||
m_customSARecords(detail.m_customSARecords),
|
m_customSARecords(detail.m_customSARecords),
|
||||||
m_internalPaths(detail.m_internalPaths),
|
m_internalPaths(detail.m_internalPaths),
|
||||||
m_pins(detail.m_pins),
|
m_pins(detail.m_pins),
|
||||||
|
m_placeLabels(detail.m_placeLabels),
|
||||||
m_ppData(detail.m_ppData),
|
m_ppData(detail.m_ppData),
|
||||||
m_piPatternInfo(detail.m_piPatternInfo),
|
m_piPatternInfo(detail.m_piPatternInfo),
|
||||||
m_glGrainline(detail.m_glGrainline),
|
m_glGrainline(detail.m_glGrainline),
|
||||||
|
@ -85,6 +87,7 @@ public:
|
||||||
QVector<CustomSARecord> m_customSARecords;
|
QVector<CustomSARecord> m_customSARecords;
|
||||||
QVector<quint32> m_internalPaths;
|
QVector<quint32> m_internalPaths;
|
||||||
QVector<quint32> m_pins;
|
QVector<quint32> m_pins;
|
||||||
|
QVector<quint32> m_placeLabels;
|
||||||
|
|
||||||
/** @brief Pattern piece data */
|
/** @brief Pattern piece data */
|
||||||
VPieceLabelData m_ppData;
|
VPieceLabelData m_ppData;
|
||||||
|
|
|
@ -435,6 +435,17 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QList<quint32> VPiecePath::Dependencies() const
|
||||||
|
{
|
||||||
|
QList<quint32> list;
|
||||||
|
foreach (const VPieceNode &node, d->m_nodes)
|
||||||
|
{
|
||||||
|
list.append(node.GetId());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<quint32> VPiecePath::MissingNodes(const VPiecePath &path) const
|
QVector<quint32> VPiecePath::MissingNodes(const VPiecePath &path) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
|
|
||||||
QPainterPath PainterPath(const VContainer *data) const;
|
QPainterPath PainterPath(const VContainer *data) const;
|
||||||
|
|
||||||
|
QList<quint32> Dependencies() const;
|
||||||
QVector<quint32> MissingNodes(const VPiecePath &path) const;
|
QVector<quint32> MissingNodes(const VPiecePath &path) const;
|
||||||
|
|
||||||
int indexOfNode(quint32 id) const;
|
int indexOfNode(quint32 id) const;
|
||||||
|
|
|
@ -44,9 +44,10 @@ HEADERS += \
|
||||||
$$PWD/tools/dialogellipticalarc.h \
|
$$PWD/tools/dialogellipticalarc.h \
|
||||||
$$PWD/tools/piece/dialogseamallowance.h \
|
$$PWD/tools/piece/dialogseamallowance.h \
|
||||||
$$PWD/tools/piece/dialogpiecepath.h \
|
$$PWD/tools/piece/dialogpiecepath.h \
|
||||||
$$PWD/tools/dialogpin.h \
|
$$PWD/tools/piece/dialogpin.h \
|
||||||
$$PWD/tools/dialoginsertnode.h \
|
$$PWD/tools/piece/dialoginsertnode.h \
|
||||||
$$PWD/support/dialogeditlabel.h
|
$$PWD/support/dialogeditlabel.h \
|
||||||
|
$$PWD/tools/piece/dialogplacelabel.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/tools/dialogalongline.cpp \
|
$$PWD/tools/dialogalongline.cpp \
|
||||||
|
@ -90,9 +91,10 @@ SOURCES += \
|
||||||
$$PWD/tools/dialogellipticalarc.cpp \
|
$$PWD/tools/dialogellipticalarc.cpp \
|
||||||
$$PWD/tools/piece/dialogseamallowance.cpp \
|
$$PWD/tools/piece/dialogseamallowance.cpp \
|
||||||
$$PWD/tools/piece/dialogpiecepath.cpp \
|
$$PWD/tools/piece/dialogpiecepath.cpp \
|
||||||
$$PWD/tools/dialogpin.cpp \
|
$$PWD/tools/piece/dialogpin.cpp \
|
||||||
$$PWD/tools/dialoginsertnode.cpp \
|
$$PWD/tools/piece/dialoginsertnode.cpp \
|
||||||
$$PWD/support/dialogeditlabel.cpp
|
$$PWD/support/dialogeditlabel.cpp \
|
||||||
|
$$PWD/tools/piece/dialogplacelabel.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tools/dialogalongline.ui \
|
$$PWD/tools/dialogalongline.ui \
|
||||||
|
@ -135,11 +137,13 @@ FORMS += \
|
||||||
$$PWD/tools/dialogellipticalarc.ui \
|
$$PWD/tools/dialogellipticalarc.ui \
|
||||||
$$PWD/tools/piece/dialogseamallowance.ui \
|
$$PWD/tools/piece/dialogseamallowance.ui \
|
||||||
$$PWD/tools/piece/dialogpiecepath.ui \
|
$$PWD/tools/piece/dialogpiecepath.ui \
|
||||||
$$PWD/tools/dialogpin.ui \
|
$$PWD/tools/piece/dialogpin.ui \
|
||||||
$$PWD/tools/piece/tabs/tabpaths.ui \
|
$$PWD/tools/piece/tabs/tabpaths.ui \
|
||||||
$$PWD/tools/piece/tabs/tablabels.ui \
|
$$PWD/tools/piece/tabs/tablabels.ui \
|
||||||
$$PWD/tools/piece/tabs/tabgrainline.ui \
|
$$PWD/tools/piece/tabs/tabgrainline.ui \
|
||||||
$$PWD/tools/piece/tabs/tabpins.ui \
|
$$PWD/tools/piece/tabs/tabpins.ui \
|
||||||
$$PWD/tools/dialoginsertnode.ui \
|
$$PWD/tools/piece/dialoginsertnode.ui \
|
||||||
$$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/tabs/tabplacelabels.ui
|
||||||
|
|
|
@ -67,8 +67,9 @@
|
||||||
#include "tools/dialogmove.h"
|
#include "tools/dialogmove.h"
|
||||||
#include "tools/dialogellipticalarc.h"
|
#include "tools/dialogellipticalarc.h"
|
||||||
#include "tools/piece/dialogpiecepath.h"
|
#include "tools/piece/dialogpiecepath.h"
|
||||||
#include "tools/dialogpin.h"
|
#include "tools/piece/dialogpin.h"
|
||||||
#include "tools/dialoginsertnode.h"
|
#include "tools/piece/dialoginsertnode.h"
|
||||||
|
#include "tools/piece/dialogplacelabel.h"
|
||||||
|
|
||||||
#include "support/dialogeditwrongformula.h"
|
#include "support/dialogeditwrongformula.h"
|
||||||
#include "support/dialogundo.h"
|
#include "support/dialogundo.h"
|
||||||
|
|
|
@ -457,10 +457,10 @@ VSpline DialogSpline::CurrentSpline() const
|
||||||
|
|
||||||
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
|
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
|
||||||
|
|
||||||
const qreal angle1 = Visualization::FindVal(angle1F, vars);
|
const qreal angle1 = Visualization::FindValFromUser(angle1F, vars);
|
||||||
const qreal angle2 = Visualization::FindVal(angle2F, vars);
|
const qreal angle2 = Visualization::FindValFromUser(angle2F, vars);
|
||||||
const qreal length1 = Visualization::FindLength(length1F, vars);
|
const qreal length1 = Visualization::FindLengthFromUser(length1F, vars);
|
||||||
const qreal length2 = Visualization::FindLength(length2F, vars);
|
const qreal length2 = Visualization::FindLengthFromUser(length2F, vars);
|
||||||
|
|
||||||
const bool separator = qApp->Settings()->GetOsSeparator();
|
const bool separator = qApp->Settings()->GetOsSeparator();
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ void DialogSplinePath::Angle1Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString angle1F = ui->plainTextEditAngle1F->toPlainText().replace("\n", " ");
|
const QString angle1F = ui->plainTextEditAngle1F->toPlainText().replace("\n", " ");
|
||||||
const qreal angle1 = Visualization::FindVal(angle1F, data->DataVariables());
|
const qreal angle1 = Visualization::FindValFromUser(angle1F, data->DataVariables());
|
||||||
p.SetAngle1(angle1, VTranslateVars::TryFormulaFromUser(angle1F, qApp->Settings()->GetOsSeparator()));
|
p.SetAngle1(angle1, VTranslateVars::TryFormulaFromUser(angle1F, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
|
@ -341,7 +341,7 @@ void DialogSplinePath::Angle2Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString angle2F = ui->plainTextEditAngle2F->toPlainText().replace("\n", " ");
|
const QString angle2F = ui->plainTextEditAngle2F->toPlainText().replace("\n", " ");
|
||||||
const qreal angle2 = Visualization::FindVal(angle2F, data->DataVariables());
|
const qreal angle2 = Visualization::FindValFromUser(angle2F, data->DataVariables());
|
||||||
p.SetAngle2(angle2, VTranslateVars::TryFormulaFromUser(angle2F, qApp->Settings()->GetOsSeparator()));
|
p.SetAngle2(angle2, VTranslateVars::TryFormulaFromUser(angle2F, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
|
@ -375,7 +375,7 @@ void DialogSplinePath::Length1Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString length1F = ui->plainTextEditLength1F->toPlainText().replace("\n", " ");
|
const QString length1F = ui->plainTextEditLength1F->toPlainText().replace("\n", " ");
|
||||||
const qreal length1 = Visualization::FindLength(length1F, data->DataVariables());
|
const qreal length1 = Visualization::FindLengthFromUser(length1F, data->DataVariables());
|
||||||
p.SetLength1(length1, VTranslateVars::TryFormulaFromUser(length1F, qApp->Settings()->GetOsSeparator()));
|
p.SetLength1(length1, VTranslateVars::TryFormulaFromUser(length1F, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
|
@ -400,7 +400,7 @@ void DialogSplinePath::Length2Changed()
|
||||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||||
|
|
||||||
const QString length2F = ui->plainTextEditLength2F->toPlainText().replace("\n", " ");
|
const QString length2F = ui->plainTextEditLength2F->toPlainText().replace("\n", " ");
|
||||||
const qreal length2 = Visualization::FindLength(length2F, data->DataVariables());
|
const qreal length2 = Visualization::FindLengthFromUser(length2F, data->DataVariables());
|
||||||
p.SetLength2(length2, VTranslateVars::TryFormulaFromUser(length2F, qApp->Settings()->GetOsSeparator()));
|
p.SetLength2(length2, VTranslateVars::TryFormulaFromUser(length2F, qApp->Settings()->GetOsSeparator()));
|
||||||
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
item->setData(Qt::UserRole, QVariant::fromValue(p));
|
||||||
|
|
|
@ -111,7 +111,7 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
||||||
flagName(true),
|
flagName(true),
|
||||||
flagFormula(true),
|
flagFormula(true),
|
||||||
flagError(true),
|
flagError(true),
|
||||||
timerFormula(nullptr),
|
timerFormula(new QTimer(this)),
|
||||||
bOk(nullptr),
|
bOk(nullptr),
|
||||||
bApply(nullptr),
|
bApply(nullptr),
|
||||||
spinBoxAngle(nullptr),
|
spinBoxAngle(nullptr),
|
||||||
|
@ -129,7 +129,6 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
||||||
vis(nullptr)
|
vis(nullptr)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
timerFormula = new QTimer(this);
|
|
||||||
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef DIALOGINSERTNODE_H
|
#ifndef DIALOGINSERTNODE_H
|
||||||
#define DIALOGINSERTNODE_H
|
#define DIALOGINSERTNODE_H
|
||||||
|
|
||||||
#include "dialogtool.h"
|
#include "../dialogtool.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
|
@ -28,9 +28,8 @@
|
||||||
|
|
||||||
#include "dialogpin.h"
|
#include "dialogpin.h"
|
||||||
#include "ui_dialogpin.h"
|
#include "ui_dialogpin.h"
|
||||||
#include "visualization/line/vistoolpin.h"
|
#include "visualization/line/vistoolspecialpoint.h"
|
||||||
#include "../../tools/vabstracttool.h"
|
#include "../../../tools/vabstracttool.h"
|
||||||
#include "../../tools/vtoolseamallowance.h"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
|
DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
|
@ -52,7 +51,7 @@ DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
CheckPieces();
|
CheckPieces();
|
||||||
});
|
});
|
||||||
|
|
||||||
vis = new VisToolPin(data);
|
vis = new VisToolSpecialPoint(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -106,7 +105,7 @@ void DialogPin::SetPointId(quint32 id)
|
||||||
{
|
{
|
||||||
setCurrentPointId(ui->comboBoxPoint, id);
|
setCurrentPointId(ui->comboBoxPoint, id);
|
||||||
|
|
||||||
VisToolPin *point = qobject_cast<VisToolPin *>(vis);
|
VisToolSpecialPoint *point = qobject_cast<VisToolSpecialPoint *>(vis);
|
||||||
SCASSERT(point != nullptr)
|
SCASSERT(point != nullptr)
|
||||||
point->setObject1Id(id);
|
point->setObject1Id(id);
|
||||||
|
|
||||||
|
@ -148,16 +147,7 @@ void DialogPin::CheckState()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPin::ShowVisualization()
|
void DialogPin::ShowVisualization()
|
||||||
{
|
{
|
||||||
AddVisualization<VisToolPin>();
|
AddVisualization<VisToolSpecialPoint>();
|
||||||
|
|
||||||
if (m_showMode)
|
|
||||||
{
|
|
||||||
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(GetPieceId()));
|
|
||||||
SCASSERT(tool != nullptr);
|
|
||||||
auto visPoint = qobject_cast<VisToolPin *>(vis);
|
|
||||||
SCASSERT(visPoint != nullptr);
|
|
||||||
visPoint->setParentItem(tool);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
|
@ -29,7 +29,7 @@
|
||||||
#ifndef DIALOGPIN_H
|
#ifndef DIALOGPIN_H
|
||||||
#define DIALOGPIN_H
|
#define DIALOGPIN_H
|
||||||
|
|
||||||
#include "dialogtool.h"
|
#include "../dialogtool.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
470
src/libs/vtools/dialogs/tools/piece/dialogplacelabel.cpp
Normal file
|
@ -0,0 +1,470 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogplacelabel.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 14 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 "dialogplacelabel.h"
|
||||||
|
#include "ui_dialogplacelabel.h"
|
||||||
|
|
||||||
|
#include "visualization/line/vistoolspecialpoint.h"
|
||||||
|
#include "../../../tools/vabstracttool.h"
|
||||||
|
#include "../../../tools/vtoolseamallowance.h"
|
||||||
|
#include "../../support/dialogeditwrongformula.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
|
: DialogTool(data, toolId, parent),
|
||||||
|
ui(new Ui::DialogPlaceLabel),
|
||||||
|
m_showMode(false),
|
||||||
|
m_flagPoint(false),
|
||||||
|
m_flagWidth(false),
|
||||||
|
m_flagHeight(false),
|
||||||
|
m_flagAngle(false),
|
||||||
|
m_formulaBaseHeightWidth(0),
|
||||||
|
m_formulaBaseHeightHeight(0),
|
||||||
|
m_formulaBaseHeightAngle(0),
|
||||||
|
timerAngle(new QTimer(this)),
|
||||||
|
timerWidth(new QTimer(this)),
|
||||||
|
timerHeight(new QTimer(this))
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
InitOkCancel(ui);
|
||||||
|
|
||||||
|
FillComboBoxPoints(ui->comboBoxPoint);
|
||||||
|
FillPlaceLabelTypes();
|
||||||
|
|
||||||
|
m_formulaBaseHeightWidth = ui->plainTextEditFormulaWidth->height();
|
||||||
|
m_formulaBaseHeightHeight = ui->plainTextEditFormulaHeight->height();
|
||||||
|
m_formulaBaseHeightAngle = ui->plainTextEditFormulaAngle->height();
|
||||||
|
|
||||||
|
ui->plainTextEditFormulaWidth->installEventFilter(this);
|
||||||
|
ui->plainTextEditFormulaHeight->installEventFilter(this);
|
||||||
|
ui->plainTextEditFormulaAngle->installEventFilter(this);
|
||||||
|
|
||||||
|
ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
||||||
|
ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
||||||
|
|
||||||
|
flagError = false;
|
||||||
|
CheckState();
|
||||||
|
|
||||||
|
connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPlaceLabel::FXWidth);
|
||||||
|
connect(ui->toolButtonExprHeight, &QPushButton::clicked, this, &DialogPlaceLabel::FXHeight);
|
||||||
|
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogPlaceLabel::FXAngle);
|
||||||
|
|
||||||
|
connect(ui->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaWidthChanged);
|
||||||
|
connect(ui->plainTextEditFormulaHeight, &QPlainTextEdit::textChanged, this,
|
||||||
|
&DialogPlaceLabel::FormulaHeightChanged);
|
||||||
|
connect(ui->plainTextEditFormulaAngle, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaAngleChanged);
|
||||||
|
|
||||||
|
connect(ui->pushButtonGrowWidth, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaWidthEdit);
|
||||||
|
connect(ui->pushButtonGrowHeight, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaHeightEdit);
|
||||||
|
connect(ui->pushButtonGrowAngle, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaAngleEdit);
|
||||||
|
|
||||||
|
connect(timerWidth, &QTimer::timeout, this, &DialogPlaceLabel::EvalWidth);
|
||||||
|
connect(timerHeight, &QTimer::timeout, this, &DialogPlaceLabel::EvalHeight);
|
||||||
|
connect(timerAngle, &QTimer::timeout, this, &DialogPlaceLabel::EvalAngle);
|
||||||
|
|
||||||
|
connect(ui->comboBoxPiece, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
{
|
||||||
|
CheckPieces();
|
||||||
|
});
|
||||||
|
|
||||||
|
vis = new VisToolSpecialPoint(data);
|
||||||
|
|
||||||
|
FormulaWidthChanged();
|
||||||
|
FormulaHeightChanged();
|
||||||
|
FormulaAngleChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogPlaceLabel::~DialogPlaceLabel()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::EnbleShowMode(bool disable)
|
||||||
|
{
|
||||||
|
m_showMode = disable;
|
||||||
|
ui->comboBoxPiece->setDisabled(m_showMode);
|
||||||
|
ui->comboBoxPoint->setDisabled(m_showMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogPlaceLabel::GetCenterPoint() const
|
||||||
|
{
|
||||||
|
return getCurrentObjectId(ui->comboBoxPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetCenterPoint(quint32 id)
|
||||||
|
{
|
||||||
|
setCurrentPointId(ui->comboBoxPoint, id);
|
||||||
|
|
||||||
|
if (not m_showMode)
|
||||||
|
{
|
||||||
|
VisToolSpecialPoint *point = qobject_cast<VisToolSpecialPoint *>(vis);
|
||||||
|
SCASSERT(point != nullptr)
|
||||||
|
point->setObject1Id(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PlaceLabelType DialogPlaceLabel::GetLabelType() const
|
||||||
|
{
|
||||||
|
return static_cast<PlaceLabelType>(ui->comboBoxLabelType->currentData().toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetLabelType(PlaceLabelType type)
|
||||||
|
{
|
||||||
|
const qint32 index = ui->comboBoxLabelType->findData(static_cast<int>(type));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxLabelType->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPlaceLabel::GetWidth() const
|
||||||
|
{
|
||||||
|
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormulaWidth->toPlainText().replace("\n", " "),
|
||||||
|
qApp->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetWidth(const QString &value)
|
||||||
|
{
|
||||||
|
const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||||
|
// of this PlainTextEdit to change 80 to this value
|
||||||
|
if (formula.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployFormulaWidthEdit();
|
||||||
|
}
|
||||||
|
ui->plainTextEditFormulaWidth->setPlainText(formula);
|
||||||
|
|
||||||
|
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
|
||||||
|
// SCASSERT(point != nullptr)
|
||||||
|
// point->setObject1Id(id);
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditFormulaWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPlaceLabel::GetHeight() const
|
||||||
|
{
|
||||||
|
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormulaHeight->toPlainText().replace("\n", " "),
|
||||||
|
qApp->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetHeight(const QString &value)
|
||||||
|
{
|
||||||
|
const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||||
|
// of this PlainTextEdit to change 80 to this value
|
||||||
|
if (formula.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployFormulaHeightEdit();
|
||||||
|
}
|
||||||
|
ui->plainTextEditFormulaHeight->setPlainText(formula);
|
||||||
|
|
||||||
|
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
|
||||||
|
// SCASSERT(point != nullptr)
|
||||||
|
// point->setObject1Id(id);
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditFormulaHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPlaceLabel::GetAngle() const
|
||||||
|
{
|
||||||
|
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormulaAngle->toPlainText().replace("\n", " "),
|
||||||
|
qApp->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetAngle(const QString &value)
|
||||||
|
{
|
||||||
|
const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||||
|
// of this PlainTextEdit to change 80 to this value
|
||||||
|
if (formula.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployFormulaAngleEdit();
|
||||||
|
}
|
||||||
|
ui->plainTextEditFormulaAngle->setPlainText(formula);
|
||||||
|
|
||||||
|
// VisToolPlaceLabel *point = qobject_cast<VisToolPlaceLabel *>(vis);
|
||||||
|
// SCASSERT(point != nullptr)
|
||||||
|
// point->setObject1Id(id);
|
||||||
|
|
||||||
|
MoveCursorToEnd(ui->plainTextEditFormulaAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogPlaceLabel::GetPieceId() const
|
||||||
|
{
|
||||||
|
return getCurrentObjectId(ui->comboBoxPiece);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetPieceId(quint32 id)
|
||||||
|
{
|
||||||
|
if (ui->comboBoxPiece->count() <= 0)
|
||||||
|
{
|
||||||
|
ui->comboBoxPiece->addItem(data->GetPiece(id).GetName(), id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const qint32 index = ui->comboBoxPiece->findData(id);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxPiece->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->comboBoxPiece->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetPiecesList(const QVector<quint32> &list)
|
||||||
|
{
|
||||||
|
FillComboBoxPiecesList(ui->comboBoxPiece, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
|
{
|
||||||
|
if (not prepare)
|
||||||
|
{
|
||||||
|
if (type == SceneObject::Point)
|
||||||
|
{
|
||||||
|
if (SetObject(id, ui->comboBoxPoint, ""))
|
||||||
|
{
|
||||||
|
vis->VisualMode(id);
|
||||||
|
CheckPoint();
|
||||||
|
prepare = true;
|
||||||
|
this->setModal(true);
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::CheckState()
|
||||||
|
{
|
||||||
|
SCASSERT(bOk != nullptr);
|
||||||
|
bOk->setEnabled(m_flagPoint && flagError && m_flagWidth && m_flagHeight && m_flagAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::ShowVisualization()
|
||||||
|
{
|
||||||
|
if (not m_showMode)
|
||||||
|
{
|
||||||
|
AddVisualization<VisToolSpecialPoint>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
ui->plainTextEditFormulaWidth->blockSignals(true);
|
||||||
|
ui->plainTextEditFormulaHeight->blockSignals(true);
|
||||||
|
ui->plainTextEditFormulaAngle->blockSignals(true);
|
||||||
|
DialogTool::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::DeployFormulaWidthEdit()
|
||||||
|
{
|
||||||
|
DeployFormula(ui->plainTextEditFormulaWidth, ui->pushButtonGrowWidth, m_formulaBaseHeightWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::DeployFormulaHeightEdit()
|
||||||
|
{
|
||||||
|
DeployFormula(ui->plainTextEditFormulaHeight, ui->pushButtonGrowHeight, m_formulaBaseHeightHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::DeployFormulaAngleEdit()
|
||||||
|
{
|
||||||
|
DeployFormula(ui->plainTextEditFormulaAngle, ui->pushButtonGrowAngle, m_formulaBaseHeightAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FormulaWidthChanged()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaWidth;
|
||||||
|
labelResultCalculation = ui->labelResultCalculationWidth;
|
||||||
|
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||||
|
ValFormulaChanged(m_flagWidth, ui->plainTextEditFormulaWidth, timerWidth, postfix);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FormulaHeightChanged()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaHeight;
|
||||||
|
labelResultCalculation = ui->labelResultCalculationHeight;
|
||||||
|
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||||
|
ValFormulaChanged(m_flagHeight, ui->plainTextEditFormulaHeight, timerHeight, postfix);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FormulaAngleChanged()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaAngle;
|
||||||
|
labelResultCalculation = ui->labelResultCalculationAngle;
|
||||||
|
ValFormulaChanged(m_flagAngle, ui->plainTextEditFormulaAngle, timerAngle, degreeSymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::EvalWidth()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaWidth;
|
||||||
|
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||||
|
Eval(ui->plainTextEditFormulaWidth->toPlainText(), m_flagWidth, ui->labelResultCalculationWidth, postfix, true,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::EvalHeight()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaHeight;
|
||||||
|
const QString postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||||
|
Eval(ui->plainTextEditFormulaHeight->toPlainText(), m_flagHeight, ui->labelResultCalculationHeight, postfix, true,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::EvalAngle()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditFormulaAngle;
|
||||||
|
Eval(ui->plainTextEditFormulaAngle->toPlainText(), m_flagAngle, ui->labelResultCalculationAngle, degreeSymbol,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FXWidth()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit rectangle width"));
|
||||||
|
dialog->SetFormula(GetWidth());
|
||||||
|
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetWidth(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FXHeight()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit rectangle width"));
|
||||||
|
dialog->SetFormula(GetHeight());
|
||||||
|
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetHeight(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FXAngle()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Edit angle"));
|
||||||
|
dialog->SetFormula(GetAngle());
|
||||||
|
dialog->setPostfix(degreeSymbol);
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetAngle(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FillPlaceLabelTypes()
|
||||||
|
{
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Segment"), static_cast<int>(PlaceLabelType::Segment));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Rectangle"), static_cast<int>(PlaceLabelType::Rectangle));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Cross"), static_cast<int>(PlaceLabelType::Cross));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("T-shaped"), static_cast<int>(PlaceLabelType::Tshaped));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Doubletree"), static_cast<int>(PlaceLabelType::Doubletree));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Corner"), static_cast<int>(PlaceLabelType::Corner));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Triangle"), static_cast<int>(PlaceLabelType::Triangle));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("H-shaped"), static_cast<int>(PlaceLabelType::Hshaped));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Button"), static_cast<int>(PlaceLabelType::Button));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::CheckPieces()
|
||||||
|
{
|
||||||
|
if (not m_showMode)
|
||||||
|
{
|
||||||
|
QColor color = okColor;
|
||||||
|
if (ui->comboBoxPiece->count() <= 0 || ui->comboBoxPiece->currentIndex() == -1)
|
||||||
|
{
|
||||||
|
flagError = false;
|
||||||
|
color = errorColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagError = true;
|
||||||
|
color = okColor;
|
||||||
|
}
|
||||||
|
ChangeColor(ui->labelPiece, color);
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::CheckPoint()
|
||||||
|
{
|
||||||
|
QColor color = okColor;
|
||||||
|
if (ui->comboBoxPoint->currentIndex() != -1)
|
||||||
|
{
|
||||||
|
m_flagPoint = true;
|
||||||
|
color = okColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_flagPoint = false;
|
||||||
|
color = errorColor;
|
||||||
|
}
|
||||||
|
ChangeColor(ui->labelPoint, color);
|
||||||
|
CheckState();
|
||||||
|
}
|
119
src/libs/vtools/dialogs/tools/piece/dialogplacelabel.h
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogplacelabel.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 14 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 DIALOGPLACELABEL_H
|
||||||
|
#define DIALOGPLACELABEL_H
|
||||||
|
|
||||||
|
#include "../dialogtool.h"
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class DialogPlaceLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VPlaceLabelItem;
|
||||||
|
|
||||||
|
class DialogPlaceLabel : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||||
|
virtual ~DialogPlaceLabel();
|
||||||
|
|
||||||
|
void EnbleShowMode(bool disable);
|
||||||
|
|
||||||
|
quint32 GetCenterPoint() const;
|
||||||
|
void SetCenterPoint(quint32 id);
|
||||||
|
|
||||||
|
PlaceLabelType GetLabelType() const;
|
||||||
|
void SetLabelType(PlaceLabelType type);
|
||||||
|
|
||||||
|
QString GetWidth() const;
|
||||||
|
void SetWidth(const QString &value);
|
||||||
|
|
||||||
|
QString GetHeight() const;
|
||||||
|
void SetHeight(const QString &value);
|
||||||
|
|
||||||
|
QString GetAngle() const;
|
||||||
|
void SetAngle(const QString &value);
|
||||||
|
|
||||||
|
quint32 GetPieceId() const;
|
||||||
|
void SetPieceId(quint32 id);
|
||||||
|
|
||||||
|
virtual void SetPiecesList(const QVector<quint32> &list) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void CheckState() Q_DECL_FINAL;
|
||||||
|
virtual void ShowVisualization() Q_DECL_OVERRIDE;
|
||||||
|
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void DeployFormulaWidthEdit();
|
||||||
|
void DeployFormulaHeightEdit();
|
||||||
|
void DeployFormulaAngleEdit();
|
||||||
|
|
||||||
|
void FormulaWidthChanged();
|
||||||
|
void FormulaHeightChanged();
|
||||||
|
void FormulaAngleChanged();
|
||||||
|
|
||||||
|
void EvalWidth();
|
||||||
|
void EvalHeight();
|
||||||
|
void EvalAngle();
|
||||||
|
|
||||||
|
void FXWidth();
|
||||||
|
void FXHeight();
|
||||||
|
void FXAngle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogPlaceLabel)
|
||||||
|
Ui::DialogPlaceLabel *ui;
|
||||||
|
bool m_showMode;
|
||||||
|
bool m_flagPoint;
|
||||||
|
bool m_flagWidth;
|
||||||
|
bool m_flagHeight;
|
||||||
|
bool m_flagAngle;
|
||||||
|
|
||||||
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
|
int m_formulaBaseHeightWidth;
|
||||||
|
int m_formulaBaseHeightHeight;
|
||||||
|
int m_formulaBaseHeightAngle;
|
||||||
|
|
||||||
|
QTimer *timerAngle;
|
||||||
|
QTimer *timerWidth;
|
||||||
|
QTimer *timerHeight;
|
||||||
|
|
||||||
|
void FillPlaceLabelTypes();
|
||||||
|
|
||||||
|
void CheckPieces();
|
||||||
|
void CheckPoint();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGPLACELABEL_H
|
655
src/libs/vtools/dialogs/tools/piece/dialogplacelabel.ui
Normal file
|
@ -0,0 +1,655 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogPlaceLabel</class>
|
||||||
|
<widget class="QDialog" name="DialogPlaceLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>338</width>
|
||||||
|
<height>363</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="labelEditFormulaWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QToolButton" name="toolButtonExprWidth">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula wizard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelResultCalculationWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_formula">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEditFormulaWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculation</string>
|
||||||
|
</property>
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonGrowWidth">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="go-down">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="labelEditFormulaHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QToolButton" name="toolButtonExprHeight">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula wizard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelResultCalculationHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_formula_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEditFormulaHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculation</string>
|
||||||
|
</property>
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonGrowHeight">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="go-down">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="labelEditFormulaAngle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Angle:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QToolButton" name="toolButtonExprAngle">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula wizard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelResultCalculationAngle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_formula_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEditFormulaAngle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculation</string>
|
||||||
|
</property>
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="plainText">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonGrowAngle">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="go-down">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelPoint">
|
||||||
|
<property name="text">
|
||||||
|
<string>Point:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxPoint"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelPiece">
|
||||||
|
<property name="text">
|
||||||
|
<string>Piece:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxPiece"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxLabelType"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</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>DialogPlaceLabel</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>DialogPlaceLabel</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>
|
|
@ -33,23 +33,27 @@
|
||||||
#include "ui_tabgrainline.h"
|
#include "ui_tabgrainline.h"
|
||||||
#include "ui_tabpins.h"
|
#include "ui_tabpins.h"
|
||||||
#include "ui_tabpassmarks.h"
|
#include "ui_tabpassmarks.h"
|
||||||
|
#include "ui_tabplacelabels.h"
|
||||||
#include "../vwidgets/fancytabbar/fancytabbar.h"
|
#include "../vwidgets/fancytabbar/fancytabbar.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 "visualization/path/vistoolpiece.h"
|
#include "visualization/path/vistoolpiece.h"
|
||||||
#include "visualization/path/vispiecepins.h"
|
#include "visualization/path/vispiecespecialpoints.h"
|
||||||
#include "dialogpiecepath.h"
|
#include "dialogpiecepath.h"
|
||||||
|
#include "dialogplacelabel.h"
|
||||||
#include "../../../undocommands/savepiecepathoptions.h"
|
#include "../../../undocommands/savepiecepathoptions.h"
|
||||||
|
#include "../../../undocommands/saveplacelabeloptions.h"
|
||||||
#include "../../support/dialogeditwrongformula.h"
|
#include "../../support/dialogeditwrongformula.h"
|
||||||
#include "../../support/dialogeditlabel.h"
|
#include "../../support/dialogeditlabel.h"
|
||||||
#include "../../../tools/vtoolseamallowance.h"
|
#include "../../../tools/vtoolseamallowance.h"
|
||||||
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtNumeric>
|
#include <QtNumeric>
|
||||||
|
|
||||||
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, Count=5};
|
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, PlaceLabels=5, Count=6};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -84,11 +88,13 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
uiTabGrainline(new Ui::TabGrainline),
|
uiTabGrainline(new Ui::TabGrainline),
|
||||||
uiTabPins(new Ui::TabPins),
|
uiTabPins(new Ui::TabPins),
|
||||||
uiTabPassmarks(new Ui::TabPassmarks),
|
uiTabPassmarks(new Ui::TabPassmarks),
|
||||||
|
uiTabPlaceLabels(new Ui::TabPlaceLabels),
|
||||||
m_tabPaths(new QWidget),
|
m_tabPaths(new QWidget),
|
||||||
m_tabLabels(new QWidget),
|
m_tabLabels(new QWidget),
|
||||||
m_tabGrainline(new QWidget),
|
m_tabGrainline(new QWidget),
|
||||||
m_tabPins(new QWidget),
|
m_tabPins(new QWidget),
|
||||||
m_tabPassmarks(new QWidget),
|
m_tabPassmarks(new QWidget),
|
||||||
|
m_tabPlaceLabels(new QWidget),
|
||||||
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
|
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
|
||||||
applyAllowed(false),// By default disabled
|
applyAllowed(false),// By default disabled
|
||||||
flagGPin(true),
|
flagGPin(true),
|
||||||
|
@ -103,7 +109,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
m_mx(0),
|
m_mx(0),
|
||||||
m_my(0),
|
m_my(0),
|
||||||
m_dialog(),
|
m_dialog(),
|
||||||
m_visPins(),
|
m_visSpecialPoints(),
|
||||||
m_oldData(),
|
m_oldData(),
|
||||||
m_oldGeom(),
|
m_oldGeom(),
|
||||||
m_oldGrainline(),
|
m_oldGrainline(),
|
||||||
|
@ -122,7 +128,10 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
m_timerWidthBefore(nullptr),
|
m_timerWidthBefore(nullptr),
|
||||||
m_timerWidthAfter(nullptr),
|
m_timerWidthAfter(nullptr),
|
||||||
m_saWidth(0),
|
m_saWidth(0),
|
||||||
m_templateLines()
|
m_templateLines(),
|
||||||
|
m_undoStack(),
|
||||||
|
m_newPlaceLabels(),
|
||||||
|
m_newPaths()
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -138,6 +147,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
InitGrainlineTab();
|
InitGrainlineTab();
|
||||||
InitPinsTab();
|
InitPinsTab();
|
||||||
InitPassmarksTab();
|
InitPassmarksTab();
|
||||||
|
InitPlaceLabelsTab();
|
||||||
|
|
||||||
flagName = true;//We have default name of piece.
|
flagName = true;//We have default name of piece.
|
||||||
ChangeColor(uiTabLabels->labelEditName, okColor);
|
ChangeColor(uiTabLabels->labelEditName, okColor);
|
||||||
|
@ -155,7 +165,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSeamAllowance::~DialogSeamAllowance()
|
DialogSeamAllowance::~DialogSeamAllowance()
|
||||||
{
|
{
|
||||||
delete m_visPins;
|
delete m_visSpecialPoints;
|
||||||
|
delete m_tabPlaceLabels;
|
||||||
delete m_tabPassmarks;
|
delete m_tabPassmarks;
|
||||||
delete m_tabPins;
|
delete m_tabPins;
|
||||||
delete m_tabGrainline;
|
delete m_tabGrainline;
|
||||||
|
@ -182,6 +193,7 @@ void DialogSeamAllowance::EnableApply(bool enable)
|
||||||
m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed);
|
m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed);
|
||||||
m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed);
|
m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed);
|
||||||
m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed);
|
m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed);
|
||||||
|
m_ftb->SetTabEnabled(TabOrder::PlaceLabels, applyAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -204,24 +216,76 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
uiTabPaths->listWidgetCustomSA->clear();
|
uiTabPaths->listWidgetCustomSA->clear();
|
||||||
for (int i = 0; i < piece.GetCustomSARecords().size(); ++i)
|
for (int i = 0; i < piece.GetCustomSARecords().size(); ++i)
|
||||||
{
|
{
|
||||||
NewCustomSA(piece.GetCustomSARecords().at(i));
|
const CustomSARecord &record = piece.GetCustomSARecords().at(i);
|
||||||
|
if (record.path > NULL_ID)
|
||||||
|
{
|
||||||
|
const QString name = GetPathName(record.path, record.reverse);
|
||||||
|
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||||
|
uiTabPaths->listWidgetCustomSA->addItem(item);
|
||||||
|
uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uiTabPaths->listWidgetCustomSA->blockSignals(false);
|
uiTabPaths->listWidgetCustomSA->blockSignals(false);
|
||||||
|
|
||||||
uiTabPaths->listWidgetInternalPaths->clear();
|
uiTabPaths->listWidgetInternalPaths->clear();
|
||||||
for (int i = 0; i < piece.GetInternalPaths().size(); ++i)
|
for (int i = 0; i < piece.GetInternalPaths().size(); ++i)
|
||||||
{
|
{
|
||||||
NewInternalPath(piece.GetInternalPaths().at(i));
|
const quint32 path = piece.GetInternalPaths().at(i);
|
||||||
|
if (path > NULL_ID)
|
||||||
|
{
|
||||||
|
const QString name = GetPathName(path);
|
||||||
|
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(path));
|
||||||
|
uiTabPaths->listWidgetInternalPaths->addItem(item);
|
||||||
|
uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto NewSpecialPoint = [this](QListWidget *listWidget, quint32 point)
|
||||||
|
{
|
||||||
|
if (point > NULL_ID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const QSharedPointer<VGObject> p = data->GetGObject(point);
|
||||||
|
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(p->name());
|
||||||
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(point));
|
||||||
|
listWidget->addItem(item);
|
||||||
|
listWidget->setCurrentRow(uiTabPins->listWidgetPins->count()-1);
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
qWarning() << qUtf8Printable(e.ErrorMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
uiTabPins->listWidgetPins->clear();
|
uiTabPins->listWidgetPins->clear();
|
||||||
for (int i = 0; i < piece.GetPins().size(); ++i)
|
for (int i = 0; i < piece.GetPins().size(); ++i)
|
||||||
{
|
{
|
||||||
NewPin(piece.GetPins().at(i));
|
NewSpecialPoint(uiTabPins->listWidgetPins, piece.GetPins().at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
InitAllPinComboboxes();
|
InitAllPinComboboxes();
|
||||||
|
|
||||||
|
uiTabPlaceLabels->listWidgetPlaceLabels->clear();
|
||||||
|
for (int i = 0; i < piece.GetPlaceLabels().size(); ++i)
|
||||||
|
{
|
||||||
|
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, piece.GetPlaceLabels().at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (piece.GetPlaceLabels().size() > 0)
|
||||||
|
{
|
||||||
|
uiTabPlaceLabels->listWidgetPlaceLabels->setCurrentRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
uiTabPaths->comboBoxStartPoint->blockSignals(true);
|
uiTabPaths->comboBoxStartPoint->blockSignals(true);
|
||||||
uiTabPaths->comboBoxStartPoint->clear();
|
uiTabPaths->comboBoxStartPoint->clear();
|
||||||
uiTabPaths->comboBoxStartPoint->blockSignals(false);
|
uiTabPaths->comboBoxStartPoint->blockSignals(false);
|
||||||
|
@ -469,7 +533,8 @@ void DialogSeamAllowance::NameDetailChanged()
|
||||||
flagName = false;
|
flagName = false;
|
||||||
ChangeColor(uiTabLabels->labelEditName, Qt::red);
|
ChangeColor(uiTabLabels->labelEditName, Qt::red);
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabPieceLabelData), icon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -585,7 +650,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
|
||||||
else if (selectedAction == actionOption)
|
else if (selectedAction == actionOption)
|
||||||
{
|
{
|
||||||
auto *dialog = new DialogPiecePath(data, record.path, this);
|
auto *dialog = new DialogPiecePath(data, record.path, this);
|
||||||
dialog->SetPiecePath(data->GetPiecePath(record.path));
|
dialog->SetPiecePath(CurrentPath(record.path));
|
||||||
dialog->SetPieceId(toolId);
|
dialog->SetPieceId(toolId);
|
||||||
if (record.includeType == PiecePathIncludeType::AsMainPath)
|
if (record.includeType == PiecePathIncludeType::AsMainPath)
|
||||||
{
|
{
|
||||||
|
@ -625,7 +690,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
||||||
const quint32 pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
const quint32 pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
||||||
|
|
||||||
auto *dialog = new DialogPiecePath(data, pathId, this);
|
auto *dialog = new DialogPiecePath(data, pathId, this);
|
||||||
dialog->SetPiecePath(data->GetPiecePath(pathId));
|
dialog->SetPiecePath(CurrentPath(pathId));
|
||||||
dialog->SetPieceId(toolId);
|
dialog->SetPieceId(toolId);
|
||||||
dialog->EnbleShowMode(true);
|
dialog->EnbleShowMode(true);
|
||||||
m_dialog = dialog;
|
m_dialog = dialog;
|
||||||
|
@ -656,6 +721,118 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
|
{
|
||||||
|
const int row = uiTabPlaceLabels->listWidgetPlaceLabels->currentRow();
|
||||||
|
if (uiTabPlaceLabels->listWidgetPlaceLabels->count() == 0
|
||||||
|
|| row == -1
|
||||||
|
|| row >= uiTabPlaceLabels->listWidgetPlaceLabels->count())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QListWidgetItem *rowItem = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||||
|
SCASSERT(rowItem != nullptr);
|
||||||
|
const quint32 labelId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
|
||||||
|
VPlaceLabelItem currentLabel = CurrentPlaceLabel(labelId);
|
||||||
|
|
||||||
|
QScopedPointer<QMenu> menu(new QMenu());
|
||||||
|
|
||||||
|
auto InitAction = [currentLabel, &menu](const QString &text, PlaceLabelType type)
|
||||||
|
{
|
||||||
|
QAction *action = menu->addAction(text);
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setChecked(currentLabel.GetLabelType() == type);
|
||||||
|
return action;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto SaveType = [this, currentLabel, labelId](PlaceLabelType type)
|
||||||
|
{
|
||||||
|
VPlaceLabelItem newLabel = VPlaceLabelItem(currentLabel);
|
||||||
|
newLabel.SetLabelType(type);
|
||||||
|
m_newPlaceLabels.insert(labelId, newLabel);
|
||||||
|
|
||||||
|
SavePlaceLabelOptions *saveCommand = new SavePlaceLabelOptions(toolId, currentLabel, newLabel,
|
||||||
|
qApp->getCurrentDocument(),
|
||||||
|
const_cast<VContainer *>(data), labelId);
|
||||||
|
m_undoStack.append(saveCommand);
|
||||||
|
UpdateCurrentPlaceLabelRecords();
|
||||||
|
};
|
||||||
|
|
||||||
|
QAction *actionOption = menu->addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||||
|
menu->addSeparator();
|
||||||
|
QAction *actionSegment = InitAction(tr("Segment"), PlaceLabelType::Segment);
|
||||||
|
QAction *actionRectangle = InitAction(tr("Rectangle"), PlaceLabelType::Rectangle);
|
||||||
|
QAction *actionCross = InitAction(tr("Cross"), PlaceLabelType::Cross);
|
||||||
|
QAction *actionTshaped = InitAction(tr("T-shaped"), PlaceLabelType::Tshaped);
|
||||||
|
QAction *actionDoubletree = InitAction(tr("Doubletree"), PlaceLabelType::Doubletree);
|
||||||
|
QAction *actionCorner = InitAction(tr("Corner"), PlaceLabelType::Corner);
|
||||||
|
QAction *actionTriangle = InitAction(tr("Triangle"), PlaceLabelType::Triangle);
|
||||||
|
QAction *actionHshaped = InitAction(tr("H-shaped"), PlaceLabelType::Hshaped);
|
||||||
|
QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button);
|
||||||
|
menu->addSeparator();
|
||||||
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
|
|
||||||
|
QAction *selectedAction = menu->exec(uiTabPlaceLabels->listWidgetPlaceLabels->viewport()->mapToGlobal(pos));
|
||||||
|
if (selectedAction == actionDelete)
|
||||||
|
{
|
||||||
|
delete uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||||
|
FancyTabChanged(m_ftb->CurrentIndex());
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionOption)
|
||||||
|
{
|
||||||
|
auto *dialog = new DialogPlaceLabel(data, labelId, this);
|
||||||
|
dialog->SetCenterPoint(labelId);
|
||||||
|
dialog->SetLabelType(currentLabel.GetLabelType());
|
||||||
|
dialog->SetWidth(currentLabel.GetWidthFormula());
|
||||||
|
dialog->SetHeight(currentLabel.GetHeightFormula());
|
||||||
|
dialog->SetAngle(currentLabel.GetAngleFormula());
|
||||||
|
dialog->SetPieceId(toolId);
|
||||||
|
dialog->EnbleShowMode(true);
|
||||||
|
m_dialog = dialog;
|
||||||
|
m_dialog->setModal(true);
|
||||||
|
connect(m_dialog.data(), &DialogTool::DialogClosed, this, &DialogSeamAllowance::PlaceLabelDialogClosed);
|
||||||
|
m_dialog->show();
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionSegment)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Segment);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionRectangle)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Rectangle);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionCross)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Cross);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionTshaped)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Tshaped);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionDoubletree)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Doubletree);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionCorner)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Corner);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionTriangle)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Triangle);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionHshaped)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Hshaped);
|
||||||
|
}
|
||||||
|
else if (selectedAction == actionButton)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ListChanged()
|
void DialogSeamAllowance::ListChanged()
|
||||||
{
|
{
|
||||||
|
@ -1009,13 +1186,15 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const VPiecePath newPath = dialogTool->GetPiecePath();
|
VPiecePath currentPath = CurrentPath(dialogTool->GetToolId());
|
||||||
const VPiecePath oldPath = data->GetPiecePath(dialogTool->GetToolId());
|
VPiecePath newPath = dialogTool->GetPiecePath();
|
||||||
|
m_newPaths.insert(dialogTool->GetToolId(), newPath);
|
||||||
|
|
||||||
SavePiecePathOptions *saveCommand = new SavePiecePathOptions(oldPath, newPath, qApp->getCurrentDocument(),
|
SavePiecePathOptions *saveCommand = new SavePiecePathOptions(toolId, currentPath, newPath,
|
||||||
|
qApp->getCurrentDocument(),
|
||||||
const_cast<VContainer *>(data),
|
const_cast<VContainer *>(data),
|
||||||
dialogTool->GetToolId());
|
dialogTool->GetToolId());
|
||||||
qApp->getUndoStack()->push(saveCommand);
|
m_undoStack.append(saveCommand);
|
||||||
UpdateCurrentCustomSARecord();
|
UpdateCurrentCustomSARecord();
|
||||||
UpdateCurrentInternalPathRecord();
|
UpdateCurrentInternalPathRecord();
|
||||||
}
|
}
|
||||||
|
@ -1028,6 +1207,56 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
||||||
delete m_dialog;
|
delete m_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
||||||
|
{
|
||||||
|
if (result == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SCASSERT(not m_dialog.isNull());
|
||||||
|
DialogPlaceLabel *dialogTool = qobject_cast<DialogPlaceLabel*>(m_dialog.data());
|
||||||
|
SCASSERT(dialogTool != nullptr);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VPlaceLabelItem currentLabel = CurrentPlaceLabel(dialogTool->GetToolId());
|
||||||
|
|
||||||
|
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
|
||||||
|
|
||||||
|
const qreal w = qAbs(Visualization::FindLengthFromUser(dialogTool->GetWidth(), vars, false));
|
||||||
|
const qreal h = qAbs(Visualization::FindLengthFromUser(dialogTool->GetHeight(), vars, false));
|
||||||
|
const qreal a = Visualization::FindValFromUser(dialogTool->GetAngle(), vars, false);
|
||||||
|
qDebug() << w << h << a;
|
||||||
|
|
||||||
|
VPlaceLabelItem newLabel = VPlaceLabelItem();
|
||||||
|
newLabel.setName(currentLabel.name());
|
||||||
|
newLabel.setX(currentLabel.x());
|
||||||
|
newLabel.setY(currentLabel.y());
|
||||||
|
newLabel.setMx(currentLabel.mx());
|
||||||
|
newLabel.setMy(currentLabel.my());
|
||||||
|
newLabel.SetWidth(w, dialogTool->GetWidth());
|
||||||
|
newLabel.SetHeight(h, dialogTool->GetHeight());
|
||||||
|
newLabel.SetAngle(a, dialogTool->GetAngle());
|
||||||
|
newLabel.SetLabelType(dialogTool->GetLabelType());
|
||||||
|
newLabel.SetCenterPoint(currentLabel.GetCenterPoint());
|
||||||
|
newLabel.SetCorrectionAngle(currentLabel.GetCorrectionAngle());
|
||||||
|
|
||||||
|
m_newPlaceLabels.insert(dialogTool->GetToolId(), newLabel);
|
||||||
|
|
||||||
|
SavePlaceLabelOptions *saveCommand = new SavePlaceLabelOptions(toolId, currentLabel, newLabel,
|
||||||
|
qApp->getCurrentDocument(),
|
||||||
|
const_cast<VContainer *>(data),
|
||||||
|
dialogTool->GetToolId());
|
||||||
|
m_undoStack.append(saveCommand);
|
||||||
|
UpdateCurrentPlaceLabelRecords();
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
qCritical("%s\n\n%s\n\n%s", qUtf8Printable(tr("Error. Can't save piece path.")),
|
||||||
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete m_dialog;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::FancyTabChanged(int index)
|
void DialogSeamAllowance::FancyTabChanged(int index)
|
||||||
{
|
{
|
||||||
|
@ -1041,6 +1270,7 @@ void DialogSeamAllowance::FancyTabChanged(int index)
|
||||||
m_tabGrainline->hide();
|
m_tabGrainline->hide();
|
||||||
m_tabPins->hide();
|
m_tabPins->hide();
|
||||||
m_tabPassmarks->hide();
|
m_tabPassmarks->hide();
|
||||||
|
m_tabPlaceLabels->hide();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -1061,20 +1291,28 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
case TabOrder::Passmarks:
|
case TabOrder::Passmarks:
|
||||||
m_tabPassmarks->show();
|
m_tabPassmarks->show();
|
||||||
break;
|
break;
|
||||||
|
case TabOrder::PlaceLabels:
|
||||||
|
m_tabPlaceLabels->show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
if (index == TabOrder::Pins || index == TabOrder::Grainline
|
if (index == TabOrder::Pins
|
||||||
|
|| index == TabOrder::Grainline
|
||||||
|| (index == TabOrder::Labels &&
|
|| (index == TabOrder::Labels &&
|
||||||
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
uiTabLabels->tabWidget->currentIndex() == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels)))
|
||||||
{
|
{
|
||||||
ShowPins();
|
ShowPieceSpecialPointsWithRect(uiTabPins->listWidgetPins, false);
|
||||||
|
}
|
||||||
|
else if (index == TabOrder::PlaceLabels)
|
||||||
|
{
|
||||||
|
ShowPieceSpecialPointsWithRect(uiTabPlaceLabels->listWidgetPlaceLabels, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (not m_visPins.isNull())
|
if (not m_visSpecialPoints.isNull())
|
||||||
{
|
{
|
||||||
delete m_visPins;
|
delete m_visSpecialPoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1084,13 +1322,13 @@ void DialogSeamAllowance::TabChanged(int index)
|
||||||
{
|
{
|
||||||
if (index == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels))
|
if (index == uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels))
|
||||||
{
|
{
|
||||||
ShowPins();
|
ShowPieceSpecialPointsWithRect(uiTabPins->listWidgetPins, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (not m_visPins.isNull())
|
if (not m_visSpecialPoints.isNull())
|
||||||
{
|
{
|
||||||
delete m_visPins;
|
delete m_visSpecialPoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1346,7 +1584,8 @@ void DialogSeamAllowance::UpdateDetailLabelValues()
|
||||||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1431,7 +1670,8 @@ void DialogSeamAllowance::UpdatePatternLabelValues()
|
||||||
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
if (not flagDLAngle || not (flagDLFormulas || flagDPin) || not flagPLAngle || not (flagPLFormulas || flagPPin))
|
||||||
{
|
{
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1923,7 +2163,8 @@ void DialogSeamAllowance::DetailPinPointChanged()
|
||||||
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
||||||
|
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
UpdateDetailLabelValues();
|
UpdateDetailLabelValues();
|
||||||
|
@ -1955,7 +2196,8 @@ void DialogSeamAllowance::PatternPinPointChanged()
|
||||||
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
topPinId == NULL_ID && bottomPinId == NULL_ID ? color = okColor : color = errorColor;
|
||||||
|
|
||||||
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
m_ftb->SetTabText(TabOrder::Labels, tr("Labels") + QLatin1String("*"));
|
||||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||||
|
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||||
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
uiTabLabels->tabWidget->setTabIcon(uiTabLabels->tabWidget->indexOf(uiTabLabels->tabLabels), icon);
|
||||||
}
|
}
|
||||||
UpdatePatternLabelValues();
|
UpdatePatternLabelValues();
|
||||||
|
@ -1985,6 +2227,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
piece.SetCustomSARecords(GetListInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
|
piece.SetCustomSARecords(GetListInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
|
||||||
piece.SetInternalPaths(GetListInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
|
piece.SetInternalPaths(GetListInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
|
||||||
piece.SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
|
piece.SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
|
||||||
|
piece.SetPlaceLabels(GetListInternals<quint32>(uiTabPlaceLabels->listWidgetPlaceLabels));
|
||||||
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
|
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
|
||||||
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
|
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
|
||||||
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
|
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
|
||||||
|
@ -2039,51 +2282,6 @@ void DialogSeamAllowance::NewMainPathItem(const VPieceNode &node)
|
||||||
NewNodeItem(uiTabPaths->listWidgetMainPath, node);
|
NewNodeItem(uiTabPaths->listWidgetMainPath, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogSeamAllowance::NewCustomSA(const CustomSARecord &record)
|
|
||||||
{
|
|
||||||
if (record.path > NULL_ID)
|
|
||||||
{
|
|
||||||
const QString name = GetPathName(record.path, record.reverse);
|
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(record));
|
|
||||||
uiTabPaths->listWidgetCustomSA->addItem(item);
|
|
||||||
uiTabPaths->listWidgetCustomSA->setCurrentRow(uiTabPaths->listWidgetCustomSA->count()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogSeamAllowance::NewInternalPath(quint32 path)
|
|
||||||
{
|
|
||||||
if (path > NULL_ID)
|
|
||||||
{
|
|
||||||
const QString name = GetPathName(path);
|
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(path));
|
|
||||||
uiTabPaths->listWidgetInternalPaths->addItem(item);
|
|
||||||
uiTabPaths->listWidgetInternalPaths->setCurrentRow(uiTabPaths->listWidgetInternalPaths->count()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogSeamAllowance::NewPin(quint32 pinPoint)
|
|
||||||
{
|
|
||||||
if (pinPoint > NULL_ID)
|
|
||||||
{
|
|
||||||
const QSharedPointer<VGObject> pin = data->GetGObject(pinPoint);
|
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(pin->name());
|
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(pinPoint));
|
|
||||||
uiTabPins->listWidgetPins->addItem(item);
|
|
||||||
uiTabPins->listWidgetPins->setCurrentRow(uiTabPins->listWidgetPins->count()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
||||||
{
|
{
|
||||||
|
@ -2091,7 +2289,7 @@ QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
||||||
|
|
||||||
if (path > NULL_ID)
|
if (path > NULL_ID)
|
||||||
{
|
{
|
||||||
name = data->GetPiecePath(path).GetName();
|
name = CurrentPath(path).GetName();
|
||||||
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
|
@ -2340,6 +2538,7 @@ void DialogSeamAllowance::InitFancyTabBar()
|
||||||
m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels"));
|
m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels"));
|
||||||
m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline"));
|
m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline"));
|
||||||
m_ftb->InsertTab(TabOrder::Passmarks, QIcon("://icon/32x32/passmark.png"), tr("Passmarks"));
|
m_ftb->InsertTab(TabOrder::Passmarks, QIcon("://icon/32x32/passmark.png"), tr("Passmarks"));
|
||||||
|
m_ftb->InsertTab(TabOrder::PlaceLabels, QIcon("://icon/32x32/button.png"), tr("Place label"));
|
||||||
|
|
||||||
ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft);
|
ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
@ -2365,6 +2564,10 @@ void DialogSeamAllowance::InitFancyTabBar()
|
||||||
uiTabPassmarks->setupUi(m_tabPassmarks);
|
uiTabPassmarks->setupUi(m_tabPassmarks);
|
||||||
ui->horizontalLayout->addWidget(m_tabPassmarks, 1);
|
ui->horizontalLayout->addWidget(m_tabPassmarks, 1);
|
||||||
|
|
||||||
|
m_tabPlaceLabels->hide();
|
||||||
|
uiTabPlaceLabels->setupUi(m_tabPlaceLabels);
|
||||||
|
ui->horizontalLayout->addWidget(m_tabPlaceLabels, 1);
|
||||||
|
|
||||||
connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged);
|
connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged);
|
||||||
connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged);
|
connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged);
|
||||||
}
|
}
|
||||||
|
@ -2666,6 +2869,23 @@ void DialogSeamAllowance::InitPassmarksTab()
|
||||||
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::InitPlaceLabelsTab()
|
||||||
|
{
|
||||||
|
uiTabPlaceLabels->listWidgetPlaceLabels->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(uiTabPlaceLabels->listWidgetPlaceLabels, &QListWidget::currentRowChanged, this, [this]()
|
||||||
|
{
|
||||||
|
if (not m_visSpecialPoints.isNull())
|
||||||
|
{
|
||||||
|
m_visSpecialPoints->SetShowRect(true);
|
||||||
|
m_visSpecialPoints->SetRect(CurrentRect());
|
||||||
|
m_visSpecialPoints->RefreshGeometry();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(uiTabPlaceLabels->listWidgetPlaceLabels, &QListWidget::customContextMenuRequested, this,
|
||||||
|
&DialogSeamAllowance::ShowPlaceLabelsContextMenu);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::InitAllPinComboboxes()
|
void DialogSeamAllowance::InitAllPinComboboxes()
|
||||||
{
|
{
|
||||||
|
@ -2690,6 +2910,12 @@ QString DialogSeamAllowance::GetFormulaSAWidth() const
|
||||||
return qApp->TrVars()->TryFormulaFromUser(width, qApp->Settings()->GetOsSeparator());
|
return qApp->TrVars()->TryFormulaFromUser(width, qApp->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<QUndoCommand *> &DialogSeamAllowance::UndoStack()
|
||||||
|
{
|
||||||
|
return m_undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
||||||
{
|
{
|
||||||
|
@ -2739,6 +2965,21 @@ void DialogSeamAllowance::UpdateCurrentInternalPathRecord()
|
||||||
item->setText(GetPathName(path));
|
item->setText(GetPathName(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::UpdateCurrentPlaceLabelRecords()
|
||||||
|
{
|
||||||
|
const int row = uiTabPlaceLabels->listWidgetPlaceLabels->currentRow();
|
||||||
|
if (uiTabPlaceLabels->listWidgetPlaceLabels->count() == 0 || row == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->item(row);
|
||||||
|
SCASSERT(item != nullptr);
|
||||||
|
const quint32 labelId = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||||
|
item->setText(CurrentPlaceLabel(labelId).name());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
|
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
|
||||||
{
|
{
|
||||||
|
@ -2899,25 +3140,53 @@ void DialogSeamAllowance::SetPLAngle(QString angleFormula)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogSeamAllowance::ShowPins()
|
QRectF DialogSeamAllowance::CurrentRect() const
|
||||||
{
|
{
|
||||||
if (m_visPins.isNull())
|
QRectF rect;
|
||||||
|
if (QListWidgetItem *item = uiTabPlaceLabels->listWidgetPlaceLabels->currentItem())
|
||||||
{
|
{
|
||||||
m_visPins = new VisPiecePins(data);
|
VPlaceLabelItem label = CurrentPlaceLabel(qvariant_cast<quint32>(item->data(Qt::UserRole)));
|
||||||
|
rect = QRectF(QPointF(label.x() - label.GetWidth()/2.0, label.y() - label.GetHeight()/2.0),
|
||||||
|
QPointF(label.x() + label.GetWidth()/2.0, label.y() + label.GetHeight()/2.0));
|
||||||
|
}
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::ShowPieceSpecialPointsWithRect(const QListWidget *list, bool showRect)
|
||||||
|
{
|
||||||
|
SCASSERT(list != nullptr)
|
||||||
|
if (m_visSpecialPoints.isNull())
|
||||||
|
{
|
||||||
|
m_visSpecialPoints = new VisPieceSpecialPoints(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_visPins->SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
|
m_visSpecialPoints->SetPoints(GetListInternals<quint32>(list));
|
||||||
|
m_visSpecialPoints->SetShowRect(showRect);
|
||||||
|
m_visSpecialPoints->SetRect(CurrentRect());
|
||||||
|
|
||||||
if (not qApp->getCurrentScene()->items().contains(m_visPins))
|
if (not qApp->getCurrentScene()->items().contains(m_visSpecialPoints))
|
||||||
{
|
{
|
||||||
m_visPins->VisualMode(NULL_ID);
|
m_visSpecialPoints->VisualMode(NULL_ID);
|
||||||
m_visPins->setZValue(10); // pins should be on top
|
m_visSpecialPoints->setZValue(10); // pins should be on top
|
||||||
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(toolId));
|
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(toolId));
|
||||||
SCASSERT(tool != nullptr);
|
SCASSERT(tool != nullptr);
|
||||||
m_visPins->setParentItem(tool);
|
m_visSpecialPoints->setParentItem(tool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_visPins->RefreshGeometry();
|
m_visSpecialPoints->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPiecePath DialogSeamAllowance::CurrentPath(quint32 id) const
|
||||||
|
{
|
||||||
|
return m_newPaths.contains(id) ? m_newPaths.value(id) : data->GetPiecePath(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VPlaceLabelItem DialogSeamAllowance::CurrentPlaceLabel(quint32 id) const
|
||||||
|
{
|
||||||
|
return m_newPlaceLabels.contains(id) ? m_newPlaceLabels.value(id) : *data->GeometricObject<VPlaceLabelItem>(id);
|
||||||
|
}
|
||||||
|
|
|
@ -43,10 +43,13 @@ namespace Ui
|
||||||
class TabGrainline;
|
class TabGrainline;
|
||||||
class TabPins;
|
class TabPins;
|
||||||
class TabPassmarks;
|
class TabPassmarks;
|
||||||
|
class TabPlaceLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VisPiecePins;
|
class VisPieceSpecialPoints;
|
||||||
class FancyTabBar;
|
class FancyTabBar;
|
||||||
|
class VPlaceLabelItem;
|
||||||
|
class QUndoCommand;
|
||||||
|
|
||||||
class DialogSeamAllowance : public DialogTool
|
class DialogSeamAllowance : public DialogTool
|
||||||
{
|
{
|
||||||
|
@ -63,6 +66,8 @@ public:
|
||||||
|
|
||||||
QString GetFormulaSAWidth() const;
|
QString GetFormulaSAWidth() const;
|
||||||
|
|
||||||
|
QVector<QUndoCommand*> &UndoStack();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
|
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
|
||||||
|
@ -81,6 +86,7 @@ private slots:
|
||||||
void ShowCustomSAContextMenu(const QPoint &pos);
|
void ShowCustomSAContextMenu(const QPoint &pos);
|
||||||
void ShowInternalPathsContextMenu(const QPoint &pos);
|
void ShowInternalPathsContextMenu(const QPoint &pos);
|
||||||
void ShowPinsContextMenu(const QPoint &pos);
|
void ShowPinsContextMenu(const QPoint &pos);
|
||||||
|
void ShowPlaceLabelsContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
void ListChanged();
|
void ListChanged();
|
||||||
void EnableSeamAllowance(bool enable);
|
void EnableSeamAllowance(bool enable);
|
||||||
|
@ -94,6 +100,7 @@ private slots:
|
||||||
void ReturnDefAfter();
|
void ReturnDefAfter();
|
||||||
void CustomSAChanged(int row);
|
void CustomSAChanged(int row);
|
||||||
void PathDialogClosed(int result);
|
void PathDialogClosed(int result);
|
||||||
|
void PlaceLabelDialogClosed(int result);
|
||||||
void FancyTabChanged(int index);
|
void FancyTabChanged(int index);
|
||||||
void TabChanged(int index);
|
void TabChanged(int index);
|
||||||
void PassmarkLineTypeChanged(int id);
|
void PassmarkLineTypeChanged(int id);
|
||||||
|
@ -157,12 +164,14 @@ private:
|
||||||
Ui::TabGrainline *uiTabGrainline;
|
Ui::TabGrainline *uiTabGrainline;
|
||||||
Ui::TabPins *uiTabPins;
|
Ui::TabPins *uiTabPins;
|
||||||
Ui::TabPassmarks *uiTabPassmarks;
|
Ui::TabPassmarks *uiTabPassmarks;
|
||||||
|
Ui::TabPlaceLabels *uiTabPlaceLabels;
|
||||||
|
|
||||||
QWidget *m_tabPaths;
|
QWidget *m_tabPaths;
|
||||||
QWidget *m_tabLabels;
|
QWidget *m_tabLabels;
|
||||||
QWidget *m_tabGrainline;
|
QWidget *m_tabGrainline;
|
||||||
QWidget *m_tabPins;
|
QWidget *m_tabPins;
|
||||||
QWidget *m_tabPassmarks;
|
QWidget *m_tabPassmarks;
|
||||||
|
QWidget *m_tabPlaceLabels;
|
||||||
|
|
||||||
FancyTabBar* m_ftb;
|
FancyTabBar* m_ftb;
|
||||||
|
|
||||||
|
@ -180,7 +189,7 @@ private:
|
||||||
qreal m_my;
|
qreal m_my;
|
||||||
|
|
||||||
QPointer<DialogTool> m_dialog;
|
QPointer<DialogTool> m_dialog;
|
||||||
QPointer<VisPiecePins> m_visPins;
|
QPointer<VisPieceSpecialPoints> m_visSpecialPoints;
|
||||||
|
|
||||||
VPieceLabelData m_oldData;
|
VPieceLabelData m_oldData;
|
||||||
VPatternLabelData m_oldGeom;
|
VPatternLabelData m_oldGeom;
|
||||||
|
@ -204,18 +213,20 @@ private:
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> m_templateLines;
|
QVector<VLabelTemplateLine> m_templateLines;
|
||||||
|
|
||||||
|
QVector<QUndoCommand*> m_undoStack;
|
||||||
|
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels;
|
||||||
|
QHash<quint32, VPiecePath> m_newPaths;
|
||||||
|
|
||||||
VPiece CreatePiece() const;
|
VPiece CreatePiece() const;
|
||||||
|
|
||||||
void NewMainPathItem(const VPieceNode &node);
|
void NewMainPathItem(const VPieceNode &node);
|
||||||
void NewCustomSA(const CustomSARecord &record);
|
|
||||||
void NewInternalPath(quint32 path);
|
|
||||||
void NewPin(quint32 pinPoint);
|
|
||||||
QString GetPathName(quint32 path, bool reverse = false) const;
|
QString GetPathName(quint32 path, bool reverse = false) const;
|
||||||
bool MainPathIsValid() const;
|
bool MainPathIsValid() const;
|
||||||
void ValidObjects(bool value);
|
void ValidObjects(bool value);
|
||||||
bool MainPathIsClockwise() const;
|
bool MainPathIsClockwise() const;
|
||||||
void UpdateCurrentCustomSARecord();
|
void UpdateCurrentCustomSARecord();
|
||||||
void UpdateCurrentInternalPathRecord();
|
void UpdateCurrentInternalPathRecord();
|
||||||
|
void UpdateCurrentPlaceLabelRecords();
|
||||||
|
|
||||||
QListWidgetItem *GetItemById(quint32 id);
|
QListWidgetItem *GetItemById(quint32 id);
|
||||||
|
|
||||||
|
@ -241,6 +252,7 @@ private:
|
||||||
void InitGrainlineTab();
|
void InitGrainlineTab();
|
||||||
void InitPinsTab();
|
void InitPinsTab();
|
||||||
void InitPassmarksTab();
|
void InitPassmarksTab();
|
||||||
|
void InitPlaceLabelsTab();
|
||||||
void InitAllPinComboboxes();
|
void InitAllPinComboboxes();
|
||||||
|
|
||||||
void SetFormulaSAWidth(const QString &formula);
|
void SetFormulaSAWidth(const QString &formula);
|
||||||
|
@ -256,7 +268,11 @@ private:
|
||||||
void SetPLHeight(QString heightFormula);
|
void SetPLHeight(QString heightFormula);
|
||||||
void SetPLAngle(QString angleFormula);
|
void SetPLAngle(QString angleFormula);
|
||||||
|
|
||||||
void ShowPins();
|
QRectF CurrentRect() const;
|
||||||
|
void ShowPieceSpecialPointsWithRect(const QListWidget *list, bool showRect);
|
||||||
|
|
||||||
|
VPiecePath CurrentPath(quint32 id) const;
|
||||||
|
VPlaceLabelItem CurrentPlaceLabel(quint32 id) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGSEAMALLOWANCE_H
|
#endif // DIALOGSEAMALLOWANCE_H
|
||||||
|
|
28
src/libs/vtools/dialogs/tools/piece/tabs/tabplacelabels.ui
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TabPlaceLabels</class>
|
||||||
|
<widget class="QWidget" name="TabPlaceLabels">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>230</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidgetPlaceLabels">
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::InternalMove</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -61,7 +61,7 @@ void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData,
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -98,6 +98,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.data));
|
initData.data));
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -111,7 +113,7 @@ QT_WARNING_POP
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -148,6 +150,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.data, initData.destination.at(i).id);
|
initData.data, initData.destination.at(i).id);
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
|
@ -196,12 +196,16 @@ void VToolFlippingByAxis::SetVisualization()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolFlippingByAxis::SaveDialog(QDomElement &domElement)
|
void VToolFlippingByAxis::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogFlippingByAxis> dialogTool = m_dialog.objectCast<DialogFlippingByAxis>();
|
QSharedPointer<DialogFlippingByAxis> dialogTool = m_dialog.objectCast<DialogFlippingByAxis>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, m_originPointId);
|
||||||
|
AddDependence(newDependencies, dialogTool->GetOriginPointId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOriginPointId()));
|
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOriginPointId()));
|
||||||
doc->SetAttribute(domElement, AttrAxisType, QString().setNum(static_cast<int>(dialogTool->GetAxisType())));
|
doc->SetAttribute(domElement, AttrAxisType, QString().setNum(static_cast<int>(dialogTool->GetAxisType())));
|
||||||
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
||||||
|
@ -247,4 +251,3 @@ VToolFlippingByAxis::VToolFlippingByAxis(const VToolFlippingByAxisInitData &init
|
||||||
InitOperatedObjects();
|
InitOperatedObjects();
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -181,12 +181,18 @@ void VToolFlippingByLine::SetVisualization()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolFlippingByLine::SaveDialog(QDomElement &domElement)
|
void VToolFlippingByLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogFlippingByLine> dialogTool = m_dialog.objectCast<DialogFlippingByLine>();
|
QSharedPointer<DialogFlippingByLine> dialogTool = m_dialog.objectCast<DialogFlippingByLine>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, m_firstLinePointId);
|
||||||
|
AddDependence(oldDependencies, m_secondLinePointId);
|
||||||
|
AddDependence(newDependencies, dialogTool->GetFirstLinePointId());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetSecondLinePointId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetFirstLinePointId()));
|
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetFirstLinePointId()));
|
||||||
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetSecondLinePointId()));
|
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetSecondLinePointId()));
|
||||||
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
||||||
|
|
|
@ -69,7 +69,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void VAbstractOperation::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractOperation::DoChangePosition(quint32 id, const QPointF &pos)
|
void VAbstractOperation::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (operatedObjects.contains(id))
|
if (operatedObjects.contains(id))
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,6 @@ void VAbstractOperation::DoChangePosition(quint32 id, const QPointF &pos)
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
point->setMx(pos.x());
|
point->setMx(pos.x());
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
VAbstractTool::data.UpdateGObject(id, point);
|
|
||||||
item->RefreshPointGeometry(*(point.data()));
|
item->RefreshPointGeometry(*(point.data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +606,7 @@ void VAbstractOperation::InitOperatedObjects()
|
||||||
const QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(object.id);
|
const QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(object.id);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -650,6 +649,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::SplinePath);
|
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::SplinePath);
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||||
virtual void DoChangePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual bool IsLabelVisible(quint32 id) const Q_DECL_OVERRIDE;
|
virtual bool IsLabelVisible(quint32 id) const Q_DECL_OVERRIDE;
|
||||||
virtual void SetLabelVisible(quint32 id, bool visible) Q_DECL_OVERRIDE;
|
virtual void SetLabelVisible(quint32 id, bool visible) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -133,7 +133,7 @@ VToolMove *VToolMove::Create(VToolMoveInitData &initData)
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -171,6 +171,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.data));
|
initData.data));
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -184,7 +186,7 @@ QT_WARNING_POP
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -220,6 +222,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.destination.at(i).id);
|
initData.destination.at(i).id);
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -326,12 +330,15 @@ void VToolMove::SetVisualization()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolMove::SaveDialog(QDomElement &domElement)
|
void VToolMove::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogMove> dialogTool = m_dialog.objectCast<DialogMove>();
|
QSharedPointer<DialogMove> dialogTool = m_dialog.objectCast<DialogMove>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
Q_UNUSED(oldDependencies);
|
||||||
|
Q_UNUSED(newDependencies)
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||||
QString length = dialogTool->GetLength();
|
QString length = dialogTool->GetLength();
|
||||||
doc->SetAttribute(domElement, AttrLength, length);
|
doc->SetAttribute(domElement, AttrLength, length);
|
||||||
|
|
|
@ -83,7 +83,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -150,7 +150,7 @@ VToolRotation *VToolRotation::Create(VToolRotationInitData &initData)
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -187,6 +187,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.data));
|
initData.data));
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -200,7 +202,7 @@ QT_WARNING_POP
|
||||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||||
|
|
||||||
// This check helps to find missed objects in the switch
|
// This check helps to find missed objects in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 8, "Not all objects were handled.");
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -237,6 +239,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
initData.data, initData.destination.at(i).id);
|
initData.data, initData.destination.at(i).id);
|
||||||
break;
|
break;
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -328,12 +332,16 @@ void VToolRotation::SetVisualization()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolRotation::SaveDialog(QDomElement &domElement)
|
void VToolRotation::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
|
QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, origPointId);
|
||||||
|
AddDependence(newDependencies, dialogTool->GetOrigPointId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOrigPointId()));
|
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOrigPointId()));
|
||||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||||
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
|
||||||
|
|
|
@ -82,7 +82,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "../vgeometry/vgobject.h"
|
#include "../vgeometry/vgobject.h"
|
||||||
#include "../vgeometry/vpointf.h"
|
#include "../vgeometry/vpointf.h"
|
||||||
#include "../vgeometry/vspline.h"
|
#include "../vgeometry/vspline.h"
|
||||||
|
#include "../vgeometry/vabstractarc.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vwidgets/vcontrolpointspline.h"
|
#include "../vwidgets/vcontrolpointspline.h"
|
||||||
#include "../../../visualization/line/visline.h"
|
#include "../../../visualization/line/visline.h"
|
||||||
|
@ -453,3 +454,18 @@ void VAbstractSpline::GroupVisibility(quint32 object, bool visible)
|
||||||
Q_UNUSED(object)
|
Q_UNUSED(object)
|
||||||
setVisible(visible);
|
setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VToolAbstractArc
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VToolAbstractArc::VToolAbstractArc(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
||||||
|
: VAbstractSpline(doc, data, id, parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VToolAbstractArc::CenterPointName() const
|
||||||
|
{
|
||||||
|
QSharedPointer<VAbstractArc> arc = VAbstractTool::data.GeometricObject<VAbstractArc>(m_id);
|
||||||
|
SCASSERT(arc.isNull() == false)
|
||||||
|
|
||||||
|
return VAbstractTool::data.GetGObject(arc->GetCenter().id())->name();
|
||||||
|
}
|
||||||
|
|
|
@ -238,4 +238,15 @@ void VAbstractSpline::InitElArcToolConnections(VMainGraphicsScene *scene, T *too
|
||||||
QObject::connect(scene, &VMainGraphicsScene::EnableElArcItemSelection, tool, &T::AllowSelecting);
|
QObject::connect(scene, &VMainGraphicsScene::EnableElArcItemSelection, tool, &T::AllowSelecting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VToolAbstractArc:public VAbstractSpline
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VToolAbstractArc(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent = nullptr);
|
||||||
|
virtual ~VToolAbstractArc() = default;
|
||||||
|
|
||||||
|
QString CenterPointName() const;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VToolAbstractArc)
|
||||||
|
};
|
||||||
|
|
||||||
#endif // VABSTRACTSPLINE_H
|
#endif // VABSTRACTSPLINE_H
|
||||||
|
|
|
@ -64,7 +64,7 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
|
||||||
* @param initData init data
|
* @param initData init data
|
||||||
*/
|
*/
|
||||||
VToolArc::VToolArc(const VToolArcInitData &initData, QGraphicsItem *parent)
|
VToolArc::VToolArc(const VToolArcInitData &initData, QGraphicsItem *parent)
|
||||||
: VAbstractSpline(initData.doc, initData.data, initData.id, parent)
|
: VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Arc;
|
sceneType = SceneObject::Arc;
|
||||||
|
|
||||||
|
@ -183,35 +183,6 @@ QString VToolArc::getTagName() const
|
||||||
return VAbstractPattern::TagArc;
|
return VAbstractPattern::TagArc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VToolArc::CenterPointName() const
|
|
||||||
{
|
|
||||||
return VAbstractTool::data.GetGObject(getCenter())->name();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolArc::getCenter() const
|
|
||||||
{
|
|
||||||
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
|
|
||||||
SCASSERT(arc.isNull() == false)
|
|
||||||
|
|
||||||
return arc->GetCenter().id();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolArc::setCenter(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
|
||||||
|
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
|
|
||||||
arc->SetCenter(*point.data());
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VFormula VToolArc::GetFormulaRadius() const
|
VFormula VToolArc::GetFormulaRadius() const
|
||||||
{
|
{
|
||||||
|
@ -350,11 +321,17 @@ void VToolArc::RemoveReferens()
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolArc::SaveDialog(QDomElement &domElement)
|
void VToolArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogArc> dialogTool = m_dialog.objectCast<DialogArc>();
|
QSharedPointer<DialogArc> dialogTool = m_dialog.objectCast<DialogArc>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
|
||||||
|
SCASSERT(arc.isNull() == false)
|
||||||
|
AddDependence(oldDependencies, arc->GetCenter().id());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetCenter());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
||||||
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
||||||
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct VToolArcInitData : VAbstractSplineInitData
|
||||||
/**
|
/**
|
||||||
* @brief The VToolArc class tool for creation arc.
|
* @brief The VToolArc class tool for creation arc.
|
||||||
*/
|
*/
|
||||||
class VToolArc :public VAbstractSpline
|
class VToolArc :public VToolAbstractArc
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -76,11 +76,6 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(Tool::Arc)};
|
enum { Type = UserType + static_cast<int>(Tool::Arc)};
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString CenterPointName() const;
|
|
||||||
|
|
||||||
quint32 getCenter() const;
|
|
||||||
void setCenter(const quint32 &value);
|
|
||||||
|
|
||||||
VFormula GetFormulaRadius() const;
|
VFormula GetFormulaRadius() const;
|
||||||
void SetFormulaRadius(const VFormula &value);
|
void SetFormulaRadius(const VFormula &value);
|
||||||
|
|
||||||
|
@ -98,7 +93,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
@ -106,6 +102,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolArc)
|
Q_DISABLE_COPY(VToolArc)
|
||||||
|
|
||||||
VToolArc(const VToolArcInitData &initData, QGraphicsItem * parent = nullptr);
|
VToolArc(const VToolArcInitData &initData, QGraphicsItem * parent = nullptr);
|
||||||
|
virtual ~VToolArc()=default;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLARC_H
|
#endif // VTOOLARC_H
|
||||||
|
|
|
@ -60,7 +60,7 @@ const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolArcWithLength::VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent)
|
VToolArcWithLength::VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent)
|
||||||
:VAbstractSpline(initData.doc, initData.data, initData.id, parent)
|
:VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Arc;
|
sceneType = SceneObject::Arc;
|
||||||
|
|
||||||
|
@ -163,35 +163,6 @@ QString VToolArcWithLength::getTagName() const
|
||||||
return VAbstractPattern::TagArc;
|
return VAbstractPattern::TagArc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VToolArcWithLength::CenterPointName() const
|
|
||||||
{
|
|
||||||
return VAbstractTool::data.GetGObject(getCenter())->name();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolArcWithLength::getCenter() const
|
|
||||||
{
|
|
||||||
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
|
|
||||||
SCASSERT(arc.isNull() == false)
|
|
||||||
|
|
||||||
return arc->GetCenter().id();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolArcWithLength::setCenter(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
|
||||||
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
|
|
||||||
|
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
|
|
||||||
arc->SetCenter(*point.data());
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VFormula VToolArcWithLength::GetFormulaRadius() const
|
VFormula VToolArcWithLength::GetFormulaRadius() const
|
||||||
{
|
{
|
||||||
|
@ -321,11 +292,18 @@ void VToolArcWithLength::RemoveReferens()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolArcWithLength::SaveDialog(QDomElement &domElement)
|
void VToolArcWithLength::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogArcWithLength> dialogTool = m_dialog.objectCast<DialogArcWithLength>();
|
QSharedPointer<DialogArcWithLength> dialogTool = m_dialog.objectCast<DialogArcWithLength>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
|
||||||
|
SCASSERT(arc.isNull() == false)
|
||||||
|
AddDependence(oldDependencies, arc->GetCenter().id());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetCenter());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
||||||
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
||||||
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct VToolArcWithLengthInitData : VAbstractSplineInitData
|
||||||
QString length;
|
QString length;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VToolArcWithLength : public VAbstractSpline
|
class VToolArcWithLength : public VToolAbstractArc
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -73,11 +73,6 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(Tool::ArcWithLength)};
|
enum { Type = UserType + static_cast<int>(Tool::ArcWithLength)};
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString CenterPointName() const;
|
|
||||||
|
|
||||||
quint32 getCenter() const;
|
|
||||||
void setCenter(const quint32 &value);
|
|
||||||
|
|
||||||
VFormula GetFormulaRadius() const;
|
VFormula GetFormulaRadius() const;
|
||||||
void SetFormulaRadius(const VFormula &value);
|
void SetFormulaRadius(const VFormula &value);
|
||||||
|
|
||||||
|
@ -95,7 +90,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
@ -103,6 +99,7 @@ private:
|
||||||
Q_DISABLE_COPY(VToolArcWithLength)
|
Q_DISABLE_COPY(VToolArcWithLength)
|
||||||
|
|
||||||
VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent = nullptr);
|
VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
|
virtual ~VToolArcWithLength()=default;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLARCWITHLENGTH_H
|
#endif // VTOOLARCWITHLENGTH_H
|
||||||
|
|
|
@ -212,13 +212,24 @@ void VToolCubicBezier::RemoveReferens()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCubicBezier::SaveDialog(QDomElement &domElement)
|
void VToolCubicBezier::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
auto dialogTool = qobject_cast<DialogCubicBezier*>(m_dialog);
|
auto dialogTool = qobject_cast<DialogCubicBezier*>(m_dialog);
|
||||||
SCASSERT(dialogTool != nullptr)
|
SCASSERT(dialogTool != nullptr)
|
||||||
|
|
||||||
|
const auto oldSpl = VAbstractTool::data.GeometricObject<VCubicBezier>(m_id);
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP1().id());
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP2().id());
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP3().id());
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP4().id());
|
||||||
|
|
||||||
const VCubicBezier spl = dialogTool->GetSpline();
|
const VCubicBezier spl = dialogTool->GetSpline();
|
||||||
|
AddDependence(newDependencies, spl.GetP1().id());
|
||||||
|
AddDependence(newDependencies, spl.GetP2().id());
|
||||||
|
AddDependence(newDependencies, spl.GetP3().id());
|
||||||
|
AddDependence(newDependencies, spl.GetP4().id());
|
||||||
|
|
||||||
SetSplineAttributes(domElement, spl);
|
SetSplineAttributes(domElement, spl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -191,20 +191,33 @@ void VToolCubicBezierPath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event
|
||||||
void VToolCubicBezierPath::RemoveReferens()
|
void VToolCubicBezierPath::RemoveReferens()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
|
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
|
||||||
for (qint32 i = 0; i < splPath->CountSubSpl(); ++i)
|
for (qint32 i = 0; i < splPath->CountPoints(); ++i)
|
||||||
{
|
{
|
||||||
doc->DecrementReferens(splPath->at(i).getIdTool());
|
doc->DecrementReferens(splPath->at(i).getIdTool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolCubicBezierPath::SaveDialog(QDomElement &domElement)
|
void VToolCubicBezierPath::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
|
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
|
||||||
SCASSERT(dialogTool != nullptr)
|
SCASSERT(dialogTool != nullptr)
|
||||||
|
|
||||||
SetSplinePathAttributes(domElement, dialogTool->GetPath());
|
const auto oldSplPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
|
||||||
|
for (qint32 i = 0; i < oldSplPath->CountPoints(); ++i)
|
||||||
|
{
|
||||||
|
AddDependence(oldDependencies, oldSplPath->at(i).id());
|
||||||
|
}
|
||||||
|
|
||||||
|
const VCubicBezierPath splPath = dialogTool->GetPath();
|
||||||
|
for (qint32 i = 0; i < splPath.CountPoints(); ++i)
|
||||||
|
{
|
||||||
|
AddDependence(newDependencies, splPath.at(i).id());
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSplinePathAttributes(domElement, splPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -81,7 +81,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -65,7 +65,7 @@ const QString VToolEllipticalArc::ToolType = QStringLiteral("simple");
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
*/
|
*/
|
||||||
VToolEllipticalArc::VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent)
|
VToolEllipticalArc::VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent)
|
||||||
:VAbstractSpline(initData.doc, initData.data, initData.id, parent)
|
:VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::ElArc;
|
sceneType = SceneObject::ElArc;
|
||||||
|
|
||||||
|
@ -190,35 +190,6 @@ QString VToolEllipticalArc::getTagName() const
|
||||||
return VAbstractPattern::TagElArc;
|
return VAbstractPattern::TagElArc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VToolEllipticalArc::CenterPointName() const
|
|
||||||
{
|
|
||||||
return VAbstractTool::data.GetGObject(getCenter())->name();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolEllipticalArc::getCenter() const
|
|
||||||
{
|
|
||||||
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id);
|
|
||||||
SCASSERT(elArc.isNull() == false)
|
|
||||||
|
|
||||||
return elArc->GetCenter().id();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolEllipticalArc::setCenter(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
|
||||||
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
|
|
||||||
|
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
|
|
||||||
elArc->SetCenter(*point.data());
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VFormula VToolEllipticalArc::GetFormulaRadius1() const
|
VFormula VToolEllipticalArc::GetFormulaRadius1() const
|
||||||
{
|
{
|
||||||
|
@ -392,11 +363,18 @@ void VToolEllipticalArc::RemoveReferens()
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolEllipticalArc::SaveDialog(QDomElement &domElement)
|
void VToolEllipticalArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogEllipticalArc> dialogTool = m_dialog.objectCast<DialogEllipticalArc>();
|
QSharedPointer<DialogEllipticalArc> dialogTool = m_dialog.objectCast<DialogEllipticalArc>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
const auto elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id);
|
||||||
|
SCASSERT(elArc.isNull() == false)
|
||||||
|
AddDependence(oldDependencies, elArc->GetCenter().id());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetCenter());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
|
||||||
doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1());
|
doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1());
|
||||||
doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2());
|
doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2());
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct VToolEllipticalArcInitData : VAbstractSplineInitData
|
||||||
/**
|
/**
|
||||||
* @brief The VToolEllipticalArc class tool for creation elliptical arc.
|
* @brief The VToolEllipticalArc class tool for creation elliptical arc.
|
||||||
*/
|
*/
|
||||||
class VToolEllipticalArc : public VAbstractSpline
|
class VToolEllipticalArc : public VToolAbstractArc
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -79,11 +79,6 @@ public:
|
||||||
enum { Type = UserType + static_cast<int>(Tool::EllipticalArc)};
|
enum { Type = UserType + static_cast<int>(Tool::EllipticalArc)};
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString CenterPointName() const;
|
|
||||||
|
|
||||||
quint32 getCenter() const;
|
|
||||||
void setCenter(const quint32 &value);
|
|
||||||
|
|
||||||
VFormula GetFormulaRadius1() const;
|
VFormula GetFormulaRadius1() const;
|
||||||
void SetFormulaRadius1(const VFormula &value);
|
void SetFormulaRadius1(const VFormula &value);
|
||||||
|
|
||||||
|
@ -104,7 +99,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||||
|
@ -112,6 +108,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolEllipticalArc)
|
Q_DISABLE_COPY(VToolEllipticalArc)
|
||||||
VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent = nullptr);
|
VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
|
virtual ~VToolEllipticalArc()=default;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLELLIPTICALARC_H
|
#endif // VTOOLELLIPTICALARC_H
|
||||||
|
|
|
@ -313,13 +313,19 @@ void VToolSpline::RemoveReferens()
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolSpline::SaveDialog(QDomElement &domElement)
|
void VToolSpline::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
auto dialogTool = qobject_cast<DialogSpline*>(m_dialog);
|
auto dialogTool = qobject_cast<DialogSpline*>(m_dialog);
|
||||||
SCASSERT(dialogTool != nullptr)
|
SCASSERT(dialogTool != nullptr)
|
||||||
|
|
||||||
|
const auto oldSpl = VAbstractTool::data.GeometricObject<VSpline>(m_id);
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP1().id());
|
||||||
|
AddDependence(oldDependencies, oldSpl->GetP4().id());
|
||||||
|
|
||||||
const VSpline spl = dialogTool->GetSpline();
|
const VSpline spl = dialogTool->GetSpline();
|
||||||
|
AddDependence(newDependencies, spl.GetP1().id());
|
||||||
|
AddDependence(newDependencies, spl.GetP4().id());
|
||||||
|
|
||||||
controlPoints[0]->blockSignals(true);
|
controlPoints[0]->blockSignals(true);
|
||||||
controlPoints[1]->blockSignals(true);
|
controlPoints[1]->blockSignals(true);
|
||||||
|
|
|
@ -97,7 +97,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -447,7 +447,7 @@ void VToolSplinePath::AddPathPoint(VAbstractPattern *doc, QDomElement &domElemen
|
||||||
void VToolSplinePath::RemoveReferens()
|
void VToolSplinePath::RemoveReferens()
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
|
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
|
||||||
for (qint32 i = 0; i < splPath->CountSubSpl(); ++i)
|
for (qint32 i = 0; i < splPath->CountPoints(); ++i)
|
||||||
{
|
{
|
||||||
doc->DecrementReferens(splPath->at(i).P().getIdTool());
|
doc->DecrementReferens(splPath->at(i).P().getIdTool());
|
||||||
}
|
}
|
||||||
|
@ -457,13 +457,25 @@ void VToolSplinePath::RemoveReferens()
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolSplinePath::SaveDialog(QDomElement &domElement)
|
void VToolSplinePath::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogSplinePath> dialogTool = m_dialog.objectCast<DialogSplinePath>();
|
QSharedPointer<DialogSplinePath> dialogTool = m_dialog.objectCast<DialogSplinePath>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
const auto oldSplPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
|
||||||
|
for (qint32 i = 0; i < oldSplPath->CountPoints(); ++i)
|
||||||
|
{
|
||||||
|
AddDependence(oldDependencies, oldSplPath->at(i).P().id());
|
||||||
|
}
|
||||||
|
|
||||||
const VSplinePath splPath = dialogTool->GetPath();
|
const VSplinePath splPath = dialogTool->GetPath();
|
||||||
|
for (qint32 i = 0; i < splPath.CountPoints(); ++i)
|
||||||
|
{
|
||||||
|
AddDependence(newDependencies, splPath.at(i).P().id());
|
||||||
|
}
|
||||||
|
|
||||||
for (qint32 i = 1; i <= splPath.CountSubSpl(); ++i)
|
for (qint32 i = 1; i <= splPath.CountSubSpl(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spl = splPath.GetSpline(i);
|
VSpline spl = splPath.GetSpline(i);
|
||||||
|
|
|
@ -108,7 +108,8 @@ protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -220,14 +220,13 @@ void VToolDoublePoint::FullUpdateFromFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolDoublePoint::DoChangePosition(quint32 id, const QPointF &pos)
|
void VToolDoublePoint::ChangeLabelPosition(quint32 id, const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (id == p1id)
|
if (id == p1id)
|
||||||
{
|
{
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p1id);
|
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p1id);
|
||||||
point->setMx(pos.x());
|
point->setMx(pos.x());
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
VAbstractTool::data.UpdateGObject(p1id, point);
|
|
||||||
firstPoint->RefreshPointGeometry(*(point.data()));
|
firstPoint->RefreshPointGeometry(*(point.data()));
|
||||||
}
|
}
|
||||||
else if (id == p2id)
|
else if (id == p2id)
|
||||||
|
@ -235,7 +234,6 @@ void VToolDoublePoint::DoChangePosition(quint32 id, const QPointF &pos)
|
||||||
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p2id);
|
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(p2id);
|
||||||
point->setMx(pos.x());
|
point->setMx(pos.x());
|
||||||
point->setMy(pos.y());
|
point->setMy(pos.y());
|
||||||
VAbstractTool::data.UpdateGObject(p2id, point);
|
|
||||||
secondPoint->RefreshPointGeometry(*(point.data()));
|
secondPoint->RefreshPointGeometry(*(point.data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
void setNameP2(const QString &name);
|
void setNameP2(const QString &name);
|
||||||
|
|
||||||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||||
virtual void DoChangePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
virtual void ChangeLabelPosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual bool IsLabelVisible(quint32 id) const Q_DECL_OVERRIDE;
|
virtual bool IsLabelVisible(quint32 id) const Q_DECL_OVERRIDE;
|
||||||
virtual void SetLabelVisible(quint32 id, bool visible) Q_DECL_OVERRIDE;
|
virtual void SetLabelVisible(quint32 id, bool visible) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -229,96 +229,6 @@ QString VToolTrueDarts::DartP3Name() const
|
||||||
return VAbstractTool::data.GetGObject(dartP3Id)->name();
|
return VAbstractTool::data.GetGObject(dartP3Id)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolTrueDarts::GetBaseLineP1Id() const
|
|
||||||
{
|
|
||||||
return baseLineP1Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolTrueDarts::SetBaseLineP1Id(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
baseLineP1Id = value;
|
|
||||||
|
|
||||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolTrueDarts::GetBaseLineP2Id() const
|
|
||||||
{
|
|
||||||
return baseLineP2Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolTrueDarts::SetBaseLineP2Id(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
baseLineP2Id = value;
|
|
||||||
|
|
||||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolTrueDarts::GetDartP1Id() const
|
|
||||||
{
|
|
||||||
return dartP1Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolTrueDarts::SetDartP1Id(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
dartP1Id = value;
|
|
||||||
|
|
||||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolTrueDarts::GetDartP2Id() const
|
|
||||||
{
|
|
||||||
return dartP2Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolTrueDarts::SetDartP2Id(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
dartP2Id = value;
|
|
||||||
|
|
||||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
quint32 VToolTrueDarts::GetDartP3Id() const
|
|
||||||
{
|
|
||||||
return dartP3Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VToolTrueDarts::SetDartP3Id(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
dartP3Id = value;
|
|
||||||
|
|
||||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolTrueDarts::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
|
void VToolTrueDarts::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
|
||||||
{
|
{
|
||||||
|
@ -351,12 +261,25 @@ void VToolTrueDarts::RemoveReferens()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolTrueDarts::SaveDialog(QDomElement &domElement)
|
void VToolTrueDarts::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogTrueDarts> dialogTool = m_dialog.objectCast<DialogTrueDarts>();
|
QSharedPointer<DialogTrueDarts> dialogTool = m_dialog.objectCast<DialogTrueDarts>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, baseLineP1Id);
|
||||||
|
AddDependence(oldDependencies, baseLineP2Id);
|
||||||
|
AddDependence(oldDependencies, dartP1Id);
|
||||||
|
AddDependence(oldDependencies, dartP2Id);
|
||||||
|
AddDependence(oldDependencies, dartP3Id);
|
||||||
|
|
||||||
|
AddDependence(newDependencies, dialogTool->GetFirstBasePointId());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetSecondBasePointId());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetFirstDartPointId());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetSecondDartPointId());
|
||||||
|
AddDependence(newDependencies, dialogTool->GetThirdDartPointId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName1, dialogTool->GetFirstNewDartPointName());
|
doc->SetAttribute(domElement, AttrName1, dialogTool->GetFirstNewDartPointName());
|
||||||
doc->SetAttribute(domElement, AttrName2, dialogTool->GetSecondNewDartPointName());
|
doc->SetAttribute(domElement, AttrName2, dialogTool->GetSecondNewDartPointName());
|
||||||
doc->SetAttribute(domElement, AttrBaseLineP1, QString().setNum(dialogTool->GetFirstBasePointId()));
|
doc->SetAttribute(domElement, AttrBaseLineP1, QString().setNum(dialogTool->GetFirstBasePointId()));
|
||||||
|
|
|
@ -104,26 +104,12 @@ public:
|
||||||
QString DartP2Name() const;
|
QString DartP2Name() const;
|
||||||
QString DartP3Name() const;
|
QString DartP3Name() const;
|
||||||
|
|
||||||
quint32 GetBaseLineP1Id() const;
|
|
||||||
void SetBaseLineP1Id(const quint32 &value);
|
|
||||||
|
|
||||||
quint32 GetBaseLineP2Id() const;
|
|
||||||
void SetBaseLineP2Id(const quint32 &value);
|
|
||||||
|
|
||||||
quint32 GetDartP1Id() const;
|
|
||||||
void SetDartP1Id(const quint32 &value);
|
|
||||||
|
|
||||||
quint32 GetDartP2Id() const;
|
|
||||||
void SetDartP2Id(const quint32 &value);
|
|
||||||
|
|
||||||
quint32 GetDartP3Id() const;
|
|
||||||
void SetDartP3Id(const quint32 &value);
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -74,25 +74,6 @@ void VToolCut::FullUpdateFromFile()
|
||||||
SetVisualization();
|
SetVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
quint32 VToolCut::getCurveCutId() const
|
|
||||||
{
|
|
||||||
return curveCutId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VToolCut::setCurveCutId(const quint32 &value)
|
|
||||||
{
|
|
||||||
if (value != NULL_ID)
|
|
||||||
{
|
|
||||||
curveCutId = value;
|
|
||||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
|
|
||||||
SaveOption(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VFormula VToolCut::GetFormula() const
|
VFormula VToolCut::GetFormula() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,9 +59,6 @@ public:
|
||||||
|
|
||||||
QString CurveName() const;
|
QString CurveName() const;
|
||||||
|
|
||||||
quint32 getCurveCutId() const;
|
|
||||||
void setCurveCutId(const quint32 &value);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
|
||||||
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;
|
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -195,11 +195,16 @@ void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolCutArc::SaveDialog(QDomElement &domElement)
|
void VToolCutArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogCutArc> dialogTool = m_dialog.objectCast<DialogCutArc>();
|
QSharedPointer<DialogCutArc> dialogTool = m_dialog.objectCast<DialogCutArc>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, curveCutId);
|
||||||
|
AddDependence(newDependencies, dialogTool->getArcId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||||
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
||||||
|
@ -246,7 +251,7 @@ QString VToolCutArc::MakeToolTip() const
|
||||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(curveCutId);
|
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(curveCutId);
|
||||||
|
|
||||||
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal length = Visualization::FindVal(expression, VAbstractTool::data.DataVariables());
|
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
||||||
|
|
||||||
const QString arcStr = tr("Arc");
|
const QString arcStr = tr("Arc");
|
||||||
const QString lengthStr = tr("length");
|
const QString lengthStr = tr("length");
|
||||||
|
|
|
@ -73,7 +73,8 @@ public:
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -194,11 +194,16 @@ void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quin
|
||||||
/**
|
/**
|
||||||
* @brief SaveDialog save options into file after change in dialog.
|
* @brief SaveDialog save options into file after change in dialog.
|
||||||
*/
|
*/
|
||||||
void VToolCutSpline::SaveDialog(QDomElement &domElement)
|
void VToolCutSpline::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
|
||||||
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
QSharedPointer<DialogCutSpline> dialogTool = m_dialog.objectCast<DialogCutSpline>();
|
QSharedPointer<DialogCutSpline> dialogTool = m_dialog.objectCast<DialogCutSpline>();
|
||||||
SCASSERT(not dialogTool.isNull())
|
SCASSERT(not dialogTool.isNull())
|
||||||
|
|
||||||
|
AddDependence(oldDependencies, curveCutId);
|
||||||
|
AddDependence(newDependencies, dialogTool->getSplineId());
|
||||||
|
|
||||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||||
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
|
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
|
||||||
|
@ -245,7 +250,7 @@ QString VToolCutSpline::MakeToolTip() const
|
||||||
const auto spl = VAbstractTool::data.GeometricObject<VAbstractCubicBezier>(curveCutId);
|
const auto spl = VAbstractTool::data.GeometricObject<VAbstractCubicBezier>(curveCutId);
|
||||||
|
|
||||||
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
const QString expression = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
const qreal length = Visualization::FindVal(expression, VAbstractTool::data.DataVariables());
|
const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables());
|
||||||
|
|
||||||
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
QPointF spl1p2, spl1p3, spl2p2, spl2p3;
|
||||||
QPointF point = spl->CutSpline(qApp->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3);
|
QPointF point = spl->CutSpline(qApp->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
|