|
|
|
@ -116,14 +116,31 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent, |
|
|
|
{ |
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "1,1,0.3,0.5, 1.0*" |
|
|
|
* type (1), exposure, diameter, pos.x, pos.y |
|
|
|
* type (1), exposure, diameter, pos.x, pos.y, <rotation> |
|
|
|
* <rotation> is a optional parameter: rotation form origin |
|
|
|
* type is not stored in parameters list, so the first parameter is exposure |
|
|
|
*/ |
|
|
|
curPos += mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric ); |
|
|
|
curPos = aParent->GetABPosition( curPos ); |
|
|
|
wxPoint center = mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric ); |
|
|
|
int radius = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ) / 2; |
|
|
|
|
|
|
|
TransformCircleToPolygon( aShapeBuffer, curPos, radius, seg_per_circle ); |
|
|
|
TransformCircleToPolygon( aShapeBuffer, center, radius, seg_per_circle ); |
|
|
|
|
|
|
|
SHAPE_LINE_CHAIN& poly = aShapeBuffer.Outline( aShapeBuffer.OutlineCount() - 1 ); |
|
|
|
|
|
|
|
// shape rotation (if any):
|
|
|
|
if( params.size() >= 5 ) |
|
|
|
{ |
|
|
|
rotation = params[4].GetValue( tool ) * 10.0; |
|
|
|
|
|
|
|
if( rotation != 0) |
|
|
|
{ |
|
|
|
for( int ii = 0; ii < poly.PointCount(); ii++ ) |
|
|
|
RotatePoint( &poly.Point(ii).x, &poly.Point(ii).y, rotation ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Move to current position:
|
|
|
|
poly.Move( aParent->GetABPosition( curPos ) ); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
@ -434,8 +451,8 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, |
|
|
|
wxPoint delta = end - start; |
|
|
|
int len = KiROUND( EuclideanNorm( delta ) ); |
|
|
|
|
|
|
|
// To build the polygon, we must create a horizonta polygon starting to "start"
|
|
|
|
// and rotate it to have it end point to "end"
|
|
|
|
// To build the polygon, we must create a horizontal polygon starting to "start"
|
|
|
|
// and rotate it to have the end point to "end"
|
|
|
|
wxPoint currpt; |
|
|
|
currpt.y += width / 2; // Upper left
|
|
|
|
aBuffer.push_back( currpt ); |
|
|
|
@ -443,7 +460,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, |
|
|
|
aBuffer.push_back( currpt ); |
|
|
|
currpt.y -= width; // lower right
|
|
|
|
aBuffer.push_back( currpt ); |
|
|
|
currpt.x = 0; // Upper left
|
|
|
|
currpt.x = 0; // lower left
|
|
|
|
aBuffer.push_back( currpt ); |
|
|
|
|
|
|
|
// Rotate rectangle and move it to the actual start point
|
|
|
|
|