Commit 6bd572f5 authored by dickelbeck's avatar dickelbeck

fix case where first edge segment is an arc

parent 9536bdce
...@@ -748,91 +748,92 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IOErr ...@@ -748,91 +748,92 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IOErr
items.Remove( 0 ); items.Remove( 0 );
prevPt = graphic->GetEnd(); prevPt = graphic->GetEnd();
path->AppendPoint( mapPt( graphic->GetStart() ) );
path->AppendPoint( mapPt( graphic->GetEnd() ) ); path->AppendPoint( mapPt( graphic->GetEnd() ) );
while( items.GetCount() ) // do not append the other end point yet, this first edge item might be an arc
for(;;)
{ {
graphic = findPoint( prevPt, &items ); switch( graphic->m_Shape )
if( graphic )
{ {
switch( graphic->m_Shape ) case S_ARC:
// freerouter does not yet understand arcs, so approximate
// an arc with a series of short lines and put those
// line segments into the !same! PATH.
{ {
case S_ARC: const int STEPS = 9; // in an arc of 90 degrees
// freerouter does not yet understand arcs, so approximate
// an arc with a series of short lines and put those wxPoint start = graphic->GetStart();
// line segments into the !same! PATH. wxPoint end = graphic->GetEnd();
wxPoint center = graphic->m_Start;
int angle = -graphic->m_Angle;
if( prevPt != start )
{ {
const int STEPS = 9; // in an arc of 90 degrees wxASSERT( prevPt == graphic->GetEnd() );
wxPoint start = graphic->GetStart(); angle = -angle;
wxPoint end = graphic->GetEnd(); EXCHG( start, end );
wxPoint center = graphic->m_Start; }
int angle = -graphic->m_Angle;
if( prevPt != start ) wxPoint nextPt;
{
wxASSERT( prevPt == graphic->GetEnd() );
angle = -angle; for( int step=1; step<=STEPS; ++step )
EXCHG( start, end ); {
} int rotation = ( angle * step )/STEPS;
wxPoint nextPt; nextPt = start;
for( int step=1; step<=STEPS; ++step ) RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation );
{
int rotation = ( angle * step )/STEPS;
nextPt = start; path->AppendPoint( mapPt( nextPt ) );
}
RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation ); prevPt = nextPt;
}
break;
path->AppendPoint( mapPt( nextPt ) ); case S_CIRCLE:
} // do not output a circle, freerouter does not understand it.
// this might be a mounting hole or something, ignore it without error
break;
prevPt = nextPt; default:
} {
break; wxString error;
case S_CIRCLE: error.Printf( _("Unsupported DRAWSEGMENT type %s"),
// do not output a circle, freerouter does not understand it. BOARD_ITEM::ShowShape( (Track_Shapes) graphic->m_Shape ).GetData() );
// this might be a mounting hole or something, ignore it without error
break;
default: ThrowIOError( error );
{ }
wxString error; break;
error.Printf( _("Unsupported DRAWSEGMENT type %s"), case S_SEGMENT:
BOARD_ITEM::ShowShape( (Track_Shapes) graphic->m_Shape ).GetData() ); {
POINT nextPt;
ThrowIOError( error ); if( prevPt != graphic->GetStart() )
{
wxASSERT( prevPt == graphic->GetEnd() );
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetStart();
} }
break; else
case S_SEGMENT:
{ {
POINT nextPt; nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetEnd();
if( prevPt != graphic->GetStart() ) }
{
wxASSERT( prevPt == graphic->GetEnd() ); path->AppendPoint( nextPt );
nextPt = mapPt( graphic->GetStart() ); }
prevPt = graphic->GetStart();
}
else
{
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetEnd();
}
path->AppendPoint( nextPt );
}
}
} }
else
if( items.GetCount() == 0 )
break;
graphic = findPoint( prevPt, &items );
if( !graphic )
{ {
wxString error; wxString error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment