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
items.Remove( 0 );
prevPt = graphic->GetEnd();
path->AppendPoint( mapPt( graphic->GetStart() ) );
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 );
if( graphic )
switch( graphic->m_Shape )
{
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:
// 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.
const int STEPS = 9; // in an arc of 90 degrees
wxPoint start = graphic->GetStart();
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();
wxPoint end = graphic->GetEnd();
wxPoint center = graphic->m_Start;
int angle = -graphic->m_Angle;
angle = -angle;
EXCHG( start, end );
}
if( prevPt != start )
{
wxASSERT( prevPt == graphic->GetEnd() );
wxPoint nextPt;
angle = -angle;
EXCHG( start, end );
}
for( int step=1; step<=STEPS; ++step )
{
int rotation = ( angle * step )/STEPS;
wxPoint nextPt;
nextPt = start;
for( int step=1; step<=STEPS; ++step )
{
int rotation = ( angle * step )/STEPS;
RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation );
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;
}
break;
default:
{
wxString error;
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;
error.Printf( _("Unsupported DRAWSEGMENT type %s"),
BOARD_ITEM::ShowShape( (Track_Shapes) graphic->m_Shape ).GetData() );
default:
{
wxString error;
ThrowIOError( error );
}
break;
error.Printf( _("Unsupported DRAWSEGMENT type %s"),
BOARD_ITEM::ShowShape( (Track_Shapes) graphic->m_Shape ).GetData() );
case S_SEGMENT:
{
POINT nextPt;
ThrowIOError( error );
if( prevPt != graphic->GetStart() )
{
wxASSERT( prevPt == graphic->GetEnd() );
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetStart();
}
break;
case S_SEGMENT:
else
{
POINT nextPt;
if( prevPt != graphic->GetStart() )
{
wxASSERT( prevPt == graphic->GetEnd() );
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetStart();
}
else
{
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetEnd();
}
path->AppendPoint( nextPt );
}
}
nextPt = mapPt( graphic->GetStart() );
prevPt = graphic->GetEnd();
}
path->AppendPoint( nextPt );
}
}
else
if( items.GetCount() == 0 )
break;
graphic = findPoint( prevPt, &items );
if( !graphic )
{
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