41extern int scaletoIU(
double aCoord,
bool isMetric );
78 return m_Params[0].GetValueFromMacro( aApertMacro ) != 0;
97 static std::vector<VECTOR2I> polybuffer;
121 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
148 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
172 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
193 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
209 std::vector<VECTOR2I> subshape_poly;
219 for(
int ii = 0; ii < 4; ii++ )
221 polybuffer = subshape_poly;
224 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
229 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
231 polybuffer[jj] += center;
237 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
238 aShapeBuffer.
Append( polybuffer[jj] );
240 aShapeBuffer.
Append( polybuffer[0] );
261 int numCircles =
KiROUND(
m_Params[5].GetValueFromMacro( aApertMacro ) );
273 int diamAdjust = ( gap + penThickness ) * 2;
275 for(
int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
286 if( outerDiam <= penThickness )
302 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
305 polybuffer[ii] += center;
331 int numCorners = (int)
m_Params[1].GetValueFromMacro( aApertMacro );
344 for(
int i = 0; i <= numCorners; ++i )
350 polybuffer.push_back(pos);
355 if( prm_idx >= last_prm )
360 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
388 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
390 polybuffer[ii] += curPos;
402 if( polybuffer.size() > 1 )
406 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
407 aShapeBuffer.
Append( polybuffer[jj] );
410 aShapeBuffer.
Append( polybuffer[0] );
416 std::vector<VECTOR2I>& aBuffer )
439 const int seg_per_circle = 64;
448 aBuffer.push_back( corner );
463 int len =
delta.EuclideanNorm();
468 currpt.
y += width / 2;
469 aBuffer.push_back( currpt );
471 aBuffer.push_back( currpt );
473 aBuffer.push_back( currpt );
475 aBuffer.push_back( currpt );
480 for(
unsigned ii = 0; ii < 4; ii++ )
483 aBuffer[ii] += start;
499 aBuffer.push_back( pos );
501 aBuffer.push_back( pos );
503 aBuffer.push_back( pos );
505 aBuffer.push_back( pos );
517 aBuffer.push_back( lowerLeft );
518 lowerLeft.
y += size.
y;
519 aBuffer.push_back( lowerLeft );
520 lowerLeft.
x += size.
x;
521 aBuffer.push_back( lowerLeft );
522 lowerLeft.
y -= size.
y;
523 aBuffer.push_back( lowerLeft );
537 outerRadius = std::max( 1, outerRadius );
538 innerRadius = std::max( 1, innerRadius );
547 startpos.
x = innerRadius;
554 aBuffer.push_back( pos );
560 aBuffer.push_back( pos );
563 startpos.
x = outerRadius;
573 aBuffer.push_back( pos );
579 aBuffer.push_back( pos );
581 aBuffer.push_back( aBuffer[0] );
594 VECTOR2I pos( crossHairThickness / 2, crossHairLength / 2 );
595 aBuffer.push_back( pos );
596 pos.
y = crossHairThickness / 2;
597 aBuffer.push_back( pos );
598 pos.
x = -crossHairLength / 2;
599 aBuffer.push_back( pos );
600 pos.
y = -crossHairThickness / 2;
601 aBuffer.push_back( pos );
604 for(
int jj = 1; jj <= 3; jj ++ )
606 for(
int ii = 0; ii < 4; ii++ )
610 aBuffer.push_back( pos );
623 int vertexcount =
KiROUND(
m_Params[1].GetValueFromMacro( aApertMacro ) );
627 if( vertexcount < 3 )
630 if( vertexcount > 10 )
633 for(
int ii = 0; ii <= vertexcount; ii++ )
637 aBuffer.push_back( pos );
int scaletoIU(double aCoord, bool isMetric)
Convert a distance given in floating point to our internal units.
static VECTOR2I mapPt(double x, double y, bool isMetric)
Translate a point from the aperture macro coordinate system to our deci-mils coordinate system.
constexpr EDA_IU_SCALE gerbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
void ConvertBasicShapeToPolygon(APERTURE_MACRO *aApertMacro, SHAPE_POLY_SET &aShapeBuffer)
Generate the polygonal shape of the primitive shape of an aperture macro instance.
bool IsAMPrimitiveExposureOn(APERTURE_MACRO *aApertMacro) const
void ConvertShapeToPolygon(APERTURE_MACRO *aApertMacroe, std::vector< VECTOR2I > &aBuffer)
Convert a shape to an equivalent polygon.
AM_PARAMS m_Params
A sequence of parameters used by the primitive.
AM_PRIMITIVE_ID m_Primitive_id
The primitive type.
Support the "aperture macro" defined within standard RS274X.
void EvalLocalParams(const AM_PRIMITIVE &aPrimitive)
Evaluate m_localParamValues from current m_paramLevelEval to aPrimitive m_LocalParamLevel if m_paramL...
Represent a set of closed polygons.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void TransformRingToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc)
Convert arcs to multiple straight segments.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_360
constexpr int mmToIU(double mm) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.