Show seam line feature.

This commit is contained in:
Roman Telezhynskyi 2021-08-31 14:12:46 +03:00
parent b14ad59010
commit 1e15d343a0
7 changed files with 50 additions and 32 deletions

View File

@ -368,6 +368,8 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
} }
// initialises the seam line // initialises the seam line
if (not piece->IsHideMainPath() || not piece->IsSeamAllowance())
{
QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints(); QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints();
if(!seamLinePoints.isEmpty()) if(!seamLinePoints.isEmpty())
{ {
@ -385,8 +387,11 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
painter->restore(); painter->restore();
} }
} }
}
// initiliases the cutting line // initiliases the cutting line
if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn())
{
QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints(); QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
if(!cuttingLinepoints.isEmpty()) if(!cuttingLinepoints.isEmpty())
{ {
@ -404,6 +409,7 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
painter->restore(); painter->restore();
} }
} }
}
// initialises the grainline // initialises the grainline
if(piece->IsGrainlineEnabled()) if(piece->IsGrainlineEnabled())

View File

@ -756,5 +756,7 @@ void VPMainGraphicsView::on_PieceSheetChanged(const VPPiecePtr &piece)
scene()->addItem(graphicsPiece); scene()->addItem(graphicsPiece);
} }
m_rotationControls->on_UpdateControls();
VMainGraphicsView::NewSceneRect(scene(), this); VMainGraphicsView::NewSceneRect(scene(), this);
} }

View File

@ -111,6 +111,11 @@ void VPUndoMovePieceOnSheet::redo()
{ {
piece->SetSheet(sourceSheet); piece->SetSheet(sourceSheet);
if (sourceSheet.isNull())
{
piece->SetSelected(false);
}
if (m_followGrainline) if (m_followGrainline)
{ {
VPTransformationOrigon origin; VPTransformationOrigon origin;

View File

@ -515,8 +515,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
VPPiecePtr selectedPiece = selectedPieces.first(); VPPiecePtr selectedPiece = selectedPieces.first();
if (not selectedPiece.isNull()) if (not selectedPiece.isNull())
{ {
// selectedPiece->SetShowSeamline(checked); selectedPiece->SetHideMainPath(not checked);
// LayoutWasSaved(false); LayoutWasSaved(false);
// nothing changed, but will force redraw
emit m_layout->PieceTransformationChanged(selectedPiece);
} }
} }
}); });
@ -929,7 +931,7 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
SetPlainTextEditValue(ui->plainTextEditCurrentPieceUUID, selectedPiece->GetUUID().toString()); SetPlainTextEditValue(ui->plainTextEditCurrentPieceUUID, selectedPiece->GetUUID().toString());
SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId()); SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId());
// SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, selectedPiece->GetShowSeamLine()); SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, not selectedPiece->IsHideMainPath());
SetCheckBoxValue(ui->checkBoxCurrentPieceMirrorPiece, selectedPiece->IsMirror()); SetCheckBoxValue(ui->checkBoxCurrentPieceMirrorPiece, selectedPiece->IsMirror());
if (not ui->checkBoxRelativeTranslation->isChecked()) if (not ui->checkBoxRelativeTranslation->isChecked())

View File

@ -440,9 +440,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
piece->SetName(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel)); piece->SetName(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel));
piece->SetCopyNumber(static_cast<quint16>(ReadAttributeUInt(attribs, ML::AttrCopyNumber, QChar('1')))); piece->SetCopyNumber(static_cast<quint16>(ReadAttributeUInt(attribs, ML::AttrCopyNumber, QChar('1'))));
piece->SetHideMainPath(not ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr));
// bool showSeamline = ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr);
// piece->SetShowSeamLine(showSeamline);
bool pieceMirrored = ReadAttributeBool(attribs, ML::AttrMirrored, falseStr); bool pieceMirrored = ReadAttributeBool(attribs, ML::AttrMirrored, falseStr);
piece->SetMirror(pieceMirrored); piece->SetMirror(pieceMirrored);

View File

@ -251,6 +251,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
SetAttributeOrRemoveIf<QString>(ML::AttrGradationLabel, piece->GetGradationId(), SetAttributeOrRemoveIf<QString>(ML::AttrGradationLabel, piece->GetGradationId(),
[](const QString &label){return label.isEmpty();}); [](const QString &label){return label.isEmpty();});
SetAttribute(ML::AttrCopyNumber, piece->CopyNumber()); SetAttribute(ML::AttrCopyNumber, piece->CopyNumber());
SetAttributeOrRemoveIf<bool>(ML::AttrShowSeamline, not piece->IsHideMainPath(), [](bool show){return show;});
writeStartElement(ML::TagSeamLine); writeStartElement(ML::TagSeamLine);
writeCharacters(PathToString(piece->GetContourPoints())); writeCharacters(PathToString(piece->GetContourPoints()));

View File

@ -186,6 +186,7 @@
<xs:attribute type="Transformation" name="transform"/> <xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/> <xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/> <xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
@ -326,6 +327,9 @@
<xs:attribute type="xs:string" name="name"/> <xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="mirrored"/> <xs:attribute type="xs:boolean" name="mirrored"/>
<xs:attribute type="Transformation" name="transform"/> <xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>