Resolved issue #551. Improve Labels on Details.
--HG-- branch : develop
This commit is contained in:
commit
c1866ccdb2
|
@ -234,18 +234,10 @@ QGroupBox *TapeConfigurationPage::PMSystemGroup()
|
|||
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)[this]()
|
||||
{
|
||||
systemChanged = true;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
|
||||
#endif
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
||||
systemAuthorValueLabel->setText(text);
|
||||
systemAuthorValueLabel->setToolTip(text);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
|
||||
#endif
|
||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
||||
systemBookValueLabel->setPlainText(text);
|
||||
});
|
||||
|
||||
|
@ -337,18 +329,10 @@ void TapeConfigurationPage::RetranslateUi()
|
|||
systemAuthorLabel->setText(tr("Author:"));
|
||||
systemBookLabel->setText(tr("Book:"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
|
||||
#endif
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
||||
systemAuthorValueLabel->setText(text);
|
||||
systemAuthorValueLabel->setToolTip(text);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
|
||||
#endif
|
||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
||||
systemBookValueLabel->setPlainText(text);
|
||||
|
||||
gradationGroup->setTitle(tr("Default height and size"));
|
||||
|
|
|
@ -81,11 +81,7 @@ bool DialogExportToCSV::WithHeader() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogExportToCSV::SelectedMib() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return ui->comboBoxCodec->itemData(ui->comboBoxCodec->currentIndex()).toInt();
|
||||
#else
|
||||
return ui->comboBoxCodec->currentData().toInt();
|
||||
#endif
|
||||
return CURRENT_DATA(ui->comboBoxCodec).toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -80,21 +80,13 @@ DialogNewMeasurements::~DialogNewMeasurements()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementsType DialogNewMeasurements::Type() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return static_cast<MeasurementsType>(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt());
|
||||
#else
|
||||
return static_cast<MeasurementsType>(ui->comboBoxMType->currentData().toInt());
|
||||
#endif
|
||||
return static_cast<MeasurementsType>(CURRENT_DATA(ui->comboBoxMType).toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit DialogNewMeasurements::MUnit() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return static_cast<Unit>(ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt());
|
||||
#else
|
||||
return static_cast<Unit>(ui->comboBoxUnit->currentData().toInt());
|
||||
#endif
|
||||
return static_cast<Unit>(CURRENT_DATA(ui->comboBoxUnit).toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -117,14 +109,7 @@ void DialogNewMeasurements::changeEvent(QEvent *event)
|
|||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
InitMTypes();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const MeasurementsType type =
|
||||
static_cast<MeasurementsType>(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt());
|
||||
#else
|
||||
const MeasurementsType type = static_cast<MeasurementsType>(ui->comboBoxMType->currentData().toInt());
|
||||
#endif
|
||||
InitUnits(type);
|
||||
InitUnits(static_cast<MeasurementsType>(CURRENT_DATA(ui->comboBoxMType).toInt()));
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
|
@ -192,11 +177,7 @@ void DialogNewMeasurements::InitMTypes()
|
|||
int val = static_cast<int>(MeasurementsType::Unknown);
|
||||
if (ui->comboBoxMType->currentIndex() != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
val = ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt();
|
||||
#else
|
||||
val = ui->comboBoxMType->currentData().toInt();
|
||||
#endif
|
||||
val = CURRENT_DATA(ui->comboBoxMType).toInt();
|
||||
}
|
||||
|
||||
ui->comboBoxMType->blockSignals(true);
|
||||
|
@ -234,11 +215,7 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
|
|||
int val = static_cast<int>(Unit::Cm);
|
||||
if (ui->comboBoxUnit->currentIndex() != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
val = ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt();
|
||||
#else
|
||||
val = ui->comboBoxUnit->currentData().toInt();
|
||||
#endif
|
||||
val = CURRENT_DATA(ui->comboBoxUnit).toInt();
|
||||
}
|
||||
|
||||
ui->comboBoxUnit->blockSignals(true);
|
||||
|
|
|
@ -76,7 +76,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
|
|||
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
||||
{
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||
|
||||
switch (item->type())
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
}
|
||||
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||
|
||||
switch (currentItem->type())
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
|
|||
}
|
||||
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||
|
||||
switch (currentItem->type())
|
||||
{
|
||||
|
|
|
@ -395,19 +395,11 @@ QGroupBox *ConfigurationPage::ToolBarGroup()
|
|||
void ConfigurationPage::SystemChanged()
|
||||
{
|
||||
systemChanged = true;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
|
||||
#endif
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
||||
systemAuthorValueLabel->setText(text);
|
||||
systemAuthorValueLabel->setToolTip(text);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
|
||||
#endif
|
||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
||||
systemBookValueLabel->setPlainText(text);
|
||||
}
|
||||
|
||||
|
@ -470,18 +462,11 @@ void ConfigurationPage::RetranslateUi()
|
|||
systemAuthorLabel->setText(tr("Author:"));
|
||||
systemBookLabel->setText(tr("Book:"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
|
||||
#endif
|
||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
||||
systemAuthorValueLabel->setText(text);
|
||||
systemAuthorValueLabel->setToolTip(text);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||
#else
|
||||
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
|
||||
#endif
|
||||
|
||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
||||
systemBookValueLabel->setPlainText(text);
|
||||
|
||||
sendGroup->setTitle(tr("Send crash reports"));
|
||||
|
|
|
@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
QString DialogHistory::Record(const VToolRecord &tool)
|
||||
{
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in history.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history.");
|
||||
|
||||
const QDomElement domElem = doc->elementById(tool.getId());
|
||||
if (domElem.isElement() == false)
|
||||
|
@ -405,6 +405,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
case Tool::FlippingByAxis:
|
||||
case Tool::Move:
|
||||
case Tool::PiecePath:
|
||||
case Tool::Pin:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -824,12 +824,7 @@ QString DialogLayoutSettings::MakeHelpTemplateList()
|
|||
QSizeF DialogLayoutSettings::Template()
|
||||
{
|
||||
PaperSizeTemplate temp;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->itemData(ui->comboBoxTemplates->currentIndex())
|
||||
.toInt());
|
||||
#else
|
||||
temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
|
||||
#endif
|
||||
temp = static_cast<PaperSizeTemplate>(CURRENT_DATA(ui->comboBoxTemplates).toInt());
|
||||
|
||||
switch (temp)
|
||||
{
|
||||
|
@ -981,23 +976,13 @@ QMarginsF DialogLayoutSettings::GetDefPrinterFields() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit DialogLayoutSettings::PaperUnit() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->itemData(ui->comboBoxPaperSizeUnit->currentIndex())
|
||||
.toString());
|
||||
#else
|
||||
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString());
|
||||
#endif
|
||||
return VDomDocument::StrToUnits(CURRENT_DATA(ui->comboBoxPaperSizeUnit).toString());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit DialogLayoutSettings::LayoutUnit() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->itemData(ui->comboBoxLayoutUnit->currentIndex())
|
||||
.toString());
|
||||
#else
|
||||
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString());
|
||||
#endif
|
||||
return VDomDocument::StrToUnits(CURRENT_DATA(ui->comboBoxLayoutUnit).toString());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -208,11 +208,7 @@ QString DialogSaveLayout::FileName() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSaveLayout::Format() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return ui->comboBoxFormat->itemData(ui->comboBoxFormat->currentIndex()).toString();
|
||||
#else
|
||||
return ui->comboBoxFormat->currentData().toString();
|
||||
#endif
|
||||
return CURRENT_DATA(ui->comboBoxFormat).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "../vtools/dialogs/tooldialogs.h"
|
||||
#include "tools/vtoolseamallowance.h"
|
||||
#include "tools/nodeDetails/vtoolpiecepath.h"
|
||||
#include "tools/nodeDetails/vtoolpin.h"
|
||||
#include "tools/vtooluniondetails.h"
|
||||
#include "dialogs/dialogs.h"
|
||||
#include "dialogs/vwidgetgroups.h"
|
||||
|
@ -572,6 +573,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
|||
dialogTool->Build(t);
|
||||
break;
|
||||
case Tool::PiecePath:
|
||||
case Tool::Pin:
|
||||
dialogTool->SetPiecesList(doc->GetActivePPPieces());
|
||||
break;
|
||||
default:
|
||||
|
@ -991,6 +993,14 @@ void MainWindow::ToolPiecePath(bool checked)
|
|||
&MainWindow::ClosedDialogPiecePath);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToolPin(bool checked)
|
||||
{
|
||||
ToolSelectAllDrawObjects();
|
||||
SetToolButton<DialogPin>(checked, Tool::Pin, "://cursor/pin_cursor.png", tr("Select pin point"),
|
||||
&MainWindow::ClosedDialogPin);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ToolHeight handler tool height.
|
||||
|
@ -1140,6 +1150,18 @@ void MainWindow::ClosedDialogPiecePath(int result)
|
|||
doc->LiteParseTree(Document::LiteParse);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ClosedDialogPin(int result)
|
||||
{
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
if (result == QDialog::Accepted)
|
||||
{
|
||||
VToolPin::Create(dialogTool, doc, pattern);
|
||||
}
|
||||
ArrowTool();
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ToolCutArc handler tool cutArc.
|
||||
|
@ -1779,7 +1801,7 @@ void MainWindow::InitToolButtons()
|
|||
}
|
||||
|
||||
// This check helps to find missed tools
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Check if all tools were connected.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected.");
|
||||
|
||||
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
||||
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
||||
|
@ -1825,6 +1847,7 @@ void MainWindow::InitToolButtons()
|
|||
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
|
||||
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
|
||||
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
|
||||
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1852,7 +1875,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
void MainWindow::CancelTool()
|
||||
{
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||
|
||||
qCDebug(vMainWindow, "Canceling tool.");
|
||||
delete dialogTool;
|
||||
|
@ -2008,6 +2031,9 @@ void MainWindow::CancelTool()
|
|||
case Tool::EllipticalArc:
|
||||
ui->toolButtonEllipticalArc->setChecked(false);
|
||||
break;
|
||||
case Tool::Pin:
|
||||
ui->toolButtonPin->setChecked(false);
|
||||
break;
|
||||
}
|
||||
|
||||
// Crash: using CRTL+Z while using line tool.
|
||||
|
@ -2326,7 +2352,19 @@ void MainWindow::ActionLayout(bool checked)
|
|||
|
||||
SaveCurrentScene();
|
||||
|
||||
PrepareDetailsForLayout(&details);
|
||||
try
|
||||
{
|
||||
PrepareDetailsForLayout(&details);
|
||||
}
|
||||
catch (VException &e)
|
||||
{
|
||||
listDetails.clear();
|
||||
QMessageBox::warning(this, tr("Layout mode"),
|
||||
tr("You can't use now the Layout mode. \n%1").arg(e.ErrorMessage()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
mode == Draw::Calculation ? ActionDraw(true) : ActionDetails(true);
|
||||
return;
|
||||
}
|
||||
|
||||
currentScene = tempSceneLayout;
|
||||
ui->view->itemClicked(nullptr);
|
||||
|
@ -3114,7 +3152,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
}
|
||||
|
||||
// This check helps to find missed tools
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||
|
||||
//Drawing Tools
|
||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||
|
@ -3155,6 +3193,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
ui->toolButtonMove->setEnabled(drawTools);
|
||||
ui->toolButtonMidpoint->setEnabled(drawTools);
|
||||
ui->toolButtonEllipticalArc->setEnabled(drawTools);
|
||||
ui->toolButtonPin->setEnabled(drawTools);
|
||||
|
||||
ui->actionLast_tool->setEnabled(drawTools);
|
||||
|
||||
|
@ -3436,7 +3475,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
void MainWindow::LastUsedTool()
|
||||
{
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||
|
||||
if (currentTool == lastUsedTool)
|
||||
{
|
||||
|
@ -3623,6 +3662,10 @@ void MainWindow::LastUsedTool()
|
|||
ui->toolButtonEllipticalArc->setChecked(true);
|
||||
ToolEllipticalArc(true);
|
||||
break;
|
||||
case Tool::Pin:
|
||||
ui->toolButtonPin->setChecked(true);
|
||||
ToolPin(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ private slots:
|
|||
void ToolPointOfContact(bool checked);
|
||||
void ToolDetail(bool checked);
|
||||
void ToolPiecePath(bool checked);
|
||||
void ToolPin(bool checked);
|
||||
void ToolHeight(bool checked);
|
||||
void ToolTriangle(bool checked);
|
||||
void ToolPointOfIntersection(bool checked);
|
||||
|
@ -170,6 +171,7 @@ private slots:
|
|||
void ClosedDialogUnionDetails(int result);
|
||||
void ClosedDialogGroup(int result);
|
||||
void ClosedDialogPiecePath(int result);
|
||||
void ClosedDialogPin(int result);
|
||||
|
||||
void LoadIndividual();
|
||||
void LoadStandard();
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<string>Tools</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
|
@ -1449,6 +1449,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QToolButton" name="toolButtonPin">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Pin tool</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/toolicon.qrc">
|
||||
<normaloff>:/toolicon/32x32/pin.png</normaloff>:/toolicon/32x32/pin.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>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutPage">
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
#include "dialogs/dialoglayoutprogress.h"
|
||||
#include "dialogs/dialogsavelayout.h"
|
||||
#include "../vlayout/vposter.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
#include "../vtools/tools/vabstracttool.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
|
|
@ -80,5 +80,7 @@
|
|||
<file>cursor/el_arc_cursor@2x.png</file>
|
||||
<file>cursor/path_cursor.png</file>
|
||||
<file>cursor/path_cursor@2x.png</file>
|
||||
<file>cursor/pin_cursor.png</file>
|
||||
<file>cursor/pin_cursor@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/app/valentina/share/resources/cursor/pin_cursor.png
Normal file
BIN
src/app/valentina/share/resources/cursor/pin_cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 561 B |
BIN
src/app/valentina/share/resources/cursor/pin_cursor@2x.png
Normal file
BIN
src/app/valentina/share/resources/cursor/pin_cursor@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -78,5 +78,7 @@
|
|||
<file>toolicon/32x32/el_arc@2x.png</file>
|
||||
<file>toolicon/32x32/path.png</file>
|
||||
<file>toolicon/32x32/path@2x.png</file>
|
||||
<file>toolicon/32x32/pin.png</file>
|
||||
<file>toolicon/32x32/pin@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/app/valentina/share/resources/toolicon/32x32/pin.png
Normal file
BIN
src/app/valentina/share/resources/toolicon/32x32/pin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 B |
BIN
src/app/valentina/share/resources/toolicon/32x32/pin@2x.png
Normal file
BIN
src/app/valentina/share/resources/toolicon/32x32/pin@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1006 B |
81
src/app/valentina/share/resources/toolicon/svg/pin.svg
Normal file
81
src/app/valentina/share/resources/toolicon/svg/pin.svg
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
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"
|
||||
height="24"
|
||||
version="1.1"
|
||||
width="24"
|
||||
id="svg14"
|
||||
sodipodi:docname="pin.svg"
|
||||
inkscape:export-filename="/home/dismine/CAD/Valentina_cpoint/valentina/src/app/valentina/share/resources/toolicon/32x32/pin@2x.png"
|
||||
inkscape:export-xdpi="256"
|
||||
inkscape:export-ydpi="256"
|
||||
inkscape:version="0.92.0 unknown">
|
||||
<metadata
|
||||
id="metadata20">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs18" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1460"
|
||||
inkscape:window-height="829"
|
||||
id="namedview16"
|
||||
showgrid="false"
|
||||
inkscape:zoom="9.8333333"
|
||||
inkscape:cx="-8.0847458"
|
||||
inkscape:cy="12"
|
||||
inkscape:window-x="75"
|
||||
inkscape:window-y="34"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg14" />
|
||||
<g
|
||||
transform="matrix(1.080652,0,0,1.0806515,-1.8456748,-1111.4295)"
|
||||
id="g12">
|
||||
<g
|
||||
transform="matrix(0.70711,0.70711,-0.70711,0.70711,737.68,297.72)"
|
||||
id="g10">
|
||||
<path
|
||||
d="m 11,1028.4 v 13 h 1 6.406 c -0.595,-1.1 -1.416,-2.1 -2.406,-2.8 v -8 c 0.616,-0.6 1.131,-1.4 1.531,-2.2 H 12 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#c0392b" />
|
||||
<path
|
||||
d="m 11,13 v 2 4 2 l 1,2 v -2 -6 -2 z"
|
||||
transform="translate(0,1028.4)"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#bdc3c7" />
|
||||
<path
|
||||
d="m 12,13 v 2 4 2 2 l 1,-2 v -2 -4 -2 z"
|
||||
transform="translate(0,1028.4)"
|
||||
id="path6"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#7f8c8d" />
|
||||
<path
|
||||
d="m 6.4688,1028.4 c 0.4006,0.8 0.915,1.6 1.5312,2.2 v 8 c -0.9897,0.7 -1.8113,1.7 -2.4062,2.8 H 12 v -13 z"
|
||||
id="path8"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#e74c3c" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
|
@ -51,9 +51,9 @@
|
|||
#include "../core/vapplication.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
#include "../vpatterndb/vpiecepath.h"
|
||||
#include "../vpatterndb/vnodedetail.h"
|
||||
|
||||
|
@ -717,7 +717,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
|||
<< TagPatternInfo
|
||||
<< TagGrainline
|
||||
<< VToolSeamAllowance::TagCSA
|
||||
<< VToolSeamAllowance::TagIPaths;
|
||||
<< VToolSeamAllowance::TagIPaths
|
||||
<< VToolSeamAllowance::TagPins;
|
||||
|
||||
const QDomNodeList nodeList = domElement.childNodes();
|
||||
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||
|
@ -757,6 +758,9 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
|||
case 5:// VToolSeamAllowance::TagIPaths
|
||||
detail.SetInternalPaths(ParsePieceInternalPaths(element));
|
||||
break;
|
||||
case 6:// VToolSeamAllowance::TagPins
|
||||
detail.SetPins(ParsePiecePins(element));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -824,6 +828,12 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail)
|
|||
qreal dRot = GetParametrDouble(domElement, AttrRotation, "0");
|
||||
detail.GetPatternPieceData().SetRotation(dRot);
|
||||
|
||||
const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR);
|
||||
detail.GetPatternPieceData().SetTopLeftPin(topLeftPin);
|
||||
|
||||
const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR);
|
||||
detail.GetPatternPieceData().SetBottomRightPin(bottomRightPin);
|
||||
|
||||
QDomNodeList nodeListMCP = domElement.childNodes();
|
||||
for (int iMCP = 0; iMCP < nodeListMCP.count(); ++iMCP)
|
||||
{
|
||||
|
@ -856,6 +866,12 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta
|
|||
detail.GetPatternInfo().SetFontSize(iFS);
|
||||
qreal dRot = GetParametrDouble(domElement, AttrRotation, "0");
|
||||
detail.GetPatternInfo().SetRotation(dRot);
|
||||
|
||||
const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR);
|
||||
detail.GetPatternInfo().SetTopLeftPin(topLeftPin);
|
||||
|
||||
const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR);
|
||||
detail.GetPatternInfo().SetBottomRightPin(bottomRightPin);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -870,9 +886,14 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail
|
|||
detail.GetGrainlineGeometry().SetLength(qsLength);
|
||||
QString qsRot = GetParametrString(domElement, AttrRotation, "90");
|
||||
detail.GetGrainlineGeometry().SetRotation(qsRot);
|
||||
VGrainlineGeometry::ArrowType eAT =
|
||||
VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0"));
|
||||
ArrowType eAT = static_cast<ArrowType>(GetParametrUInt(domElement, AttrArrows, "0"));
|
||||
detail.GetGrainlineGeometry().SetArrowType(eAT);
|
||||
|
||||
const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
|
||||
detail.GetGrainlineGeometry().SetTopPin(topPin);
|
||||
|
||||
const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR);
|
||||
detail.GetGrainlineGeometry().SetBottomPin(bottomPin);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -963,7 +984,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
<< VToolPointFromCircleAndTangent::ToolType /*19*/
|
||||
<< VToolPointFromArcAndTangent::ToolType /*20*/
|
||||
<< VToolTrueDarts::ToolType /*21*/
|
||||
<< VToolPointOfIntersectionCurves::ToolType; /*22*/
|
||||
<< VToolPointOfIntersectionCurves::ToolType /*22*/
|
||||
<< VToolPin::ToolType; /*23*/
|
||||
switch (points.indexOf(type))
|
||||
{
|
||||
case 0: //VToolBasePoint::ToolType
|
||||
|
@ -1035,6 +1057,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
case 22: //VToolPointOfIntersectionCurves::ToolType
|
||||
ParseToolPointOfIntersectionCurves(scene, domElement, parse);
|
||||
break;
|
||||
case 23: //VToolPin::ToolType
|
||||
ParsePinPoint(domElement, parse);
|
||||
break;
|
||||
default:
|
||||
VException e(tr("Unknown point type '%1'.").arg(type));
|
||||
throw e;
|
||||
|
@ -1536,6 +1561,28 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::ParsePinPoint(const QDomElement &domElement, const Document &parse)
|
||||
{
|
||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||
|
||||
try
|
||||
{
|
||||
quint32 id = 0;
|
||||
|
||||
ToolsCommonAttributes(domElement, id);
|
||||
const quint32 idObject = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
|
||||
VToolPin::Create(id, idObject, NULL_ID, this, data, parse, Source::FromFile, "", idTool);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
VExceptionObjectError excep(tr("Error creating or updating pin point"), domElement);
|
||||
excep.AddMoreInformation(e.ErrorMessage());
|
||||
throw excep;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
|
||||
{
|
||||
|
@ -3726,7 +3773,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
QRectF VPattern::ActiveDrawBoundingRect() const
|
||||
{
|
||||
// This check helps to find missed tools in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used.");
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used.");
|
||||
|
||||
QRectF rec;
|
||||
|
||||
|
@ -3860,6 +3907,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
|||
case Tool::NodeSplinePath:
|
||||
case Tool::Group:
|
||||
case Tool::PiecePath:
|
||||
case Tool::Pin:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ private:
|
|||
void ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseNodePoint(const QDomElement &domElement, const Document &parse);
|
||||
void ParsePinPoint(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 ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||
|
|
|
@ -73,7 +73,7 @@ VException &VException::operator=(const VException &e)
|
|||
*/
|
||||
QString VException::ErrorMessage() const
|
||||
{
|
||||
return QString("Exception: %1").arg(error);
|
||||
return tr("Exception: %1").arg(error);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<file>schema/pattern/v0.3.9.xsd</file>
|
||||
<file>schema/pattern/v0.4.0.xsd</file>
|
||||
<file>schema/pattern/v0.4.1.xsd</file>
|
||||
<file>schema/pattern/v0.4.2.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.1.xsd</file>
|
||||
|
|
860
src/libs/ifc/schema/pattern/v0.4.2.xsd
Normal file
860
src/libs/ifc/schema/pattern/v0.4.2.xsd
Normal file
|
@ -0,0 +1,860 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<!-- XML Schema Generated from XML Document-->
|
||||
<xs:element name="pattern">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element name="version" type="formatVersion"/>
|
||||
<xs:element name="unit" type="units"/>
|
||||
<xs:element name="image" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="extension" type="imageExtension"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="heights">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="all" type="xs:boolean" use="required"/>
|
||||
<xs:attribute name="h50" type="xs:boolean"/>
|
||||
<xs:attribute name="h56" type="xs:boolean"/>
|
||||
<xs:attribute name="h62" type="xs:boolean"/>
|
||||
<xs:attribute name="h68" type="xs:boolean"/>
|
||||
<xs:attribute name="h74" type="xs:boolean"/>
|
||||
<xs:attribute name="h80" type="xs:boolean"/>
|
||||
<xs:attribute name="h86" type="xs:boolean"/>
|
||||
<xs:attribute name="h92" type="xs:boolean"/>
|
||||
<xs:attribute name="h98" type="xs:boolean"/>
|
||||
<xs:attribute name="h104" type="xs:boolean"/>
|
||||
<xs:attribute name="h110" type="xs:boolean"/>
|
||||
<xs:attribute name="h116" type="xs:boolean"/>
|
||||
<xs:attribute name="h122" type="xs:boolean"/>
|
||||
<xs:attribute name="h128" type="xs:boolean"/>
|
||||
<xs:attribute name="h134" type="xs:boolean"/>
|
||||
<xs:attribute name="h140" type="xs:boolean"/>
|
||||
<xs:attribute name="h146" type="xs:boolean"/>
|
||||
<xs:attribute name="h152" type="xs:boolean"/>
|
||||
<xs:attribute name="h158" type="xs:boolean"/>
|
||||
<xs:attribute name="h164" type="xs:boolean"/>
|
||||
<xs:attribute name="h170" type="xs:boolean"/>
|
||||
<xs:attribute name="h176" type="xs:boolean"/>
|
||||
<xs:attribute name="h182" type="xs:boolean"/>
|
||||
<xs:attribute name="h188" type="xs:boolean"/>
|
||||
<xs:attribute name="h194" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="sizes">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="all" type="xs:boolean" use="required"/>
|
||||
<xs:attribute name="s22" type="xs:boolean"/>
|
||||
<xs:attribute name="s24" type="xs:boolean"/>
|
||||
<xs:attribute name="s26" type="xs:boolean"/>
|
||||
<xs:attribute name="s28" type="xs:boolean"/>
|
||||
<xs:attribute name="s30" type="xs:boolean"/>
|
||||
<xs:attribute name="s32" type="xs:boolean"/>
|
||||
<xs:attribute name="s34" type="xs:boolean"/>
|
||||
<xs:attribute name="s36" type="xs:boolean"/>
|
||||
<xs:attribute name="s38" type="xs:boolean"/>
|
||||
<xs:attribute name="s40" type="xs:boolean"/>
|
||||
<xs:attribute name="s42" type="xs:boolean"/>
|
||||
<xs:attribute name="s44" type="xs:boolean"/>
|
||||
<xs:attribute name="s46" type="xs:boolean"/>
|
||||
<xs:attribute name="s48" type="xs:boolean"/>
|
||||
<xs:attribute name="s50" type="xs:boolean"/>
|
||||
<xs:attribute name="s52" type="xs:boolean"/>
|
||||
<xs:attribute name="s54" type="xs:boolean"/>
|
||||
<xs:attribute name="s56" type="xs:boolean"/>
|
||||
<xs:attribute name="s58" type="xs:boolean"/>
|
||||
<xs:attribute name="s60" type="xs:boolean"/>
|
||||
<xs:attribute name="s62" type="xs:boolean"/>
|
||||
<xs:attribute name="s64" type="xs:boolean"/>
|
||||
<xs:attribute name="s66" type="xs:boolean"/>
|
||||
<xs:attribute name="s68" type="xs:boolean"/>
|
||||
<xs:attribute name="s70" type="xs:boolean"/>
|
||||
<xs:attribute name="s72" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="custom" type="xs:boolean"/>
|
||||
<xs:attribute name="defHeight" type="baseHeight"/>
|
||||
<xs:attribute name="defSize" type="baseSize"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="measurements" type="xs:string"/>
|
||||
<xs:element name="increments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="description" type="xs:string" use="required"/>
|
||||
<xs:attribute name="name" type="shortName" use="required"/>
|
||||
<xs:attribute name="formula" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:unique name="incrementName">
|
||||
<xs:selector xpath="increment"/>
|
||||
<xs:field xpath="@name"/>
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="x" type="xs:double"/>
|
||||
<xs:attribute name="y" type="xs:double"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="name" type="shortName"/>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="thirdPoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="basePoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="pShoulder" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="length" type="xs:string"/>
|
||||
<xs:attribute name="angle" type="xs:string"/>
|
||||
<xs:attribute name="typeLine" type="xs:string"/>
|
||||
<xs:attribute name="splinePath" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="spline" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p1Line1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p1Line2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p2Line1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p2Line2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="radius" type="xs:string"/>
|
||||
<xs:attribute name="axisP1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="axisP2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="arc" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="elArc" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="curve" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="curve1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="curve2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="lineColor" type="colors"/>
|
||||
<xs:attribute name="color" type="colors"/>
|
||||
<xs:attribute name="firstArc" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="secondArc" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="crossPoint" type="crossType"/>
|
||||
<xs:attribute name="vCrossPoint" type="crossType"/>
|
||||
<xs:attribute name="hCrossPoint" type="crossType"/>
|
||||
<xs:attribute name="c1Center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="c2Center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="c1Radius" type="xs:string"/>
|
||||
<xs:attribute name="c2Radius" type="xs:string"/>
|
||||
<xs:attribute name="cRadius" type="xs:string"/>
|
||||
<xs:attribute name="tangent" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="cCenter" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="name1" type="shortName"/>
|
||||
<xs:attribute name="mx1" type="xs:double"/>
|
||||
<xs:attribute name="my1" type="xs:double"/>
|
||||
<xs:attribute name="name2" type="shortName"/>
|
||||
<xs:attribute name="mx2" type="xs:double"/>
|
||||
<xs:attribute name="my2" type="xs:double"/>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="point2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="dartP1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="dartP2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="dartP3" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="baseLineP1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="baseLineP2" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="typeLine" type="xs:string"/>
|
||||
<xs:attribute name="lineColor" type="colors"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="operation" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="source" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="destination" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="angle" type="xs:string"/>
|
||||
<xs:attribute name="length" type="xs:string"/>
|
||||
<xs:attribute name="suffix" type="xs:string"/>
|
||||
<xs:attribute name="type" type="xs:string" use="required"/>
|
||||
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="axisType" type="axisType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="angle1" type="xs:string"/>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="angle2" type="xs:string"/>
|
||||
<xs:attribute name="radius" type="xs:string"/>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="color" type="colors"/>
|
||||
<xs:attribute name="length" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="angle1" type="xs:string"/>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="angle2" type="xs:string"/>
|
||||
<xs:attribute name="rotationAngle" type="xs:string"/>
|
||||
<xs:attribute name="radius1" type="xs:string"/>
|
||||
<xs:attribute name="radius2" type="xs:string"/>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="color" type="colors"/>
|
||||
<xs:attribute name="length" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="kAsm2" type="xs:string"/>
|
||||
<xs:attribute name="pSpline" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="angle" type="xs:string"/>
|
||||
<xs:attribute name="angle1" type="xs:string"/>
|
||||
<xs:attribute name="angle2" type="xs:string"/>
|
||||
<xs:attribute name="length1" type="xs:string"/>
|
||||
<xs:attribute name="length2" type="xs:string"/>
|
||||
<xs:attribute name="kAsm1" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="kCurve" type="xs:double"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="kAsm1" type="xs:double"/>
|
||||
<xs:attribute name="kAsm2" type="xs:double"/>
|
||||
<xs:attribute name="angle1" type="xs:string"/>
|
||||
<xs:attribute name="angle2" type="xs:string"/>
|
||||
<xs:attribute name="length1" type="xs:string"/>
|
||||
<xs:attribute name="length2" type="xs:string"/>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="point2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="point3" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="point4" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="color" type="colors"/>
|
||||
<xs:attribute name="duplicate" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="path" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="type" type="xs:string" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="before" type="xs:double"/>
|
||||
<xs:attribute name="after" type="xs:double"/>
|
||||
<xs:attribute name="angle" type="nodeAngle"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="type" type="piecePathType"/>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="typeLine" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="det" minOccurs="2" maxOccurs="2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="type" type="xs:string" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="before" type="xs:string"/>
|
||||
<xs:attribute name="after" type="xs:string"/>
|
||||
<xs:attribute name="angle" type="nodeAngle"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="csa" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="start" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="end" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="reverse" type="xs:boolean"/>
|
||||
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="pins" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="children" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="nodes" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="csa" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="pins" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="type" type="xs:string"/>
|
||||
<xs:attribute name="indexD1" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="indexD2" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="inUse" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="data" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="mcp" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="userDef" type="xs:string"/>
|
||||
<xs:attribute name="material" type="materialType"/>
|
||||
<xs:attribute name="placement" type="placementType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="letter" type="xs:string"/>
|
||||
<xs:attribute name="visible" type="xs:boolean"/>
|
||||
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="width" type="xs:double"/>
|
||||
<xs:attribute name="height" type="xs:double"/>
|
||||
<xs:attribute name="rotation" type="xs:double"/>
|
||||
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="visible" type="xs:boolean"/>
|
||||
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="width" type="xs:double"/>
|
||||
<xs:attribute name="height" type="xs:double"/>
|
||||
<xs:attribute name="rotation" type="xs:double"/>
|
||||
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="visible" type="xs:boolean"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="length" type="xs:string"/>
|
||||
<xs:attribute name="rotation" type="xs:string"/>
|
||||
<xs:attribute name="arrows" type="arrowType"/>
|
||||
<xs:attribute name="topPin" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="bottomPin" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="type" type="xs:string" use="required"/>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="before" type="xs:string"/>
|
||||
<xs:attribute name="after" type="xs:string"/>
|
||||
<xs:attribute name="angle" type="nodeAngle"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="csa" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="start" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="end" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="reverse" type="xs:boolean"/>
|
||||
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="pins" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="record" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="version" type="pieceVersion"/>
|
||||
<xs:attribute name="mx" type="xs:double"/>
|
||||
<xs:attribute name="my" type="xs:double"/>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="inLayout" type="xs:boolean"/>
|
||||
<xs:attribute name="forbidFlipping" type="xs:boolean"/>
|
||||
<xs:attribute name="width" type="xs:string"/>
|
||||
<xs:attribute name="seamAllowance" type="xs:boolean"/>
|
||||
<xs:attribute name="united" type="xs:boolean"/>
|
||||
<xs:attribute name="closed" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="groups" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="object" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="tool" type="xs:unsignedInt"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
<xs:attribute name="visible" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="readOnly" type="xs:boolean"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^([^\p{Nd}\p{Zs}*/&|!<>^\-()–+−=?:;'\"]){1,1}([^\p{Zs}*/&|!<>^\-()–+−=?:;\"]){0,}$"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="units">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="mm"/>
|
||||
<xs:enumeration value="cm"/>
|
||||
<xs:enumeration value="inch"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="measurementsTypes">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="standard"/>
|
||||
<xs:enumeration value="individual"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="formatVersion">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="imageExtension">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="PNG"/>
|
||||
<xs:enumeration value="JPG"/>
|
||||
<xs:enumeration value="BMP"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="colors">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="black"/>
|
||||
<xs:enumeration value="green"/>
|
||||
<xs:enumeration value="blue"/>
|
||||
<xs:enumeration value="darkRed"/>
|
||||
<xs:enumeration value="darkGreen"/>
|
||||
<xs:enumeration value="darkBlue"/>
|
||||
<xs:enumeration value="yellow"/>
|
||||
<xs:enumeration value="lightsalmon"/>
|
||||
<xs:enumeration value="goldenrod"/>
|
||||
<xs:enumeration value="orange"/>
|
||||
<xs:enumeration value="deeppink"/>
|
||||
<xs:enumeration value="violet"/>
|
||||
<xs:enumeration value="darkviolet"/>
|
||||
<xs:enumeration value="mediumseagreen"/>
|
||||
<xs:enumeration value="lime"/>
|
||||
<xs:enumeration value="deepskyblue"/>
|
||||
<xs:enumeration value="cornflowerblue"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="baseHeight">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="50"/>
|
||||
<xs:enumeration value="56"/>
|
||||
<xs:enumeration value="62"/>
|
||||
<xs:enumeration value="68"/>
|
||||
<xs:enumeration value="74"/>
|
||||
<xs:enumeration value="80"/>
|
||||
<xs:enumeration value="86"/>
|
||||
<xs:enumeration value="92"/>
|
||||
<xs:enumeration value="98"/>
|
||||
<xs:enumeration value="104"/>
|
||||
<xs:enumeration value="110"/>
|
||||
<xs:enumeration value="116"/>
|
||||
<xs:enumeration value="122"/>
|
||||
<xs:enumeration value="128"/>
|
||||
<xs:enumeration value="134"/>
|
||||
<xs:enumeration value="140"/>
|
||||
<xs:enumeration value="146"/>
|
||||
<xs:enumeration value="152"/>
|
||||
<xs:enumeration value="158"/>
|
||||
<xs:enumeration value="164"/>
|
||||
<xs:enumeration value="170"/>
|
||||
<xs:enumeration value="176"/>
|
||||
<xs:enumeration value="182"/>
|
||||
<xs:enumeration value="188"/>
|
||||
<xs:enumeration value="194"/>
|
||||
<xs:enumeration value="500"/>
|
||||
<xs:enumeration value="560"/>
|
||||
<xs:enumeration value="620"/>
|
||||
<xs:enumeration value="680"/>
|
||||
<xs:enumeration value="740"/>
|
||||
<xs:enumeration value="800"/>
|
||||
<xs:enumeration value="860"/>
|
||||
<xs:enumeration value="920"/>
|
||||
<xs:enumeration value="980"/>
|
||||
<xs:enumeration value="1040"/>
|
||||
<xs:enumeration value="1100"/>
|
||||
<xs:enumeration value="1160"/>
|
||||
<xs:enumeration value="1220"/>
|
||||
<xs:enumeration value="1280"/>
|
||||
<xs:enumeration value="1340"/>
|
||||
<xs:enumeration value="1400"/>
|
||||
<xs:enumeration value="1460"/>
|
||||
<xs:enumeration value="1520"/>
|
||||
<xs:enumeration value="1580"/>
|
||||
<xs:enumeration value="1640"/>
|
||||
<xs:enumeration value="1700"/>
|
||||
<xs:enumeration value="1760"/>
|
||||
<xs:enumeration value="1820"/>
|
||||
<xs:enumeration value="1880"/>
|
||||
<xs:enumeration value="1940"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="baseSize">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="22"/>
|
||||
<xs:enumeration value="24"/>
|
||||
<xs:enumeration value="26"/>
|
||||
<xs:enumeration value="28"/>
|
||||
<xs:enumeration value="30"/>
|
||||
<xs:enumeration value="32"/>
|
||||
<xs:enumeration value="34"/>
|
||||
<xs:enumeration value="36"/>
|
||||
<xs:enumeration value="38"/>
|
||||
<xs:enumeration value="40"/>
|
||||
<xs:enumeration value="42"/>
|
||||
<xs:enumeration value="44"/>
|
||||
<xs:enumeration value="46"/>
|
||||
<xs:enumeration value="48"/>
|
||||
<xs:enumeration value="50"/>
|
||||
<xs:enumeration value="52"/>
|
||||
<xs:enumeration value="54"/>
|
||||
<xs:enumeration value="56"/>
|
||||
<xs:enumeration value="220"/>
|
||||
<xs:enumeration value="240"/>
|
||||
<xs:enumeration value="260"/>
|
||||
<xs:enumeration value="280"/>
|
||||
<xs:enumeration value="300"/>
|
||||
<xs:enumeration value="320"/>
|
||||
<xs:enumeration value="340"/>
|
||||
<xs:enumeration value="360"/>
|
||||
<xs:enumeration value="380"/>
|
||||
<xs:enumeration value="400"/>
|
||||
<xs:enumeration value="420"/>
|
||||
<xs:enumeration value="440"/>
|
||||
<xs:enumeration value="460"/>
|
||||
<xs:enumeration value="480"/>
|
||||
<xs:enumeration value="500"/>
|
||||
<xs:enumeration value="520"/>
|
||||
<xs:enumeration value="540"/>
|
||||
<xs:enumeration value="560"/>
|
||||
<xs:enumeration value="580"/>
|
||||
<xs:enumeration value="600"/>
|
||||
<xs:enumeration value="620"/>
|
||||
<xs:enumeration value="640"/>
|
||||
<xs:enumeration value="660"/>
|
||||
<xs:enumeration value="680"/>
|
||||
<xs:enumeration value="700"/>
|
||||
<xs:enumeration value="720"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="crossType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="1"/>
|
||||
<xs:enumeration value="2"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="axisType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="1"/>
|
||||
<xs:enumeration value="2"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="materialType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/>
|
||||
<!--Fabric-->
|
||||
<xs:enumeration value="1"/>
|
||||
<!--Lining-->
|
||||
<xs:enumeration value="2"/>
|
||||
<!--Interfacing-->
|
||||
<xs:enumeration value="3"/>
|
||||
<!--Interlining-->
|
||||
<xs:enumeration value="4"/>
|
||||
<!--UserDefined-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="placementType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/>
|
||||
<!--No placement-->
|
||||
<xs:enumeration value="1"/>
|
||||
<!--Cut on Fold-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="arrowType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/>
|
||||
<!--Both-->
|
||||
<xs:enumeration value="1"/>
|
||||
<!--Front-->
|
||||
<xs:enumeration value="2"/>
|
||||
<!--Rear-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="pieceVersion">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="1"/>
|
||||
<!--Old version-->
|
||||
<xs:enumeration value="2"/>
|
||||
<!--New version-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="nodeAngle">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/>
|
||||
<!--by length-->
|
||||
<xs:enumeration value="1"/>
|
||||
<!--by points intersections-->
|
||||
<xs:enumeration value="2"/>
|
||||
<!--by second edge symmetry-->
|
||||
<xs:enumeration value="3"/>
|
||||
<!--by first edge symmetry-->
|
||||
<xs:enumeration value="4"/>
|
||||
<!--by first edge right angle-->
|
||||
<xs:enumeration value="5"/>
|
||||
<!--by first edge right angle-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="piecePathType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="1"/>
|
||||
<!--custom seam allowance-->
|
||||
<xs:enumeration value="2"/>
|
||||
<!--internal path-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="piecePathIncludeType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/>
|
||||
<!--as main path-->
|
||||
<xs:enumeration value="1"/>
|
||||
<!--as custom seam allowance-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
|
@ -639,6 +639,26 @@ QVector<quint32> VAbstractPattern::ParsePieceInternalPaths(const QDomElement &do
|
|||
return records;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> VAbstractPattern::ParsePiecePins(const QDomElement &domElement)
|
||||
{
|
||||
QVector<quint32> records;
|
||||
const QDomNodeList nodeList = domElement.childNodes();
|
||||
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||
{
|
||||
const QDomElement element = nodeList.at(i).toElement();
|
||||
if (not element.isNull())
|
||||
{
|
||||
const quint32 path = element.text().toUInt();
|
||||
if (path > NULL_ID)
|
||||
{
|
||||
records.append(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
|
||||
{
|
||||
|
@ -1628,7 +1648,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment a number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagPoint);
|
||||
|
@ -1700,7 +1720,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagArc);
|
||||
|
@ -1754,7 +1774,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagElArc);
|
||||
|
@ -1825,7 +1845,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
||||
|
@ -1892,7 +1912,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagOperation);
|
||||
|
@ -1947,7 +1967,7 @@ QStringList VAbstractPattern::ListPathExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagPath);
|
||||
|
@ -2000,7 +2020,7 @@ QStringList VAbstractPattern::ListPieceExpressions() const
|
|||
// Check if new tool doesn't bring new attribute with a formula.
|
||||
// If no just increment number.
|
||||
// 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) == 51);
|
||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||
|
||||
QStringList expressions;
|
||||
const QDomNodeList list = elementsByTagName(TagDetail);
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
static VPiecePath ParsePieceNodes(const QDomElement &domElement);
|
||||
static QVector<CustomSARecord> ParsePieceCSARecords(const QDomElement &domElement);
|
||||
static QVector<quint32> ParsePieceInternalPaths(const QDomElement &domElement);
|
||||
static QVector<quint32> ParsePiecePins(const QDomElement &domElement);
|
||||
|
||||
void AddToolOnRemove(VDataTool *tool);
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ class QDomElement;
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.1");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.1.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.2");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.2.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -200,6 +200,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
case (0x000400):
|
||||
return QStringLiteral("://schema/pattern/v0.4.0.xsd");
|
||||
case (0x000401):
|
||||
return QStringLiteral("://schema/pattern/v0.4.1.xsd");
|
||||
case (0x000402):
|
||||
return CurrentSchema;
|
||||
default:
|
||||
InvalidVersion(ver);
|
||||
|
@ -309,6 +311,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(0x000401), m_convertedFileName);
|
||||
V_FALLTHROUGH
|
||||
case (0x000401):
|
||||
ToV0_4_2();
|
||||
ValidateXML(XSDSchema(0x000402), m_convertedFileName);
|
||||
V_FALLTHROUGH
|
||||
case (0x000402):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -327,7 +333,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VPatternConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute readOnly was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 1),
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 2),
|
||||
"Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -621,6 +627,17 @@ void VPatternConverter::ToV0_4_1()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_4_2()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.4.2
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 2),
|
||||
"Time to refactor the code.");
|
||||
|
||||
SetVersion(QStringLiteral("0.4.2"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
|
|
@ -55,10 +55,10 @@ public:
|
|||
// GCC 4.6 doesn't allow constexpr and const together
|
||||
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
|
||||
static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1);
|
||||
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2);
|
||||
#else
|
||||
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 2);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -102,6 +102,7 @@ private:
|
|||
void ToV0_3_9();
|
||||
void ToV0_4_0();
|
||||
void ToV0_4_1();
|
||||
void ToV0_4_2();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
#include <Qt>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
#include "vlayoutdef.h"
|
||||
#include "vlayoutpiece_p.h"
|
||||
#include "vtextmanager.h"
|
||||
|
@ -55,8 +56,11 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VContainer *pattern)
|
||||
{
|
||||
SCASSERT(pattern != nullptr)
|
||||
|
||||
QVector<VLayoutPiecePath> paths;
|
||||
const QVector<quint32> pathsId = piece.GetInternalPaths();
|
||||
for (int i = 0; i < pathsId.size(); ++i)
|
||||
|
@ -69,6 +73,200 @@ QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VConta
|
|||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pattern, qreal &labelWidth,
|
||||
qreal &labelHeight, QPointF &pos)
|
||||
{
|
||||
SCASSERT(pattern != nullptr)
|
||||
|
||||
const quint32 topLeftPin = labelData.TopLeftPin();
|
||||
const quint32 bottomRightPin = labelData.BottomRightPin();
|
||||
|
||||
if (topLeftPin != NULL_ID && bottomRightPin != NULL_ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto topLeftPinPoint = pattern->GeometricObject<VPointF>(topLeftPin);
|
||||
const auto bottomRightPinPoint = pattern->GeometricObject<VPointF>(bottomRightPin);
|
||||
|
||||
const QRectF labelRect = QRectF(*topLeftPinPoint, *bottomRightPinPoint);
|
||||
labelWidth = qAbs(labelRect.width());
|
||||
labelHeight = qAbs(labelRect.height());
|
||||
|
||||
pos = labelRect.topLeft();
|
||||
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &)
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
labelWidth = labelData.GetLabelWidth();
|
||||
labelHeight = labelData.GetLabelHeight();
|
||||
pos = labelData.GetPos();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern, qreal &length, qreal &rotationAngle,
|
||||
QPointF &pos)
|
||||
{
|
||||
SCASSERT(pattern != nullptr)
|
||||
|
||||
const quint32 topPin = geom.TopPin();
|
||||
const quint32 bottomPin = geom.BottomPin();
|
||||
|
||||
if (topPin != NULL_ID && bottomPin != NULL_ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto topPinPoint = pattern->GeometricObject<VPointF>(topPin);
|
||||
const auto bottomPinPoint = pattern->GeometricObject<VPointF>(bottomPin);
|
||||
|
||||
QLineF grainline(*bottomPinPoint, *topPinPoint);
|
||||
length = grainline.length();
|
||||
rotationAngle = grainline.angle();
|
||||
|
||||
if (not VFuzzyComparePossibleNulls(rotationAngle, 0))
|
||||
{
|
||||
grainline.setAngle(0);
|
||||
}
|
||||
|
||||
pos = grainline.p1();
|
||||
rotationAngle = qDegreesToRadians(rotationAngle);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(const VExceptionBadId &)
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Calculator cal1;
|
||||
rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), geom.GetRotation());
|
||||
rotationAngle = qDegreesToRadians(rotationAngle);
|
||||
|
||||
Calculator cal2;
|
||||
length = cal2.EvalFormula(pattern->PlainVariables(), geom.GetLength());
|
||||
length = ToPixel(length, *pattern->GetPatternUnit());
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
pos = geom.GetPos();
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool IsItemContained(const QRectF &parentBoundingRect, const QVector<QPointF> &shape, qreal &dX, qreal &dY)
|
||||
{
|
||||
dX = 0;
|
||||
dY = 0;
|
||||
// single point differences
|
||||
bool bInside = true;
|
||||
|
||||
for (int i = 0; i < shape.size(); ++i)
|
||||
{
|
||||
qreal dPtX = 0;
|
||||
qreal dPtY = 0;
|
||||
if (not parentBoundingRect.contains(shape.at(i)))
|
||||
{
|
||||
if (shape.at(i).x() < parentBoundingRect.left())
|
||||
{
|
||||
dPtX = parentBoundingRect.left() - shape.at(i).x();
|
||||
}
|
||||
else if (shape.at(i).x() > parentBoundingRect.right())
|
||||
{
|
||||
dPtX = parentBoundingRect.right() - shape.at(i).x();
|
||||
}
|
||||
|
||||
if (shape.at(i).y() < parentBoundingRect.top())
|
||||
{
|
||||
dPtY = parentBoundingRect.top() - shape.at(i).y();
|
||||
}
|
||||
else if (shape.at(i).y() > parentBoundingRect.bottom())
|
||||
{
|
||||
dPtY = parentBoundingRect.bottom() - shape.at(i).y();
|
||||
}
|
||||
|
||||
if (fabs(dPtX) > fabs(dX))
|
||||
{
|
||||
dX = dPtX;
|
||||
}
|
||||
|
||||
if (fabs(dPtY) > fabs(dY))
|
||||
{
|
||||
dY = dPtY;
|
||||
}
|
||||
|
||||
bInside = false;
|
||||
}
|
||||
}
|
||||
return bInside;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> CorrectPosition(const QRectF &parentBoundingRect, QVector<QPointF> points)
|
||||
{
|
||||
qreal dX = 0;
|
||||
qreal dY = 0;
|
||||
if (not IsItemContained(parentBoundingRect, points, dX, dY))
|
||||
{
|
||||
for (int i =0; i < points.size(); ++i)
|
||||
{
|
||||
points[i] = QPointF(points.at(i).x() + dX, points.at(i).y() + dY);
|
||||
}
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> RoundPoints(const QVector<QPointF> &points)
|
||||
{
|
||||
QVector<QPointF> p;
|
||||
for (int i=0; i < points.size(); ++i)
|
||||
{
|
||||
p.append(QPointF(qRound(points.at(i).x()), qRound(points.at(i).y())));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VSAPoint> PrepareAllowance(const QVector<QPointF> &points)
|
||||
{
|
||||
QVector<VSAPoint> allowancePoints;
|
||||
for(int i = 0; i < points.size(); ++i)
|
||||
{
|
||||
allowancePoints.append(VSAPoint(points.at(i)));
|
||||
}
|
||||
return allowancePoints;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VLayoutDetail::RotatePoint rotates a point around the center for given angle
|
||||
* @param ptCenter center around which the point is rotated
|
||||
* @param pt point, which is rotated around the center
|
||||
* @param dAng angle of rotation
|
||||
* @return position of point pt after rotating it around the center for dAng radians
|
||||
*/
|
||||
QPointF RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
||||
{
|
||||
QPointF ptDest;
|
||||
QPointF ptRel = pt - ptCenter;
|
||||
ptDest.setX(cos(dAng)*ptRel.x() - sin(dAng)*ptRel.y());
|
||||
ptDest.setY(sin(dAng)*ptRel.x() + cos(dAng)*ptRel.y());
|
||||
|
||||
return ptDest + ptCenter;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -106,24 +304,33 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
|
|||
det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
|
||||
|
||||
det.SetName(piece.GetName());
|
||||
const VPatternPieceData& data = piece.GetPatternPieceData();
|
||||
|
||||
// Very important to set main path first!
|
||||
if (det.ContourPath().isEmpty())
|
||||
{
|
||||
throw VException (tr("Piece %1 doesn't have shape.").arg(piece.GetName()));
|
||||
}
|
||||
|
||||
const VPieceLabelData& data = piece.GetPatternPieceData();
|
||||
if (data.IsVisible() == true)
|
||||
{
|
||||
det.SetDetail(piece.GetName(), data, qApp->font());
|
||||
det.SetDetail(piece.GetName(), data, qApp->font(), pattern);
|
||||
}
|
||||
const VPatternInfoGeometry& geom = piece.GetPatternInfo();
|
||||
|
||||
const VPatternLabelData& geom = piece.GetPatternInfo();
|
||||
if (geom.IsVisible() == true)
|
||||
{
|
||||
VAbstractPattern* pDoc = qApp->getCurrentDocument();
|
||||
det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height());
|
||||
det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height(), pattern);
|
||||
}
|
||||
const VGrainlineGeometry& grainlineGeom = piece.GetGrainlineGeometry();
|
||||
|
||||
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
|
||||
if (grainlineGeom.IsVisible() == true)
|
||||
{
|
||||
det.SetGrainline(grainlineGeom, *pattern);
|
||||
det.SetGrainline(grainlineGeom, pattern);
|
||||
}
|
||||
|
||||
det.SetSAWidth(qApp->toPixel(piece.GetSAWidth()));
|
||||
det.CreateTextItems();
|
||||
det.SetForbidFlipping(piece.IsForbidFlipping());
|
||||
|
||||
return det;
|
||||
|
@ -175,21 +382,29 @@ QVector<QPointF> VLayoutPiece::GetLayoutAllowancePoints() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetDetail(const QString& qsName, const VPatternPieceData& data, const QFont &font)
|
||||
void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, const QFont &font,
|
||||
const VContainer *pattern)
|
||||
{
|
||||
d->detailData = data;
|
||||
qreal dAng = qDegreesToRadians(data.GetRotation());
|
||||
QPointF ptCenter(data.GetPos().x() + data.GetLabelWidth()/2, data.GetPos().y() + data.GetLabelHeight()/2);
|
||||
QPointF ptPos = data.GetPos();
|
||||
QPointF ptPos;
|
||||
qreal labelWidth = 0;
|
||||
qreal labelHeight = 0;
|
||||
FindLabelGeometry(data, pattern, labelWidth, labelHeight, ptPos);
|
||||
|
||||
QVector<QPointF> v;
|
||||
v << ptPos << QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y())
|
||||
<< QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y() + data.GetLabelHeight())
|
||||
<< QPointF(ptPos.x(), ptPos.y() + data.GetLabelHeight());
|
||||
v << ptPos
|
||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y())
|
||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight)
|
||||
<< QPointF(ptPos.x(), ptPos.y() + labelHeight);
|
||||
|
||||
const qreal dAng = qDegreesToRadians(data.GetRotation());
|
||||
const QPointF ptCenter(ptPos.x() + labelWidth/2, ptPos.y() + labelHeight/2);
|
||||
for (int i = 0; i < v.count(); ++i)
|
||||
{
|
||||
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
||||
}
|
||||
d->detailLabel = RoundPoints(v);
|
||||
|
||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
||||
d->detailLabel = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||
|
||||
// generate text
|
||||
d->m_tmDetail.SetFont(font);
|
||||
|
@ -197,26 +412,32 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPatternPieceData& dat
|
|||
d->m_tmDetail.Update(qsName, data);
|
||||
// this will generate the lines of text
|
||||
d->m_tmDetail.SetFontSize(data.GetFontSize());
|
||||
d->m_tmDetail.FitFontSize(data.GetLabelWidth(), data.GetLabelHeight());
|
||||
d->m_tmDetail.FitFontSize(labelWidth, labelHeight);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font,
|
||||
qreal dSize, qreal dHeight)
|
||||
void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font,
|
||||
qreal dSize, qreal dHeight, const VContainer *pattern)
|
||||
{
|
||||
d->patternGeom = geom;
|
||||
qreal dAng = qDegreesToRadians(geom.GetRotation());
|
||||
QPointF ptCenter(geom.GetPos().x() + geom.GetLabelWidth()/2, geom.GetPos().y() + geom.GetLabelHeight()/2);
|
||||
QPointF ptPos = geom.GetPos();
|
||||
QPointF ptPos;
|
||||
qreal labelWidth = 0;
|
||||
qreal labelHeight = 0;
|
||||
FindLabelGeometry(geom, pattern, labelWidth, labelHeight, ptPos);
|
||||
|
||||
QVector<QPointF> v;
|
||||
v << ptPos << QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y())
|
||||
<< QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y() + geom.GetLabelHeight())
|
||||
<< QPointF(ptPos.x(), ptPos.y() + geom.GetLabelHeight());
|
||||
v << ptPos
|
||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y())
|
||||
<< QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight)
|
||||
<< QPointF(ptPos.x(), ptPos.y() + labelHeight);
|
||||
|
||||
const qreal dAng = qDegreesToRadians(geom.GetRotation());
|
||||
const QPointF ptCenter(ptPos.x() + labelWidth/2, ptPos.y() + labelHeight/2);
|
||||
for (int i = 0; i < v.count(); ++i)
|
||||
{
|
||||
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
||||
}
|
||||
d->patternInfo = RoundPoints(v);
|
||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
||||
d->patternInfo = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||
|
||||
// Generate text
|
||||
d->m_tmPattern.SetFont(font);
|
||||
|
@ -226,75 +447,50 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternIn
|
|||
|
||||
// generate lines of text
|
||||
d->m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
d->m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
d->m_tmPattern.FitFontSize(labelWidth, labelHeight);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern)
|
||||
void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pattern)
|
||||
{
|
||||
d->grainlineGeom = geom;
|
||||
qreal dAng;
|
||||
qreal dLen;
|
||||
SCASSERT(pattern != nullptr)
|
||||
|
||||
try
|
||||
QPointF pt1;
|
||||
qreal dAng = 0;
|
||||
qreal dLen = 0;
|
||||
if ( not FindGrainlineGeometry(geom, pattern, dLen, dAng, pt1))
|
||||
{
|
||||
QString qsFormula = geom.GetRotation().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
Calculator cal1;
|
||||
dAng = cal1.EvalFormula(rPattern.PlainVariables(), qsFormula);
|
||||
dAng = qDegreesToRadians(dAng);
|
||||
|
||||
qsFormula = geom.GetLength().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
Calculator cal2;
|
||||
dLen = cal2.EvalFormula(rPattern.PlainVariables(), qsFormula);
|
||||
dLen = ToPixel(dLen, *rPattern.GetPatternUnit());
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
return;
|
||||
}
|
||||
|
||||
QPointF pt1 = geom.GetPos();
|
||||
QPointF pt2;
|
||||
pt2.setX(pt1.x() + dLen * qCos(dAng));
|
||||
pt2.setY(pt1.y() - dLen * qSin(dAng));
|
||||
QPointF pt2(pt1.x() + dLen * qCos(dAng), pt1.y() - dLen * qSin(dAng));
|
||||
QVector<QPointF> v;
|
||||
QPointF pt;
|
||||
qreal dArrowLen = ToPixel(0.5, *rPattern.GetPatternUnit());
|
||||
qreal dArrowAng = M_PI/9;
|
||||
|
||||
const qreal dArrowLen = ToPixel(0.5, *pattern->GetPatternUnit());
|
||||
const qreal dArrowAng = M_PI/9;
|
||||
|
||||
v << pt1;
|
||||
|
||||
if (geom.GetArrowType() != VGrainlineGeometry::atRear) {
|
||||
pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng));
|
||||
pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
|
||||
v << pt;
|
||||
pt.setX(pt1.x() + dArrowLen * qCos(dAng - dArrowAng));
|
||||
pt.setY(pt1.y() - dArrowLen * qSin(dAng - dArrowAng));
|
||||
v << pt;
|
||||
|
||||
if (geom.GetArrowType() != ArrowType::atRear)
|
||||
{
|
||||
v << QPointF(pt1.x() + dArrowLen * qCos(dAng + dArrowAng), pt1.y() - dArrowLen * qSin(dAng + dArrowAng));
|
||||
v << QPointF(pt1.x() + dArrowLen * qCos(dAng - dArrowAng), pt1.y() - dArrowLen * qSin(dAng - dArrowAng));
|
||||
v << pt1;
|
||||
}
|
||||
|
||||
v << pt2;
|
||||
|
||||
if (geom.GetArrowType() != VGrainlineGeometry::atFront)
|
||||
if (geom.GetArrowType() != ArrowType::atFront)
|
||||
{
|
||||
dAng += M_PI;
|
||||
|
||||
pt.setX(pt2.x() + dArrowLen * qCos(dAng + dArrowAng));
|
||||
pt.setY(pt2.y() - dArrowLen * qSin(dAng + dArrowAng));
|
||||
v << pt;
|
||||
pt.setX(pt2.x() + dArrowLen * qCos(dAng - dArrowAng));
|
||||
pt.setY(pt2.y() - dArrowLen * qSin(dAng - dArrowAng));
|
||||
v << pt;
|
||||
|
||||
v << QPointF(pt2.x() + dArrowLen * qCos(dAng + dArrowAng), pt2.y() - dArrowLen * qSin(dAng + dArrowAng));
|
||||
v << QPointF(pt2.x() + dArrowLen * qCos(dAng - dArrowAng), pt2.y() - dArrowLen * qSin(dAng - dArrowAng));
|
||||
v << pt2;
|
||||
}
|
||||
|
||||
d->grainlinePoints = RoundPoints(v);
|
||||
QScopedPointer<QGraphicsItem> item(GetMainItem());
|
||||
d->grainlinePoints = CorrectPosition(item->boundingRect(), RoundPoints(v));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -543,17 +739,6 @@ QVector<QPointF> VLayoutPiece::Map(const QVector<QPointF> &points) const
|
|||
return p;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VLayoutPiece::RoundPoints(const QVector<QPointF> &points)
|
||||
{
|
||||
QVector<QPointF> p;
|
||||
for (int i=0; i < points.size(); ++i)
|
||||
{
|
||||
p.append(QPointF(qRound(points.at(i).x()), qRound(points.at(i).y())));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VLayoutPiece::ContourPath() const
|
||||
{
|
||||
|
@ -592,133 +777,6 @@ QPainterPath VLayoutPiece::ContourPath() const
|
|||
return path;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::ClearTextItems()
|
||||
{
|
||||
d->m_liPP.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::CreateTextItems()
|
||||
{
|
||||
ClearTextItems();
|
||||
// first add detail texts
|
||||
if (d->detailLabel.count() > 0)
|
||||
{
|
||||
// get the mapped label vertices
|
||||
QVector<QPointF> points = Map(Mirror(d->detailLabel));
|
||||
// append the first point to obtain the closed rectangle
|
||||
points.push_back(points.at(0));
|
||||
// calculate the angle of rotation
|
||||
qreal dAng = qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x());
|
||||
// calculate the label width and height
|
||||
qreal dW = GetDistance(points.at(0), points.at(1));
|
||||
qreal dH = GetDistance(points.at(1), points.at(2));
|
||||
qreal dY = 0;
|
||||
qreal dX;
|
||||
// set up the rotation around top-left corner matrix
|
||||
QMatrix mat;
|
||||
mat.translate(points.at(0).x(), points.at(0).y());
|
||||
mat.rotate(qRadiansToDegrees(dAng));
|
||||
|
||||
for (int i = 0; i < d->m_tmDetail.GetSourceLinesCount(); ++i)
|
||||
{
|
||||
const TextLine& tl = d->m_tmDetail.GetSourceLine(i);
|
||||
QFont fnt = d->m_tmDetail.GetFont();
|
||||
fnt.setPixelSize(d->m_tmDetail.GetFont().pixelSize() + tl.m_iFontSize);
|
||||
fnt.setWeight(tl.m_eFontWeight);
|
||||
fnt.setStyle(tl.m_eStyle);
|
||||
|
||||
QFontMetrics fm(fnt);
|
||||
|
||||
dY += fm.height();
|
||||
// check if the next line will go out of bounds
|
||||
if (dY > dH)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
QString qsText = tl.m_qsText;
|
||||
if (fm.width(qsText) > dW)
|
||||
{
|
||||
qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast<int>(dW));
|
||||
}
|
||||
// find the correct horizontal offset, depending on the alignment flag
|
||||
if ((tl.m_eAlign & Qt::AlignLeft) > 0)
|
||||
{
|
||||
dX = 0;
|
||||
}
|
||||
else if ((tl.m_eAlign & Qt::AlignHCenter) > 0)
|
||||
{
|
||||
dX = (dW - fm.width(qsText))/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dX = dW - fm.width(qsText);
|
||||
}
|
||||
// create text path and add it to the list
|
||||
QPainterPath path;
|
||||
path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText);
|
||||
d->m_liPP << mat.map(path);
|
||||
dY += d->m_tmDetail.GetSpacing();
|
||||
}
|
||||
}
|
||||
// and then add pattern texts
|
||||
if (d->patternInfo.count() > 0)
|
||||
{
|
||||
// similar approach like for the detail label
|
||||
QVector<QPointF> points = Map(Mirror(d->patternInfo));
|
||||
points.push_back(points.at(0));
|
||||
qreal dAng = qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x());
|
||||
qreal dW = GetDistance(points.at(0), points.at(1));
|
||||
qreal dH = GetDistance(points.at(1), points.at(2));
|
||||
qreal dY = 0;
|
||||
qreal dX;
|
||||
QMatrix mat;
|
||||
mat.translate(points.at(0).x(), points.at(0).y());
|
||||
mat.rotate(qRadiansToDegrees(dAng));
|
||||
|
||||
for (int i = 0; i < d->m_tmPattern.GetSourceLinesCount(); ++i)
|
||||
{
|
||||
const TextLine& tl = d->m_tmPattern.GetSourceLine(i);
|
||||
QFont fnt = d->m_tmPattern.GetFont();
|
||||
fnt.setPixelSize(d->m_tmPattern.GetFont().pixelSize() + tl.m_iFontSize);
|
||||
fnt.setWeight(tl.m_eFontWeight);
|
||||
fnt.setStyle(tl.m_eStyle);
|
||||
|
||||
QFontMetrics fm(fnt);
|
||||
|
||||
dY += fm.height();
|
||||
if (dY > dH)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
QString qsText = tl.m_qsText;
|
||||
if (fm.width(qsText) > dW)
|
||||
{
|
||||
qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast<int>(dW));
|
||||
}
|
||||
if ((tl.m_eAlign & Qt::AlignLeft) > 0)
|
||||
{
|
||||
dX = 0;
|
||||
}
|
||||
else if ((tl.m_eAlign & Qt::AlignHCenter) > 0)
|
||||
{
|
||||
dX = (dW - fm.width(qsText))/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dX = dW - fm.width(qsText);
|
||||
}
|
||||
QPainterPath path;
|
||||
path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText);
|
||||
d->m_liPP << mat.map(path);
|
||||
dY += d->m_tmPattern.GetSpacing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
||||
{
|
||||
|
@ -732,52 +790,16 @@ void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief CreateTextItem Creates the i-th text item
|
||||
* @param i index of the requested item
|
||||
* @param parent parent of this text item. Can't be null.
|
||||
*/
|
||||
void VLayoutPiece::CreateTextItem(int i, QGraphicsItem *parent) const
|
||||
void VLayoutPiece::CreateLabel(QGraphicsItem *parent, const QPainterPath &path) const
|
||||
{
|
||||
SCASSERT(parent != nullptr)
|
||||
|
||||
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
||||
QPainterPath path = d->matrix.map(d->m_liPP.at(i));
|
||||
|
||||
if (d->mirror == true)
|
||||
if (not path.isEmpty())
|
||||
{
|
||||
QVector<QPointF> points;
|
||||
if (i < d->m_tmDetail.GetSourceLinesCount())
|
||||
{
|
||||
points = Map(Mirror(d->detailLabel));
|
||||
}
|
||||
else
|
||||
{
|
||||
points = Map(Mirror(d->patternInfo));
|
||||
}
|
||||
QPointF ptCenter = (points.at(1) + points.at(3))/2;
|
||||
qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(),
|
||||
points.at(1).x() - points.at(0).x()));
|
||||
|
||||
// we need to move the center back to the origin, rotate it to align it with x axis,
|
||||
// then mirror it to obtain the proper text direction, rotate it and translate it back to original position.
|
||||
// The operations must be added in reverse order
|
||||
QTransform t;
|
||||
// move the label back to its original position
|
||||
t.translate(ptCenter.x(), ptCenter.y());
|
||||
// rotate the label back to original angle
|
||||
t.rotate(dRot);
|
||||
// mirror the label horizontally
|
||||
t.scale(-1, 1);
|
||||
// rotate the label to normal position
|
||||
t.rotate(-dRot);
|
||||
// move the label center into origin
|
||||
t.translate(-ptCenter.x(), -ptCenter.y());
|
||||
path = t.map(path);
|
||||
QGraphicsPathItem* item = new QGraphicsPathItem(parent);
|
||||
item->setPath(path);
|
||||
item->setBrush(QBrush(Qt::black));
|
||||
}
|
||||
|
||||
item->setPath(path);
|
||||
item->setBrush(QBrush(Qt::black));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -800,19 +822,15 @@ QPainterPath VLayoutPiece::LayoutAllowancePath() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGraphicsItem *VLayoutPiece::GetItem() const
|
||||
{
|
||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||
item->setPath(ContourPath());
|
||||
QGraphicsPathItem *item = GetMainItem();
|
||||
|
||||
for (int i = 0; i < d->m_internalPaths.count(); ++i)
|
||||
{
|
||||
CreateInternalPathItem(i, item);
|
||||
}
|
||||
|
||||
for (int i = 0; i < d->m_liPP.count(); ++i)
|
||||
{
|
||||
CreateTextItem(i, item);
|
||||
}
|
||||
|
||||
CreateLabel(item, CreateLabelText(d->detailLabel, d->m_tmDetail));
|
||||
CreateLabel(item, CreateLabelText(d->patternInfo, d->m_tmPattern));
|
||||
CreateGrainlineItem(item);
|
||||
|
||||
return item;
|
||||
|
@ -828,12 +846,13 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
|||
return;
|
||||
}
|
||||
VGraphicsFillItem* item = new VGraphicsFillItem(parent);
|
||||
|
||||
QPainterPath path;
|
||||
QVector<QPointF> v = Map(d->grainlinePoints);
|
||||
path.moveTo(v.at(0));
|
||||
for (int i = 1; i < v.count(); ++i)
|
||||
QVector<QPointF> gPoints = Map(d->grainlinePoints);
|
||||
path.moveTo(gPoints.at(0));
|
||||
for (int i = 1; i < gPoints.count(); ++i)
|
||||
{
|
||||
path.lineTo(v.at(i));
|
||||
path.lineTo(gPoints.at(i));
|
||||
}
|
||||
item->setPath(path);
|
||||
}
|
||||
|
@ -852,14 +871,11 @@ QVector<QPointF> VLayoutPiece::DetailPath() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VSAPoint> VLayoutPiece::PrepareAllowance(const QVector<QPointF> &points)
|
||||
QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
||||
{
|
||||
QVector<VSAPoint> allowancePoints;
|
||||
for(int i = 0; i < points.size(); ++i)
|
||||
{
|
||||
allowancePoints.append(VSAPoint(points.at(i)));
|
||||
}
|
||||
return allowancePoints;
|
||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||
item->setPath(ContourPath());
|
||||
return item;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -874,64 +890,6 @@ void VLayoutPiece::SetMirror(bool value)
|
|||
d->mirror = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VLayoutDetail::RotatePoint rotates a point around the center for given angle
|
||||
* @param ptCenter center around which the point is rotated
|
||||
* @param pt point, which is rotated around the center
|
||||
* @param dAng angle of rotation
|
||||
* @return position of point pt after rotating it around the center for dAng radians
|
||||
*/
|
||||
QPointF VLayoutPiece::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
||||
{
|
||||
QPointF ptDest;
|
||||
QPointF ptRel = pt - ptCenter;
|
||||
ptDest.setX(cos(dAng)*ptRel.x() - sin(dAng)*ptRel.y());
|
||||
ptDest.setY(sin(dAng)*ptRel.x() + cos(dAng)*ptRel.y());
|
||||
|
||||
return ptDest + ptCenter;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VLayoutDetail::Mirror if the detail layout is rotated, this method will flip the
|
||||
* label points over vertical axis, which goes through the center of the label
|
||||
* @param points list of 4 label vertices
|
||||
* @return list of flipped points
|
||||
*/
|
||||
QVector<QPointF> VLayoutPiece::Mirror(const QVector<QPointF> &points) const
|
||||
{
|
||||
// should only call this method with rectangular shapes
|
||||
Q_ASSERT(points.count() == 4);
|
||||
if (d->mirror == false)
|
||||
{
|
||||
return points;
|
||||
}
|
||||
|
||||
QVector<QPointF> v;
|
||||
v.resize(4);
|
||||
v[0] = points.at(2);
|
||||
v[1] = points.at(3);
|
||||
v[2] = points.at(0);
|
||||
v[3] = points.at(1);
|
||||
return v;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VLayoutDetail::GetDistance calculates the Euclidian distance between the points
|
||||
* @param pt1 first point
|
||||
* @param pt2 second point
|
||||
* @return Euclidian distance between the two points
|
||||
*/
|
||||
qreal VLayoutPiece::GetDistance(const QPointF &pt1, const QPointF &pt2)
|
||||
{
|
||||
const qreal dX = pt1.x() - pt2.x();
|
||||
const qreal dY = pt1.y() - pt2.y();
|
||||
|
||||
return qSqrt(dX*dX + dY*dY);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QLineF VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const
|
||||
{
|
||||
|
@ -989,3 +947,74 @@ int VLayoutPiece::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) c
|
|||
}
|
||||
return 0; // Did not find edge
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VLayoutPiece::CreateLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm) const
|
||||
{
|
||||
QPainterPath textpath;
|
||||
if (labelShape.count() > 2)
|
||||
{
|
||||
const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length();
|
||||
const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length();
|
||||
const qreal angle = QLineF(labelShape.at(0), labelShape.at(1)).angle();
|
||||
qreal dY = 0;
|
||||
qreal dX;
|
||||
|
||||
// set up the rotation around top-left corner matrix
|
||||
QTransform mat;
|
||||
mat.translate(labelShape.at(0).x(), labelShape.at(0).y());
|
||||
if (d->mirror)
|
||||
{
|
||||
mat.scale(-1, 1);
|
||||
mat.rotate(angle);
|
||||
mat.translate(-dW, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.rotate(angle);
|
||||
}
|
||||
|
||||
mat *= d->matrix;
|
||||
|
||||
for (int i = 0; i < tm.GetSourceLinesCount(); ++i)
|
||||
{
|
||||
const TextLine& tl = tm.GetSourceLine(i);
|
||||
QFont fnt = tm.GetFont();
|
||||
fnt.setPixelSize(tm.GetFont().pixelSize() + tl.m_iFontSize);
|
||||
fnt.setWeight(tl.m_eFontWeight);
|
||||
fnt.setStyle(tl.m_eStyle);
|
||||
|
||||
QFontMetrics fm(fnt);
|
||||
|
||||
dY += fm.height();
|
||||
if (dY > dH)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
QString qsText = tl.m_qsText;
|
||||
if (fm.width(qsText) > dW)
|
||||
{
|
||||
qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast<int>(dW));
|
||||
}
|
||||
if ((tl.m_eAlign & Qt::AlignLeft) > 0)
|
||||
{
|
||||
dX = 0;
|
||||
}
|
||||
else if ((tl.m_eAlign & Qt::AlignHCenter) > 0)
|
||||
{
|
||||
dX = (dW - fm.width(qsText))/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dX = dW - fm.width(qsText);
|
||||
}
|
||||
QPainterPath path;
|
||||
path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText);
|
||||
textpath.addPath(mat.map(path));
|
||||
dY += tm.GetSpacing();
|
||||
}
|
||||
}
|
||||
|
||||
return textpath;
|
||||
}
|
||||
|
|
|
@ -42,17 +42,20 @@
|
|||
#include <QtGlobal>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "vabstractpiece.h"
|
||||
|
||||
class VLayoutPieceData;
|
||||
class VLayoutPiecePath;
|
||||
class QGraphicsItem;
|
||||
class QGraphicsPathItem;
|
||||
class VTextManager;
|
||||
|
||||
class VLayoutPiece :public VAbstractPiece
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VLayoutPiece)
|
||||
public:
|
||||
VLayoutPiece();
|
||||
VLayoutPiece(const VLayoutPiece &detail);
|
||||
|
@ -73,12 +76,12 @@ public:
|
|||
QVector<VLayoutPiecePath> GetInternalPaths() const;
|
||||
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
|
||||
|
||||
void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
|
||||
void SetDetail(const QString &qsName, const VPieceLabelData& data, const QFont& font, const VContainer *pattern);
|
||||
|
||||
void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font,
|
||||
qreal dSize, qreal dHeight);
|
||||
void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font,
|
||||
qreal dSize, qreal dHeight, const VContainer *pattern);
|
||||
|
||||
void SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern);
|
||||
void SetGrainline(const VGrainlineData& geom, const VContainer *pattern);
|
||||
|
||||
QTransform GetMatrix() const;
|
||||
void SetMatrix(const QTransform &matrix);
|
||||
|
@ -114,24 +117,19 @@ public:
|
|||
QGraphicsItem *GetItem() const Q_REQUIRED_RESULT;
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VLayoutPieceData> d;
|
||||
QSharedDataPointer<VLayoutPieceData> d;
|
||||
|
||||
QVector<QPointF> DetailPath() const;
|
||||
|
||||
void ClearTextItems();
|
||||
void CreateTextItems();
|
||||
QGraphicsPathItem *GetMainItem() const Q_REQUIRED_RESULT;
|
||||
|
||||
QPainterPath CreateLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm) const;
|
||||
|
||||
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
|
||||
void CreateTextItem(int i, QGraphicsItem *parent) const;
|
||||
void CreateLabel(QGraphicsItem *parent, const QPainterPath &path) const;
|
||||
void CreateGrainlineItem(QGraphicsItem *parent) const;
|
||||
|
||||
static QVector<VSAPoint> PrepareAllowance(const QVector<QPointF> &points);
|
||||
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
||||
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
||||
|
||||
static QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng);
|
||||
QVector<QPointF> Mirror(const QVector<QPointF>& points) const;
|
||||
static qreal GetDistance(const QPointF& pt1, const QPointF& pt2);
|
||||
|
||||
QLineF Edge(const QVector<QPointF> &path, int i) const;
|
||||
int EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const;
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
#include <QVector>
|
||||
#include <QTransform>
|
||||
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "vlayoutpiecepath.h"
|
||||
|
||||
|
@ -59,12 +59,8 @@ public:
|
|||
detailLabel(),
|
||||
patternInfo(),
|
||||
grainlinePoints(),
|
||||
detailData(),
|
||||
patternGeom(),
|
||||
grainlineGeom(),
|
||||
m_tmDetail(),
|
||||
m_tmPattern(),
|
||||
m_liPP()
|
||||
m_tmPattern()
|
||||
{}
|
||||
|
||||
VLayoutPieceData(const VLayoutPieceData &detail)
|
||||
|
@ -79,12 +75,8 @@ public:
|
|||
detailLabel(detail.detailLabel),
|
||||
patternInfo(detail.patternInfo),
|
||||
grainlinePoints(detail.grainlinePoints),
|
||||
detailData(detail.detailData),
|
||||
patternGeom(detail.patternGeom),
|
||||
grainlineGeom(detail.grainlineGeom),
|
||||
m_tmDetail(detail.m_tmDetail),
|
||||
m_tmPattern(detail.m_tmPattern),
|
||||
m_liPP(detail.m_liPP)
|
||||
m_tmPattern(detail.m_tmPattern)
|
||||
{}
|
||||
|
||||
~VLayoutPieceData() {}
|
||||
|
@ -111,22 +103,18 @@ public:
|
|||
|
||||
/** @brief detailLabel detail label rectangle */
|
||||
QVector<QPointF> detailLabel;
|
||||
|
||||
/** @brief patternInfo pattern info rectangle */
|
||||
QVector<QPointF> patternInfo;
|
||||
|
||||
/** @brief grainlineInfo line */
|
||||
QVector<QPointF> grainlinePoints;
|
||||
/** @brief detailData detail data */
|
||||
VPatternPieceData detailData;
|
||||
/** @brief patternGeom pattern geometry */
|
||||
VPatternInfoGeometry patternGeom;
|
||||
/** @brief grainlineGeom grainline geometry */
|
||||
VGrainlineGeometry grainlineGeom;
|
||||
|
||||
/** @brief m_tmDetail text manager for laying out detail info */
|
||||
VTextManager m_tmDetail;
|
||||
|
||||
/** @brief m_tmPattern text manager for laying out pattern info */
|
||||
VTextManager m_tmPattern;
|
||||
/** @bried m_liPP list of generated text painter paths */
|
||||
QList<QPainterPath> m_liPP;
|
||||
|
||||
private:
|
||||
VLayoutPieceData &operator=(const VLayoutPieceData &) Q_DECL_EQ_DELETE;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
#include "vtextmanager.h"
|
||||
|
@ -238,7 +238,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
|
|||
* @param qsName detail name
|
||||
* @param data reference to the detail data
|
||||
*/
|
||||
void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
||||
void VTextManager::Update(const QString& qsName, const VPieceLabelData& data)
|
||||
{
|
||||
ClearSourceLines();
|
||||
TextLine tl;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <QtGlobal>
|
||||
#include <QCoreApplication>
|
||||
|
||||
class VPatternPieceData;
|
||||
class VPieceLabelData;
|
||||
class VAbstractPattern;
|
||||
|
||||
#define MIN_FONT_SIZE 5
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
int GetSourceLinesCount() const;
|
||||
const TextLine& GetSourceLine(int i) const;
|
||||
|
||||
void Update(const QString& qsName, const VPatternPieceData& data);
|
||||
void Update(const QString& qsName, const VPieceLabelData& data);
|
||||
void Update(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight);
|
||||
|
||||
private:
|
||||
|
|
|
@ -58,6 +58,11 @@ template <class T> class QSharedPointer;
|
|||
#define RECEIVER(obj)
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
#define CURRENT_DATA(box) box->itemData(box->currentIndex())
|
||||
#else
|
||||
#define CURRENT_DATA(box) box->currentData()
|
||||
#endif
|
||||
|
||||
class QComboBox;
|
||||
class QMarginsF;
|
||||
|
@ -146,6 +151,7 @@ enum class Tool : ToolVisHolderType
|
|||
Move,
|
||||
Midpoint,
|
||||
EllipticalArc,
|
||||
Pin,
|
||||
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
|
||||
};
|
||||
|
||||
|
@ -192,7 +198,9 @@ enum class Vis : ToolVisHolderType
|
|||
ToolMove,
|
||||
ToolEllipticalArc,
|
||||
ToolPiece,
|
||||
ToolPiecePath
|
||||
ToolPiecePath,
|
||||
ToolPin,
|
||||
PiecePins
|
||||
};
|
||||
|
||||
enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle,
|
||||
|
|
79
src/libs/vpatterndb/floatItemData/floatitemdef.h
Normal file
79
src/libs/vpatterndb/floatItemData/floatitemdef.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 FLOATITEMDEF_H
|
||||
#define FLOATITEMDEF_H
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
// denotes the type of arrow for the grainline
|
||||
enum class ArrowType : char
|
||||
{
|
||||
atBoth,
|
||||
atFront,
|
||||
atRear
|
||||
};
|
||||
|
||||
enum class MaterialType : char
|
||||
{
|
||||
mtFabric = 0,
|
||||
mtLining = 1,
|
||||
mtInterfacing = 2,
|
||||
mtInterlining = 3,
|
||||
mtUserDefined = 4
|
||||
};
|
||||
|
||||
enum class PlacementType : char
|
||||
{
|
||||
ptNone = 0,
|
||||
ptCutOnFold = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The MaterialCutPlacement struct used to hold a material, cut number and placement 3-tuple
|
||||
*/
|
||||
struct MaterialCutPlacement
|
||||
{
|
||||
MaterialType m_eMaterial;
|
||||
QString m_qsMaterialUserDef;
|
||||
int m_iCutNumber;
|
||||
PlacementType m_ePlacement;
|
||||
|
||||
MaterialCutPlacement()
|
||||
: m_eMaterial(MaterialType::mtFabric),
|
||||
m_qsMaterialUserDef(),
|
||||
m_iCutNumber(0),
|
||||
m_ePlacement(PlacementType::ptNone)
|
||||
{}
|
||||
};
|
||||
|
||||
typedef QList<MaterialCutPlacement> MCPContainer;
|
||||
|
||||
#endif // FLOATITEMDEF_H
|
||||
|
79
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp
Normal file
79
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 "vabstractfloatitemdata.h"
|
||||
#include "vabstractfloatitemdata_p.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractFloatItemData::VAbstractFloatItemData()
|
||||
: d(new VAbstractFloatItemDataPrivate())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractFloatItemData::VAbstractFloatItemData(const VAbstractFloatItemData &data)
|
||||
: d (data.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractFloatItemData &VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data)
|
||||
{
|
||||
if ( &data == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
d = data.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractFloatItemData::~VAbstractFloatItemData()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VAbstractFloatItemData::GetPos() const
|
||||
{
|
||||
return d->m_ptPos;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractFloatItemData::SetPos(const QPointF &ptPos)
|
||||
{
|
||||
d->m_ptPos = ptPos;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractFloatItemData::IsVisible() const
|
||||
{
|
||||
return d->m_bVisible;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractFloatItemData::SetVisible(bool bVisible)
|
||||
{
|
||||
d->m_bVisible = bVisible;
|
||||
}
|
56
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h
Normal file
56
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VABSTRACTFLOATITEMDATA_H
|
||||
#define VABSTRACTFLOATITEMDATA_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QSharedDataPointer>
|
||||
|
||||
class VAbstractFloatItemDataPrivate;
|
||||
|
||||
class VAbstractFloatItemData
|
||||
{
|
||||
public:
|
||||
VAbstractFloatItemData();
|
||||
VAbstractFloatItemData(const VAbstractFloatItemData &data);
|
||||
VAbstractFloatItemData &operator=(const VAbstractFloatItemData &data);
|
||||
virtual ~VAbstractFloatItemData();
|
||||
|
||||
// methods, which set and return values of different parameters
|
||||
QPointF GetPos() const;
|
||||
void SetPos(const QPointF& ptPos);
|
||||
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool bVisible);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VAbstractFloatItemDataPrivate> d;
|
||||
};
|
||||
|
||||
#endif // VABSTRACTFLOATITEMDATA_H
|
71
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h
Normal file
71
src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VABSTRACTFLOATITEMDATA_P_H
|
||||
#define VABSTRACTFLOATITEMDATA_P_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QSharedData>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
||||
class VAbstractFloatItemDataPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
VAbstractFloatItemDataPrivate()
|
||||
: m_ptPos(),
|
||||
m_bVisible(false)
|
||||
{}
|
||||
|
||||
VAbstractFloatItemDataPrivate(const VAbstractFloatItemDataPrivate &data)
|
||||
: QSharedData(data),
|
||||
m_ptPos(data.m_ptPos),
|
||||
m_bVisible(data.m_bVisible)
|
||||
{}
|
||||
|
||||
~VAbstractFloatItemDataPrivate();
|
||||
|
||||
/** @brief m_ptPos position of label's top left corner */
|
||||
QPointF m_ptPos;
|
||||
/** @brief m_bVisible visibility flag */
|
||||
bool m_bVisible;
|
||||
|
||||
private:
|
||||
VAbstractFloatItemDataPrivate &operator=(const VAbstractFloatItemDataPrivate &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
VAbstractFloatItemDataPrivate::~VAbstractFloatItemDataPrivate()
|
||||
{}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VABSTRACTFLOATITEMDATA_P_H
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatterninfogeometry.cpp
|
||||
** @file vgrainlinedata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
** @date September 06, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
|
@ -26,84 +26,95 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vpatterninfogeometry.h"
|
||||
#include <QPointF>
|
||||
|
||||
#include "vgrainlinedata.h"
|
||||
#include "vgrainlinedata_p.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternInfoGeometry::VPatternInfoGeometry()
|
||||
:m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0),
|
||||
m_dRotation(0), m_bVisible(true)
|
||||
VGrainlineData::VGrainlineData()
|
||||
: VAbstractFloatItemData(),
|
||||
d(new VGrainlineDataPrivate())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VPatternInfoGeometry::GetPos() const
|
||||
VGrainlineData::VGrainlineData(const VGrainlineData &data)
|
||||
: VAbstractFloatItemData(data),
|
||||
d (data.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VGrainlineData &VGrainlineData::operator=(const VGrainlineData &data)
|
||||
{
|
||||
return m_ptPos;
|
||||
if ( &data == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
VAbstractFloatItemData::operator=(data);
|
||||
d = data.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetPos(const QPointF& ptPos)
|
||||
VGrainlineData::~VGrainlineData()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VGrainlineData::GetLength() const
|
||||
{
|
||||
m_ptPos = ptPos;
|
||||
return d->m_qsLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternInfoGeometry::GetLabelWidth() const
|
||||
void VGrainlineData::SetLength(const QString& qsLen)
|
||||
{
|
||||
return m_dLabelWidth;
|
||||
d->m_qsLength = qsLen;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetLabelWidth(qreal dLabelW)
|
||||
QString VGrainlineData::GetRotation() const
|
||||
{
|
||||
m_dLabelWidth = dLabelW;
|
||||
return d->m_dRotation;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternInfoGeometry::GetLabelHeight() const
|
||||
void VGrainlineData::SetRotation(const QString& qsRot)
|
||||
{
|
||||
return m_dLabelHeight;
|
||||
d->m_dRotation = qsRot;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetLabelHeight(qreal dLabelH)
|
||||
ArrowType VGrainlineData::GetArrowType() const
|
||||
{
|
||||
m_dLabelHeight = dLabelH;
|
||||
return d->m_eArrowType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPatternInfoGeometry::GetFontSize() const
|
||||
void VGrainlineData::SetArrowType(ArrowType eAT)
|
||||
{
|
||||
return m_iFontSize;
|
||||
d->m_eArrowType = eAT;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetFontSize(int iSize)
|
||||
quint32 VGrainlineData::TopPin() const
|
||||
{
|
||||
m_iFontSize = iSize;
|
||||
return d->m_topPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternInfoGeometry::GetRotation() const
|
||||
void VGrainlineData::SetTopPin(quint32 topPin)
|
||||
{
|
||||
return m_dRotation;
|
||||
d->m_topPin = topPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetRotation(qreal dRot)
|
||||
quint32 VGrainlineData::BottomPin() const
|
||||
{
|
||||
m_dRotation = dRot;
|
||||
return d->m_bottomPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPatternInfoGeometry::IsVisible() const
|
||||
void VGrainlineData::SetBottomPin(quint32 bottomPin)
|
||||
{
|
||||
return m_bVisible;
|
||||
d->m_bottomPin = bottomPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternInfoGeometry::SetVisible(bool bVal)
|
||||
{
|
||||
m_bVisible = bVal;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
73
src/libs/vpatterndb/floatItemData/vgrainlinedata.h
Normal file
73
src/libs/vpatterndb/floatItemData/vgrainlinedata.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vgrainlinedata.h
|
||||
** @author Bojan Kverh
|
||||
** @date September 06, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VGRAINLINEGEOMETRY_H
|
||||
#define VGRAINLINEGEOMETRY_H
|
||||
|
||||
#include <QString>
|
||||
#include <QPointF>
|
||||
|
||||
#include "vabstractfloatitemdata.h"
|
||||
#include "floatitemdef.h"
|
||||
|
||||
class VGrainlineDataPrivate;
|
||||
|
||||
/**
|
||||
* @brief The VGrainlineData class holds information about a grainline like
|
||||
* position, size, rotation and visibility
|
||||
*/
|
||||
class VGrainlineData : public VAbstractFloatItemData
|
||||
{
|
||||
public:
|
||||
VGrainlineData();
|
||||
VGrainlineData(const VGrainlineData &data);
|
||||
VGrainlineData &operator=(const VGrainlineData &data);
|
||||
virtual ~VGrainlineData();
|
||||
|
||||
// methods, which set and return values of different parameters
|
||||
QString GetLength() const;
|
||||
void SetLength(const QString& qsLen);
|
||||
|
||||
QString GetRotation() const;
|
||||
void SetRotation(const QString& qsRot);
|
||||
|
||||
ArrowType GetArrowType() const;
|
||||
void SetArrowType(ArrowType eAT);
|
||||
|
||||
quint32 TopPin() const;
|
||||
void SetTopPin(quint32 topPin);
|
||||
|
||||
quint32 BottomPin() const;
|
||||
void SetBottomPin(quint32 bottomPin);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VGrainlineDataPrivate> d;
|
||||
};
|
||||
|
||||
#endif // VGRAINLINEGEOMETRY_H
|
||||
|
85
src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h
Normal file
85
src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VGRAINLINEDATA_P_H
|
||||
#define VGRAINLINEDATA_P_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QSharedData>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "floatitemdef.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
||||
class VGrainlineDataPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
VGrainlineDataPrivate()
|
||||
: m_qsLength(),
|
||||
m_dRotation(),
|
||||
m_eArrowType(ArrowType::atBoth),
|
||||
m_topPin(NULL_ID),
|
||||
m_bottomPin(NULL_ID)
|
||||
{}
|
||||
|
||||
VGrainlineDataPrivate(const VGrainlineDataPrivate &data)
|
||||
: QSharedData(data),
|
||||
m_qsLength(data.m_qsLength),
|
||||
m_dRotation(data.m_dRotation),
|
||||
m_eArrowType(data.m_eArrowType),
|
||||
m_topPin(data.m_topPin),
|
||||
m_bottomPin(data.m_bottomPin)
|
||||
{}
|
||||
|
||||
~VGrainlineDataPrivate();
|
||||
|
||||
/** @brief m_dLength formula to calculate the length of grainline */
|
||||
QString m_qsLength;
|
||||
/** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */
|
||||
QString m_dRotation;
|
||||
/** @brief m_eArrowType type of arrow on the grainline */
|
||||
ArrowType m_eArrowType;
|
||||
/** @brief m_topPin top pin id */
|
||||
quint32 m_topPin;
|
||||
/** @brief m_bottomPin bottom pin id */
|
||||
quint32 m_bottomPin;
|
||||
|
||||
private:
|
||||
VGrainlineDataPrivate &operator=(const VGrainlineDataPrivate &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
VGrainlineDataPrivate::~VGrainlineDataPrivate()
|
||||
{}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VGRAINLINEDATA_P_H
|
||||
|
131
src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp
Normal file
131
src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp
Normal file
|
@ -0,0 +1,131 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternlabeldata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 "vpatternlabeldata.h"
|
||||
#include "vpatternlabeldata_p.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternLabelData::VPatternLabelData()
|
||||
: VAbstractFloatItemData(),
|
||||
d(new VPatternLabelDataPrivate())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternLabelData::VPatternLabelData(const VPatternLabelData &data)
|
||||
: VAbstractFloatItemData(data),
|
||||
d (data.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternLabelData &VPatternLabelData::operator=(const VPatternLabelData &data)
|
||||
{
|
||||
if ( &data == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
VAbstractFloatItemData::operator=(data);
|
||||
d = data.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternLabelData::~VPatternLabelData()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternLabelData::GetLabelWidth() const
|
||||
{
|
||||
return d->m_dLabelWidth;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetLabelWidth(qreal dLabelW)
|
||||
{
|
||||
d->m_dLabelWidth = dLabelW;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternLabelData::GetLabelHeight() const
|
||||
{
|
||||
return d->m_dLabelHeight;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetLabelHeight(qreal dLabelH)
|
||||
{
|
||||
d->m_dLabelHeight = dLabelH;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPatternLabelData::GetFontSize() const
|
||||
{
|
||||
return d->m_iFontSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetFontSize(int iSize)
|
||||
{
|
||||
d->m_iFontSize = iSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternLabelData::GetRotation() const
|
||||
{
|
||||
return d->m_dRotation;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetRotation(qreal dRot)
|
||||
{
|
||||
d->m_dRotation = dRot;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VPatternLabelData::TopLeftPin() const
|
||||
{
|
||||
return d->m_topLeftPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetTopLeftPin(const quint32 &topLeftPin)
|
||||
{
|
||||
d->m_topLeftPin = topLeftPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VPatternLabelData::BottomRightPin() const
|
||||
{
|
||||
return d->m_bottomRightPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternLabelData::SetBottomRightPin(const quint32 &bottomRightPin)
|
||||
{
|
||||
d->m_bottomRightPin = bottomRightPin;
|
||||
}
|
72
src/libs/vpatterndb/floatItemData/vpatternlabeldata.h
Normal file
72
src/libs/vpatterndb/floatItemData/vpatternlabeldata.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternlabeldata.h
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VPATTERNINFOGEOMETRY_H
|
||||
#define VPATTERNINFOGEOMETRY_H
|
||||
|
||||
#include <QPointF>
|
||||
|
||||
#include "vabstractfloatitemdata.h"
|
||||
|
||||
class VPatternLabelDataPrivate;
|
||||
|
||||
/**
|
||||
* @brief The VPatternLabelData class holds the information about pattern info label geometry
|
||||
*/
|
||||
class VPatternLabelData : public VAbstractFloatItemData
|
||||
{
|
||||
public:
|
||||
VPatternLabelData();
|
||||
VPatternLabelData(const VPatternLabelData &data);
|
||||
VPatternLabelData &operator=(const VPatternLabelData &data);
|
||||
virtual ~VPatternLabelData();
|
||||
|
||||
// methods, which set up label parameters
|
||||
qreal GetLabelWidth() const;
|
||||
void SetLabelWidth(qreal dLabelW);
|
||||
|
||||
qreal GetLabelHeight() const;
|
||||
void SetLabelHeight(qreal dLabelH);
|
||||
|
||||
int GetFontSize() const;
|
||||
void SetFontSize(int iSize);
|
||||
|
||||
qreal GetRotation() const;
|
||||
void SetRotation(qreal dRot);
|
||||
|
||||
quint32 TopLeftPin() const;
|
||||
void SetTopLeftPin(const quint32 &topLeftPin);
|
||||
|
||||
quint32 BottomRightPin() const;
|
||||
void SetBottomRightPin(const quint32 &bottomRightPin);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VPatternLabelDataPrivate> d;
|
||||
};
|
||||
|
||||
#endif // VPATTERNINFOGEOMETRY_H
|
88
src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h
Normal file
88
src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VPATTERNLABELDATA_P_H
|
||||
#define VPATTERNLABELDATA_P_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QSharedData>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
||||
class VPatternLabelDataPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
VPatternLabelDataPrivate()
|
||||
: m_dLabelWidth(0),
|
||||
m_dLabelHeight(0),
|
||||
m_iFontSize(0),
|
||||
m_dRotation(0),
|
||||
m_topLeftPin(NULL_ID),
|
||||
m_bottomRightPin(NULL_ID)
|
||||
{}
|
||||
|
||||
VPatternLabelDataPrivate(const VPatternLabelDataPrivate &data)
|
||||
: QSharedData(data),
|
||||
m_dLabelWidth(data.m_dLabelWidth),
|
||||
m_dLabelHeight(data.m_dLabelHeight),
|
||||
m_iFontSize(data.m_iFontSize),
|
||||
m_dRotation(data.m_dRotation),
|
||||
m_topLeftPin(data.m_topLeftPin),
|
||||
m_bottomRightPin(data.m_bottomRightPin)
|
||||
{}
|
||||
|
||||
~VPatternLabelDataPrivate();
|
||||
|
||||
/** @brief m_dLabelWidth label width */
|
||||
qreal m_dLabelWidth;
|
||||
/** @brief m_dLabelHeight label height */
|
||||
qreal m_dLabelHeight;
|
||||
/** @brief m_iFontSize label text base font size */
|
||||
int m_iFontSize;
|
||||
/** @brief m_dRotation label rotation */
|
||||
qreal m_dRotation;
|
||||
/** @brief m_topLeftPin top left corner pin id */
|
||||
quint32 m_topLeftPin;
|
||||
/** @brief m_bottomRightPin bottom right corner pin id */
|
||||
quint32 m_bottomRightPin;
|
||||
|
||||
private:
|
||||
VPatternLabelDataPrivate &operator=(const VPatternLabelDataPrivate &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
VPatternLabelDataPrivate::~VPatternLabelDataPrivate()
|
||||
{}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VPATTERNLABELDATA_P_H
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vgrainlinegeometry.cpp
|
||||
** @file vpiecelabeldata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date September 06, 2016
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
|
@ -26,85 +26,98 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include <QPointF>
|
||||
#include "vpiecelabeldata.h"
|
||||
#include "vpiecelabeldata_p.h"
|
||||
|
||||
#include "vgrainlinegeometry.h"
|
||||
#include <QList>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
VGrainlineGeometry::VGrainlineGeometry()
|
||||
:m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth)
|
||||
VPieceLabelData::VPieceLabelData()
|
||||
: VPatternLabelData(),
|
||||
d(new VPieceLabelDataPrivate())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceLabelData::VPieceLabelData(const VPieceLabelData &data)
|
||||
: VPatternLabelData(data),
|
||||
d (data.d)
|
||||
{}
|
||||
|
||||
QPointF VGrainlineGeometry::GetPos() const
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceLabelData &VPieceLabelData::operator=(const VPieceLabelData &data)
|
||||
{
|
||||
return m_ptPos;
|
||||
if ( &data == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
VPatternLabelData::operator=(data);
|
||||
d = data.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceLabelData::~VPieceLabelData()
|
||||
{}
|
||||
|
||||
void VGrainlineGeometry::SetPos(const QPointF &ptPos)
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceLabelData::Append(const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
m_ptPos = ptPos;
|
||||
d->m_conMCP.append(rMCP);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
QString VGrainlineGeometry::GetLength() const
|
||||
void VPieceLabelData::Insert(int i, const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
return m_qsLength;
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i <= GetMCPCount());
|
||||
d->m_conMCP.insert(i, rMCP);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void VGrainlineGeometry::SetLength(const QString& qsLen)
|
||||
void VPieceLabelData::Set(int i, const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
m_qsLength = qsLen;
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
d->m_conMCP[i] = rMCP;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
QString VGrainlineGeometry::GetRotation() const
|
||||
int VPieceLabelData::GetMCPCount() const
|
||||
{
|
||||
return m_qsRotation;
|
||||
return d->m_conMCP.count();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void VGrainlineGeometry::SetRotation(const QString& qsRot)
|
||||
const MaterialCutPlacement& VPieceLabelData::GetMCP(int i) const
|
||||
{
|
||||
m_qsRotation = qsRot;
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
return d->m_conMCP.at(i);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
bool VGrainlineGeometry::IsVisible() const
|
||||
void VPieceLabelData::RemoveMCP(int i)
|
||||
{
|
||||
return m_bVisible;
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
d->m_conMCP.removeAt(i);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void VGrainlineGeometry::SetVisible(bool bVisible)
|
||||
void VPieceLabelData::Clear()
|
||||
{
|
||||
m_bVisible = bVisible;
|
||||
d->m_qsLetter.clear();
|
||||
d->m_conMCP.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
VGrainlineGeometry::ArrowType VGrainlineGeometry::GetArrowType() const
|
||||
const QString& VPieceLabelData::GetLetter() const
|
||||
{
|
||||
return m_eArrowType;
|
||||
return d->m_qsLetter;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void VGrainlineGeometry::SetArrowType(ArrowType eAT)
|
||||
void VPieceLabelData::SetLetter(QString qsLetter)
|
||||
{
|
||||
m_eArrowType = eAT;
|
||||
d->m_qsLetter = qsLetter.left(3);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
68
src/libs/vpatterndb/floatItemData/vpiecelabeldata.h
Normal file
68
src/libs/vpatterndb/floatItemData/vpiecelabeldata.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpiecelabeldata.h
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VPATTERNPIECEDATA_H
|
||||
#define VPATTERNPIECEDATA_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "vpatternlabeldata.h"
|
||||
#include "floatitemdef.h"
|
||||
|
||||
class VPieceLabelDataPrivate;
|
||||
|
||||
/**
|
||||
* @brief The VPieceLabelData class holds some information about a single
|
||||
* piece like letter, name, material type, cut number and placement.
|
||||
*/
|
||||
class VPieceLabelData : public VPatternLabelData
|
||||
{
|
||||
public:
|
||||
VPieceLabelData();
|
||||
VPieceLabelData(const VPieceLabelData &data);
|
||||
VPieceLabelData &operator=(const VPieceLabelData &data);
|
||||
virtual ~VPieceLabelData();
|
||||
|
||||
// methods, which operate on MaterialCutPlacement container
|
||||
void Append(const MaterialCutPlacement& rMCP);
|
||||
void Insert(int i, const MaterialCutPlacement& rMCP);
|
||||
void Set(int i, const MaterialCutPlacement& rMCP);
|
||||
int GetMCPCount() const;
|
||||
const MaterialCutPlacement& GetMCP(int i) const;
|
||||
void RemoveMCP(int i);
|
||||
void Clear();
|
||||
|
||||
// methods, which operate on other members
|
||||
const QString& GetLetter() const;
|
||||
void SetLetter(QString qsLetter);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VPieceLabelDataPrivate> d;
|
||||
};
|
||||
|
||||
#endif // VPATTERNPIECEDATA_H
|
72
src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h
Normal file
72
src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 23 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VPIECELABELDATA_P_H
|
||||
#define VPIECELABELDATA_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include <QString>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "floatitemdef.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
||||
class VPieceLabelDataPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
VPieceLabelDataPrivate()
|
||||
: m_qsLetter(),
|
||||
m_conMCP()
|
||||
{}
|
||||
|
||||
VPieceLabelDataPrivate(const VPieceLabelDataPrivate &data)
|
||||
: QSharedData(data),
|
||||
m_qsLetter(data.m_qsLetter),
|
||||
m_conMCP(data.m_conMCP)
|
||||
{}
|
||||
|
||||
~VPieceLabelDataPrivate();
|
||||
|
||||
/** @brief m_qsLetter Detail letter (should be no more than 3 characters) */
|
||||
QString m_qsLetter;
|
||||
/** @brief m_conMCP List of material, cut, placement tuples */
|
||||
MCPContainer m_conMCP;
|
||||
|
||||
private:
|
||||
VPieceLabelDataPrivate &operator=(const VPieceLabelDataPrivate &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
VPieceLabelDataPrivate::~VPieceLabelDataPrivate()
|
||||
{}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VPIECELABELDATA_P_H
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vgrainlinegeometry.h
|
||||
** @author Bojan Kverh
|
||||
** @date September 06, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VGRAINLINEGEOMETRY_H
|
||||
#define VGRAINLINEGEOMETRY_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
* @brief The VGrainlineGeometry class holds information about a grainline like
|
||||
* position, size, rotation and visibility
|
||||
*/
|
||||
class VGrainlineGeometry
|
||||
{
|
||||
public:
|
||||
// denotes the type of arrow for the grainline
|
||||
enum ArrowType
|
||||
{
|
||||
atBoth,
|
||||
atFront,
|
||||
atRear
|
||||
};
|
||||
|
||||
VGrainlineGeometry();
|
||||
|
||||
// methods, which set and return values of different parameters
|
||||
QPointF GetPos() const;
|
||||
void SetPos(const QPointF& ptPos);
|
||||
QString GetLength() const;
|
||||
void SetLength(const QString& qsLen);
|
||||
QString GetRotation() const;
|
||||
void SetRotation(const QString& qsRot);
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool bVisible);
|
||||
ArrowType GetArrowType() const;
|
||||
void SetArrowType(ArrowType eAT);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief m_ptPos position of grainline's center
|
||||
*/
|
||||
QPointF m_ptPos;
|
||||
/**
|
||||
* @brief m_dLength formula to calculate the length of grainline
|
||||
*/
|
||||
QString m_qsLength;
|
||||
/**
|
||||
* @brief m_dRotation formula to calculate the rotation of grainline in [degrees]
|
||||
*/
|
||||
QString m_qsRotation;
|
||||
/**
|
||||
* @brief m_bVisible visibility flag
|
||||
*/
|
||||
bool m_bVisible;
|
||||
/**
|
||||
* @brief m_eArrowType type of arrow on the grainline
|
||||
*/
|
||||
ArrowType m_eArrowType;
|
||||
};
|
||||
|
||||
#endif // VGRAINLINEGEOMETRY_H
|
||||
|
|
@ -17,13 +17,14 @@ SOURCES += \
|
|||
$$PWD/variables/vmeasurement.cpp \
|
||||
$$PWD/variables/vvariable.cpp \
|
||||
$$PWD/vformula.cpp \
|
||||
$$PWD/vpatternpiecedata.cpp \
|
||||
$$PWD/vpatterninfogeometry.cpp \
|
||||
$$PWD/vgrainlinegeometry.cpp \
|
||||
$$PWD/variables/vcurveclength.cpp \
|
||||
$$PWD/vpiece.cpp \
|
||||
$$PWD/vpiecenode.cpp \
|
||||
$$PWD/vpiecepath.cpp
|
||||
$$PWD/vpiecepath.cpp \
|
||||
$$PWD/floatItemData/vpiecelabeldata.cpp \
|
||||
$$PWD/floatItemData/vpatternlabeldata.cpp \
|
||||
$$PWD/floatItemData/vgrainlinedata.cpp \
|
||||
$$PWD/floatItemData/vabstractfloatitemdata.cpp
|
||||
|
||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
|
@ -54,13 +55,19 @@ HEADERS += \
|
|||
$$PWD/variables/vvariable.h \
|
||||
$$PWD/variables/vvariable_p.h \
|
||||
$$PWD/vformula.h \
|
||||
$$PWD/vpatternpiecedata.h \
|
||||
$$PWD/vpatterninfogeometry.h \
|
||||
$$PWD/vgrainlinegeometry.h \
|
||||
$$PWD/variables/vcurveclength.h \
|
||||
$$PWD/vpiece.h \
|
||||
$$PWD/vpiece_p.h \
|
||||
$$PWD/vpiecenode.h \
|
||||
$$PWD/vpiecenode_p.h \
|
||||
$$PWD/vpiecepath.h \
|
||||
$$PWD/vpiecepath_p.h
|
||||
$$PWD/vpiecepath_p.h \
|
||||
$$PWD/floatItemData/vpiecelabeldata.h \
|
||||
$$PWD/floatItemData/vpatternlabeldata.h \
|
||||
$$PWD/floatItemData/vgrainlinedata.h \
|
||||
$$PWD/floatItemData/vabstractfloatitemdata.h \
|
||||
$$PWD/floatItemData/vabstractfloatitemdata_p.h \
|
||||
$$PWD/floatItemData/vgrainlinedata_p.h \
|
||||
$$PWD/floatItemData/floatitemdef.h \
|
||||
$$PWD/floatItemData/vpatternlabeldata_p.h \
|
||||
$$PWD/floatItemData/vpiecelabeldata_p.h
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatterninfogeometry.h
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VPATTERNINFOGEOMETRY_H
|
||||
#define VPATTERNINFOGEOMETRY_H
|
||||
|
||||
#include <QPointF>
|
||||
#include <QtGlobal>
|
||||
|
||||
/**
|
||||
* @brief The VPatternInfoGeometry class holds the information about pattern info label geometry
|
||||
*/
|
||||
class VPatternInfoGeometry
|
||||
{
|
||||
public:
|
||||
VPatternInfoGeometry();
|
||||
|
||||
// methods, which set up label parameters
|
||||
QPointF GetPos() const;
|
||||
void SetPos(const QPointF& ptPos);
|
||||
qreal GetLabelWidth() const;
|
||||
void SetLabelWidth(qreal dLabelW);
|
||||
qreal GetLabelHeight() const;
|
||||
void SetLabelHeight(qreal dLabelH);
|
||||
int GetFontSize() const;
|
||||
void SetFontSize(int iSize);
|
||||
qreal GetRotation() const;
|
||||
void SetRotation(qreal dRot);
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool bVal);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief m_ptPos position of label's top left corner
|
||||
*/
|
||||
QPointF m_ptPos;
|
||||
/**
|
||||
* @brief m_dLabelWidth label width
|
||||
*/
|
||||
qreal m_dLabelWidth;
|
||||
/**
|
||||
* @brief m_dLabelHeight label height
|
||||
*/
|
||||
qreal m_dLabelHeight;
|
||||
/**
|
||||
* @brief m_iFontSize label text base font size
|
||||
*/
|
||||
int m_iFontSize;
|
||||
/**
|
||||
* @brief m_dRotation Label rotation
|
||||
*/
|
||||
qreal m_dRotation;
|
||||
/**
|
||||
* @brief m_bVisible visibility flag
|
||||
*/
|
||||
bool m_bVisible;
|
||||
|
||||
};
|
||||
|
||||
#endif // VPATTERNINFOGEOMETRY_H
|
|
@ -1,178 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternpiecedata.cpp
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 "vpatternpiecedata.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MaterialCutPlacement::MaterialCutPlacement()
|
||||
:m_eMaterial(MaterialType::mtFabric), m_qsMaterialUserDef(), m_iCutNumber(0), m_ePlacement(PlacementType::ptNone)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternPieceData::VPatternPieceData()
|
||||
:m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0),
|
||||
m_iFontSize(0), m_dRotation(0), m_bVisible(true)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::Append(const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
m_conMCP.append(rMCP);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i <= GetMCPCount());
|
||||
m_conMCP.insert(i, rMCP);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::Set(int i, const MaterialCutPlacement& rMCP)
|
||||
{
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
m_conMCP[i] = rMCP;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPatternPieceData::GetMCPCount() const
|
||||
{
|
||||
return m_conMCP.count();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const
|
||||
{
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
return m_conMCP.at(i);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::RemoveMCP(int i)
|
||||
{
|
||||
Q_ASSERT(i >= 0);
|
||||
Q_ASSERT(i < GetMCPCount());
|
||||
m_conMCP.removeAt(i);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::Clear()
|
||||
{
|
||||
m_qsLetter.clear();
|
||||
m_conMCP.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QString& VPatternPieceData::GetLetter() const
|
||||
{
|
||||
return m_qsLetter;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetLetter(QString qsLetter)
|
||||
{
|
||||
m_qsLetter = qsLetter.left(3);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VPatternPieceData::GetPos() const
|
||||
{
|
||||
return m_ptPos;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetPos(const QPointF& ptPos)
|
||||
{
|
||||
m_ptPos = ptPos;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternPieceData::GetLabelWidth() const
|
||||
{
|
||||
return m_dLabelWidth;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetLabelWidth(qreal dLabelW)
|
||||
{
|
||||
m_dLabelWidth = dLabelW;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternPieceData::GetLabelHeight() const
|
||||
{
|
||||
return m_dLabelHeight;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetLabelHeight(qreal dLabelH)
|
||||
{
|
||||
m_dLabelHeight = dLabelH;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VPatternPieceData::GetFontSize() const
|
||||
{
|
||||
return m_iFontSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetFontSize(int iSize)
|
||||
{
|
||||
m_iFontSize = iSize;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPatternPieceData::GetRotation() const
|
||||
{
|
||||
return m_dRotation;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetRotation(qreal dRot)
|
||||
{
|
||||
m_dRotation = dRot;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPatternPieceData::IsVisible() const
|
||||
{
|
||||
return m_bVisible;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternPieceData::SetVisible(bool bVal)
|
||||
{
|
||||
m_bVisible = bVal;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpatternpiecedata.h
|
||||
** @author Bojan Kverh
|
||||
** @date June 16, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 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 VPATTERNPIECEDATA_H
|
||||
#define VPATTERNPIECEDATA_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPointF>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
|
||||
enum class MaterialType : char
|
||||
{
|
||||
mtFabric = 0,
|
||||
mtLining = 1,
|
||||
mtInterfacing = 2,
|
||||
mtInterlining = 3,
|
||||
mtUserDefined = 4
|
||||
};
|
||||
|
||||
enum class PlacementType : char
|
||||
{
|
||||
ptNone = 0,
|
||||
ptCutOnFold = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The MaterialCutPlacement struct used to hold a material, cut number and placement 3-tuple
|
||||
*/
|
||||
struct MaterialCutPlacement
|
||||
{
|
||||
MaterialType m_eMaterial;
|
||||
QString m_qsMaterialUserDef;
|
||||
int m_iCutNumber;
|
||||
PlacementType m_ePlacement;
|
||||
|
||||
MaterialCutPlacement();
|
||||
};
|
||||
|
||||
typedef QList<MaterialCutPlacement> MCPContainer;
|
||||
|
||||
/**
|
||||
* @brief The VPatternPieceData class holds some information about a single
|
||||
* piece like letter, name, material type, cut number and placement.
|
||||
*/
|
||||
class VPatternPieceData
|
||||
{
|
||||
public:
|
||||
VPatternPieceData();
|
||||
|
||||
// methods, which operate on MaterialCutPlacement container
|
||||
void Append(const MaterialCutPlacement& rMCP);
|
||||
void Insert(int i, const MaterialCutPlacement& rMCP);
|
||||
void Set(int i, const MaterialCutPlacement& rMCP);
|
||||
int GetMCPCount() const;
|
||||
const MaterialCutPlacement& GetMCP(int i) const;
|
||||
void RemoveMCP(int i);
|
||||
void Clear();
|
||||
|
||||
// methods, which operate on other members
|
||||
const QString& GetLetter() const;
|
||||
void SetLetter(QString qsLetter);
|
||||
|
||||
// methods, which set up label parameters
|
||||
QPointF GetPos() const;
|
||||
void SetPos(const QPointF& ptPos);
|
||||
qreal GetLabelWidth() const;
|
||||
void SetLabelWidth(qreal dLabelW);
|
||||
qreal GetLabelHeight() const;
|
||||
void SetLabelHeight(qreal dLabelH);
|
||||
int GetFontSize() const;
|
||||
void SetFontSize(int iSize);
|
||||
qreal GetRotation() const;
|
||||
void SetRotation(qreal dRot);
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool bVal);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief m_qsLetter Detail letter (should be no more than 3 characters)
|
||||
*/
|
||||
QString m_qsLetter;
|
||||
/**
|
||||
* @brief m_conMCP List of material, cut, placement tuples
|
||||
*/
|
||||
MCPContainer m_conMCP;
|
||||
/**
|
||||
* @brief m_ptPos position of label's top left corner
|
||||
*/
|
||||
QPointF m_ptPos;
|
||||
/**
|
||||
* @brief m_dLabelWidth label width
|
||||
*/
|
||||
qreal m_dLabelWidth;
|
||||
/**
|
||||
* @brief m_dLabelHeight label height
|
||||
*/
|
||||
qreal m_dLabelHeight;
|
||||
/**
|
||||
* @brief m_iFontSize label font size
|
||||
*/
|
||||
int m_iFontSize;
|
||||
/**
|
||||
* @brief m_dRotation label rotation
|
||||
*/
|
||||
qreal m_dRotation;
|
||||
/**
|
||||
* @brief m_bVisible visibility flag
|
||||
*/
|
||||
bool m_bVisible;
|
||||
|
||||
};
|
||||
|
||||
#endif // VPATTERNPIECEDATA_H
|
|
@ -36,6 +36,38 @@
|
|||
#include <QDebug>
|
||||
#include <QPainterPath>
|
||||
|
||||
namespace
|
||||
{
|
||||
QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVector<quint32> &d2Nodes)
|
||||
{
|
||||
if (d1Nodes.size() == d2Nodes.size()) //-V807
|
||||
{
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
QSet<quint32> set1;
|
||||
for (qint32 i = 0; i < d1Nodes.size(); ++i)
|
||||
{
|
||||
set1.insert(d1Nodes.at(i));
|
||||
}
|
||||
|
||||
QSet<quint32> set2;
|
||||
for (qint32 j = 0; j < d2Nodes.size(); ++j)
|
||||
{
|
||||
set2.insert(d2Nodes.at(j));
|
||||
}
|
||||
|
||||
const QList<quint32> set3 = set1.subtract(set2).toList();
|
||||
QVector<quint32> r;
|
||||
for (qint32 i = 0; i < set3.size(); ++i)
|
||||
{
|
||||
r.append(set3.at(i));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPiece::VPiece()
|
||||
: VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath))
|
||||
|
@ -290,6 +322,12 @@ QVector<quint32> VPiece::GetInternalPaths() const
|
|||
return d->m_internalPaths;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> &VPiece::GetInternalPaths()
|
||||
{
|
||||
return d->m_internalPaths;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetInternalPaths(const QVector<quint32> &iPaths)
|
||||
{
|
||||
|
@ -297,13 +335,13 @@ void VPiece::SetInternalPaths(const QVector<quint32> &iPaths)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::AppendInternalPath(quint32 path)
|
||||
QVector<CustomSARecord> VPiece::GetCustomSARecords() const
|
||||
{
|
||||
d->m_internalPaths.append(path);
|
||||
return d->m_customSARecords;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<CustomSARecord> VPiece::GetCustomSARecords() const
|
||||
QVector<CustomSARecord> &VPiece::GetCustomSARecords()
|
||||
{
|
||||
return d->m_customSARecords;
|
||||
}
|
||||
|
@ -315,9 +353,21 @@ void VPiece::SetCustomSARecords(const QVector<CustomSARecord> &records)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::AppendCustomSARecord(const CustomSARecord &record)
|
||||
QVector<quint32> VPiece::GetPins() const
|
||||
{
|
||||
d->m_customSARecords.append(record);
|
||||
return d->m_pins;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> &VPiece::GetPins()
|
||||
{
|
||||
return d->m_pins;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetPins(const QVector<quint32> &pins)
|
||||
{
|
||||
d->m_pins = pins;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -335,67 +385,35 @@ QVector<quint32> VPiece::MissingNodes(const VPiece &det) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> VPiece::MissingCSAPath(const VPiece &det) const
|
||||
{
|
||||
const QVector<CustomSARecord> detRecords = det.GetCustomSARecords();
|
||||
if (d->m_customSARecords.size() == detRecords.size()) //-V807
|
||||
{
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
QSet<quint32> set1;
|
||||
QVector<quint32> oldCSARecords;
|
||||
for (qint32 i = 0; i < d->m_customSARecords.size(); ++i)
|
||||
{
|
||||
set1.insert(d->m_customSARecords.at(i).path);
|
||||
oldCSARecords.append(d->m_customSARecords.at(i).path);
|
||||
}
|
||||
|
||||
QSet<quint32> set2;
|
||||
for (qint32 j = 0; j < detRecords.size(); ++j)
|
||||
QVector<quint32> newCSARecords;
|
||||
for (qint32 i = 0; i < det.GetCustomSARecords().size(); ++i)
|
||||
{
|
||||
set2.insert(detRecords.at(j).path);
|
||||
newCSARecords.append(det.GetCustomSARecords().at(i).path);
|
||||
}
|
||||
|
||||
const QList<quint32> set3 = set1.subtract(set2).toList();
|
||||
QVector<quint32> r;
|
||||
for (qint32 i = 0; i < set3.size(); ++i)
|
||||
{
|
||||
r.append(set3.at(i));
|
||||
}
|
||||
|
||||
return r;
|
||||
return PieceMissingNodes(oldCSARecords, newCSARecords);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> VPiece::MissingInternalPaths(const VPiece &det) const
|
||||
{
|
||||
const QVector<quint32> detRecords = det.GetInternalPaths();
|
||||
if (d->m_internalPaths.size() == detRecords.size()) //-V807
|
||||
{
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
QSet<quint32> set1;
|
||||
for (qint32 i = 0; i < d->m_internalPaths.size(); ++i)
|
||||
{
|
||||
set1.insert(d->m_internalPaths.at(i));
|
||||
}
|
||||
|
||||
QSet<quint32> set2;
|
||||
for (qint32 j = 0; j < detRecords.size(); ++j)
|
||||
{
|
||||
set2.insert(detRecords.at(j));
|
||||
}
|
||||
|
||||
const QList<quint32> set3 = set1.subtract(set2).toList();
|
||||
QVector<quint32> r;
|
||||
for (qint32 i = 0; i < set3.size(); ++i)
|
||||
{
|
||||
r.append(set3.at(i));
|
||||
}
|
||||
|
||||
return r;
|
||||
return PieceMissingNodes(d->m_internalPaths, det.GetInternalPaths());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetPatternPieceData(const VPatternPieceData &data)
|
||||
QVector<quint32> VPiece::MissingPins(const VPiece &det) const
|
||||
{
|
||||
return PieceMissingNodes(d->m_pins, det.GetPins());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetPatternPieceData(const VPieceLabelData &data)
|
||||
{
|
||||
d->m_ppData = data;
|
||||
}
|
||||
|
@ -405,7 +423,7 @@ void VPiece::SetPatternPieceData(const VPatternPieceData &data)
|
|||
* @brief Returns full access to the pattern piece data object
|
||||
* @return pattern piece data object
|
||||
*/
|
||||
VPatternPieceData &VPiece::GetPatternPieceData()
|
||||
VPieceLabelData &VPiece::GetPatternPieceData()
|
||||
{
|
||||
return d->m_ppData;
|
||||
}
|
||||
|
@ -415,13 +433,13 @@ VPatternPieceData &VPiece::GetPatternPieceData()
|
|||
* @brief Returns the read only reference to the pattern piece data object
|
||||
* @return pattern piece data object
|
||||
*/
|
||||
const VPatternPieceData &VPiece::GetPatternPieceData() const
|
||||
const VPieceLabelData &VPiece::GetPatternPieceData() const
|
||||
{
|
||||
return d->m_ppData;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetPatternInfo(const VPatternInfoGeometry &info)
|
||||
void VPiece::SetPatternInfo(const VPatternLabelData &info)
|
||||
{
|
||||
d->m_piPatternInfo = info;
|
||||
}
|
||||
|
@ -431,7 +449,7 @@ void VPiece::SetPatternInfo(const VPatternInfoGeometry &info)
|
|||
* @brief Returns full access to the pattern info geometry object
|
||||
* @return pattern info geometry object
|
||||
*/
|
||||
VPatternInfoGeometry &VPiece::GetPatternInfo()
|
||||
VPatternLabelData &VPiece::GetPatternInfo()
|
||||
{
|
||||
return d->m_piPatternInfo;
|
||||
}
|
||||
|
@ -441,7 +459,7 @@ VPatternInfoGeometry &VPiece::GetPatternInfo()
|
|||
* @brief Returns the read only reference to the pattern info geometry object
|
||||
* @return pattern info geometry object
|
||||
*/
|
||||
const VPatternInfoGeometry &VPiece::GetPatternInfo() const
|
||||
const VPatternLabelData &VPiece::GetPatternInfo() const
|
||||
{
|
||||
return d->m_piPatternInfo;
|
||||
}
|
||||
|
@ -451,7 +469,7 @@ const VPatternInfoGeometry &VPiece::GetPatternInfo() const
|
|||
* @brief VDetail::GetGrainlineGeometry full access to the grainline geometry object
|
||||
* @return reference to grainline geometry object
|
||||
*/
|
||||
VGrainlineGeometry &VPiece::GetGrainlineGeometry()
|
||||
VGrainlineData &VPiece::GetGrainlineGeometry()
|
||||
{
|
||||
return d->m_glGrainline;
|
||||
}
|
||||
|
@ -461,7 +479,7 @@ VGrainlineGeometry &VPiece::GetGrainlineGeometry()
|
|||
* @brief VDetail::GetGrainlineGeometry returns the read-only reference to the grainline geometry object
|
||||
* @return reference to grainline geometry object
|
||||
*/
|
||||
const VGrainlineGeometry &VPiece::GetGrainlineGeometry() const
|
||||
const VGrainlineData &VPiece::GetGrainlineGeometry() const
|
||||
{
|
||||
return d->m_glGrainline;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ class VPieceNode;
|
|||
template <class T> class QVector;
|
||||
template <class T>class QSharedPointer;
|
||||
class VPiecePath;
|
||||
class VPatternInfoGeometry;
|
||||
class VPatternPieceData;
|
||||
class VGrainlineGeometry;
|
||||
class VPatternLabelData;
|
||||
class VPieceLabelData;
|
||||
class VGrainlineData;
|
||||
class VContainer;
|
||||
class QPainterPath;
|
||||
class VPointF;
|
||||
|
@ -81,27 +81,32 @@ public:
|
|||
void SetFormulaSAWidth(const QString &formula, qreal value);
|
||||
|
||||
QVector<quint32> GetInternalPaths() const;
|
||||
QVector<quint32> &GetInternalPaths();
|
||||
void SetInternalPaths(const QVector<quint32> &iPaths);
|
||||
void AppendInternalPath(quint32 path);
|
||||
|
||||
QVector<CustomSARecord> GetCustomSARecords() const;
|
||||
QVector<CustomSARecord> &GetCustomSARecords();
|
||||
void SetCustomSARecords(const QVector<CustomSARecord> &records);
|
||||
void AppendCustomSARecord(const CustomSARecord &record);
|
||||
|
||||
QVector<quint32> GetPins() const;
|
||||
QVector<quint32> &GetPins();
|
||||
void SetPins(const QVector<quint32> &pins);
|
||||
|
||||
QVector<quint32> MissingNodes(const VPiece &det) const;
|
||||
QVector<quint32> MissingCSAPath(const VPiece &det) const;
|
||||
QVector<quint32> MissingInternalPaths(const VPiece &det) const;
|
||||
QVector<quint32> MissingPins(const VPiece &det) const;
|
||||
|
||||
void SetPatternPieceData(const VPatternPieceData &data);
|
||||
VPatternPieceData& GetPatternPieceData();
|
||||
const VPatternPieceData& GetPatternPieceData() const;
|
||||
void SetPatternPieceData(const VPieceLabelData &data);
|
||||
VPieceLabelData& GetPatternPieceData();
|
||||
const VPieceLabelData& GetPatternPieceData() const;
|
||||
|
||||
void SetPatternInfo(const VPatternInfoGeometry &info);
|
||||
VPatternInfoGeometry& GetPatternInfo();
|
||||
const VPatternInfoGeometry& GetPatternInfo() const;
|
||||
void SetPatternInfo(const VPatternLabelData &info);
|
||||
VPatternLabelData& GetPatternInfo();
|
||||
const VPatternLabelData& GetPatternInfo() const;
|
||||
|
||||
VGrainlineGeometry& GetGrainlineGeometry();
|
||||
const VGrainlineGeometry& GetGrainlineGeometry() const;
|
||||
VGrainlineData& GetGrainlineGeometry();
|
||||
const VGrainlineData& GetGrainlineGeometry() const;
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VPieceData> d;
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "vpiecenode.h"
|
||||
#include "vpiecepath.h"
|
||||
#include "vpatternpiecedata.h"
|
||||
#include "vpatterninfogeometry.h"
|
||||
#include "vgrainlinegeometry.h"
|
||||
#include "floatItemData/vpiecelabeldata.h"
|
||||
#include "floatItemData/vpatternlabeldata.h"
|
||||
#include "floatItemData/vgrainlinedata.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
@ -54,6 +54,7 @@ public:
|
|||
m_united(false),
|
||||
m_customSARecords(),
|
||||
m_internalPaths(),
|
||||
m_pins(),
|
||||
m_ppData(),
|
||||
m_piPatternInfo(),
|
||||
m_glGrainline(),
|
||||
|
@ -69,6 +70,7 @@ public:
|
|||
m_united(detail.m_united),
|
||||
m_customSARecords(detail.m_customSARecords),
|
||||
m_internalPaths(detail.m_internalPaths),
|
||||
m_pins(detail.m_pins),
|
||||
m_ppData(detail.m_ppData),
|
||||
m_piPatternInfo(detail.m_piPatternInfo),
|
||||
m_glGrainline(detail.m_glGrainline),
|
||||
|
@ -88,15 +90,16 @@ public:
|
|||
|
||||
QVector<CustomSARecord> m_customSARecords;
|
||||
QVector<quint32> m_internalPaths;
|
||||
QVector<quint32> m_pins;
|
||||
|
||||
/** @brief Pattern piece data */
|
||||
VPatternPieceData m_ppData;
|
||||
VPieceLabelData m_ppData;
|
||||
|
||||
/** @brief Pattern info coordinates */
|
||||
VPatternInfoGeometry m_piPatternInfo;
|
||||
VPatternLabelData m_piPatternInfo;
|
||||
|
||||
/** @brief m_glGrainline grainline geometry object*/
|
||||
VGrainlineGeometry m_glGrainline;
|
||||
VGrainlineData m_glGrainline;
|
||||
|
||||
QString m_formulaWidth;
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ HEADERS += \
|
|||
$$PWD/tools/dialogmove.h \
|
||||
$$PWD/tools/dialogellipticalarc.h \
|
||||
$$PWD/tools/dialogseamallowance.h \
|
||||
$$PWD/tools/dialogpiecepath.h
|
||||
$$PWD/tools/dialogpiecepath.h \
|
||||
$$PWD/tools/dialogpin.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/tools/dialogalongline.cpp \
|
||||
|
@ -86,7 +87,8 @@ SOURCES += \
|
|||
$$PWD/tools/dialogmove.cpp \
|
||||
$$PWD/tools/dialogellipticalarc.cpp \
|
||||
$$PWD/tools/dialogseamallowance.cpp \
|
||||
$$PWD/tools/dialogpiecepath.cpp
|
||||
$$PWD/tools/dialogpiecepath.cpp \
|
||||
$$PWD/tools/dialogpin.cpp
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tools/dialogalongline.ui \
|
||||
|
@ -128,4 +130,5 @@ FORMS += \
|
|||
$$PWD/tools/dialogmove.ui \
|
||||
$$PWD/tools/dialogellipticalarc.ui \
|
||||
$$PWD/tools/dialogseamallowance.ui \
|
||||
$$PWD/tools/dialogpiecepath.ui
|
||||
$$PWD/tools/dialogpiecepath.ui \
|
||||
$$PWD/tools/dialogpin.ui
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "tools/dialogmove.h"
|
||||
#include "tools/dialogellipticalarc.h"
|
||||
#include "tools/dialogpiecepath.h"
|
||||
#include "tools/dialogpin.h"
|
||||
|
||||
#include "support/dialogeditwrongformula.h"
|
||||
#include "support/dialogundo.h"
|
||||
|
|
|
@ -216,11 +216,7 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
*/
|
||||
quint32 DialogLine::GetFirstPoint() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return qvariant_cast<quint32>(ui->comboBoxFirstPoint->itemData(ui->comboBoxFirstPoint->currentIndex()));
|
||||
#else
|
||||
return qvariant_cast<quint32>(ui->comboBoxFirstPoint->currentData());
|
||||
#endif
|
||||
return qvariant_cast<quint32>(CURRENT_DATA(ui->comboBoxFirstPoint));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -230,11 +226,7 @@ quint32 DialogLine::GetFirstPoint() const
|
|||
*/
|
||||
quint32 DialogLine::GetSecondPoint() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
return qvariant_cast<quint32>(ui->comboBoxSecondPoint->itemData(ui->comboBoxSecondPoint->currentIndex()));
|
||||
#else
|
||||
return qvariant_cast<quint32>(ui->comboBoxSecondPoint->currentData());
|
||||
#endif
|
||||
return qvariant_cast<quint32>(CURRENT_DATA(ui->comboBoxSecondPoint));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -298,13 +298,8 @@ void DialogPiecePath::NodeChanged(int index)
|
|||
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
const VPiecePath path = CreatePath();
|
||||
const int nodeIndex = path.indexOfNode(id);
|
||||
const int nodeIndex = path.indexOfNode(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (nodeIndex != -1)
|
||||
{
|
||||
const VPieceNode &node = path.at(nodeIndex);
|
||||
|
@ -598,11 +593,7 @@ void DialogPiecePath::InitPathTypes()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::InitNodesList()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(ui->comboBoxNodes->currentIndex()).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
const quint32 id = CURRENT_DATA(ui->comboBoxNodes).toUInt();
|
||||
|
||||
ui->comboBoxNodes->blockSignals(true);
|
||||
ui->comboBoxNodes->clear();
|
||||
|
@ -639,21 +630,10 @@ void DialogPiecePath::NodeAngleChanged(int index)
|
|||
const int i = ui->comboBoxNodes->currentIndex();
|
||||
if (i != -1 && index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(i).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->itemData(index).toUInt());
|
||||
#else
|
||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
|
||||
#endif
|
||||
|
||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(CURRENT_DATA(ui->comboBoxAngle).toUInt());
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetAngleType(angle);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
@ -694,14 +674,7 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PiecePathType DialogPiecePath::GetType() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const PiecePathType type =
|
||||
static_cast<PiecePathType>(ui->comboBoxType->itemData(ui->comboBoxType->currentIndex()).toInt());
|
||||
#else
|
||||
const PiecePathType type = static_cast<PiecePathType>(ui->comboBoxType->currentData().toInt());
|
||||
#endif
|
||||
|
||||
return type;
|
||||
return static_cast<PiecePathType>(CURRENT_DATA(ui->comboBoxType).toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -781,13 +754,7 @@ void DialogPiecePath::UpdateNodeSABefore(const QString &formula)
|
|||
const int index = ui->comboBoxNodes->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
@ -803,13 +770,7 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
|
|||
const int index = ui->comboBoxNodes->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
|
204
src/libs/vtools/dialogs/tools/dialogpin.cpp
Normal file
204
src/libs/vtools/dialogs/tools/dialogpin.cpp
Normal file
|
@ -0,0 +1,204 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpin.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 "dialogpin.h"
|
||||
#include "ui_dialogpin.h"
|
||||
#include "visualization/line/vistoolpin.h"
|
||||
#include "../../tools/vabstracttool.h"
|
||||
#include "../../tools/vtoolseamallowance.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogPin),
|
||||
m_showMode(false),
|
||||
m_flagPoint(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancel(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
|
||||
flagError = false;
|
||||
CheckState();
|
||||
|
||||
vis = new VisToolPin(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPin::~DialogPin()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::EnbleShowMode(bool disable)
|
||||
{
|
||||
m_showMode = disable;
|
||||
ui->comboBoxPiece->setDisabled(m_showMode);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPin::GetPieceId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxPiece);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::SetPieceId(quint32 id)
|
||||
{
|
||||
if (ui->comboBoxPiece->count() <= 0)
|
||||
{
|
||||
const VPiece piece = data->GetPiece(id);
|
||||
ui->comboBoxPiece->addItem(piece.GetName(), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
const qint32 index = ui->comboBoxPiece->findData(id);
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxPiece->setCurrentIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->comboBoxPiece->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
CheckPieces();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPin::GetPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::SetPointId(quint32 id)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxPoint, id);
|
||||
|
||||
VisToolPin *point = qobject_cast<VisToolPin *>(vis);
|
||||
SCASSERT(point != nullptr)
|
||||
point->setObject1Id(id);
|
||||
|
||||
CheckPoint();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::SetPiecesList(const QVector<quint32> &list)
|
||||
{
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
const VPiece piece = data->GetPiece(list.at(i));
|
||||
ui->comboBoxPiece->addItem(piece.GetName(), list.at(i));
|
||||
}
|
||||
|
||||
CheckPieces();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::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 DialogPin::CheckState()
|
||||
{
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(m_flagPoint && flagError);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::ShowVisualization()
|
||||
{
|
||||
AddVisualization<VisToolPin>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::CheckPieces()
|
||||
{
|
||||
if (not m_showMode)
|
||||
{
|
||||
QColor color = okColor;
|
||||
if (ui->comboBoxPiece->count() <= 0)
|
||||
{
|
||||
flagError = false;
|
||||
color = errorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagError = true;
|
||||
color = okColor;
|
||||
}
|
||||
ChangeColor(ui->labelPiece, color);
|
||||
CheckState();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPin::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();
|
||||
}
|
73
src/libs/vtools/dialogs/tools/dialogpin.h
Normal file
73
src/libs/vtools/dialogs/tools/dialogpin.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpin.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 DIALOGPIN_H
|
||||
#define DIALOGPIN_H
|
||||
|
||||
#include "dialogtool.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPin;
|
||||
}
|
||||
|
||||
class DialogPin : public DialogTool
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DialogPin(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogPin();
|
||||
|
||||
void EnbleShowMode(bool disable);
|
||||
|
||||
quint32 GetPieceId() const;
|
||||
void SetPieceId(quint32 id);
|
||||
|
||||
quint32 GetPointId() const;
|
||||
void SetPointId(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_OVERRIDE;
|
||||
virtual void ShowVisualization() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPin)
|
||||
Ui::DialogPin *ui;
|
||||
bool m_showMode;
|
||||
bool m_flagPoint;
|
||||
|
||||
void CheckPieces();
|
||||
void CheckPoint();
|
||||
};
|
||||
|
||||
#endif // DIALOGPIN_H
|
91
src/libs/vtools/dialogs/tools/dialogpin.ui
Normal file
91
src/libs/vtools/dialogs/tools/dialogpin.ui
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogPin</class>
|
||||
<widget class="QDialog" name="DialogPin">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>194</width>
|
||||
<height>114</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Pin tool</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<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>
|
||||
</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/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogPin</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>DialogPin</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>
|
|
@ -32,6 +32,7 @@
|
|||
#include "../vpatterndb/vpiecepath.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "visualization/path/vistoolpiece.h"
|
||||
#include "visualization/path/vispiecepins.h"
|
||||
#include "dialogpiecepath.h"
|
||||
#include "../../undocommands/savepiecepathoptions.h"
|
||||
#include "../support/dialogeditwrongformula.h"
|
||||
|
@ -69,10 +70,15 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
|||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogSeamAllowance),
|
||||
applyAllowed(false),// By default disabled
|
||||
flagGPin(true),
|
||||
flagDPin(true),
|
||||
flagPPin(true),
|
||||
flagGFormulas(false),
|
||||
m_bAddMode(true),
|
||||
m_mx(0),
|
||||
m_my(0),
|
||||
m_dialog(),
|
||||
m_visPins(),
|
||||
m_qslMaterials(),
|
||||
m_qslPlacements(),
|
||||
m_conMCP(),
|
||||
|
@ -99,6 +105,9 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
|||
InitInternalPathsTab();
|
||||
InitPatternPieceDataTab();
|
||||
InitGrainlineTab();
|
||||
InitPinsTab();
|
||||
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged);
|
||||
|
||||
flagName = true;//We have default name of piece.
|
||||
ChangeColor(ui->labelEditName, okColor);
|
||||
|
@ -116,6 +125,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSeamAllowance::~DialogSeamAllowance()
|
||||
{
|
||||
delete m_visPins;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -129,6 +139,7 @@ void DialogSeamAllowance::EnableApply(bool enable)
|
|||
ui->tabInternalPaths->setEnabled(applyAllowed);
|
||||
ui->tabPatternPieceData->setEnabled(applyAllowed);
|
||||
ui->tabGrainline->setEnabled(applyAllowed);
|
||||
ui->tabPins->setEnabled(applyAllowed);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -148,20 +159,26 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
|
||||
ui->listWidgetCustomSA->blockSignals(true);
|
||||
ui->listWidgetCustomSA->clear();
|
||||
const QVector<CustomSARecord> records = piece.GetCustomSARecords();
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (int i = 0; i < piece.GetCustomSARecords().size(); ++i)
|
||||
{
|
||||
NewCustomSA(records.at(i));
|
||||
NewCustomSA(piece.GetCustomSARecords().at(i));
|
||||
}
|
||||
ui->listWidgetCustomSA->blockSignals(false);
|
||||
|
||||
ui->listWidgetInternalPaths->clear();
|
||||
const QVector<quint32> iPaths = piece.GetInternalPaths();
|
||||
for (int i = 0; i < iPaths.size(); ++i)
|
||||
for (int i = 0; i < piece.GetInternalPaths().size(); ++i)
|
||||
{
|
||||
NewInternalPath(iPaths.at(i));
|
||||
NewInternalPath(piece.GetInternalPaths().at(i));
|
||||
}
|
||||
|
||||
ui->listWidgetPins->clear();
|
||||
for (int i = 0; i < piece.GetPins().size(); ++i)
|
||||
{
|
||||
NewPin(piece.GetPins().at(i));
|
||||
}
|
||||
|
||||
InitAllPinComboboxes();
|
||||
|
||||
ui->comboBoxStartPoint->blockSignals(true);
|
||||
ui->comboBoxStartPoint->clear();
|
||||
ui->comboBoxStartPoint->blockSignals(false);
|
||||
|
@ -184,8 +201,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
m_my = piece.GetMy();
|
||||
|
||||
ui->lineEditLetter->setText(piece.GetPatternPieceData().GetLetter());
|
||||
ui->checkBoxDetail->setChecked(piece.GetPatternPieceData().IsVisible());
|
||||
ui->checkBoxPattern->setChecked(piece.GetPatternInfo().IsVisible());
|
||||
ui->groupBoxDetailLabel->setChecked(piece.GetPatternPieceData().IsVisible());
|
||||
ui->groupBoxPatternLabel->setChecked(piece.GetPatternInfo().IsVisible());
|
||||
|
||||
m_conMCP.clear();
|
||||
for (int i = 0; i < piece.GetPatternPieceData().GetMCPCount(); ++i)
|
||||
|
@ -195,14 +212,22 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
|
||||
UpdateList();
|
||||
|
||||
ui->checkBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible());
|
||||
ui->lineEditRotFormula->setPlainText(piece.GetGrainlineGeometry().GetRotation());
|
||||
ui->lineEditLenFormula->setPlainText(piece.GetGrainlineGeometry().GetLength());
|
||||
ui->groupBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible());
|
||||
SetGrainlineAngle(piece.GetGrainlineGeometry());
|
||||
SetGrainlineLength(piece.GetGrainlineGeometry());
|
||||
ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType()));
|
||||
|
||||
m_oldData = piece.GetPatternPieceData();
|
||||
ChangeCurrentData(ui->comboBoxDetailLabelTopLeftPin, m_oldData.TopLeftPin());
|
||||
ChangeCurrentData(ui->comboBoxDetailLabelBottomRightPin, m_oldData.BottomRightPin());
|
||||
|
||||
m_oldGeom = piece.GetPatternInfo();
|
||||
ChangeCurrentData(ui->comboBoxPatternLabelTopLeftPin, m_oldGeom.TopLeftPin());
|
||||
ChangeCurrentData(ui->comboBoxPatternLabelBottomRightPin, m_oldGeom.BottomRightPin());
|
||||
|
||||
m_oldGrainline = piece.GetGrainlineGeometry();
|
||||
ChangeCurrentData(ui->comboBoxGrainlineTopPin, m_oldGrainline.TopPin());
|
||||
ChangeCurrentData(ui->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin());
|
||||
|
||||
ValidObjects(MainPathIsValid());
|
||||
EnableGrainlineRotation();
|
||||
|
@ -321,7 +346,7 @@ void DialogSeamAllowance::SaveData()
|
|||
void DialogSeamAllowance::CheckState()
|
||||
{
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagName && flagError && flagFormula);
|
||||
bOk->setEnabled(flagName && flagError && flagFormula && flagDPin && flagPPin && (flagGFormulas || flagGPin));
|
||||
// In case dialog hasn't apply button
|
||||
if ( bApply != nullptr && applyAllowed)
|
||||
{
|
||||
|
@ -375,11 +400,7 @@ void DialogSeamAllowance::AddUpdate()
|
|||
MaterialCutPlacement mcp;
|
||||
QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
int i = ui->comboBoxMaterial->itemData(ui->comboBoxMaterial->currentIndex()).toInt();
|
||||
#else
|
||||
int i = ui->comboBoxMaterial->currentData().toInt();
|
||||
#endif
|
||||
const int i = CURRENT_DATA(ui->comboBoxMaterial).toInt();
|
||||
QString qsMat = ui->comboBoxMaterial->currentText();
|
||||
if (i < m_qslMaterials.count() && qsMat == m_qslMaterials[i])
|
||||
{
|
||||
|
@ -454,14 +475,13 @@ void DialogSeamAllowance::NameDetailChanged()
|
|||
flagName = false;
|
||||
ChangeColor(ui->labelEditName, Qt::red);
|
||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||
ui->tabWidget->setTabIcon(1, icon);
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagName = true;
|
||||
ChangeColor(ui->labelEditName, okColor);
|
||||
QIcon icon;
|
||||
ui->tabWidget->setTabIcon(1, icon);
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), QIcon());
|
||||
}
|
||||
}
|
||||
CheckState();
|
||||
|
@ -600,6 +620,27 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos)
|
||||
{
|
||||
const int row = ui->listWidgetPins->currentRow();
|
||||
if (ui->listWidgetPins->count() == 0 || row == -1 || row >= ui->listWidgetPins->count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu *menu = new QMenu(this);
|
||||
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||
|
||||
QAction *selectedAction = menu->exec(ui->listWidgetPins->viewport()->mapToGlobal(pos));
|
||||
if (selectedAction == actionDelete)
|
||||
{
|
||||
delete ui->listWidgetPins->item(row);
|
||||
TabChanged(ui->tabWidget->currentIndex());
|
||||
InitAllPinComboboxes();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::ListChanged()
|
||||
{
|
||||
|
@ -643,13 +684,8 @@ void DialogSeamAllowance::NodeChanged(int index)
|
|||
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
const VPiece piece = CreatePiece();
|
||||
const int nodeIndex = piece.GetPath().indexOfNode(id);
|
||||
const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (nodeIndex != -1)
|
||||
{
|
||||
const VPieceNode &node = piece.GetPath().at(nodeIndex);
|
||||
|
@ -703,71 +739,54 @@ void DialogSeamAllowance::NodeChanged(int index)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::CSAStartPointChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
const int row = ui->listWidgetCustomSA->currentRow();
|
||||
if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 startPoint = ui->comboBoxStartPoint->itemData(index).toUInt();
|
||||
#else
|
||||
Q_UNUSED(index);
|
||||
const quint32 startPoint = ui->comboBoxStartPoint->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row);
|
||||
SCASSERT(rowItem != nullptr);
|
||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||
record.startPoint = startPoint;
|
||||
record.startPoint = CURRENT_DATA(ui->comboBoxStartPoint).toUInt();
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::CSAEndPointChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
const int row = ui->listWidgetCustomSA->currentRow();
|
||||
if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 endPoint = ui->comboBoxEndPoint->itemData(index).toUInt();
|
||||
#else
|
||||
Q_UNUSED(index);
|
||||
const quint32 endPoint = ui->comboBoxEndPoint->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row);
|
||||
SCASSERT(rowItem != nullptr);
|
||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||
record.endPoint = endPoint;
|
||||
record.endPoint = CURRENT_DATA(ui->comboBoxEndPoint).toUInt();
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::CSAIncludeTypeChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
const int row = ui->listWidgetCustomSA->currentRow();
|
||||
if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const PiecePathIncludeType type =
|
||||
static_cast<PiecePathIncludeType>(ui->comboBoxIncludeType->itemData(index).toUInt());
|
||||
#else
|
||||
Q_UNUSED(index);
|
||||
const PiecePathIncludeType type =
|
||||
static_cast<PiecePathIncludeType>(ui->comboBoxIncludeType->currentData().toUInt());
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row);
|
||||
SCASSERT(rowItem != nullptr);
|
||||
CustomSARecord record = qvariant_cast<CustomSARecord>(rowItem->data(Qt::UserRole));
|
||||
record.includeType = type;
|
||||
record.includeType = static_cast<PiecePathIncludeType>(CURRENT_DATA(ui->comboBoxIncludeType).toUInt());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(record));
|
||||
}
|
||||
|
||||
|
@ -777,23 +796,11 @@ void DialogSeamAllowance::NodeAngleChanged(int index)
|
|||
const int i = ui->comboBoxNodes->currentIndex();
|
||||
if (i != -1 && index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(i).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->itemData(index).toUInt());
|
||||
#else
|
||||
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
|
||||
#endif
|
||||
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetAngleType(angle);
|
||||
rowNode.SetAngleType(static_cast<PieceNodeAngle>(CURRENT_DATA(ui->comboBoxAngle).toUInt()));
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
|
||||
ListChanged();
|
||||
|
@ -907,6 +914,38 @@ void DialogSeamAllowance::PathDialogClosed(int result)
|
|||
delete m_dialog;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::TabChanged(int index)
|
||||
{
|
||||
if (index == ui->tabWidget->indexOf(ui->tabPins)
|
||||
|| index == ui->tabWidget->indexOf(ui->tabGrainline)
|
||||
|| index == ui->tabWidget->indexOf(ui->tabPatternPieceData))
|
||||
{
|
||||
if (m_visPins.isNull())
|
||||
{
|
||||
m_visPins = new VisPiecePins(data);
|
||||
}
|
||||
|
||||
m_visPins->SetPins(GetPieceInternals<quint32>(ui->listWidgetPins));
|
||||
|
||||
if (not qApp->getCurrentScene()->items().contains(m_visPins))
|
||||
{
|
||||
m_visPins->VisualMode(NULL_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_visPins->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not m_visPins.isNull())
|
||||
{
|
||||
delete m_visPins;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdateValues()
|
||||
{
|
||||
|
@ -972,8 +1011,8 @@ void DialogSeamAllowance::UpdateValues()
|
|||
plbVal->setText(qsVal);
|
||||
}
|
||||
|
||||
bOk->setEnabled(bFormulasOK);
|
||||
if (bFormulasOK == false)
|
||||
flagGFormulas = bFormulasOK;
|
||||
if (not flagGFormulas && not flagGPin)
|
||||
{
|
||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon);
|
||||
|
@ -982,6 +1021,7 @@ void DialogSeamAllowance::UpdateValues()
|
|||
{
|
||||
ResetWarning();
|
||||
}
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1034,22 +1074,14 @@ void DialogSeamAllowance::SetEditMode()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EnableGrainlineRotation()
|
||||
{
|
||||
ui->lineEditRotFormula->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
ui->lineEditLenFormula->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
ui->pushButtonRot->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
ui->pushButtonLen->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
ui->pushButtonShowLen->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
ui->pushButtonShowRot->setEnabled(ui->checkBoxGrainline->isChecked());
|
||||
|
||||
if (ui->checkBoxGrainline->isChecked() == true)
|
||||
if (ui->groupBoxGrainline->isChecked() == true)
|
||||
{
|
||||
UpdateValues();
|
||||
GrainlinePinPointChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeColor(ui->labelEditLen, okColor);
|
||||
ChangeColor(ui->labelEditRot, okColor);
|
||||
bOk->setEnabled(true);
|
||||
flagGFormulas = true;
|
||||
ResetWarning();
|
||||
}
|
||||
}
|
||||
|
@ -1103,8 +1135,10 @@ void DialogSeamAllowance::DeployLength()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::ResetWarning()
|
||||
{
|
||||
QIcon icon;
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon);
|
||||
if (flagGFormulas || flagGPin)
|
||||
{
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1247,43 +1281,109 @@ void DialogSeamAllowance::DeployWidthAfterFormulaTextEdit()
|
|||
DeployFormula(ui->plainTextEditFormulaWidthAfter, ui->pushButtonGrowWidthAfter, m_formulaBaseWidthAfter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::GrainlinePinPointChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin);
|
||||
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin);
|
||||
if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)
|
||||
{
|
||||
flagGPin = true;
|
||||
color = okColor;
|
||||
|
||||
ResetWarning();
|
||||
}
|
||||
else
|
||||
{
|
||||
flagGPin = false;
|
||||
color = errorColor;
|
||||
|
||||
if (not flagGFormulas && not flagGPin)
|
||||
{
|
||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon);
|
||||
}
|
||||
}
|
||||
ChangeColor(ui->labelGrainlineTopPin, color);
|
||||
ChangeColor(ui->labelGrainlineBottomPin, color);
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::DetailPinPointChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
const quint32 topPinId = getCurrentObjectId(ui->comboBoxDetailLabelTopLeftPin);
|
||||
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxDetailLabelBottomRightPin);
|
||||
if ((topPinId == NULL_ID && bottomPinId == NULL_ID)
|
||||
|| (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId))
|
||||
{
|
||||
flagDPin = true;
|
||||
color = okColor;
|
||||
|
||||
if (flagPPin)
|
||||
{
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), QIcon());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flagDPin = false;
|
||||
color = errorColor;
|
||||
|
||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), icon);
|
||||
}
|
||||
ChangeColor(ui->labelDetailLabelTopLeftPin, color);
|
||||
ChangeColor(ui->labelDetailLabelBottomRightPin, color);
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::PatternPinPointChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
const quint32 topPinId = getCurrentObjectId(ui->comboBoxPatternLabelTopLeftPin);
|
||||
const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxPatternLabelBottomRightPin);
|
||||
if ((topPinId == NULL_ID && bottomPinId == NULL_ID)
|
||||
|| (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId))
|
||||
{
|
||||
flagPPin = true;
|
||||
color = okColor;
|
||||
|
||||
if (flagDPin)
|
||||
{
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), QIcon());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flagPPin = false;
|
||||
color = errorColor;
|
||||
|
||||
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
|
||||
ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), icon);
|
||||
}
|
||||
ChangeColor(ui->labelPatternLabelTopLeftPin, color);
|
||||
ChangeColor(ui->labelPatternLabelBottomRightPin, color);
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPiece DialogSeamAllowance::CreatePiece() const
|
||||
{
|
||||
VPiece piece;
|
||||
for (qint32 i = 0; i < ui->listWidgetMainPath->count(); ++i)
|
||||
{
|
||||
QListWidgetItem *item = ui->listWidgetMainPath->item(i);
|
||||
piece.GetPath().Append(qvariant_cast<VPieceNode>(item->data(Qt::UserRole)));
|
||||
}
|
||||
|
||||
QVector<CustomSARecord> records;
|
||||
for (qint32 i = 0; i < ui->listWidgetCustomSA->count(); ++i)
|
||||
{
|
||||
QListWidgetItem *item = ui->listWidgetCustomSA->item(i);
|
||||
records.append(qvariant_cast<CustomSARecord>(item->data(Qt::UserRole)));
|
||||
}
|
||||
piece.SetCustomSARecords(records);
|
||||
|
||||
QVector<quint32> iPaths;
|
||||
for (qint32 i = 0; i < ui->listWidgetInternalPaths->count(); ++i)
|
||||
{
|
||||
QListWidgetItem *item = ui->listWidgetInternalPaths->item(i);
|
||||
iPaths.append(qvariant_cast<quint32>(item->data(Qt::UserRole)));
|
||||
}
|
||||
piece.SetInternalPaths(iPaths);
|
||||
|
||||
piece.GetPath().SetNodes(GetPieceInternals<VPieceNode>(ui->listWidgetMainPath));
|
||||
piece.SetCustomSARecords(GetPieceInternals<CustomSARecord>(ui->listWidgetCustomSA));
|
||||
piece.SetInternalPaths(GetPieceInternals<quint32>(ui->listWidgetInternalPaths));
|
||||
piece.SetPins(GetPieceInternals<quint32>(ui->listWidgetPins));
|
||||
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
||||
piece.SetSeamAllowance(ui->checkBoxSeams->isChecked());
|
||||
piece.SetName(ui->lineEditName->text());
|
||||
piece.SetMx(m_mx);
|
||||
piece.SetMy(m_my);
|
||||
|
||||
QString width = ui->plainTextEditFormulaWidth->toPlainText();
|
||||
width.replace("\n", " ");
|
||||
width = qApp->TrVars()->TryFormulaFromUser(width, qApp->Settings()->GetOsSeparator());
|
||||
piece.SetFormulaSAWidth(width, m_saWidth);
|
||||
|
||||
piece.SetFormulaSAWidth(GetFormulaFromUser(ui->plainTextEditFormulaWidth), m_saWidth);
|
||||
piece.GetPatternPieceData().SetLetter(ui->lineEditLetter->text());
|
||||
|
||||
for (int i = 0; i < m_conMCP.count(); ++i)
|
||||
|
@ -1296,16 +1396,22 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
|||
piece.GetPatternPieceData().SetLabelHeight(m_oldData.GetLabelHeight());
|
||||
piece.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize());
|
||||
piece.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
||||
piece.GetPatternPieceData().SetVisible(ui->checkBoxDetail->isChecked());
|
||||
piece.GetPatternPieceData().SetVisible(ui->groupBoxDetailLabel->isChecked());
|
||||
piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(ui->comboBoxDetailLabelTopLeftPin));
|
||||
piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(ui->comboBoxDetailLabelBottomRightPin));
|
||||
|
||||
piece.GetPatternInfo() = m_oldGeom;
|
||||
piece.GetPatternInfo().SetVisible(ui->checkBoxPattern->isChecked());
|
||||
piece.GetPatternInfo().SetVisible(ui->groupBoxPatternLabel->isChecked());
|
||||
piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(ui->comboBoxPatternLabelTopLeftPin));
|
||||
piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(ui->comboBoxPatternLabelBottomRightPin));
|
||||
|
||||
piece.GetGrainlineGeometry() = m_oldGrainline;
|
||||
piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked());
|
||||
piece.GetGrainlineGeometry().SetVisible(ui->groupBoxGrainline->isChecked());
|
||||
piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula));
|
||||
piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula));
|
||||
piece.GetGrainlineGeometry().SetArrowType(VGrainlineGeometry::ArrowType(ui->comboBoxArrow->currentIndex()));
|
||||
piece.GetGrainlineGeometry().SetArrowType(static_cast<ArrowType>(ui->comboBoxArrow->currentIndex()));
|
||||
piece.GetGrainlineGeometry().SetTopPin(getCurrentObjectId(ui->comboBoxGrainlineTopPin));
|
||||
piece.GetGrainlineGeometry().SetBottomPin(getCurrentObjectId(ui->comboBoxGrainlineBottomPin));
|
||||
|
||||
return piece;
|
||||
}
|
||||
|
@ -1346,6 +1452,21 @@ void DialogSeamAllowance::NewInternalPath(quint32 path)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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));
|
||||
ui->listWidgetPins->addItem(item);
|
||||
ui->listWidgetPins->setCurrentRow(ui->listWidgetPins->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
|
||||
{
|
||||
|
@ -1428,20 +1549,16 @@ bool DialogSeamAllowance::MainPathIsClockwise() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitNodesList()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(ui->comboBoxNodes->currentIndex()).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
const quint32 id = CURRENT_DATA(ui->comboBoxNodes).toUInt();
|
||||
|
||||
ui->comboBoxNodes->blockSignals(true);
|
||||
ui->comboBoxNodes->clear();
|
||||
|
||||
const VPiece piece = CreatePiece();
|
||||
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(ui->listWidgetMainPath);
|
||||
|
||||
for (int i = 0; i < piece.GetPath().CountNodes(); ++i)
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
const VPieceNode node = piece.GetPath().at(i);
|
||||
const VPieceNode node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
@ -1515,13 +1632,7 @@ void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula)
|
|||
const int index = ui->comboBoxNodes->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
@ -1537,13 +1648,7 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula)
|
|||
const int index = ui->comboBoxNodes->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
const quint32 id = ui->comboBoxNodes->itemData(index).toUInt();
|
||||
#else
|
||||
const quint32 id = ui->comboBoxNodes->currentData().toUInt();
|
||||
#endif
|
||||
|
||||
QListWidgetItem *rowItem = GetItemById(id);
|
||||
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
|
@ -1637,11 +1742,11 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
|
|||
box->clear();
|
||||
box->addItem(tr("Empty"), NULL_ID);
|
||||
|
||||
const VPiece piece = CreatePiece();
|
||||
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(ui->listWidgetMainPath);
|
||||
|
||||
for (int i = 0; i < piece.GetPath().CountNodes(); ++i)
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
const VPieceNode &node = piece.GetPath().at(i);
|
||||
const VPieceNode &node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
@ -1650,6 +1755,35 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitPinPoint(QComboBox *box)
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
|
||||
quint32 currentId = NULL_ID;
|
||||
if (box->count() > 0)
|
||||
{
|
||||
currentId = CURRENT_DATA(box).toUInt();
|
||||
}
|
||||
|
||||
box->clear();
|
||||
box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID);
|
||||
|
||||
const QVector<quint32> pins = GetPieceInternals<quint32>(ui->listWidgetPins);
|
||||
|
||||
for (int i = 0; i < pins.size(); ++i)
|
||||
{
|
||||
const QSharedPointer<VGObject> pin = data->GetGObject(pins.at(i));
|
||||
box->addItem(pin->name(), pins.at(i));
|
||||
}
|
||||
|
||||
const int index = ui->comboBoxNodes->findData(currentId);
|
||||
if (index != -1)
|
||||
{
|
||||
box->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitSAIncludeType()
|
||||
{
|
||||
|
@ -1676,6 +1810,26 @@ void DialogSeamAllowance::InitPatternPieceDataTab()
|
|||
ui->lineEditLetter->setClearButtonEnabled(true);
|
||||
#endif
|
||||
|
||||
InitPinPoint(ui->comboBoxDetailLabelTopLeftPin);
|
||||
InitPinPoint(ui->comboBoxDetailLabelBottomRightPin);
|
||||
|
||||
connect(ui->comboBoxDetailLabelTopLeftPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::DetailPinPointChanged);
|
||||
connect(ui->comboBoxDetailLabelBottomRightPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::DetailPinPointChanged);
|
||||
|
||||
InitPinPoint(ui->comboBoxPatternLabelTopLeftPin);
|
||||
InitPinPoint(ui->comboBoxPatternLabelBottomRightPin);
|
||||
|
||||
connect(ui->comboBoxPatternLabelTopLeftPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::PatternPinPointChanged);
|
||||
connect(ui->comboBoxPatternLabelBottomRightPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::PatternPinPointChanged);
|
||||
|
||||
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
|
||||
|
||||
m_qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
||||
|
@ -1709,7 +1863,7 @@ void DialogSeamAllowance::InitPatternPieceDataTab()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitGrainlineTab()
|
||||
{
|
||||
connect(ui->checkBoxGrainline, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableGrainlineRotation);
|
||||
connect(ui->groupBoxGrainline, &QGroupBox::toggled, this, &DialogSeamAllowance::EnableGrainlineRotation);
|
||||
connect(ui->pushButtonRot, &QPushButton::clicked, this, &DialogSeamAllowance::EditFormula);
|
||||
connect(ui->pushButtonLen, &QPushButton::clicked, this, &DialogSeamAllowance::EditFormula);
|
||||
connect(ui->lineEditLenFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateValues);
|
||||
|
@ -1727,6 +1881,36 @@ void DialogSeamAllowance::InitGrainlineTab()
|
|||
|
||||
m_iRotBaseHeight = ui->lineEditRotFormula->height();
|
||||
m_iLenBaseHeight = ui->lineEditLenFormula->height();
|
||||
|
||||
InitPinPoint(ui->comboBoxGrainlineTopPin);
|
||||
InitPinPoint(ui->comboBoxGrainlineBottomPin);
|
||||
|
||||
connect(ui->comboBoxGrainlineTopPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::GrainlinePinPointChanged);
|
||||
connect(ui->comboBoxGrainlineBottomPin,
|
||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::GrainlinePinPointChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitPinsTab()
|
||||
{
|
||||
ui->listWidgetPins->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->listWidgetPins, &QListWidget::customContextMenuRequested, this,
|
||||
&DialogSeamAllowance::ShowPinsContextMenu);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitAllPinComboboxes()
|
||||
{
|
||||
InitPinPoint(ui->comboBoxGrainlineTopPin);
|
||||
InitPinPoint(ui->comboBoxGrainlineBottomPin);
|
||||
|
||||
InitPinPoint(ui->comboBoxDetailLabelTopLeftPin);
|
||||
InitPinPoint(ui->comboBoxDetailLabelBottomRightPin);
|
||||
InitPinPoint(ui->comboBoxPatternLabelTopLeftPin);
|
||||
InitPinPoint(ui->comboBoxPatternLabelBottomRightPin);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1793,3 +1977,45 @@ void DialogSeamAllowance::ClearFields()
|
|||
ui->spinBoxCutNumber->setValue(0);
|
||||
ui->comboBoxPlacement->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
QVector<T> DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const
|
||||
{
|
||||
SCASSERT(list != nullptr)
|
||||
QVector<T> internals;
|
||||
for (qint32 i = 0; i < list->count(); ++i)
|
||||
{
|
||||
QListWidgetItem *item = list->item(i);
|
||||
internals.append(qvariant_cast<T>(item->data(Qt::UserRole)));
|
||||
}
|
||||
return internals;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetGrainlineAngle(const VGrainlineData &data)
|
||||
{
|
||||
const QString formula = qApp->TrVars()->FormulaToUser(data.GetRotation(), qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployRotation();
|
||||
}
|
||||
ui->lineEditRotFormula->setPlainText(formula);
|
||||
|
||||
MoveCursorToEnd(ui->lineEditRotFormula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetGrainlineLength(const VGrainlineData &data)
|
||||
{
|
||||
const QString formula = qApp->TrVars()->FormulaToUser(data.GetLength(), qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (formula.length() > 80)
|
||||
{
|
||||
this->DeployLength();
|
||||
}
|
||||
ui->lineEditLenFormula->setPlainText(formula);
|
||||
|
||||
MoveCursorToEnd(ui->lineEditLenFormula);
|
||||
}
|
||||
|
|
|
@ -31,15 +31,17 @@
|
|||
|
||||
#include "dialogtool.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogSeamAllowance;
|
||||
}
|
||||
|
||||
class VisPiecePins;
|
||||
|
||||
class DialogSeamAllowance : public DialogTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -77,6 +79,7 @@ private slots:
|
|||
void ShowMainPathContextMenu(const QPoint &pos);
|
||||
void ShowCustomSAContextMenu(const QPoint &pos);
|
||||
void ShowInternalPathsContextMenu(const QPoint &pos);
|
||||
void ShowPinsContextMenu(const QPoint &pos);
|
||||
|
||||
void ListChanged();
|
||||
void EnableSeamAllowance(bool enable);
|
||||
|
@ -89,6 +92,7 @@ private slots:
|
|||
void ReturnDefAfter();
|
||||
void CustomSAChanged(int row);
|
||||
void PathDialogClosed(int result);
|
||||
void TabChanged(int index);
|
||||
|
||||
void UpdateValues();
|
||||
void SetAddMode();
|
||||
|
@ -115,25 +119,34 @@ private slots:
|
|||
void DeployWidthBeforeFormulaTextEdit();
|
||||
void DeployWidthAfterFormulaTextEdit();
|
||||
|
||||
void GrainlinePinPointChanged();
|
||||
void DetailPinPointChanged();
|
||||
void PatternPinPointChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSeamAllowance)
|
||||
|
||||
Ui::DialogSeamAllowance *ui;
|
||||
bool applyAllowed;
|
||||
bool flagGPin;
|
||||
bool flagDPin;
|
||||
bool flagPPin;
|
||||
bool flagGFormulas;
|
||||
bool m_bAddMode;
|
||||
qreal m_mx;
|
||||
qreal m_my;
|
||||
|
||||
QPointer<DialogTool> m_dialog;
|
||||
QPointer<DialogTool> m_dialog;
|
||||
QPointer<VisPiecePins> m_visPins;
|
||||
|
||||
QStringList m_qslMaterials;
|
||||
QStringList m_qslPlacements;
|
||||
// temporary container for Material/Cut/Placement 3-tuples
|
||||
MCPContainer m_conMCP;
|
||||
|
||||
VPatternPieceData m_oldData;
|
||||
VPatternInfoGeometry m_oldGeom;
|
||||
VGrainlineGeometry m_oldGrainline;
|
||||
VPieceLabelData m_oldData;
|
||||
VPatternLabelData m_oldGeom;
|
||||
VGrainlineData m_oldGrainline;
|
||||
int m_iRotBaseHeight;
|
||||
int m_iLenBaseHeight;
|
||||
int m_formulaBaseWidth;
|
||||
|
@ -150,6 +163,7 @@ private:
|
|||
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;
|
||||
bool MainPathIsValid() const;
|
||||
void ValidObjects(bool value);
|
||||
|
@ -172,12 +186,20 @@ private:
|
|||
void InitSeamAllowanceTab();
|
||||
void InitNodesList();
|
||||
void InitCSAPoint(QComboBox *box);
|
||||
void InitPinPoint(QComboBox *box);
|
||||
void InitSAIncludeType();
|
||||
void InitInternalPathsTab();
|
||||
void InitPatternPieceDataTab();
|
||||
void InitGrainlineTab();
|
||||
void InitPinsTab();
|
||||
void InitAllPinComboboxes();
|
||||
|
||||
void SetFormulaSAWidth(const QString &formula);
|
||||
|
||||
template <typename T>
|
||||
QVector<T> GetPieceInternals(const QListWidget *list) const;
|
||||
void SetGrainlineAngle(const VGrainlineData &data);
|
||||
void SetGrainlineLength(const VGrainlineData &data);
|
||||
};
|
||||
|
||||
#endif // DIALOGSEAMALLOWANCE_H
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -86,18 +86,34 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog")
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true),
|
||||
timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr),
|
||||
labelResultCalculation(nullptr), labelEditNamePoint(nullptr), labelEditFormula(nullptr),
|
||||
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr),
|
||||
toolId(toolId), prepare(false), pointName(QString()), number(0), vis(nullptr)
|
||||
: QDialog(parent),
|
||||
data(data),
|
||||
isInitialized(false),
|
||||
flagName(true),
|
||||
flagFormula(true),
|
||||
flagError(true),
|
||||
timerFormula(nullptr),
|
||||
bOk(nullptr),
|
||||
bApply(nullptr),
|
||||
spinBoxAngle(nullptr),
|
||||
plainTextEditFormula(nullptr),
|
||||
labelResultCalculation(nullptr),
|
||||
labelEditNamePoint(nullptr),
|
||||
labelEditFormula(nullptr),
|
||||
okColor(this->palette().color(QPalette::Active, QPalette::WindowText)),
|
||||
errorColor(Qt::red),
|
||||
associatedTool(nullptr),
|
||||
toolId(toolId),
|
||||
prepare(false),
|
||||
pointName(),
|
||||
number(0),
|
||||
vis(nullptr)
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
timerFormula = new QTimer(this);
|
||||
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogTool::~DialogTool()
|
||||
{
|
||||
|
@ -337,7 +353,7 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit)
|
||||
void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const
|
||||
{
|
||||
SCASSERT(plainTextEdit != nullptr)
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
|
@ -446,12 +462,18 @@ QString DialogTool::DialogWarningIcon()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogTool::GetNodeName(const VPieceNode &node) const
|
||||
{
|
||||
const QSharedPointer<VGObject> obj = data->GeometricObject<VGObject>(node.GetId());
|
||||
const QSharedPointer<VGObject> obj = data->GetGObject(node.GetId());
|
||||
QString name = obj->name();
|
||||
|
||||
if (node.GetTypeTool() != Tool::NodePoint && node.GetReverse())
|
||||
if (node.GetTypeTool() != Tool::NodePoint)
|
||||
{
|
||||
name = QLatin1String("- ") + name;
|
||||
int bias = 0;
|
||||
qApp->TrVars()->VariablesToUser(name, 0, obj->name(), bias);
|
||||
|
||||
if (node.GetReverse())
|
||||
{
|
||||
name = QLatin1String("- ") + name;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
|
@ -470,10 +492,8 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
|
|||
case (Tool::NodeElArc):
|
||||
case (Tool::NodeSpline):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
name = GetNodeName(node);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qDebug()<<"Got wrong tools. Ignore.";
|
||||
return;
|
||||
|
@ -918,7 +938,7 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
|
|||
{
|
||||
SCASSERT(widget != nullptr)
|
||||
QPalette palette = widget->palette();
|
||||
palette.setColor(widget->foregroundRole(), color);
|
||||
palette.setColor(QPalette::Active, widget->foregroundRole(), color);
|
||||
widget->setPalette(palette);
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ protected:
|
|||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData() {}
|
||||
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit);
|
||||
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const;
|
||||
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
|
||||
quint32 DNumber(const QString &baseName) const;
|
||||
|
||||
|
|
|
@ -35,5 +35,6 @@
|
|||
#include "vnodespline.h"
|
||||
#include "vnodesplinepath.h"
|
||||
#include "vtoolpiecepath.h"
|
||||
#include "vtoolpin.h"
|
||||
|
||||
#endif // NODEDETAILS_H
|
||||
|
|
|
@ -211,18 +211,14 @@ void VToolPiecePath::AddToFile()
|
|||
|
||||
if (path.GetType() == PiecePathType::InternalPath)
|
||||
{
|
||||
QVector<quint32> iPaths = newDet.GetInternalPaths();
|
||||
iPaths.append(id);
|
||||
newDet.SetInternalPaths(iPaths);
|
||||
newDet.GetInternalPaths().append(id);
|
||||
}
|
||||
else if (path.GetType() == PiecePathType::CustomSeamAllowance)
|
||||
{
|
||||
CustomSARecord record;
|
||||
record.path = id;
|
||||
|
||||
QVector<CustomSARecord> records = newDet.GetCustomSARecords();
|
||||
records.append(record);
|
||||
newDet.SetCustomSARecords(records);
|
||||
newDet.GetCustomSARecords().append(record);
|
||||
}
|
||||
|
||||
SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId);
|
||||
|
|
168
src/libs/vtools/tools/nodeDetails/vtoolpin.cpp
Normal file
168
src/libs/vtools/tools/nodeDetails/vtoolpin.cpp
Normal file
|
@ -0,0 +1,168 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 "vtoolpin.h"
|
||||
#include "../../dialogs/tools/dialogpin.h"
|
||||
#include "../../undocommands/savepieceoptions.h"
|
||||
#include "../vtoolseamallowance.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
|
||||
const QString VToolPin::ToolType = QStringLiteral("pin");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPin *VToolPin::Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPin *dialogTool = qobject_cast<DialogPin*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 pointId = dialogTool->GetPointId();
|
||||
const quint32 pieceId = dialogTool->GetPieceId();
|
||||
|
||||
return Create(0, pointId, pieceId, doc, data, Document::FullParse, Source::FromGui);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPin *VToolPin::Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstractPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation, const QString &drawName,
|
||||
const quint32 &idTool)
|
||||
{
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = CreateNode<VPointF>(data, pointId);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSharedPointer<VPointF> point;
|
||||
try
|
||||
{
|
||||
point = data->GeometricObject<VPointF>(pointId);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||
Q_UNUSED(e)
|
||||
return nullptr;// Just ignore
|
||||
}
|
||||
VPointF *pinPoint = new VPointF(*point);
|
||||
pinPoint->setMode(Draw::Modeling);
|
||||
data->UpdateGObject(id, pinPoint);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
}
|
||||
VAbstractTool::AddRecord(id, Tool::Pin, doc);
|
||||
VToolPin *point = nullptr;
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
point = new VToolPin(doc, data, id, pointId, pieceId, typeCreation, drawName, idTool, doc);
|
||||
|
||||
doc->AddTool(id, point);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||
VDataTool *tool = doc->getTool(idTool);
|
||||
SCASSERT(tool != nullptr)
|
||||
point->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
// Help to delete the node before each FullParse
|
||||
doc->AddToolOnRemove(point);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolPin::getTagName() const
|
||||
{
|
||||
return VAbstractPattern::TagPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPin::AllowHover(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPin::AllowSelecting(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPin::AddToFile()
|
||||
{
|
||||
QDomElement domElement = doc->createElement(getTagName());
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
doc->SetAttribute(domElement, AttrType, ToolType);
|
||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
|
||||
AddToModeling(domElement);
|
||||
|
||||
if (m_pieceId > NULL_ID)
|
||||
{
|
||||
const VPiece oldDet = VAbstractTool::data.GetPiece(m_pieceId);
|
||||
VPiece newDet = oldDet;
|
||||
|
||||
newDet.GetPins().append(id);
|
||||
|
||||
SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId);
|
||||
qApp->getUndoStack()->push(saveCommand);// First push then make a connect
|
||||
VAbstractTool::data.UpdatePiece(m_pieceId, newDet);// Update piece because first save will not call lite update
|
||||
connect(saveCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPin::RefreshDataInFile()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPin::VToolPin(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pointId, quint32 pieceId,
|
||||
const Source &typeCreation, const QString &drawName, const quint32 &idTool, QObject *qoParent)
|
||||
: VAbstractNode(doc, data, id, pointId, drawName, idTool, qoParent),
|
||||
m_pieceId(pieceId)
|
||||
{
|
||||
ToolCreation(typeCreation);
|
||||
}
|
68
src/libs/vtools/tools/nodeDetails/vtoolpin.h
Normal file
68
src/libs/vtools/tools/nodeDetails/vtoolpin.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VTOOLPIN_H
|
||||
#define VTOOLPIN_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "vabstractnode.h"
|
||||
|
||||
class DialogTool;
|
||||
|
||||
class VToolPin : public VAbstractNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static VToolPin* Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data);
|
||||
static VToolPin *Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstractPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation, const QString &drawName = QString(),
|
||||
const quint32 &idTool = 0);
|
||||
|
||||
static const QString ToolType;
|
||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE {}
|
||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolPin)
|
||||
|
||||
quint32 m_pieceId;
|
||||
|
||||
VToolPin(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pointId, quint32 pieceId,
|
||||
const Source &typeCreation, const QString &drawName = QString(), const quint32 &idTool = 0,
|
||||
QObject *qoParent = nullptr);
|
||||
};
|
||||
|
||||
#endif // VTOOLPIN_H
|
|
@ -58,7 +58,8 @@ HEADERS += \
|
|||
$$PWD/drawTools/toolcurve/vtoolellipticalarc.h \
|
||||
$$PWD/nodeDetails/vnodeellipticalarc.h \
|
||||
$$PWD/vtoolseamallowance.h \
|
||||
$$PWD/nodeDetails/vtoolpiecepath.h
|
||||
$$PWD/nodeDetails/vtoolpiecepath.h \
|
||||
$$PWD/nodeDetails/vtoolpin.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vdatatool.cpp \
|
||||
|
@ -114,4 +115,5 @@ SOURCES += \
|
|||
$$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp \
|
||||
$$PWD/nodeDetails/vnodeellipticalarc.cpp \
|
||||
$$PWD/vtoolseamallowance.cpp \
|
||||
$$PWD/nodeDetails/vtoolpiecepath.cpp
|
||||
$$PWD/nodeDetails/vtoolpiecepath.cpp \
|
||||
$$PWD/nodeDetails/vtoolpin.cpp
|
||||
|
|
|
@ -85,32 +85,16 @@ const QString VAbstractTool::AttrInUse = QStringLiteral("inUse");
|
|||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
/**
|
||||
* @brief CreateNode create new node for detail.
|
||||
* @param data container.
|
||||
* @param id id parent object.
|
||||
* @return id for new object.
|
||||
*/
|
||||
quint32 CreateNode(VContainer *data, quint32 id)
|
||||
{
|
||||
//We can't use exist object. Need create new.
|
||||
T *node = new T(*data->GeometricObject<T>(id).data());
|
||||
node->setMode(Draw::Modeling);
|
||||
return data->AddGObject(node);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 CreateNodeSpline(VContainer *data, quint32 id)
|
||||
{
|
||||
if (data->GetGObject(id)->getType() == GOType::Spline)
|
||||
{
|
||||
return CreateNode<VSpline>(data, id);
|
||||
return VAbstractTool::CreateNode<VSpline>(data, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateNode<VCubicBezier>(data, id);
|
||||
return VAbstractTool::CreateNode<VCubicBezier>(data, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,11 +103,11 @@ quint32 CreateNodeSplinePath(VContainer *data, quint32 id)
|
|||
{
|
||||
if (data->GetGObject(id)->getType() == GOType::SplinePath)
|
||||
{
|
||||
return CreateNode<VSplinePath>(data, id);
|
||||
return VAbstractTool::CreateNode<VSplinePath>(data, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateNode<VCubicBezierPath>(data, id);
|
||||
return VAbstractTool::CreateNode<VCubicBezierPath>(data, id);
|
||||
}
|
||||
}
|
||||
}//static functions
|
||||
|
|
|
@ -80,6 +80,9 @@ public:
|
|||
QMap<QString, quint32> PointsList() const;
|
||||
virtual QString getTagName() const =0;
|
||||
virtual void ShowVisualization(bool show) =0;
|
||||
|
||||
template<typename T>
|
||||
static quint32 CreateNode(VContainer *data, quint32 id);
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
@ -185,4 +188,20 @@ inline void VAbstractTool::AddVisualization()
|
|||
vis = visual;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
/**
|
||||
* @brief CreateNode create new node for detail.
|
||||
* @param data container.
|
||||
* @param id id parent object.
|
||||
* @return id for new object.
|
||||
*/
|
||||
quint32 VAbstractTool::CreateNode(VContainer *data, quint32 id)
|
||||
{
|
||||
//We can't use exist object. Need create new.
|
||||
T *node = new T(*data->GeometricObject<T>(id).data());
|
||||
node->setMode(Draw::Modeling);
|
||||
return data->AddGObject(node);
|
||||
}
|
||||
|
||||
#endif // VABSTRACTTOOL_H
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../vpatterndb/vpiecepath.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "nodeDetails/vnodearc.h"
|
||||
#include "nodeDetails/vnodeellipticalarc.h"
|
||||
#include "nodeDetails/vnodepoint.h"
|
||||
|
@ -54,6 +54,7 @@
|
|||
#include "../undocommands/togglepieceinlayout.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
#include "../vwidgets/vnobrushscalepathitem.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
|
@ -67,6 +68,7 @@ const quint8 VToolSeamAllowance::pieceVersion = 2;
|
|||
const QString VToolSeamAllowance::TagCSA = QStringLiteral("csa");
|
||||
const QString VToolSeamAllowance::TagRecord = QStringLiteral("record");
|
||||
const QString VToolSeamAllowance::TagIPaths = QStringLiteral("iPaths");
|
||||
const QString VToolSeamAllowance::TagPins = QStringLiteral("pins");
|
||||
|
||||
const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version");
|
||||
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
|
||||
|
@ -74,6 +76,10 @@ const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllow
|
|||
const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height");
|
||||
const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united");
|
||||
const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize");
|
||||
const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin");
|
||||
const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin");
|
||||
const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin");
|
||||
const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolSeamAllowance::~VToolSeamAllowance()
|
||||
|
@ -221,11 +227,27 @@ void VToolSeamAllowance::AddInternalPaths(VAbstractPattern *doc, QDomElement &do
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::AddPins(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &pins)
|
||||
{
|
||||
if (pins.size() > 0)
|
||||
{
|
||||
QDomElement pinsElement = doc->createElement(VToolSeamAllowance::TagPins);
|
||||
for (int i = 0; i < pins.size(); ++i)
|
||||
{
|
||||
QDomElement recordNode = doc->createElement(VToolSeamAllowance::TagRecord);
|
||||
recordNode.appendChild(doc->createTextNode(QString().setNum(pins.at(i))));
|
||||
pinsElement.appendChild(recordNode);
|
||||
}
|
||||
domElement.appendChild(pinsElement);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece)
|
||||
{
|
||||
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
|
||||
const VPatternPieceData& data = piece.GetPatternPieceData();
|
||||
const VPieceLabelData& data = piece.GetPatternPieceData();
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr);
|
||||
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
|
||||
|
@ -235,6 +257,24 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement
|
|||
doc->SetAttribute(domData, AttrFont, data.GetFontSize());
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, data.GetRotation());
|
||||
|
||||
if (data.TopLeftPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrTopLeftPin, data.TopLeftPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrTopLeftPin);
|
||||
}
|
||||
|
||||
if (data.BottomRightPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrBottomRightPin, data.BottomRightPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrBottomRightPin);
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.GetMCPCount(); ++i)
|
||||
{
|
||||
const MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
|
@ -255,7 +295,7 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement
|
|||
void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece)
|
||||
{
|
||||
QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo);
|
||||
const VPatternInfoGeometry& geom = piece.GetPatternInfo();
|
||||
const VPatternLabelData& geom = piece.GetPatternInfo();
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true ? trueStr : falseStr);
|
||||
doc->SetAttribute(domData, AttrMx, geom.GetPos().x());
|
||||
doc->SetAttribute(domData, AttrMy, geom.GetPos().y());
|
||||
|
@ -263,6 +303,25 @@ void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domE
|
|||
doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight());
|
||||
doc->SetAttribute(domData, AttrFont, geom.GetFontSize());
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, geom.GetRotation());
|
||||
|
||||
if (geom.TopLeftPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrTopLeftPin, geom.TopLeftPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrTopLeftPin);
|
||||
}
|
||||
|
||||
if (geom.BottomRightPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrBottomRightPin, geom.BottomRightPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrBottomRightPin);
|
||||
}
|
||||
|
||||
domElement.appendChild(domData);
|
||||
}
|
||||
|
||||
|
@ -271,13 +330,32 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle
|
|||
{
|
||||
// grainline
|
||||
QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline);
|
||||
const VGrainlineGeometry& glGeom = piece.GetGrainlineGeometry();
|
||||
const VGrainlineData& glGeom = piece.GetGrainlineGeometry();
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true ? trueStr : falseStr);
|
||||
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
|
||||
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
|
||||
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, glGeom.GetRotation());
|
||||
doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
|
||||
|
||||
if (glGeom.TopPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrTopPin, glGeom.TopPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrTopPin);
|
||||
}
|
||||
|
||||
if (glGeom.BottomPin() > NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domData, AttrBottomPin, glGeom.BottomPin());
|
||||
}
|
||||
else
|
||||
{
|
||||
domData.removeAttribute(AttrBottomPin);
|
||||
}
|
||||
|
||||
domElement.appendChild(domData);
|
||||
}
|
||||
|
||||
|
@ -400,33 +478,39 @@ void VToolSeamAllowance::Highlight(quint32 id)
|
|||
void VToolSeamAllowance::UpdateLabel()
|
||||
{
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
const VPatternPieceData& data = detail.GetPatternPieceData();
|
||||
const VPieceLabelData& labelData = detail.GetPatternPieceData();
|
||||
|
||||
if (data.IsVisible() == true)
|
||||
if (labelData.IsVisible() == true)
|
||||
{
|
||||
QPointF pos;
|
||||
qreal labelWidth = 0;
|
||||
qreal labelHeight = 0;
|
||||
const VTextGraphicsItem::MoveType type = FindLabelGeometry(labelData, labelWidth, labelHeight, pos);
|
||||
m_dataLabel->SetMoveType(type);
|
||||
|
||||
QFont fnt = qApp->font();
|
||||
{
|
||||
const int iFS = data.GetFontSize();
|
||||
const int iFS = labelData.GetFontSize();
|
||||
iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS);
|
||||
}
|
||||
m_dataLabel->SetFont(fnt);
|
||||
m_dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight());
|
||||
m_dataLabel->UpdateData(detail.GetName(), data);
|
||||
QPointF pt = data.GetPos();
|
||||
m_dataLabel->SetSize(labelWidth, labelHeight);
|
||||
m_dataLabel->UpdateData(detail.GetName(), labelData);
|
||||
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setTopLeft(pos);
|
||||
rectBB.setWidth(m_dataLabel->boundingRect().width());
|
||||
rectBB.setHeight(m_dataLabel->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (m_dataLabel->IsContained(rectBB, data.GetRotation(), dX, dY) == false)
|
||||
if (m_dataLabel->IsContained(rectBB, labelData.GetRotation(), dX, dY) == false)
|
||||
{
|
||||
pt.setX(pt.x() + dX);
|
||||
pt.setY(pt.y() + dY);
|
||||
pos.setX(pos.x() + dX);
|
||||
pos.setY(pos.y() + dY);
|
||||
}
|
||||
|
||||
m_dataLabel->setPos(pt);
|
||||
m_dataLabel->setRotation(data.GetRotation());
|
||||
m_dataLabel->setPos(pos);
|
||||
m_dataLabel->setRotation(labelData.GetRotation());
|
||||
m_dataLabel->Update();
|
||||
m_dataLabel->show();
|
||||
}
|
||||
|
@ -443,10 +527,16 @@ void VToolSeamAllowance::UpdateLabel()
|
|||
void VToolSeamAllowance::UpdatePatternInfo()
|
||||
{
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
|
||||
const VPatternLabelData& geom = detail.GetPatternInfo();
|
||||
|
||||
if (geom.IsVisible() == true)
|
||||
{
|
||||
QPointF pos;
|
||||
qreal labelWidth = 0;
|
||||
qreal labelHeight = 0;
|
||||
const VTextGraphicsItem::MoveType type = FindLabelGeometry(geom, labelWidth, labelHeight, pos);
|
||||
m_patternInfo->SetMoveType(type);
|
||||
|
||||
QFont fnt = qApp->font();
|
||||
int iFS = geom.GetFontSize();
|
||||
if (iFS < MIN_FONT_SIZE)
|
||||
|
@ -455,23 +545,22 @@ void VToolSeamAllowance::UpdatePatternInfo()
|
|||
}
|
||||
fnt.setPixelSize(iFS);
|
||||
m_patternInfo->SetFont(fnt);
|
||||
m_patternInfo->SetSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
m_patternInfo->SetSize(labelWidth, labelHeight);
|
||||
m_patternInfo->UpdateData(doc, getData()->size(), getData()->height());
|
||||
|
||||
QPointF pt = geom.GetPos();
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setTopLeft(pos);
|
||||
rectBB.setWidth(m_patternInfo->boundingRect().width());
|
||||
rectBB.setHeight(m_patternInfo->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (m_patternInfo->IsContained(rectBB, geom.GetRotation(), dX, dY) == false)
|
||||
{
|
||||
pt.setX(pt.x() + dX);
|
||||
pt.setY(pt.y() + dY);
|
||||
pos.setX(pos.x() + dX);
|
||||
pos.setY(pos.y() + dY);
|
||||
}
|
||||
|
||||
m_patternInfo->setPos(pt);
|
||||
m_patternInfo->setPos(pos);
|
||||
m_patternInfo->setRotation(geom.GetRotation());
|
||||
m_patternInfo->Update();
|
||||
m_patternInfo->GetTextLines() > 0 ? m_patternInfo->show() : m_patternInfo->hide();
|
||||
|
@ -489,34 +578,23 @@ void VToolSeamAllowance::UpdatePatternInfo()
|
|||
void VToolSeamAllowance::UpdateGrainline()
|
||||
{
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
const VGrainlineGeometry& geom = detail.GetGrainlineGeometry();
|
||||
const VGrainlineData& geom = detail.GetGrainlineGeometry();
|
||||
|
||||
if (geom.IsVisible() == true)
|
||||
{
|
||||
qreal dRotation;
|
||||
qreal dLength;
|
||||
try
|
||||
{
|
||||
QString qsFormula;
|
||||
qsFormula = geom.GetRotation().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
QPointF pos;
|
||||
qreal dRotation = 0;
|
||||
qreal dLength = 0;
|
||||
|
||||
Calculator cal1;
|
||||
dRotation = cal1.EvalFormula(VDataTool::data.PlainVariables(), qsFormula);
|
||||
|
||||
qsFormula = geom.GetLength().replace("\n", " ");
|
||||
qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator());
|
||||
Calculator cal2;
|
||||
dLength = cal2.EvalFormula(VDataTool::data.PlainVariables(), qsFormula);
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
const VGrainlineItem::MoveType type = FindGrainlineGeometry(geom, dLength, dRotation, pos);
|
||||
if (type == VGrainlineItem::Error)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
m_grainLine->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
m_grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()),
|
||||
m_grainLine->SetMoveType(type);
|
||||
m_grainLine->UpdateGeometry(pos, dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()),
|
||||
geom.GetArrowType());
|
||||
m_grainLine->show();
|
||||
}
|
||||
|
@ -662,7 +740,7 @@ void VToolSeamAllowance::SaveResizeGrainline(qreal dLength)
|
|||
VPiece newDet = oldDet;
|
||||
|
||||
dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit());
|
||||
newDet.GetGrainlineGeometry().SetLength(qApp->LocaleToString(dLength));
|
||||
newDet.GetGrainlineGeometry().SetLength(QString().setNum(dLength));
|
||||
SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, id);
|
||||
resizeCommand->setText(tr("resize grainline"));
|
||||
connect(resizeCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
||||
|
@ -676,7 +754,7 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos)
|
|||
VPiece newDet = oldDet;
|
||||
|
||||
dRot = qRadiansToDegrees(dRot);
|
||||
newDet.GetGrainlineGeometry().SetRotation(qApp->LocaleToString(dRot));
|
||||
newDet.GetGrainlineGeometry().SetRotation(QString().setNum(dRot));
|
||||
newDet.GetGrainlineGeometry().SetPos(ptPos);
|
||||
SavePieceOptions* rotateCommand = new SavePieceOptions(oldDet, newDet, doc, id);
|
||||
rotateCommand->setText(tr("rotate grainline"));
|
||||
|
@ -690,22 +768,9 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos)
|
|||
*/
|
||||
void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
if (scene()->views().count() > 0)
|
||||
{
|
||||
const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0);
|
||||
const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100);
|
||||
|
||||
const QPoint p = pt - pt0;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
const qreal dScale = qSqrt(QPoint::dotProduct(p, p));
|
||||
#else
|
||||
const qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y());
|
||||
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
m_grainLine->SetScale(100/dScale);
|
||||
}
|
||||
|
||||
if (m_dataLabel->IsIdle() == false || m_patternInfo->IsIdle() == false || m_grainLine->IsIdle() == false)
|
||||
if ((m_dataLabel->IsIdle() == false
|
||||
|| m_patternInfo->IsIdle() == false
|
||||
|| m_grainLine->IsIdle() == false) && not isSelected())
|
||||
{
|
||||
setSelected(true);
|
||||
}
|
||||
|
@ -729,6 +794,7 @@ void VToolSeamAllowance::AddToFile()
|
|||
//custom seam allowance
|
||||
AddCSARecords(doc, domElement, piece.GetCustomSARecords());
|
||||
AddInternalPaths(doc, domElement, piece.GetInternalPaths());
|
||||
AddPins(doc, domElement, piece.GetPins());
|
||||
|
||||
AddPiece *addDet = new AddPiece(domElement, doc, piece, m_drawName);
|
||||
connect(addDet, &AddPiece::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
|
||||
|
@ -761,6 +827,7 @@ void VToolSeamAllowance::RefreshDataInFile()
|
|||
AddNodes(doc, domElement, piece);
|
||||
AddCSARecords(doc, domElement, piece.GetCustomSARecords());
|
||||
AddInternalPaths(doc, domElement, piece.GetInternalPaths());
|
||||
AddPins(doc, domElement, piece.GetPins());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1009,6 +1076,7 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data,
|
|||
InitNodes(detail, scene);
|
||||
InitCSAPaths(detail);
|
||||
InitInternalPaths(detail);
|
||||
InitPins(detail);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
RefreshGeometry();
|
||||
|
@ -1088,6 +1156,114 @@ void VToolSeamAllowance::SaveDialogChange()
|
|||
UpdateLabel();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceItem::MoveType VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &labelWidth,
|
||||
qreal &labelHeight, QPointF &pos)
|
||||
{
|
||||
const quint32 topLeftPin = labelData.TopLeftPin();
|
||||
const quint32 bottomRightPin = labelData.BottomRightPin();
|
||||
|
||||
if (topLeftPin != NULL_ID && bottomRightPin != NULL_ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto topLeftPinPoint = VAbstractTool::data.GeometricObject<VPointF>(topLeftPin);
|
||||
const auto bottomRightPinPoint = VAbstractTool::data.GeometricObject<VPointF>(bottomRightPin);
|
||||
|
||||
const QRectF labelRect = QRectF(*topLeftPinPoint, *bottomRightPinPoint);
|
||||
labelWidth = qAbs(labelRect.width());
|
||||
labelHeight = qAbs(labelRect.height());
|
||||
|
||||
pos = labelRect.topLeft();
|
||||
|
||||
return VTextGraphicsItem::OnlyRotatable;
|
||||
}
|
||||
catch(const VExceptionBadId &)
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
labelWidth = labelData.GetLabelWidth();
|
||||
labelHeight = labelData.GetLabelHeight();
|
||||
pos = labelData.GetPos();
|
||||
return VTextGraphicsItem::AllModifications;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceItem::MoveType VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal &length,
|
||||
qreal &rotationAngle, QPointF &pos)
|
||||
{
|
||||
const quint32 topPin = geom.TopPin();
|
||||
const quint32 bottomPin = geom.BottomPin();
|
||||
|
||||
if (topPin != NULL_ID && bottomPin != NULL_ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto topPinPoint = VAbstractTool::data.GeometricObject<VPointF>(topPin);
|
||||
const auto bottomPinPoint = VAbstractTool::data.GeometricObject<VPointF>(bottomPin);
|
||||
|
||||
QLineF grainline(*bottomPinPoint, *topPinPoint);
|
||||
length = FromPixel(grainline.length(), *VDataTool::data.GetPatternUnit());
|
||||
rotationAngle = grainline.angle();
|
||||
|
||||
if (not VFuzzyComparePossibleNulls(rotationAngle, 0))
|
||||
{
|
||||
grainline.setAngle(0);
|
||||
}
|
||||
|
||||
pos = grainline.p1();
|
||||
|
||||
return VPieceItem::NotMovable;
|
||||
}
|
||||
catch(const VExceptionBadId &)
|
||||
{
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
bool isResizable = false;
|
||||
bool isRotatable = false;
|
||||
try
|
||||
{
|
||||
isRotatable = qmu::QmuTokenParser::IsSingle(geom.GetRotation());
|
||||
|
||||
Calculator cal1;
|
||||
rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetRotation());
|
||||
|
||||
isResizable = qmu::QmuTokenParser::IsSingle(geom.GetLength());
|
||||
|
||||
Calculator cal2;
|
||||
length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetLength());
|
||||
}
|
||||
catch(qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
return VPieceItem::Error;
|
||||
}
|
||||
|
||||
pos = geom.GetPos();
|
||||
|
||||
if (isResizable && isRotatable)
|
||||
{
|
||||
return VPieceItem::AllModifications;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isResizable)
|
||||
{
|
||||
return VPieceItem::OnlyResizable;
|
||||
}
|
||||
|
||||
if (isRotatable)
|
||||
{
|
||||
return VPieceItem::OnlyRotatable;
|
||||
}
|
||||
}
|
||||
return VPieceItem::OnlyMovable;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *scene)
|
||||
{
|
||||
|
@ -1117,25 +1293,32 @@ void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *sce
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitCSAPaths(const VPiece &detail)
|
||||
{
|
||||
QVector<CustomSARecord> records = detail.GetCustomSARecords();
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (int i = 0; i < detail.GetCustomSARecords().size(); ++i)
|
||||
{
|
||||
doc->IncrementReferens(records.at(i).path);
|
||||
doc->IncrementReferens(detail.GetCustomSARecords().at(i).path);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitInternalPaths(const VPiece &detail)
|
||||
{
|
||||
QVector<quint32> records = detail.GetInternalPaths();
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (int i = 0; i < detail.GetInternalPaths().size(); ++i)
|
||||
{
|
||||
VToolPiecePath *tool = qobject_cast<VToolPiecePath*>(doc->getTool(records.at(i)));
|
||||
VToolPiecePath *tool = qobject_cast<VToolPiecePath*>(doc->getTool(detail.GetInternalPaths().at(i)));
|
||||
SCASSERT(tool != nullptr);
|
||||
tool->setParentItem(this);
|
||||
tool->SetParentType(ParentType::Item);
|
||||
tool->show();
|
||||
doc->IncrementReferens(records.at(i));
|
||||
doc->IncrementReferens(detail.GetInternalPaths().at(i));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitPins(const VPiece &detail)
|
||||
{
|
||||
for (int i = 0; i < detail.GetPins().size(); ++i)
|
||||
{
|
||||
doc->IncrementReferens(detail.GetPins().at(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
static const QString TagCSA;
|
||||
static const QString TagRecord;
|
||||
static const QString TagIPaths;
|
||||
static const QString TagPins;
|
||||
|
||||
static const QString AttrVersion;
|
||||
static const QString AttrForbidFlipping;
|
||||
|
@ -65,6 +66,10 @@ public:
|
|||
static const QString AttrHeight;
|
||||
static const QString AttrUnited;
|
||||
static const QString AttrFont;
|
||||
static const QString AttrTopLeftPin;
|
||||
static const QString AttrBottomRightPin;
|
||||
static const QString AttrTopPin;
|
||||
static const QString AttrBottomPin;
|
||||
|
||||
void Remove(bool ask);
|
||||
|
||||
|
@ -72,6 +77,7 @@ public:
|
|||
static void AddCSARecord(VAbstractPattern *doc, QDomElement &domElement, const CustomSARecord &record);
|
||||
static void AddCSARecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<CustomSARecord> &records);
|
||||
static void AddInternalPaths(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &paths);
|
||||
static void AddPins(VAbstractPattern *doc, QDomElement &domElement, const QVector<quint32> &pins);
|
||||
static void AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||
static void AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||
static void AddGrainline(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece);
|
||||
|
@ -145,10 +151,15 @@ private:
|
|||
|
||||
void RefreshGeometry();
|
||||
void SaveDialogChange();
|
||||
VPieceItem::MoveType FindLabelGeometry(const VPatternLabelData &labelData, qreal &labelWidth, qreal &labelHeight,
|
||||
QPointF &pos);
|
||||
VPieceItem::MoveType FindGrainlineGeometry(const VGrainlineData &geom, qreal &length, qreal &rotationAngle,
|
||||
QPointF &pos);
|
||||
|
||||
void InitNodes(const VPiece &detail, VMainGraphicsScene *scene);
|
||||
void InitCSAPaths(const VPiece &detail);
|
||||
void InitInternalPaths(const VPiece &detail);
|
||||
void InitPins(const VPiece &detail);
|
||||
|
||||
template <typename Tool>
|
||||
Tool* InitTool(VMainGraphicsScene *scene, quint32 toolId);
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "nodeDetails/vnodespline.h"
|
||||
#include "nodeDetails/vnodesplinepath.h"
|
||||
#include "nodeDetails/vtoolpiecepath.h"
|
||||
#include "nodeDetails/vtoolpin.h"
|
||||
#include "vdatatool.h"
|
||||
#include "vnodedetail.h"
|
||||
#include "vtoolseamallowance.h"
|
||||
|
@ -198,6 +199,37 @@ QVector<quint32> GetPiece2InternalPaths(VAbstractPattern *doc, quint32 id)
|
|||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> GetPiece2Pins(VAbstractPattern *doc, quint32 id)
|
||||
{
|
||||
const QDomElement tool = doc->elementById(id);
|
||||
if (tool.isNull())
|
||||
{
|
||||
VException e(QString("Can't get tool by id='%1'.").arg(id));
|
||||
throw e;
|
||||
}
|
||||
|
||||
const QDomNodeList nodesList = tool.childNodes();
|
||||
for (qint32 i = 0; i < nodesList.size(); ++i)
|
||||
{
|
||||
const QDomElement element = nodesList.at(i).toElement();
|
||||
if (not element.isNull() && element.tagName() == VToolUnionDetails::TagDetail && i+1 == 2)
|
||||
{
|
||||
const QDomNodeList detList = element.childNodes();
|
||||
for (qint32 j = 0; j < detList.size(); ++j)
|
||||
{
|
||||
const QDomElement element = detList.at(j).toElement();
|
||||
if (not element.isNull() && element.tagName() == VToolSeamAllowance::TagPins)
|
||||
{
|
||||
return VAbstractPattern::ParsePiecePins(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id)
|
||||
{
|
||||
|
@ -350,6 +382,29 @@ quint32 AddNodePoint(const VPieceNode &node, const VToolUnionDetailsInitData &in
|
|||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 AddPin(quint32 id, const VToolUnionDetailsInitData &initData, quint32 idTool, QVector<quint32> &children,
|
||||
const QString &drawName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
QScopedPointer<VPointF> point(new VPointF(*initData.data->GeometricObject<VPointF>(id)));
|
||||
point->setMode(Draw::Modeling);
|
||||
|
||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||
{
|
||||
BiasRotatePoint(point.data(), dx, dy, *initData.data->GeometricObject<VPointF>(pRotate), angle);
|
||||
}
|
||||
|
||||
QScopedPointer<VPointF> point1(new VPointF(*point));
|
||||
|
||||
const quint32 idObject = initData.data->AddGObject(point.take());
|
||||
children.append(idObject);
|
||||
point1->setMode(Draw::Modeling);
|
||||
const quint32 idPin = initData.data->AddGObject(point1.take());
|
||||
VToolPin::Create(idPin, idObject, 0, initData.doc, initData.data, Document::FullParse, Source::FromTool, drawName,
|
||||
idTool);
|
||||
return idPin;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &initData, quint32 idTool,
|
||||
QVector<quint32> &children, const QString &drawName, qreal dx, qreal dy,
|
||||
|
@ -649,6 +704,12 @@ void SaveInternalPathsChildren(VAbstractPattern *doc, quint32 id, const QVector<
|
|||
SaveChildren(doc, id, doc->createElement(VToolSeamAllowance::TagIPaths), children);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void SavePinsChildren(VAbstractPattern *doc, quint32 id, const QVector<quint32> &children)
|
||||
{
|
||||
SaveChildren(doc, id, doc->createElement(VToolSeamAllowance::TagPins), children);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> GetChildren(VAbstractPattern *doc, quint32 id, const QString &tagName)
|
||||
{
|
||||
|
@ -701,6 +762,12 @@ QVector<quint32> GetInternalPathsChildren(VAbstractPattern *doc, quint32 id)
|
|||
return GetChildren(doc, id, VToolSeamAllowance::TagIPaths);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> GetPinChildren(VAbstractPattern *doc, quint32 id)
|
||||
{
|
||||
return GetChildren(doc, id, VToolSeamAllowance::TagPins);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 TakeNextId(QVector<quint32> &children)
|
||||
{
|
||||
|
@ -958,12 +1025,10 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector<quint32>
|
|||
const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy,
|
||||
quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<CustomSARecord> newList = newDetail.GetCustomSARecords();
|
||||
const QVector<CustomSARecord> oldList = d.GetCustomSARecords();
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < oldList.size(); ++i)
|
||||
for(int i=0; i < d.GetCustomSARecords().size(); ++i)
|
||||
{
|
||||
CustomSARecord record = oldList.at(i);
|
||||
CustomSARecord record = d.GetCustomSARecords().at(i);
|
||||
const VPiecePath path = initData.data->GetPiecePath(record.path);
|
||||
VPiecePath newPath = path;
|
||||
newPath.Clear();//Clear nodes
|
||||
|
@ -975,21 +1040,19 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector<quint32>
|
|||
VToolPiecePath::Create(idPath, newPath, NULL_ID, initData.scene, initData.doc, initData.data, initData.parse,
|
||||
Source::FromTool, drawName, id);
|
||||
record.path = idPath;
|
||||
newList.append(record);
|
||||
newDetail.GetCustomSARecords().append(record);
|
||||
nodeChildren.prepend(idPath);
|
||||
}
|
||||
children += nodeChildren;
|
||||
newDetail.SetCustomSARecords(newList);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void CreateUnitedCSA(VPiece &newDetail, const VPiece &d1, const VPiece &d2, quint32 id, const QString &drawName,
|
||||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
const QVector<CustomSARecord> d1Records = d1.GetCustomSARecords();
|
||||
for (int i = 0; i < d1Records.size(); ++i)
|
||||
for (int i = 0; i < d1.GetCustomSARecords().size(); ++i)
|
||||
{
|
||||
newDetail.AppendCustomSARecord(d1Records.at(i));
|
||||
newDetail.GetCustomSARecords().append(d1.GetCustomSARecords().at(i));
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1002,12 +1065,10 @@ void CreateUnitedDetailInternalPaths(VPiece &newDetail, const VPiece &d, QVector
|
|||
const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx,
|
||||
qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> newList = newDetail.GetInternalPaths();
|
||||
const QVector<quint32> oldList = d.GetInternalPaths();
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < oldList.size(); ++i)
|
||||
for(int i=0; i < d.GetInternalPaths().size(); ++i)
|
||||
{
|
||||
const VPiecePath path = initData.data->GetPiecePath(oldList.at(i));
|
||||
const VPiecePath path = initData.data->GetPiecePath(d.GetInternalPaths().at(i));
|
||||
VPiecePath newPath = path;
|
||||
newPath.Clear();//Clear nodes
|
||||
|
||||
|
@ -1018,11 +1079,10 @@ void CreateUnitedDetailInternalPaths(VPiece &newDetail, const VPiece &d, QVector
|
|||
const quint32 idPath = initData.data->AddPiecePath(newPath);
|
||||
VToolPiecePath::Create(idPath, newPath, NULL_ID, initData.scene, initData.doc, initData.data, initData.parse,
|
||||
Source::FromTool, drawName, id);
|
||||
newList.append(idPath);
|
||||
newDetail.GetInternalPaths().append(idPath);
|
||||
nodeChildren.prepend(idPath);
|
||||
}
|
||||
children += nodeChildren;
|
||||
newDetail.SetInternalPaths(newList);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1030,10 +1090,9 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece
|
|||
const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy,
|
||||
quint32 pRotate, qreal angle)
|
||||
{
|
||||
const QVector<quint32> d1Internal = d1.GetInternalPaths();
|
||||
for (int i = 0; i < d1Internal.size(); ++i)
|
||||
for (int i = 0; i < d1.GetInternalPaths().size(); ++i)
|
||||
{
|
||||
newDetail.AppendInternalPath(d1Internal.at(i));
|
||||
newDetail.GetInternalPaths().append(d1.GetInternalPaths().at(i));
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1042,6 +1101,35 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece
|
|||
SaveInternalPathsChildren(initData.doc, id, children);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void CreateUnitedDetailPins(VPiece &newDetail, const VPiece &d, QVector<quint32> &children, quint32 idTool,
|
||||
const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy,
|
||||
quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < d.GetPins().size(); ++i)
|
||||
{
|
||||
const quint32 id = AddPin(d.GetPins().at(i), initData, idTool, children, drawName, dx, dy, pRotate, angle);
|
||||
newDetail.GetPins().append(id);
|
||||
nodeChildren.prepend(id);
|
||||
}
|
||||
children += nodeChildren;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void CreateUnitedPins(VPiece &newDetail, const VPiece &d1, const VPiece &d2, quint32 id, const QString &drawName,
|
||||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
for (int i = 0; i < d1.GetPins().size(); ++i)
|
||||
{
|
||||
newDetail.GetPins().append(d1.GetPins().at(i));
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
CreateUnitedDetailPins(newDetail, d2, children, id, drawName, initData, dx, dy, pRotate, angle);
|
||||
SavePinsChildren(initData.doc, id, children);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void UpdateUnitedNodes(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate,
|
||||
qreal angle)
|
||||
|
@ -1161,6 +1249,24 @@ void UpdateUnitedDetailInternalPaths(quint32 id, const VToolUnionDetailsInitData
|
|||
UpdateUnitedDetailPaths(initData, dx, dy, pRotate, angle, records, GetInternalPathsChildren(initData.doc, id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void UpdateUnitedDetailPins(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy,
|
||||
quint32 pRotate, qreal angle, const QVector<quint32> &records)
|
||||
{
|
||||
QVector<quint32> children = GetPinChildren(initData.doc, id);
|
||||
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
{
|
||||
QScopedPointer<VPointF> point(new VPointF(*initData.data->GeometricObject<VPointF>(records.at(i))));
|
||||
point->setMode(Draw::Modeling);
|
||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||
{
|
||||
BiasRotatePoint(point.data(), dx, dy, *initData.data->GeometricObject<VPointF>(pRotate), angle);
|
||||
}
|
||||
initData.data->UpdateGObject(TakeNextId(children), point.take());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void CreateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate,
|
||||
qreal angle)
|
||||
|
@ -1176,6 +1282,7 @@ void CreateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, q
|
|||
CreateUnitedNodes(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle);
|
||||
CreateUnitedCSA(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle);
|
||||
CreateUnitedInternalPaths(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle);
|
||||
CreateUnitedPins(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle);
|
||||
|
||||
newDetail.SetName(QObject::tr("United detail"));
|
||||
QString formulaSAWidth = d1.GetFormulaSAWidth();
|
||||
|
@ -1211,6 +1318,7 @@ void UpdateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, q
|
|||
UpdateUnitedNodes(id, initData, dx, dy, pRotate, angle);
|
||||
UpdateUnitedDetailCSA(id, initData, dx, dy, pRotate, angle, GetPiece2CSAPaths(initData.doc, id));
|
||||
UpdateUnitedDetailInternalPaths(id, initData, dx, dy, pRotate, angle, GetPiece2InternalPaths(initData.doc, id));
|
||||
UpdateUnitedDetailPins(id, initData, dx, dy, pRotate, angle, GetPiece2Pins(initData.doc, id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1427,6 +1535,7 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, const VPiece &d) cons
|
|||
//custom seam allowance
|
||||
VToolSeamAllowance::AddCSARecords(doc, det, d.GetCustomSARecords());
|
||||
VToolSeamAllowance::AddInternalPaths(doc, det, d.GetInternalPaths());
|
||||
VToolSeamAllowance::AddPins(doc, det, d.GetPins());
|
||||
|
||||
domElement.appendChild(det);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ void AddPiece::undo()
|
|||
DecrementReferences(m_detail.GetPath().GetNodes());
|
||||
DecrementReferences(m_detail.GetCustomSARecords());
|
||||
DecrementReferences(m_detail.GetInternalPaths());
|
||||
DecrementReferences(m_detail.GetPins());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -105,6 +105,7 @@ void DeletePiece::redo()
|
|||
DecrementReferences(m_detail.GetPath().GetNodes());
|
||||
DecrementReferences(m_detail.GetCustomSARecords());
|
||||
DecrementReferences(m_detail.GetInternalPaths());
|
||||
DecrementReferences(m_detail.GetPins());
|
||||
emit NeedFullParsing(); // Doesn't work when UnionDetail delete detail.
|
||||
}
|
||||
else
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
#include "../vmisc/logging.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../vpatterndb/vpatterninfogeometry.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
#include "../tools/vtoolseamallowance.h"
|
||||
#include "vundocommand.h"
|
||||
|
||||
|
@ -75,10 +75,12 @@ void SavePieceOptions::undo()
|
|||
VToolSeamAllowance::AddNodes(doc, domElement, m_oldDet);
|
||||
VToolSeamAllowance::AddCSARecords(doc, domElement, m_oldDet.GetCustomSARecords());
|
||||
VToolSeamAllowance::AddInternalPaths(doc, domElement, m_oldDet.GetInternalPaths());
|
||||
VToolSeamAllowance::AddPins(doc, domElement, m_oldDet.GetPins());
|
||||
|
||||
IncrementReferences(m_oldDet.MissingNodes(m_newDet));
|
||||
IncrementReferences(m_oldDet.MissingCSAPath(m_newDet));
|
||||
IncrementReferences(m_oldDet.MissingInternalPaths(m_newDet));
|
||||
IncrementReferences(m_oldDet.MissingPins(m_newDet));
|
||||
emit NeedLiteParsing(Document::LiteParse);
|
||||
}
|
||||
else
|
||||
|
@ -104,10 +106,12 @@ void SavePieceOptions::redo()
|
|||
VToolSeamAllowance::AddNodes(doc, domElement, m_newDet);
|
||||
VToolSeamAllowance::AddCSARecords(doc, domElement, m_newDet.GetCustomSARecords());
|
||||
VToolSeamAllowance::AddInternalPaths(doc, domElement, m_newDet.GetInternalPaths());
|
||||
VToolSeamAllowance::AddPins(doc, domElement, m_newDet.GetPins());
|
||||
|
||||
DecrementReferences(m_oldDet.MissingNodes(m_newDet));
|
||||
DecrementReferences(m_oldDet.MissingCSAPath(m_newDet));
|
||||
DecrementReferences(m_oldDet.MissingInternalPaths(m_newDet));
|
||||
DecrementReferences(m_oldDet.MissingPins(m_newDet));
|
||||
|
||||
emit NeedLiteParsing(Document::LiteParse);
|
||||
}
|
||||
|
|
69
src/libs/vtools/visualization/line/vistoolpin.cpp
Normal file
69
src/libs/vtools/visualization/line/vistoolpin.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 "vistoolpin.h"
|
||||
#include "../vwidgets/vsimplepoint.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent),
|
||||
m_point()
|
||||
{
|
||||
this->mainColor = Qt::red;
|
||||
this->setZValue(2);// Show on top real tool
|
||||
|
||||
m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor);
|
||||
m_point->SetPointHighlight(true);
|
||||
m_point->setParentItem(this);
|
||||
m_point->SetVisualizationMode(true);
|
||||
m_point->setVisible(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPin::~VisToolPin()
|
||||
{
|
||||
if (not m_point.isNull())
|
||||
{
|
||||
delete m_point;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPin::RefreshGeometry()
|
||||
{
|
||||
if (object1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VPointF> point = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||
|
||||
m_point->SetOnlyPoint(mode == Mode::Creation);
|
||||
m_point->RefreshGeometry(*point);
|
||||
m_point->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
51
src/libs/vtools/visualization/line/vistoolpin.h
Normal file
51
src/libs/vtools/visualization/line/vistoolpin.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 31 1, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VISTOOLPIN_H
|
||||
#define VISTOOLPIN_H
|
||||
|
||||
#include "visline.h"
|
||||
|
||||
class VSimplePoint;
|
||||
|
||||
class VisToolPin : public VisLine
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VisToolPin(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||
virtual ~VisToolPin() Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPin)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPin)
|
||||
QPointer<VSimplePoint> m_point;
|
||||
};
|
||||
|
||||
#endif // VISTOOLPIN_H
|
|
@ -34,6 +34,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../visualization.h"
|
||||
#include "../vwidgets/vsimplepoint.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisPath::VisPath(const VContainer *data, QGraphicsItem *parent)
|
||||
|
@ -59,3 +60,23 @@ void VisPath::AddOnScene()
|
|||
{
|
||||
AddItem(this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSimplePoint *VisPath::GetPoint(QVector<VSimplePoint *> &points, quint32 i, const QColor &color)
|
||||
{
|
||||
if (not points.isEmpty() && static_cast<quint32>(points.size() - 1) >= i)
|
||||
{
|
||||
return points.at(static_cast<int>(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
VSimplePoint *point = new VSimplePoint(NULL_ID, color, *Visualization::data->GetPatternUnit(), &factor);
|
||||
point->SetPointHighlight(true);
|
||||
point->setParentItem(this);
|
||||
point->SetVisualizationMode(true);
|
||||
points.append(point);
|
||||
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "../visualization.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
class VSimplePoint;
|
||||
|
||||
class VisPath : public Visualization, public QGraphicsPathItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -52,6 +54,8 @@ public:
|
|||
protected:
|
||||
virtual void InitPen() Q_DECL_OVERRIDE;
|
||||
virtual void AddOnScene() Q_DECL_OVERRIDE;
|
||||
|
||||
VSimplePoint *GetPoint(QVector<VSimplePoint *> &points, quint32 i, const QColor &color);
|
||||
private:
|
||||
Q_DISABLE_COPY(VisPath)
|
||||
};
|
||||
|
|
84
src/libs/vtools/visualization/path/vispiecepins.cpp
Normal file
84
src/libs/vtools/visualization/path/vispiecepins.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 14 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 "vispiecepins.h"
|
||||
#include "../vwidgets/vsimplepoint.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisPiecePins::VisPiecePins(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisPath(data, parent),
|
||||
m_points(),
|
||||
m_pins()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisPiecePins::~VisPiecePins()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisPiecePins::RefreshGeometry()
|
||||
{
|
||||
HideAllItems();
|
||||
|
||||
for (int i = 0; i < m_pins.size(); ++i)
|
||||
{
|
||||
VSimplePoint *point = GetPoint(static_cast<quint32>(i), supportColor);
|
||||
point->SetOnlyPoint(false);
|
||||
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(m_pins.at(i));
|
||||
point->RefreshGeometry(*p);
|
||||
point->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisPiecePins::SetPins(const QVector<quint32> &pins)
|
||||
{
|
||||
m_pins = pins;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSimplePoint *VisPiecePins::GetPoint(quint32 i, const QColor &color)
|
||||
{
|
||||
return VisPath::GetPoint(m_points, i, color);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisPiecePins::HideAllItems()
|
||||
{
|
||||
for (int i=0; i < m_points.size(); ++i)
|
||||
{
|
||||
if (QGraphicsEllipseItem *item = m_points.at(i))
|
||||
{
|
||||
item->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
src/libs/vtools/visualization/path/vispiecepins.h
Normal file
57
src/libs/vtools/visualization/path/vispiecepins.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 14 2, 2017
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 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 VISPIECEPINS_H
|
||||
#define VISPIECEPINS_H
|
||||
|
||||
#include "vispath.h"
|
||||
|
||||
class VSimplePoint;
|
||||
|
||||
class VisPiecePins : public VisPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VisPiecePins(const VContainer *data, QGraphicsItem *parent = nullptr);
|
||||
virtual ~VisPiecePins();
|
||||
|
||||
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
|
||||
void SetPins(const QVector<quint32> &pins);
|
||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::PiecePins)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisPiecePins)
|
||||
QVector<VSimplePoint *> m_points;
|
||||
QVector<quint32> m_pins;
|
||||
|
||||
VSimplePoint *GetPoint(quint32 i, const QColor &color);
|
||||
|
||||
void HideAllItems();
|
||||
};
|
||||
|
||||
#endif // VISPIECEPINS_H
|
|
@ -91,21 +91,7 @@ void VisToolPiecePath::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSimplePoint *VisToolPiecePath::GetPoint(quint32 i, const QColor &color)
|
||||
{
|
||||
if (not m_points.isEmpty() && static_cast<quint32>(m_points.size() - 1) >= i)
|
||||
{
|
||||
return m_points.at(static_cast<int>(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
VSimplePoint *point = new VSimplePoint(NULL_ID, color, *Visualization::data->GetPatternUnit(), &factor);
|
||||
point->SetPointHighlight(true);
|
||||
point->setParentItem(this);
|
||||
point->SetVisualizationMode(true);
|
||||
m_points.append(point);
|
||||
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
return VisPath::GetPoint(m_points, i, color);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -40,7 +40,9 @@ HEADERS += \
|
|||
$$PWD/line/operation/vistoolmove.h \
|
||||
$$PWD/path/vistoolellipticalarc.h \
|
||||
$$PWD/path/vistoolpiece.h \
|
||||
$$PWD/path/vistoolpiecepath.h
|
||||
$$PWD/path/vistoolpiecepath.h \
|
||||
$$PWD/line/vistoolpin.h \
|
||||
$$PWD/path/vispiecepins.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/visualization.cpp \
|
||||
|
@ -81,4 +83,6 @@ SOURCES += \
|
|||
$$PWD/line/operation/vistoolmove.cpp \
|
||||
$$PWD/path/vistoolellipticalarc.cpp \
|
||||
$$PWD/path/vistoolpiece.cpp \
|
||||
$$PWD/path/vistoolpiecepath.cpp
|
||||
$$PWD/path/vistoolpiecepath.cpp \
|
||||
$$PWD/line/vistoolpin.cpp \
|
||||
$$PWD/path/vispiecepins.cpp
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
|
@ -44,6 +46,7 @@
|
|||
#define RESIZE_RECT_SIZE 10
|
||||
#define ROTATE_CIRC_R 7
|
||||
#define ACTIVE_Z 10
|
||||
#define LINE_PEN_WIDTH 3
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -65,8 +68,10 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
|
|||
m_ptFinish(),
|
||||
m_ptCenter(),
|
||||
m_dAngle(0),
|
||||
m_eArrowType(VGrainlineGeometry::atBoth)
|
||||
m_eArrowType(ArrowType::atBoth),
|
||||
m_penWidth(LINE_PEN_WIDTH)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
m_inactiveZ = 5;
|
||||
Reset();
|
||||
UpdateRectangle();
|
||||
|
@ -79,6 +84,21 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent)
|
|||
VGrainlineItem::~VGrainlineItem()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VGrainlineItem::shape() const
|
||||
{
|
||||
if (m_eMode == mNormal)
|
||||
{
|
||||
return MainShape();
|
||||
}
|
||||
else
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addPolygon(m_polyBound);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VGrainlineItem::paint paints the item content
|
||||
|
@ -92,45 +112,26 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
|
|||
Q_UNUSED(pWidget)
|
||||
pP->save();
|
||||
QColor clr = Qt::black;
|
||||
pP->setPen(QPen(clr, 3));
|
||||
QPointF pt1(0, 0);
|
||||
QPointF pt2;
|
||||
|
||||
pt2.setX(pt1.x() + m_dLength * cos(m_dRotation));
|
||||
pt2.setY(pt1.y() - m_dLength * sin(m_dRotation));
|
||||
pP->setPen(QPen(clr, m_penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
|
||||
pP->setRenderHints(QPainter::Antialiasing);
|
||||
// line
|
||||
pP->drawLine(pt1, pt2);
|
||||
const QLineF mainLine = MainLine();
|
||||
pP->drawLine(mainLine.p1(), mainLine.p2());
|
||||
|
||||
pP->setBrush(clr);
|
||||
QPolygonF poly;
|
||||
QPointF ptA;
|
||||
|
||||
m_dScale = GetScale();
|
||||
qreal dArrLen = ARROW_LENGTH*m_dScale;
|
||||
if (m_eArrowType != VGrainlineGeometry::atRear)
|
||||
if (m_eArrowType != ArrowType::atRear)
|
||||
{
|
||||
// first arrow
|
||||
poly << pt1;
|
||||
ptA.setX(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE));
|
||||
ptA.setY(pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE));
|
||||
poly << ptA;
|
||||
ptA.setX(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE));
|
||||
ptA.setY(pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE));
|
||||
poly << ptA;
|
||||
pP->drawPolygon(poly);
|
||||
pP->drawPolygon(FirstArrow(dArrLen));
|
||||
}
|
||||
if (m_eArrowType != VGrainlineGeometry::atFront)
|
||||
if (m_eArrowType != ArrowType::atFront)
|
||||
{
|
||||
// second arrow
|
||||
poly.clear();
|
||||
poly << pt2;
|
||||
ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE));
|
||||
ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE));
|
||||
poly << ptA;
|
||||
ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE));
|
||||
ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE));
|
||||
poly << ptA;
|
||||
pP->drawPolygon(poly);
|
||||
pP->drawPolygon(SecondArrow(dArrLen));
|
||||
}
|
||||
|
||||
if (m_eMode != mNormal)
|
||||
|
@ -175,7 +176,6 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
|
|||
pP->drawArc(iX - iR, -iY, iR, iR, 90*16, -90*16);
|
||||
pP->restore();
|
||||
}
|
||||
|
||||
}
|
||||
pP->restore();
|
||||
}
|
||||
|
@ -187,8 +187,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
|
|||
* @param dRotation rotation of the grainline in [degrees]
|
||||
* @param dLength length of the grainline in user's units
|
||||
*/
|
||||
void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength,
|
||||
VGrainlineGeometry::ArrowType eAT)
|
||||
void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT)
|
||||
{
|
||||
m_dRotation = qDegreesToRadians(dRotation);
|
||||
m_dLength = dLength;
|
||||
|
@ -271,18 +270,6 @@ bool VGrainlineItem::IsContained(const QPointF& pt, qreal dRot, qreal &dX, qreal
|
|||
return bInside;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VGrainlineItem::SetScale sets the scale for keeping the arrows of constant size
|
||||
* @param dScale scale factor
|
||||
*/
|
||||
void VGrainlineItem::SetScale(qreal dScale)
|
||||
{
|
||||
m_dScale = dScale;
|
||||
UpdateRectangle();
|
||||
Update();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VGrainlineItem::mousePressEvent handles left button mouse press events
|
||||
|
@ -290,8 +277,14 @@ void VGrainlineItem::SetScale(qreal dScale)
|
|||
*/
|
||||
void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME)
|
||||
{
|
||||
if (pME->button() == Qt::LeftButton)
|
||||
if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
if (m_moveType == NotMovable)
|
||||
{
|
||||
pME->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
m_ptStartPos = pos();
|
||||
m_ptStartMove = pME->scenePos();
|
||||
m_dStartLength = m_dLength;
|
||||
|
@ -299,25 +292,52 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME)
|
|||
m_dAngle = GetAngle(mapToParent(pME->pos()));
|
||||
m_ptRotCenter = m_ptCenter;
|
||||
|
||||
if (m_eMode != mRotate)
|
||||
if (m_moveType == OnlyRotatable)
|
||||
{
|
||||
if (m_polyResize.containsPoint(pME->pos(), Qt::OddEvenFill) == true)
|
||||
{
|
||||
m_eMode = mResize;
|
||||
SetOverrideCursor(Qt::SizeFDiagCursor);
|
||||
}
|
||||
else
|
||||
if (m_eMode != mRotate)
|
||||
{
|
||||
m_eMode = mMove;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
|
||||
setZValue(ACTIVE_Z);
|
||||
Update();
|
||||
}
|
||||
else
|
||||
else if (m_moveType == OnlyMovable)
|
||||
{
|
||||
m_eMode = mMove;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
|
||||
setZValue(ACTIVE_Z);
|
||||
Update();
|
||||
}
|
||||
else // All modifications
|
||||
{
|
||||
if (m_eMode != mRotate)
|
||||
{
|
||||
if (m_polyResize.containsPoint(pME->pos(), Qt::OddEvenFill) == true)
|
||||
{
|
||||
m_eMode = mResize;
|
||||
SetOverrideCursor(Qt::SizeFDiagCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eMode = mMove;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
|
||||
setZValue(ACTIVE_Z);
|
||||
Update();
|
||||
}
|
||||
setZValue(ACTIVE_Z);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,7 +433,7 @@ void VGrainlineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
|||
{
|
||||
if (bShort == true)
|
||||
{
|
||||
if (m_bReleased == true)
|
||||
if (m_bReleased == true && m_moveType != OnlyResizable && m_moveType != OnlyMovable)
|
||||
{
|
||||
m_eMode = mRotate;
|
||||
Update();
|
||||
|
@ -448,6 +468,20 @@ void VGrainlineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGrainlineItem::hoverEnterEvent(QGraphicsSceneHoverEvent *pME)
|
||||
{
|
||||
m_penWidth = LINE_PEN_WIDTH + 1;
|
||||
VPieceItem::hoverEnterEvent(pME);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGrainlineItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *pME)
|
||||
{
|
||||
m_penWidth = LINE_PEN_WIDTH;
|
||||
VPieceItem::hoverLeaveEvent(pME);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VGrainlineItem::UpdateBox updates the item
|
||||
|
@ -511,6 +545,12 @@ void VGrainlineItem::UpdateRectangle()
|
|||
prepareGeometryChange();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
double VGrainlineItem::GetAngle(const QPointF &pt) const
|
||||
{
|
||||
return -VPieceItem::GetAngle(pt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VGrainlineItem::Rotate rotates point pt around ptCenter by angle dAng [rad]
|
||||
|
@ -548,3 +588,102 @@ QPointF VGrainlineItem::GetInsideCorner(int i, qreal dDist) const
|
|||
|
||||
return m_polyBound.at(i) + pt1 + pt2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetScale gets the scale for keeping the arrows of constant size
|
||||
*/
|
||||
qreal VGrainlineItem::GetScale() const
|
||||
{
|
||||
if (scene()->views().count() > 0)
|
||||
{
|
||||
const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0);
|
||||
const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100);
|
||||
|
||||
const QPoint p = pt - pt0;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
qreal dScale = qSqrt(QPoint::dotProduct(p, p));
|
||||
#else
|
||||
qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y());
|
||||
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
dScale = 100.0/dScale;
|
||||
if (dScale < 1.0)
|
||||
{
|
||||
dScale = 1.0;
|
||||
}
|
||||
return dScale;
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QLineF VGrainlineItem::MainLine() const
|
||||
{
|
||||
QPointF pt1;
|
||||
QPointF pt2(pt1.x() + m_dLength * cos(m_dRotation), pt1.y() - m_dLength * sin(m_dRotation));
|
||||
return QLineF(pt1, pt2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPolygonF VGrainlineItem::FirstArrow(qreal dArrLen) const
|
||||
{
|
||||
const QPointF pt1 = MainLine().p1();
|
||||
QPolygonF poly;
|
||||
poly << pt1;
|
||||
poly << QPointF(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE),
|
||||
pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE));
|
||||
poly << QPointF(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE),
|
||||
pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE));
|
||||
return poly;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPolygonF VGrainlineItem::SecondArrow(qreal dArrLen) const
|
||||
{
|
||||
const QPointF pt2 = MainLine().p2();
|
||||
QPolygonF poly;
|
||||
poly << pt2;
|
||||
poly << QPointF(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE),
|
||||
pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE));
|
||||
poly << QPointF(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE),
|
||||
pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE));
|
||||
return poly;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VGrainlineItem::MainShape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
const QLineF mainLine = MainLine();
|
||||
QPainterPath linePath;
|
||||
linePath.moveTo(mainLine.p1());
|
||||
linePath.lineTo(mainLine.p2());
|
||||
linePath.closeSubpath();
|
||||
|
||||
QPainterPathStroker stroker;
|
||||
stroker.setWidth(m_penWidth);
|
||||
path.addPath((stroker.createStroke(linePath) + linePath).simplified());
|
||||
path.closeSubpath();
|
||||
|
||||
const qreal dArrLen = ARROW_LENGTH*GetScale();
|
||||
if (m_eArrowType != ArrowType::atRear)
|
||||
{
|
||||
// first arrow
|
||||
QPainterPath polyPath;
|
||||
polyPath.addPolygon(FirstArrow(dArrLen));
|
||||
path.addPath((stroker.createStroke(polyPath) + polyPath).simplified());
|
||||
path.closeSubpath();
|
||||
}
|
||||
|
||||
if (m_eArrowType != ArrowType::atFront)
|
||||
{
|
||||
// second arrow
|
||||
QPainterPath polyPath;
|
||||
polyPath.addPolygon(SecondArrow(dArrLen));
|
||||
path.addPath((stroker.createStroke(polyPath) + polyPath).simplified());
|
||||
path.closeSubpath();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define VGRAINLINEITEM_H
|
||||
|
||||
#include "vpieceitem.h"
|
||||
#include "../vpatterndb/vgrainlinegeometry.h"
|
||||
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
|
||||
|
||||
class VGrainlineItem : public VPieceItem
|
||||
{
|
||||
|
@ -39,12 +39,12 @@ public:
|
|||
explicit VGrainlineItem(QGraphicsItem* pParent = nullptr);
|
||||
virtual ~VGrainlineItem();
|
||||
|
||||
virtual QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE;
|
||||
void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength,
|
||||
VGrainlineGeometry::ArrowType eAT);
|
||||
void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT);
|
||||
|
||||
bool IsContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const;
|
||||
void SetScale(qreal dScale);
|
||||
|
||||
signals:
|
||||
void SignalResized(qreal dLength);
|
||||
|
@ -54,9 +54,13 @@ protected:
|
|||
virtual void mousePressEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE;
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE;
|
||||
virtual void Update() Q_DECL_OVERRIDE;
|
||||
void UpdateRectangle();
|
||||
|
||||
virtual double GetAngle(const QPointF &pt) const Q_DECL_OVERRIDE;
|
||||
|
||||
QPointF Rotate(const QPointF& pt, const QPointF& ptCenter, qreal dAng) const;
|
||||
QPointF GetInsideCorner(int i, qreal dDist) const;
|
||||
|
||||
|
@ -75,7 +79,16 @@ private:
|
|||
QPointF m_ptFinish;
|
||||
QPointF m_ptCenter;
|
||||
qreal m_dAngle;
|
||||
VGrainlineGeometry::ArrowType m_eArrowType;
|
||||
ArrowType m_eArrowType;
|
||||
int m_penWidth;
|
||||
|
||||
qreal GetScale() const;
|
||||
|
||||
QLineF MainLine() const;
|
||||
QPolygonF FirstArrow(qreal dArrLen) const;
|
||||
QPolygonF SecondArrow(qreal dArrLen) const;
|
||||
|
||||
QPainterPath MainShape() const;
|
||||
};
|
||||
|
||||
#endif // VGRAINLINEITEM_H
|
||||
|
|
|
@ -38,6 +38,7 @@ VPieceItem::VPieceItem(QGraphicsItem *pParent)
|
|||
m_eMode(VPieceItem::mNormal),
|
||||
m_bReleased(false),
|
||||
m_ptRotCenter(),
|
||||
m_moveType(AllModifications),
|
||||
m_inactiveZ(1)
|
||||
{
|
||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||
|
@ -106,3 +107,15 @@ double VPieceItem::GetAngle(const QPointF &pt) const
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceItem::MoveType VPieceItem::GetMoveType() const
|
||||
{
|
||||
return m_moveType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceItem::SetMoveType(const MoveType &moveType)
|
||||
{
|
||||
m_moveType = moveType;
|
||||
setAcceptHoverEvents(m_moveType != NotMovable);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ class VPieceItem : public QGraphicsObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum MoveType {AllModifications, OnlyResizable, OnlyRotatable, OnlyMovable, NotMovable, Error};
|
||||
|
||||
explicit VPieceItem(QGraphicsItem* pParent = nullptr);
|
||||
virtual ~VPieceItem();
|
||||
|
||||
|
@ -46,7 +48,8 @@ public:
|
|||
void Reset();
|
||||
bool IsIdle() const;
|
||||
|
||||
double GetAngle(const QPointF &pt) const;
|
||||
MoveType GetMoveType() const;
|
||||
void SetMoveType(const MoveType &moveType);
|
||||
|
||||
signals:
|
||||
void SignalMoved(const QPointF &ptPos);
|
||||
|
@ -59,13 +62,16 @@ protected:
|
|||
mResize,
|
||||
mRotate
|
||||
};
|
||||
QRectF m_rectBoundingBox;
|
||||
Mode m_eMode;
|
||||
bool m_bReleased;
|
||||
QPointF m_ptRotCenter;
|
||||
QRectF m_rectBoundingBox;
|
||||
Mode m_eMode;
|
||||
bool m_bReleased;
|
||||
QPointF m_ptRotCenter;
|
||||
MoveType m_moveType;
|
||||
|
||||
qreal m_inactiveZ;
|
||||
|
||||
virtual double GetAngle(const QPointF &pt) const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VPieceItem)
|
||||
};
|
||||
|
|
|
@ -359,7 +359,7 @@ bool VTextGraphicsItem::IsContained(QRectF rectBB, qreal dRot, qreal &dX, qreal
|
|||
* @param qsName name of detail
|
||||
* @param data reference to VPatternPieceData
|
||||
*/
|
||||
void VTextGraphicsItem::UpdateData(const QString &qsName, const VPatternPieceData &data)
|
||||
void VTextGraphicsItem::UpdateData(const QString &qsName, const VPieceLabelData &data)
|
||||
{
|
||||
m_tm.Update(qsName, data);
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ int VTextGraphicsItem::GetFontSize() const
|
|||
*/
|
||||
void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
||||
{
|
||||
if (pME->button() == Qt::LeftButton)
|
||||
if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
// record the parameters of the mouse press. Specially record the position
|
||||
// of the press as the origin for the following operations
|
||||
|
@ -413,28 +413,47 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME)
|
|||
m_dRotation = rotation();
|
||||
// in rotation mode, do not do any changes here, because user might want to
|
||||
// rotate the label more.
|
||||
if (m_eMode != mRotate)
|
||||
|
||||
if (m_moveType == OnlyRotatable)
|
||||
{
|
||||
// if user pressed the button inside the resize square, switch to resize mode
|
||||
if (m_rectResize.contains(pME->pos()) == true)
|
||||
if (m_eMode != mRotate)
|
||||
{
|
||||
m_eMode = mResize;
|
||||
SetOverrideCursor(Qt::SizeFDiagCursor);
|
||||
m_eMode = mRotate;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if user pressed the button outside the resize square, switch to move mode
|
||||
m_eMode = mMove;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
|
||||
setZValue(ACTIVE_Z);
|
||||
Update();
|
||||
}
|
||||
else
|
||||
else // All modifications
|
||||
{
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
if (m_eMode != mRotate)
|
||||
{
|
||||
// if user pressed the button inside the resize square, switch to resize mode
|
||||
if (m_rectResize.contains(pME->pos()) == true)
|
||||
{
|
||||
m_eMode = mResize;
|
||||
SetOverrideCursor(Qt::SizeFDiagCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if user pressed the button outside the resize square, switch to move mode
|
||||
m_eMode = mMove;
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
// raise the label and redraw it
|
||||
setZValue(ACTIVE_Z);
|
||||
UpdateBox();
|
||||
}
|
||||
// raise the label and redraw it
|
||||
setZValue(ACTIVE_Z);
|
||||
UpdateBox();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,7 +572,10 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME)
|
|||
{ // in rotate mode, if user did just press/release, switch to move mode
|
||||
if (bShort == true)
|
||||
{
|
||||
m_eMode = mMove;
|
||||
if (m_moveType != OnlyRotatable)
|
||||
{
|
||||
m_eMode = mMove;
|
||||
}
|
||||
UpdateBox();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
void Clear();
|
||||
void SetSize(qreal fW, qreal fH);
|
||||
bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const;
|
||||
void UpdateData(const QString& qsName, const VPatternPieceData& data);
|
||||
void UpdateData(const QString& qsName, const VPieceLabelData& data);
|
||||
void UpdateData(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight);
|
||||
int GetTextLines() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user