PNS: Correctly assemble lines with reversed arcs
This commit is contained in:
parent
feda03f69b
commit
e7b047660c
|
@ -861,8 +861,8 @@ void NODE::Remove( LINE& aLine )
|
||||||
|
|
||||||
|
|
||||||
void NODE::followLine( LINKED_ITEM* aCurrent, int aScanDirection, int& aPos, int aLimit,
|
void NODE::followLine( LINKED_ITEM* aCurrent, int aScanDirection, int& aPos, int aLimit,
|
||||||
VECTOR2I* aCorners, LINKED_ITEM** aSegments, bool& aGuardHit,
|
VECTOR2I* aCorners, LINKED_ITEM** aSegments, bool* aArcReversed,
|
||||||
bool aStopAtLockedJoints )
|
bool& aGuardHit, bool aStopAtLockedJoints )
|
||||||
{
|
{
|
||||||
bool prevReversed = false;
|
bool prevReversed = false;
|
||||||
|
|
||||||
|
@ -877,9 +877,18 @@ void NODE::followLine( LINKED_ITEM* aCurrent, int aScanDirection, int& aPos, int
|
||||||
|
|
||||||
aCorners[aPos] = jt->Pos();
|
aCorners[aPos] = jt->Pos();
|
||||||
aSegments[aPos] = aCurrent;
|
aSegments[aPos] = aCurrent;
|
||||||
|
aArcReversed[aPos] = false;
|
||||||
|
|
||||||
|
if( aCurrent->Kind() == ITEM::ARC_T )
|
||||||
|
{
|
||||||
|
if( ( aScanDirection && jt->Pos() == aCurrent->Anchor( 0 ) ) ||
|
||||||
|
( !aScanDirection && jt->Pos() == aCurrent->Anchor( 1 ) ) )
|
||||||
|
aArcReversed[aPos] = true;
|
||||||
|
}
|
||||||
|
|
||||||
aPos += ( aScanDirection ? 1 : -1 );
|
aPos += ( aScanDirection ? 1 : -1 );
|
||||||
|
|
||||||
if( count && guard == p)
|
if( count && guard == p )
|
||||||
{
|
{
|
||||||
aSegments[aPos] = NULL;
|
aSegments[aPos] = NULL;
|
||||||
aGuardHit = true;
|
aGuardHit = true;
|
||||||
|
@ -905,6 +914,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
||||||
|
|
||||||
VECTOR2I corners[MaxVerts + 1];
|
VECTOR2I corners[MaxVerts + 1];
|
||||||
LINKED_ITEM* segs[MaxVerts + 1];
|
LINKED_ITEM* segs[MaxVerts + 1];
|
||||||
|
bool arcReversed[MaxVerts + 1];
|
||||||
|
|
||||||
LINE pl;
|
LINE pl;
|
||||||
bool guardHit = false;
|
bool guardHit = false;
|
||||||
|
@ -916,10 +926,14 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
||||||
pl.SetNet( aSeg->Net() );
|
pl.SetNet( aSeg->Net() );
|
||||||
pl.SetOwner( this );
|
pl.SetOwner( this );
|
||||||
|
|
||||||
followLine( aSeg, false, i_start, MaxVerts, corners, segs, guardHit, aStopAtLockedJoints );
|
followLine( aSeg, false, i_start, MaxVerts, corners, segs, arcReversed,
|
||||||
|
guardHit, aStopAtLockedJoints );
|
||||||
|
|
||||||
if( !guardHit )
|
if( !guardHit )
|
||||||
followLine( aSeg, true, i_end, MaxVerts, corners, segs, guardHit, aStopAtLockedJoints );
|
{
|
||||||
|
followLine( aSeg, true, i_end, MaxVerts, corners, segs, arcReversed, guardHit,
|
||||||
|
aStopAtLockedJoints );
|
||||||
|
}
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
@ -940,7 +954,7 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
||||||
{
|
{
|
||||||
const ARC* arc = static_cast<const ARC*>( li );
|
const ARC* arc = static_cast<const ARC*>( li );
|
||||||
const SHAPE_ARC* sa = static_cast<const SHAPE_ARC*>( arc->Shape() );
|
const SHAPE_ARC* sa = static_cast<const SHAPE_ARC*>( arc->Shape() );
|
||||||
pl.Line().Append( p == sa->GetP0() ? *sa : sa->Reversed() );
|
pl.Line().Append( arcReversed[i] ? sa->Reversed() : *sa );
|
||||||
}
|
}
|
||||||
|
|
||||||
pl.Link( li );
|
pl.Link( li );
|
||||||
|
|
|
@ -472,8 +472,8 @@ private:
|
||||||
|
|
||||||
///> scans the joint map, forming a line starting from segment (current).
|
///> scans the joint map, forming a line starting from segment (current).
|
||||||
void followLine( LINKED_ITEM* aCurrent, int aScanDirection, int& aPos, int aLimit,
|
void followLine( LINKED_ITEM* aCurrent, int aScanDirection, int& aPos, int aLimit,
|
||||||
VECTOR2I* aCorners, LINKED_ITEM** aSegments, bool& aGuardHit,
|
VECTOR2I* aCorners, LINKED_ITEM** aSegments, bool* aArcReversed,
|
||||||
bool aStopAtLockedJoints );
|
bool& aGuardHit, bool aStopAtLockedJoints );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JOINT_MAP m_joints; ///> hash table with the joints, linking the items. Joints
|
JOINT_MAP m_joints; ///> hash table with the joints, linking the items. Joints
|
||||||
|
|
Loading…
Reference in New Issue