KiCad PCB EDA Suite
Loading...
Searching...
No Matches
APERTURE_MACRO Class Reference

Support the "aperture macro" defined within standard RS274X. More...

#include <aperture_macro.h>

Public Member Functions

 APERTURE_MACRO ()
 
double GetLocalParam (const D_CODE *aDcode, unsigned aParamId) const
 Usually, parameters are defined inside the aperture primitive using immediate mode or deferred mode.
 
void InitLocalParams (const D_CODE *aDcode)
 Init m_localParamValues to a initial values coming from aDcode and clear m_paramLevelEval must be called once before trying to build the aperture macro shape corresponding to aDcode.
 
void EvalLocalParams (const AM_PRIMITIVE &aPrimitive)
 Evaluate m_localParamValues from current m_paramLevelEval to aPrimitive m_LocalParamLevel if m_paramLevelEval >= m_LocalParamLevel, do nothing after call, m_paramLevelEval = m_LocalParamLevel.
 
double GetLocalParamValue (int aIndex)
 
SHAPE_POLY_SETGetApertureMacroShape (const GERBER_DRAW_ITEM *aParent, const VECTOR2I &aShapePos)
 Calculate the primitive shape for flashed items.
 
void AddPrimitiveToList (AM_PRIMITIVE &aPrimitive)
 Add a new ptimitive ( AMP_CIRCLE, AMP_LINE2 ...) to the list of primitives to define the full shape of the aperture macro.
 
void AddLocalParamDefToStack ()
 A deferred parameter can be defined in aperture macro, but outside aperture primitives.
 
AM_PARAMGetLastLocalParamDefFromStack ()
 

Public Attributes

wxString m_AmName
 The name of the aperture macro as defined like AMVB_RECTANGLE* (name is VB_RECTANGLE)
 

Private Attributes

std::vector< AM_PRIMITIVEm_primitivesList
 A list of AM_PRIMITIVEs to define the shape of the aperture macro.
 
AM_PARAMS m_localParamStack
 m_localparamStack handle a list of local deferred parameters
 
std::map< int, double > m_localParamValues
 m_localParamValues is the current value of local parameters after evaluation the key is the local param id (from $n) and the value is double
 
int m_paramLevelEval
 the current level of local param values evaluation when a primitive is evaluated, if its m_LocalParamLevel is smaller than m_paramLevelEval, all local params must be evaluated from current m_paramLevelEval upto m_LocalParamLevel before use in this primitive
 
SHAPE_POLY_SET m_shape
 The shape of the item, calculated by GetApertureMacroShape.
 

Detailed Description

Support the "aperture macro" defined within standard RS274X.

Definition at line 68 of file aperture_macro.h.

Constructor & Destructor Documentation

◆ APERTURE_MACRO()

APERTURE_MACRO::APERTURE_MACRO ( )
inline

Definition at line 71 of file aperture_macro.h.

Member Function Documentation

◆ AddLocalParamDefToStack()

void APERTURE_MACRO::AddLocalParamDefToStack ( )

A deferred parameter can be defined in aperture macro, but outside aperture primitives.

Example AMRECTHERM* $4=$3/2* parameter $4 is half value of parameter $3

Definition at line 91 of file aperture_macro.cpp.

References m_localParamStack.

Referenced by GERBER_FILE_IMAGE::ReadApertureMacro().

◆ AddPrimitiveToList()

void APERTURE_MACRO::AddPrimitiveToList ( AM_PRIMITIVE aPrimitive)

Add a new ptimitive ( AMP_CIRCLE, AMP_LINE2 ...) to the list of primitives to define the full shape of the aperture macro.

Definition at line 85 of file aperture_macro.cpp.

References m_localParamStack, and m_primitivesList.

Referenced by GERBER_FILE_IMAGE::ReadApertureMacro().

◆ EvalLocalParams()

void APERTURE_MACRO::EvalLocalParams ( const AM_PRIMITIVE aPrimitive)

Evaluate m_localParamValues from current m_paramLevelEval to aPrimitive m_LocalParamLevel if m_paramLevelEval >= m_LocalParamLevel, do nothing after call, m_paramLevelEval = m_LocalParamLevel.

Definition at line 49 of file aperture_macro.cpp.

References AM_PARAM::GetIndex(), AM_PARAM::GetValueFromMacro(), AM_PRIMITIVE::m_LocalParamLevel, m_localParamStack, m_localParamValues, and m_paramLevelEval.

Referenced by AM_PRIMITIVE::ConvertBasicShapeToPolygon().

◆ GetApertureMacroShape()

SHAPE_POLY_SET * APERTURE_MACRO::GetApertureMacroShape ( const GERBER_DRAW_ITEM aParent,
const VECTOR2I aShapePos 
)

◆ GetLastLocalParamDefFromStack()

AM_PARAM & APERTURE_MACRO::GetLastLocalParamDefFromStack ( )

Definition at line 97 of file aperture_macro.cpp.

References m_localParamStack.

Referenced by GERBER_FILE_IMAGE::ReadApertureMacro().

◆ GetLocalParam()

double APERTURE_MACRO::GetLocalParam ( const D_CODE aDcode,
unsigned  aParamId 
) const

Usually, parameters are defined inside the aperture primitive using immediate mode or deferred mode.

In deferred mode the value is defined in a DCODE that want to use the aperture macro. Some parameters are defined outside the aperture primitive and are local to the aperture macro.

Returns
the value of a deferred parameter defined inside the aperture macro.
Parameters
aDcodeis the D_CODE that uses this aperture macro and define deferred parameters.
aParamIdis the param id (defined by $3 or $5 ..) to evaluate.

◆ GetLocalParamValue()

double APERTURE_MACRO::GetLocalParamValue ( int  aIndex)
Returns
the local param value stored in m_localParamValues
Parameters
aIndexis the param Id (from $n) if not found, returns 0

Definition at line 73 of file aperture_macro.cpp.

References m_localParamValues.

Referenced by AM_PARAM::GetValueFromMacro().

◆ InitLocalParams()

void APERTURE_MACRO::InitLocalParams ( const D_CODE aDcode)

Init m_localParamValues to a initial values coming from aDcode and clear m_paramLevelEval must be called once before trying to build the aperture macro shape corresponding to aDcode.

Definition at line 35 of file aperture_macro.cpp.

References D_CODE::GetParam(), D_CODE::GetParamCount(), m_localParamValues, and m_paramLevelEval.

Referenced by GetApertureMacroShape().

Member Data Documentation

◆ m_AmName

wxString APERTURE_MACRO::m_AmName

The name of the aperture macro as defined like AMVB_RECTANGLE* (name is VB_RECTANGLE)

Definition at line 126 of file aperture_macro.h.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), APERTURE_MACRO_less_than::operator()(), GERBER_FILE_IMAGE::ReadApertureMacro(), and GERBER_DRAW_ITEM::ShowGBRShape().

◆ m_localParamStack

AM_PARAMS APERTURE_MACRO::m_localParamStack
private

m_localparamStack handle a list of local deferred parameters

Definition at line 152 of file aperture_macro.h.

Referenced by AddLocalParamDefToStack(), AddPrimitiveToList(), EvalLocalParams(), and GetLastLocalParamDefFromStack().

◆ m_localParamValues

std::map<int, double> APERTURE_MACRO::m_localParamValues
private

m_localParamValues is the current value of local parameters after evaluation the key is the local param id (from $n) and the value is double

Definition at line 158 of file aperture_macro.h.

Referenced by EvalLocalParams(), GetLocalParamValue(), and InitLocalParams().

◆ m_paramLevelEval

int APERTURE_MACRO::m_paramLevelEval
private

the current level of local param values evaluation when a primitive is evaluated, if its m_LocalParamLevel is smaller than m_paramLevelEval, all local params must be evaluated from current m_paramLevelEval upto m_LocalParamLevel before use in this primitive

Definition at line 166 of file aperture_macro.h.

Referenced by EvalLocalParams(), and InitLocalParams().

◆ m_primitivesList

std::vector<AM_PRIMITIVE> APERTURE_MACRO::m_primitivesList
private

A list of AM_PRIMITIVEs to define the shape of the aperture macro.

Definition at line 147 of file aperture_macro.h.

Referenced by AddPrimitiveToList(), and GetApertureMacroShape().

◆ m_shape

SHAPE_POLY_SET APERTURE_MACRO::m_shape
private

The shape of the item, calculated by GetApertureMacroShape.

Definition at line 168 of file aperture_macro.h.

Referenced by GetApertureMacroShape().


The documentation for this class was generated from the following files: