PnS router: add support for circles in board outline
This commit is contained in:
parent
3b085f0d03
commit
cf5d93857f
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -36,8 +36,9 @@ public:
|
||||||
SHAPE_ARC() :
|
SHAPE_ARC() :
|
||||||
SHAPE( SH_ARC ), m_width( 0 ) {};
|
SHAPE( SH_ARC ), m_width( 0 ) {};
|
||||||
|
|
||||||
SHAPE_ARC( const VECTOR2I& pc, const VECTOR2I& p0, double aCenterAngle, int aWidth = 0 ) :
|
SHAPE_ARC( const VECTOR2I& aArcCenter, const VECTOR2I& aArcStartPoint,
|
||||||
SHAPE( SH_ARC ), m_p0( p0 ), m_pc( pc ), m_centralAngle( aCenterAngle )
|
double aCenterAngle, int aWidth = 0 ) :
|
||||||
|
SHAPE( SH_ARC ), m_p0( aArcStartPoint ), m_pc( aArcCenter ), m_centralAngle( aCenterAngle )
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -849,7 +849,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
|
||||||
{
|
{
|
||||||
case S_ARC:
|
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();
|
auto l = arc.ConvertToPolyline();
|
||||||
|
|
||||||
|
@ -861,6 +861,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case S_SEGMENT:
|
case S_SEGMENT:
|
||||||
{
|
{
|
||||||
SHAPE_SEGMENT *seg = new SHAPE_SEGMENT( aItem->GetStart(), aItem->GetEnd(), aItem->GetWidth() );
|
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;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue