PnS router: add support for circles in board outline

This commit is contained in:
jean-pierre charras 2018-02-18 21:00:28 +01:00
parent 3b085f0d03
commit cf5d93857f
2 changed files with 23 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 CERN
* Copyright (C) 2018 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -36,8 +36,9 @@ public:
SHAPE_ARC() :
SHAPE( SH_ARC ), m_width( 0 ) {};
SHAPE_ARC( const VECTOR2I& pc, const VECTOR2I& p0, double aCenterAngle, int aWidth = 0 ) :
SHAPE( SH_ARC ), m_p0( p0 ), m_pc( pc ), m_centralAngle( aCenterAngle )
SHAPE_ARC( const VECTOR2I& aArcCenter, const VECTOR2I& aArcStartPoint,
double aCenterAngle, int aWidth = 0 ) :
SHAPE( SH_ARC ), m_p0( aArcStartPoint ), m_pc( aArcCenter ), m_centralAngle( aCenterAngle )
{
};

View File

@ -849,7 +849,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
{
case S_ARC:
{
SHAPE_ARC arc( aItem->GetStart(), aItem->GetEnd(), (double) aItem->GetAngle() / 10.0 );
SHAPE_ARC arc( aItem->GetCenter(), aItem->GetArcStart(), (double) aItem->GetAngle() / 10.0 );
auto l = arc.ConvertToPolyline();
@ -861,6 +861,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
break;
}
case S_SEGMENT:
{
SHAPE_SEGMENT *seg = new SHAPE_SEGMENT( aItem->GetStart(), aItem->GetEnd(), aItem->GetWidth() );
@ -868,6 +869,23 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
break;
}
case S_CIRCLE:
{
// SHAPE_CIRCLE has no ConvertToPolyline() method, so use a 360.0 SHAPE_ARC
SHAPE_ARC circle( aItem->GetCenter(), aItem->GetEnd(), 360.0 );
auto l = circle.ConvertToPolyline();
for( int i = 0; i < l.SegmentCount(); i++ )
{
SHAPE_SEGMENT *seg = new SHAPE_SEGMENT( l.CSegment(i), aItem->GetWidth() );
segs.push_back( seg );
}
break;
}
default:
break;
}