Prepare rounded rect and custom shaped pads: add plot functions. It fixes also a pcbnew crash in HPGL mode when plotting trapezoidal pads.

This commit is contained in:
jean-pierre charras
2016-02-10 17:02:40 +01:00
parent a319c34188
commit 5658ed9c8e
11 changed files with 480 additions and 241 deletions
+38 -1
View File
@@ -5,7 +5,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -617,6 +617,43 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
FinishTo( wxPoint( ox, oy ) );
}
void DXF_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
int aCornerRadius, double aOrient,
EDA_DRAW_MODE_T aTraceMode )
{
SHAPE_POLY_SET outline;
const int segmentToCircleCount = 64;
TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
aCornerRadius, segmentToCircleCount );
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
MoveTo( wxPoint( poly.Point( 0 ).x, poly.Point( 0 ).y ) );
for( int ii = 1; ii < poly.PointCount(); ++ii )
LineTo( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
FinishTo( wxPoint( poly.Point( 0 ).x, poly.Point( 0 ).y ) );
}
void DXF_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
SHAPE_POLY_SET* aPolygons,
EDA_DRAW_MODE_T aTraceMode )
{
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
{
SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
MoveTo( wxPoint( poly.Point( 0 ).x, poly.Point( 0 ).y ) );
for( int ii = 1; ii < poly.PointCount(); ++ii )
LineTo( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
FinishTo(wxPoint( poly.Point( 0 ).x, poly.Point( 0 ).y ) );
}
}
/**
* DXF trapezoidal pad: only sketch mode is supported