Show seam line feature.
This commit is contained in:
parent
b14ad59010
commit
1e15d343a0
|
@ -368,40 +368,46 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialises the seam line
|
// initialises the seam line
|
||||||
QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints();
|
if (not piece->IsHideMainPath() || not piece->IsSeamAllowance())
|
||||||
if(!seamLinePoints.isEmpty())
|
|
||||||
{
|
{
|
||||||
m_seamLine.moveTo(seamLinePoints.first());
|
QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints();
|
||||||
for (int i = 1; i < seamLinePoints.size(); i++)
|
if(!seamLinePoints.isEmpty())
|
||||||
{
|
{
|
||||||
m_seamLine.lineTo(seamLinePoints.at(i));
|
m_seamLine.moveTo(seamLinePoints.first());
|
||||||
}
|
for (int i = 1; i < seamLinePoints.size(); i++)
|
||||||
|
{
|
||||||
|
m_seamLine.lineTo(seamLinePoints.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
if (painter != nullptr)
|
if (painter != nullptr)
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
|
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
|
||||||
painter->drawPath(m_seamLine);
|
painter->drawPath(m_seamLine);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initiliases the cutting line
|
// initiliases the cutting line
|
||||||
QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
|
if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn())
|
||||||
if(!cuttingLinepoints.isEmpty())
|
|
||||||
{
|
{
|
||||||
m_cuttingLine.moveTo(cuttingLinepoints.first());
|
QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
|
||||||
for (int i = 1; i < cuttingLinepoints.size(); i++)
|
if(!cuttingLinepoints.isEmpty())
|
||||||
{
|
{
|
||||||
m_cuttingLine.lineTo(cuttingLinepoints.at(i));
|
m_cuttingLine.moveTo(cuttingLinepoints.first());
|
||||||
}
|
for (int i = 1; i < cuttingLinepoints.size(); i++)
|
||||||
|
{
|
||||||
|
m_cuttingLine.lineTo(cuttingLinepoints.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
if (painter != nullptr)
|
if (painter != nullptr)
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setBrush(isSelected() ? selectionBrush : noBrush);
|
painter->setBrush(isSelected() ? selectionBrush : noBrush);
|
||||||
painter->drawPath(m_cuttingLine);
|
painter->drawPath(m_cuttingLine);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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()));
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user