KiCad PCB EDA Suite
|
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_SET * | GetApertureMacroShape (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_PARAM & | GetLastLocalParamDefFromStack () |
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_PRIMITIVE > | m_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. | |
Support the "aperture macro" defined within standard RS274X.
Definition at line 68 of file aperture_macro.h.
|
inline |
Definition at line 71 of file aperture_macro.h.
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().
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().
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().
SHAPE_POLY_SET * APERTURE_MACRO::GetApertureMacroShape | ( | const GERBER_DRAW_ITEM * | aParent, |
const VECTOR2I & | aShapePos | ||
) |
Calculate the primitive shape for flashed items.
When an item is flashed, this is the shape of the item.
aParent | is the parent GERBER_DRAW_ITEM which is actually drawn. |
aShapePos | is the position of the shape to build. |
Definition at line 103 of file aperture_macro.cpp.
References AMP_COMMENT, SHAPE_POLY_SET::BooleanSubtract(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::Fracture(), GERBER_DRAW_ITEM::GetABPosition(), GERBER_DRAW_ITEM::GetDcodeDescr(), InitLocalParams(), m_primitivesList, m_shape, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::PointCount(), SHAPE_POLY_SET::RemoveAllContours(), SHAPE_LINE_CHAIN::SetPoint(), and SHAPE_POLY_SET::Simplify().
Referenced by D_CODE::ConvertShapeToPolygon(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), and fillFlashedGBRITEM().
AM_PARAM & APERTURE_MACRO::GetLastLocalParamDefFromStack | ( | ) |
Definition at line 97 of file aperture_macro.cpp.
References m_localParamStack.
Referenced by GERBER_FILE_IMAGE::ReadApertureMacro().
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.
aDcode | is the D_CODE that uses this aperture macro and define deferred parameters. |
aParamId | is the param id (defined by $3 or $5 ..) to evaluate. |
double APERTURE_MACRO::GetLocalParamValue | ( | int | aIndex | ) |
aIndex | is 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().
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().
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().
|
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().
|
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().
|
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().
|
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().
|
private |
The shape of the item, calculated by GetApertureMacroShape.
Definition at line 168 of file aperture_macro.h.
Referenced by GetApertureMacroShape().