KiCad PCB EDA Suite
|
A gerber DCODE (also called Aperture) definition. More...
#include <dcode.h>
Public Member Functions | |
D_CODE (int num_dcode) | |
~D_CODE () | |
void | Clear_D_CODE_Data () |
void | AppendParam (double aValue) |
Add a parameter to the D_CODE parameter list. | |
unsigned | GetParamCount () const |
Return the number of parameters stored in parameter list. | |
double | GetParam (unsigned aIdx) const |
Return a parameter stored in parameter list. | |
void | SetMacro (APERTURE_MACRO *aMacro) |
APERTURE_MACRO * | GetMacro () const |
void | DrawFlashedShape (const GERBER_DRAW_ITEM *aParent, wxDC *aDC, const COLOR4D &aColor, const VECTOR2I &aShapePos, bool aFilledShape) |
Draw the dcode shape for flashed items. | |
void | DrawFlashedPolygon (const GERBER_DRAW_ITEM *aParent, wxDC *aDC, const COLOR4D &aColor, bool aFilled, const VECTOR2I &aPosition) |
A helper function used to draw the polygon stored in m_PolyCorners. | |
void | ConvertShapeToPolygon (const GERBER_DRAW_ITEM *aParent) |
Convert a shape to an equivalent polygon. | |
int | GetShapeDim (GERBER_DRAW_ITEM *aParent) |
Calculate a value that can be used to evaluate the size of text when displaying the D-Code of an item. | |
Static Public Member Functions | |
static const wxChar * | ShowApertureType (APERTURE_T aType) |
Return a character string telling what type of aperture type aType is. | |
Public Attributes | |
VECTOR2I | m_Size |
Horizontal and vertical dimensions. | |
APERTURE_T | m_ApertType |
Aperture type ( Line, rectangle, circle, oval poly, macro ) | |
int | m_Num_Dcode |
D code value ( >= 10 ) | |
VECTOR2I | m_Drill |
dimension of the hole (if any) (drill file) | |
APERTURE_DEF_HOLETYPE | m_DrillShape |
shape of the hole (0 = no hole, round = 1, rect = 2). | |
EDA_ANGLE | m_Rotation |
shape rotation | |
int | m_EdgesCount |
in aperture definition Polygon only: number of edges for the polygon | |
bool | m_InUse |
false if the aperture (previously defined) is not used to draw something | |
bool | m_Defined |
false if the aperture is not defined in the header | |
wxString | m_AperFunction |
the aperture attribute (created by a TA.AperFunction command). | |
SHAPE_POLY_SET | m_Polygon |
Private Attributes | |
APERTURE_MACRO * | m_Macro |
no ownership, points to GERBER.m_aperture_macros element. | |
std::vector< double > | m_am_params |
parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters would customize the macro. | |
D_CODE::D_CODE | ( | int | num_dcode | ) |
Definition at line 58 of file dcode.cpp.
References Clear_D_CODE_Data(), and m_Num_Dcode.
|
inline |
Add a parameter to the D_CODE parameter list.
Used to customize the corresponding aperture macro.
Definition at line 91 of file dcode.h.
References m_am_params.
Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().
void D_CODE::Clear_D_CODE_Data | ( | ) |
Definition at line 70 of file dcode.cpp.
References ANGLE_0, APT_CIRCLE, APT_DEF_NO_HOLE, DCODE_DEFAULT_SIZE, m_ApertType, m_Defined, m_Drill, m_DrillShape, m_EdgesCount, m_InUse, m_Macro, m_Polygon, m_Rotation, m_Size, SHAPE_POLY_SET::RemoveAllContours(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by D_CODE().
void D_CODE::ConvertShapeToPolygon | ( | const GERBER_DRAW_ITEM * | aParent | ) |
Convert a shape to an equivalent polygon.
Arcs and circles are approximated by segments. Useful when a shape is not a graphic primitive (shape with hole, rotated shape ... ) and cannot be easily drawn.
aParent | is the GERBER_DRAW_ITEM using this DCode. Not used in all shapes, used for APT_MACRO |
Definition at line 297 of file dcode.cpp.
References addHoleToPolygon(), ANGLE_360, ANGLE_90, SHAPE_POLY_SET::Append(), APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, delta, ERROR_INSIDE, gerbIUScale, APERTURE_MACRO::GetApertureMacroShape(), GetMacro(), EDA_ANGLE::IsZero(), m_ApertType, m_Drill, m_DrillShape, m_EdgesCount, m_Polygon, m_Rotation, m_Size, EDA_IU_SCALE::mmToIU(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::RemoveAllContours(), SHAPE_POLY_SET::Rotate(), RotatePoint(), SEGS_CNT, TransformCircleToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), GERBER_DRAW_ITEM::GetBoundingBox(), and GetShapeDim().
void D_CODE::DrawFlashedPolygon | ( | const GERBER_DRAW_ITEM * | aParent, |
wxDC * | aDC, | ||
const COLOR4D & | aColor, | ||
bool | aFilled, | ||
const VECTOR2I & | aPosition | ||
) |
A helper function used to draw the polygon stored in m_PolyCorners.
Draw some Apertures shapes when they are defined as filled polygons. APT_POLYGON is always a polygon, but some complex shapes are also converted to polygons (shapes with holes, some rotated shapes).
aParent | is the GERBER_DRAW_ITEM being drawn. |
aDC | is the device context. |
aColor | is the normal color to use. |
aFilled | set to true to draw in filled mode, false to draw in sketch mode. |
aPosition | is the actual shape position. |
Definition at line 266 of file dcode.cpp.
References SHAPE_POLY_SET::CVertex(), GERBER_DRAW_ITEM::GetABPosition(), GRClosedPoly(), m_Polygon, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::VertexCount(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DrawFlashedShape().
void D_CODE::DrawFlashedShape | ( | const GERBER_DRAW_ITEM * | aParent, |
wxDC * | aDC, | ||
const COLOR4D & | aColor, | ||
const VECTOR2I & | aShapePos, | ||
bool | aFilledShape | ||
) |
Draw the dcode shape for flashed items.
When an item is flashed, the DCode shape is the shape of the item.
aParent | is the GERBER_DRAW_ITEM being drawn. |
aDC | is the device context. |
aColor | is the normal color to use. |
aShapePos | is the actual shape position |
aFilledShape | set to true to draw in filled mode, false to draw in sketch mode |
Definition at line 153 of file dcode.cpp.
References APT_CIRCLE, APT_DEF_NO_HOLE, APT_DEF_ROUND_HOLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, ConvertShapeToPolygon(), delta, DrawFlashedPolygon(), GERBER_DRAW_ITEM::GetABPosition(), GRCircle(), GRCSegm(), GRFilledCircle(), GRFilledRect(), GRFilledSegment(), GRRect(), m_ApertType, m_Drill, m_DrillShape, m_Polygon, m_Size, SHAPE_POLY_SET::OutlineCount(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GERBER_DRAW_ITEM::Print().
|
inline |
Definition at line 125 of file dcode.h.
References m_Macro.
Referenced by ConvertShapeToPolygon(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), fillFlashedGBRITEM(), and GERBER_DRAW_ITEM::ShowGBRShape().
|
inline |
Return a parameter stored in parameter list.
aIdx | is the index of parameter. for n parameters from the Dcode definition, aIdx = 1 .. n, not 0 |
Definition at line 110 of file dcode.h.
References m_am_params.
Referenced by APERTURE_MACRO::InitLocalParams().
|
inline |
Return the number of parameters stored in parameter list.
Definition at line 99 of file dcode.h.
References m_am_params.
Referenced by APERTURE_MACRO::InitLocalParams().
int D_CODE::GetShapeDim | ( | GERBER_DRAW_ITEM * | aParent | ) |
Calculate a value that can be used to evaluate the size of text when displaying the D-Code of an item.
Due to the complexity of some shapes, one cannot calculate the "size" of a shape (only a bounding box) but here, the "dimension" of the shape is the diameter of the primitive or for lines the width of the line if the shape is a line.
aParent | is the parent GERBER_DRAW_ITEM which is actually drawn. |
Definition at line 115 of file dcode.cpp.
References APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, SHAPE_POLY_SET::BBox(), ConvertShapeToPolygon(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), m_ApertType, m_Macro, m_Polygon, m_Size, SHAPE_POLY_SET::OutlineCount(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GERBER_DRAW_ITEM::GetTextD_CodePrms().
|
inline |
Definition at line 120 of file dcode.h.
References m_Macro.
Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().
|
static |
Return a character string telling what type of aperture type aType is.
aType | is the aperture type to show. |
Definition at line 86 of file dcode.cpp.
References APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, and APT_RECT.
Referenced by GERBVIEW_INSPECTION_TOOL::ShowDCodes(), and GERBVIEW_FRAME::updateDCodeSelectBox().
|
private |
parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters would customize the macro.
Definition at line 218 of file dcode.h.
Referenced by AppendParam(), GetParam(), and GetParamCount().
wxString D_CODE::m_AperFunction |
the aperture attribute (created by a TA.AperFunction command).
attached to the D_CODE
Definition at line 203 of file dcode.h.
Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), GERBVIEW_CONTROL::HighlightControl(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), HIGHLIGHT_MENU::update(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().
APERTURE_T D_CODE::m_ApertType |
Aperture type ( Line, rectangle, circle, oval poly, macro )
Definition at line 191 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), KIGFX::GERBVIEW_PAINTER::draw(), DrawFlashedShape(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GBR_TO_PCB_EXPORTER::export_copper_item(), GERBER_DRAW_ITEM::GetBoundingBox(), GetShapeDim(), GERBER_DRAW_ITEM::Print(), EXCELLON_IMAGE::readToolInformation(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), and GERBVIEW_FRAME::updateDCodeSelectBox().
bool D_CODE::m_Defined |
false if the aperture is not defined in the header
Definition at line 202 of file dcode.h.
Referenced by Clear_D_CODE_Data(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), EXCELLON_IMAGE::readToolInformation(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().
VECTOR2I D_CODE::m_Drill |
dimension of the hole (if any) (drill file)
Definition at line 194 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedShape(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().
APERTURE_DEF_HOLETYPE D_CODE::m_DrillShape |
shape of the hole (0 = no hole, round = 1, rect = 2).
Definition at line 195 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().
int D_CODE::m_EdgesCount |
in aperture definition Polygon only: number of edges for the polygon
Definition at line 198 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().
bool D_CODE::m_InUse |
false if the aperture (previously defined) is not used to draw something
Definition at line 200 of file dcode.h.
Referenced by Clear_D_CODE_Data(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), EXCELLON_IMAGE::Select_Tool(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().
|
private |
no ownership, points to GERBER.m_aperture_macros element.
Definition at line 212 of file dcode.h.
Referenced by Clear_D_CODE_Data(), GetMacro(), GetShapeDim(), and SetMacro().
int D_CODE::m_Num_Dcode |
D code value ( >= 10 )
Definition at line 193 of file dcode.h.
Referenced by D_CODE(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), EXCELLON_IMAGE::FinishRouteCommand(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GERBVIEW_CONTROL::HighlightControl(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), HIGHLIGHT_MENU::update(), and GERBVIEW_FRAME::updateDCodeSelectBox().
SHAPE_POLY_SET D_CODE::m_Polygon |
Definition at line 206 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedPolygon(), DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), GERBER_DRAW_ITEM::GetBoundingBox(), GetShapeDim(), GERBER_DRAW_ITEM::HitTest(), and GERBER_DRAW_ITEM::ViewGetLOD().
EDA_ANGLE D_CODE::m_Rotation |
shape rotation
Definition at line 197 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().
VECTOR2I D_CODE::m_Size |
Horizontal and vertical dimensions.
Definition at line 190 of file dcode.h.
Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), EXCELLON_IMAGE::FinishRouteCommand(), GERBER_DRAW_ITEM::GetBoundingBox(), GetShapeDim(), EXCELLON_IMAGE::readToolInformation(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), and GERBVIEW_FRAME::updateDCodeSelectBox().