Get active pattern piece list of pieces.
--HG-- branch : feature
This commit is contained in:
parent
965e588a9d
commit
524e98d372
|
@ -58,6 +58,7 @@
|
||||||
#include "dialogs/vwidgetgroups.h"
|
#include "dialogs/vwidgetgroups.h"
|
||||||
#include "../vtools/undocommands/addgroup.h"
|
#include "../vtools/undocommands/addgroup.h"
|
||||||
#include "dialogs/vwidgetdetails.h"
|
#include "dialogs/vwidgetdetails.h"
|
||||||
|
#include "../vpatterndb/vpiecepath.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
@ -558,9 +559,16 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
ui->view->setShowToolOptions(false);
|
ui->view->setShowToolOptions(false);
|
||||||
dialogTool = new Dialog(pattern, 0, this);
|
dialogTool = new Dialog(pattern, 0, this);
|
||||||
|
|
||||||
if (t == Tool::Midpoint)
|
switch(t)
|
||||||
{
|
{
|
||||||
|
case Tool::Midpoint:
|
||||||
dialogTool->Build(t);
|
dialogTool->Build(t);
|
||||||
|
break;
|
||||||
|
case Tool::PiecePath:
|
||||||
|
dialogTool->SetPiecesList(doc->GetActivePPPieces());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
@ -1121,8 +1129,12 @@ void MainWindow::ClosedDialogPiecePath(int result)
|
||||||
DialogPiecePath *dialog = qobject_cast<DialogPiecePath*>(dialogTool);
|
DialogPiecePath *dialog = qobject_cast<DialogPiecePath*>(dialogTool);
|
||||||
SCASSERT(dialog != nullptr);
|
SCASSERT(dialog != nullptr);
|
||||||
|
|
||||||
|
const PiecePathType type = dialog->GetType();
|
||||||
|
const VPiecePath path = dialog->GetPiecePath();
|
||||||
|
//VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
|
||||||
}
|
}
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
|
doc->LiteParseTree(Document::LiteParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -350,6 +350,31 @@ quint32 VPattern::SPointActiveDraw()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<quint32> VPattern::GetActivePPPieces() const
|
||||||
|
{
|
||||||
|
QVector<quint32> pieces;
|
||||||
|
QDomElement drawElement;
|
||||||
|
if (GetActivDrawElement(drawElement))
|
||||||
|
{
|
||||||
|
const QDomElement details = drawElement.firstChildElement(TagDetails);
|
||||||
|
if (not details.isNull())
|
||||||
|
{
|
||||||
|
QDomElement detail = details.firstChildElement(TagDetail);
|
||||||
|
while(not detail.isNull())
|
||||||
|
{
|
||||||
|
bool united = GetParametrBool(detail, VToolSeamAllowance::AttrUnited, falseStr);
|
||||||
|
if (not united)
|
||||||
|
{
|
||||||
|
pieces.append(GetParametrId(detail));
|
||||||
|
}
|
||||||
|
detail = detail.nextSiblingElement(TagDetail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pieces;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPattern::SaveDocument(const QString &fileName, QString &error) const
|
bool VPattern::SaveDocument(const QString &fileName, QString &error) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,6 +59,8 @@ public:
|
||||||
|
|
||||||
quint32 SPointActiveDraw();
|
quint32 SPointActiveDraw();
|
||||||
|
|
||||||
|
QVector<quint32> GetActivePPPieces() const;
|
||||||
|
|
||||||
virtual void setXMLContent(const QString &fileName) Q_DECL_OVERRIDE;
|
virtual void setXMLContent(const QString &fileName) Q_DECL_OVERRIDE;
|
||||||
virtual bool SaveDocument(const QString &fileName, QString &error) const Q_DECL_OVERRIDE;
|
virtual bool SaveDocument(const QString &fileName, QString &error) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
|
|
@ -282,6 +282,52 @@ void DialogPiecePath::SetType(PiecePathType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 DialogPiecePath::GetPieceId() const
|
||||||
|
{
|
||||||
|
quint32 id = NULL_ID;
|
||||||
|
|
||||||
|
if (ui->comboBoxPiece->count() > 0)
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||||
|
id = ui->comboBoxPiece->itemData(ui->comboBoxPiece->currentIndex()).toUInt();
|
||||||
|
#else
|
||||||
|
id = ui->comboBoxPiece->currentData().toUInt();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::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->comboBoxType->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPiecePath::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));
|
||||||
|
}
|
||||||
|
ValidObjects(PathIsValid());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiecePath DialogPiecePath::CreatePath() const
|
VPiecePath DialogPiecePath::CreatePath() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,11 @@ public:
|
||||||
PiecePathType GetType() const;
|
PiecePathType GetType() const;
|
||||||
void SetType(PiecePathType type);
|
void SetType(PiecePathType type);
|
||||||
|
|
||||||
|
quint32 GetPieceId() const;
|
||||||
|
void SetPieceId(quint32 id);
|
||||||
|
|
||||||
|
virtual void SetPiecesList(const QVector<quint32> &list) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
|
||||||
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
|
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
|
||||||
|
@ -71,6 +76,7 @@ private:
|
||||||
bool m_showMode;
|
bool m_showMode;
|
||||||
|
|
||||||
void InitPathTypes();
|
void InitPathTypes();
|
||||||
|
void InitListPieces();
|
||||||
|
|
||||||
VPiecePath CreatePath() const;
|
VPiecePath CreatePath() const;
|
||||||
|
|
||||||
|
|
|
@ -1073,6 +1073,12 @@ void DialogTool::Build(const Tool &type)
|
||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTool::SetPiecesList(const QVector<quint32> &list)
|
||||||
|
{
|
||||||
|
Q_UNUSED(list);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
void DialogTool::SetAssociatedTool(VAbstractTool *tool)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,6 +95,7 @@ public:
|
||||||
|
|
||||||
virtual void ShowDialog(bool click);
|
virtual void ShowDialog(bool click);
|
||||||
virtual void Build(const Tool &type);
|
virtual void Build(const Tool &type);
|
||||||
|
virtual void SetPiecesList(const QVector<quint32> &list);
|
||||||
|
|
||||||
quint32 GetToolId() const;
|
quint32 GetToolId() const;
|
||||||
void SetToolId(const quint32 &value);
|
void SetToolId(const quint32 &value);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user