PNS: Find origin segment correctly when arcs are present
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8139
This commit is contained in:
parent
677d7b0a60
commit
9432484394
|
@ -947,16 +947,25 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
|||
const VECTOR2I& p = corners[i];
|
||||
LINKED_ITEM* li = segs[i];
|
||||
|
||||
int nsegs = pl.Line().SegmentCount();
|
||||
|
||||
if( !li || li->Kind() != ITEM::ARC_T )
|
||||
pl.Line().Append( p );
|
||||
|
||||
if( li && prev_seg != li )
|
||||
{
|
||||
int segIdxIncrement = 1;
|
||||
|
||||
if( li->Kind() == ITEM::ARC_T )
|
||||
{
|
||||
const ARC* arc = static_cast<const ARC*>( li );
|
||||
const SHAPE_ARC* sa = static_cast<const SHAPE_ARC*>( arc->Shape() );
|
||||
|
||||
int nSegs = pl.Line().SegmentCount();
|
||||
|
||||
pl.Line().Append( arcReversed[i] ? sa->Reversed() : *sa );
|
||||
|
||||
segIdxIncrement = pl.Line().SegmentCount() - nSegs - 1;
|
||||
}
|
||||
|
||||
pl.Link( li );
|
||||
|
@ -968,7 +977,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
|||
originSet = true;
|
||||
}
|
||||
|
||||
n++;
|
||||
n += segIdxIncrement;
|
||||
}
|
||||
|
||||
prev_seg = li;
|
||||
|
|
|
@ -533,7 +533,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingLine( LINE& aCurrent, LINE& aObstacle )
|
|||
Dbg()->AddLine( aObstacle.CLine(), 1, 100000, "obstacle-line" );
|
||||
Dbg()->AddLine( aCurrent.CLine(), 2, 150000, "current-line" );
|
||||
Dbg()->AddLine( shovedLine.CLine(), 3, 200000, "shoved-line" );
|
||||
|
||||
|
||||
if( rv == SH_OK )
|
||||
{
|
||||
if( shovedLine.Marker() & MK_HEAD )
|
||||
|
@ -1301,7 +1301,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveLines( const LINE& aCurrentHead )
|
|||
m_multiLineMode = false;
|
||||
|
||||
if( Dbg() )
|
||||
{
|
||||
{
|
||||
Dbg()->Message( wxString::Format( "Shove start, lc = %d", aCurrentHead.SegmentCount() ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue