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
|
||||
QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints();
|
||||
if(!seamLinePoints.isEmpty())
|
||||
if (not piece->IsHideMainPath() || not piece->IsSeamAllowance())
|
||||
{
|
||||
m_seamLine.moveTo(seamLinePoints.first());
|
||||
for (int i = 1; i < seamLinePoints.size(); i++)
|
||||
QVector<QPointF> seamLinePoints = piece->GetMappedContourPoints();
|
||||
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)
|
||||
{
|
||||
painter->save();
|
||||
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
|
||||
painter->drawPath(m_seamLine);
|
||||
painter->restore();
|
||||
if (painter != nullptr)
|
||||
{
|
||||
painter->save();
|
||||
painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush);
|
||||
painter->drawPath(m_seamLine);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initiliases the cutting line
|
||||
QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
|
||||
if(!cuttingLinepoints.isEmpty())
|
||||
if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
m_cuttingLine.moveTo(cuttingLinepoints.first());
|
||||
for (int i = 1; i < cuttingLinepoints.size(); i++)
|
||||
QVector<QPointF> cuttingLinepoints = piece->GetMappedSeamAllowancePoints();
|
||||
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)
|
||||
{
|
||||
painter->save();
|
||||
painter->setBrush(isSelected() ? selectionBrush : noBrush);
|
||||
painter->drawPath(m_cuttingLine);
|
||||
painter->restore();
|
||||
if (painter != nullptr)
|
||||
{
|
||||
painter->save();
|
||||
painter->setBrush(isSelected() ? selectionBrush : noBrush);
|
||||
painter->drawPath(m_cuttingLine);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -756,5 +756,7 @@ void VPMainGraphicsView::on_PieceSheetChanged(const VPPiecePtr &piece)
|
|||
scene()->addItem(graphicsPiece);
|
||||
}
|
||||
|
||||
m_rotationControls->on_UpdateControls();
|
||||
|
||||
VMainGraphicsView::NewSceneRect(scene(), this);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,11 @@ void VPUndoMovePieceOnSheet::redo()
|
|||
{
|
||||
piece->SetSheet(sourceSheet);
|
||||
|
||||
if (sourceSheet.isNull())
|
||||
{
|
||||
piece->SetSelected(false);
|
||||
}
|
||||
|
||||
if (m_followGrainline)
|
||||
{
|
||||
VPTransformationOrigon origin;
|
||||
|
|
|
@ -515,8 +515,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
|
|||
VPPiecePtr selectedPiece = selectedPieces.first();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
// selectedPiece->SetShowSeamline(checked);
|
||||
// LayoutWasSaved(false);
|
||||
selectedPiece->SetHideMainPath(not checked);
|
||||
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());
|
||||
SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId());
|
||||
|
||||
// SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, selectedPiece->GetShowSeamLine());
|
||||
SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, not selectedPiece->IsHideMainPath());
|
||||
SetCheckBoxValue(ui->checkBoxCurrentPieceMirrorPiece, selectedPiece->IsMirror());
|
||||
|
||||
if (not ui->checkBoxRelativeTranslation->isChecked())
|
||||
|
|
|
@ -440,9 +440,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
|
|||
|
||||
piece->SetName(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel));
|
||||
piece->SetCopyNumber(static_cast<quint16>(ReadAttributeUInt(attribs, ML::AttrCopyNumber, QChar('1'))));
|
||||
|
||||
// bool showSeamline = ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr);
|
||||
// piece->SetShowSeamLine(showSeamline);
|
||||
piece->SetHideMainPath(not ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr));
|
||||
|
||||
bool pieceMirrored = ReadAttributeBool(attribs, ML::AttrMirrored, falseStr);
|
||||
piece->SetMirror(pieceMirrored);
|
||||
|
|
|
@ -251,6 +251,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
|
|||
SetAttributeOrRemoveIf<QString>(ML::AttrGradationLabel, piece->GetGradationId(),
|
||||
[](const QString &label){return label.isEmpty();});
|
||||
SetAttribute(ML::AttrCopyNumber, piece->CopyNumber());
|
||||
SetAttributeOrRemoveIf<bool>(ML::AttrShowSeamline, not piece->IsHideMainPath(), [](bool show){return show;});
|
||||
|
||||
writeStartElement(ML::TagSeamLine);
|
||||
writeCharacters(PathToString(piece->GetContourPoints()));
|
||||
|
|
|
@ -185,7 +185,8 @@
|
|||
<xs:attribute type="xs:boolean" name="mirrored"/>
|
||||
<xs:attribute type="Transformation" name="transform"/>
|
||||
<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:element>
|
||||
</xs:sequence>
|
||||
|
@ -325,7 +326,10 @@
|
|||
<xs:attribute name="id" type="uuid" use="required"/>
|
||||
<xs:attribute type="xs:string" name="name"/>
|
||||
<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:element>
|
||||
</xs:sequence>
|
||||
|
|
Loading…
Reference in New Issue
Block a user