41extern int scaletoIU(
double aCoord,
bool isMetric );
78 return m_Params[0].GetValueFromMacro( aApertMacro ) != 0;
96 static std::vector<VECTOR2I> polybuffer;
120 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
147 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
171 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
192 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
208 std::vector<VECTOR2I> subshape_poly;
218 for(
int ii = 0; ii < 4; ii++ )
220 polybuffer = subshape_poly;
223 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
227 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
229 polybuffer[jj] += center;
234 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
235 aShapeBuffer.
Append( polybuffer[jj] );
237 aShapeBuffer.
Append( polybuffer[0] );
258 int numCircles =
KiROUND(
m_Params[5].GetValueFromMacro( aApertMacro ) );
268 int diamAdjust = ( gap + penThickness ) * 2;
270 for(
int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
277 if( outerDiam <= penThickness )
295 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
299 polybuffer[ii] += center;
324 int numCorners = (int)
m_Params[1].GetValueFromMacro( aApertMacro );
337 for(
int i = 0; i <= numCorners; ++i )
343 polybuffer.push_back(pos);
348 if( prm_idx >= last_prm )
353 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
381 for(
unsigned ii = 0; ii < polybuffer.size(); ii++ )
384 polybuffer[ii] += curPos;
395 if( polybuffer.size() > 1 )
399 for(
unsigned jj = 0; jj < polybuffer.size(); jj++ )
400 aShapeBuffer.
Append( polybuffer[jj] );
403 aShapeBuffer.
Append( polybuffer[0] );
409 std::vector<VECTOR2I>& aBuffer )
432 const int seg_per_circle = 64;
441 aBuffer.push_back( corner );
461 currpt.
y += width / 2;
462 aBuffer.push_back( currpt );
464 aBuffer.push_back( currpt );
466 aBuffer.push_back( currpt );
468 aBuffer.push_back( currpt );
473 for(
unsigned ii = 0; ii < 4; ii++ )
476 aBuffer[ii] += start;
492 aBuffer.push_back( pos );
494 aBuffer.push_back( pos );
496 aBuffer.push_back( pos );
498 aBuffer.push_back( pos );
510 aBuffer.push_back( lowerLeft );
511 lowerLeft.
y += size.
y;
512 aBuffer.push_back( lowerLeft );
513 lowerLeft.
x += size.
x;
514 aBuffer.push_back( lowerLeft );
515 lowerLeft.
y -= size.
y;
516 aBuffer.push_back( lowerLeft );
530 outerRadius = std::max( 1, outerRadius );
531 innerRadius = std::max( 1, innerRadius );
540 startpos.
x = innerRadius;
547 aBuffer.push_back( pos );
553 aBuffer.push_back( pos );
556 startpos.
x = outerRadius;
566 aBuffer.push_back( pos );
572 aBuffer.push_back( pos );
574 aBuffer.push_back( aBuffer[0] );
587 VECTOR2I pos( crossHairThickness / 2, crossHairLength / 2 );
588 aBuffer.push_back( pos );
589 pos.
y = crossHairThickness / 2;
590 aBuffer.push_back( pos );
591 pos.
x = -crossHairLength / 2;
592 aBuffer.push_back( pos );
593 pos.
y = -crossHairThickness / 2;
594 aBuffer.push_back( pos );
597 for(
int jj = 1; jj <= 3; jj ++ )
599 for(
int ii = 0; ii < 4; ii++ )
603 aBuffer.push_back( pos );
616 int vertexcount =
KiROUND(
m_Params[1].GetValueFromMacro( aApertMacro ) );
620 if( vertexcount < 3 )
623 if( vertexcount > 10 )
626 for(
int ii = 0; ii <= vertexcount; ii++ )
630 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
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_360
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
constexpr int mmToIU(double mm) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double EuclideanNorm(const VECTOR2I &vector)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".