Code formatting

This commit is contained in:
Seth Hillbrand 2018-12-05 19:39:05 -08:00
parent 07ebc4df14
commit f9dfbe6f4d
1 changed files with 48 additions and 60 deletions

View File

@ -903,8 +903,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
{
case S_ARC:
{
SHAPE_ARC arc( aItem->GetCenter(), aItem->GetArcStart(), (double) aItem->GetAngle() / 10.0 );
SHAPE_ARC arc( aItem->GetCenter(), aItem->GetArcStart(), aItem->GetAngle() / 10.0 );
auto l = arc.ConvertToPolyline();
for( int i = 0; i < l.SegmentCount(); i++ )
@ -917,25 +916,19 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
}
case S_SEGMENT:
{
SHAPE_SEGMENT *seg = new SHAPE_SEGMENT( aItem->GetStart(), aItem->GetEnd(), aItem->GetWidth() );
segs.push_back( seg );
segs.push_back(
new SHAPE_SEGMENT( aItem->GetStart(), aItem->GetEnd(), aItem->GetWidth() ) );
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 );
}
segs.push_back( new SHAPE_SEGMENT( l.CSegment( i ), aItem->GetWidth() ) );
break;
}
@ -943,21 +936,17 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
case S_CURVE:
{
aItem->RebuildBezierToSegmentsPointsList( aItem->GetWidth() );
wxPoint start_pt = aItem->GetBezierPoints()[0];
auto pts = aItem->GetBezierPoints();
for( unsigned int jj = 1; jj < aItem->GetBezierPoints().size(); jj++ )
for( size_t ii = 1; ii < pts.size(); ii++ )
{
wxPoint end_pt = aItem->GetBezierPoints()[jj];
SHAPE_SEGMENT *seg = new SHAPE_SEGMENT(
VECTOR2I( start_pt ), VECTOR2I( end_pt ), aItem->GetWidth() );
segs.push_back( seg );
start_pt = end_pt;
}
segs.push_back( new SHAPE_SEGMENT(
VECTOR2I( pts[ii - 1] ), VECTOR2I( pts[ii] ), aItem->GetWidth() ) );
}
break;
}
case S_POLYGON:
{
if( !aItem->IsPolygonFilled() )
{
auto poly = aItem->BuildPolyPointsList();
@ -970,7 +959,6 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
segs.push_back( new SHAPE_SEGMENT(
VECTOR2I( poly.back() ), VECTOR2I( poly.front() ), aItem->GetWidth() ) );
}
}
break;
default: