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

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_MACROGetMacro () 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_MACROm_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.
 

Detailed Description

A gerber DCODE (also called Aperture) definition.

Definition at line 79 of file dcode.h.

Constructor & Destructor Documentation

◆ D_CODE()

D_CODE::D_CODE ( int  num_dcode)

Definition at line 58 of file dcode.cpp.

References Clear_D_CODE_Data(), and m_Num_Dcode.

◆ ~D_CODE()

D_CODE::~D_CODE ( )

Definition at line 65 of file dcode.cpp.

Member Function Documentation

◆ AppendParam()

void D_CODE::AppendParam ( double  aValue)
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().

◆ Clear_D_CODE_Data()

◆ ConvertShapeToPolygon()

void D_CODE::ConvertShapeToPolygon ( const GERBER_DRAW_ITEM aParent)

◆ DrawFlashedPolygon()

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).

Parameters
aParentis the GERBER_DRAW_ITEM being drawn.
aDCis the device context.
aColoris the normal color to use.
aFilledset to true to draw in filled mode, false to draw in sketch mode.
aPositionis 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().

◆ 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.

Parameters
aParentis the GERBER_DRAW_ITEM being drawn.
aDCis the device context.
aColoris the normal color to use.
aShapePosis the actual shape position
aFilledShapeset 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().

◆ GetMacro()

◆ GetParam()

double D_CODE::GetParam ( unsigned  aIdx) const
inline

Return a parameter stored in parameter list.

Parameters
aIdxis 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().

◆ GetParamCount()

unsigned D_CODE::GetParamCount ( ) const
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().

◆ GetShapeDim()

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.

Parameters
aParentis the parent GERBER_DRAW_ITEM which is actually drawn.
Returns
a dimension, or -1 if no dim to calculate.

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().

◆ SetMacro()

void D_CODE::SetMacro ( APERTURE_MACRO aMacro)
inline

Definition at line 120 of file dcode.h.

References m_Macro.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

◆ ShowApertureType()

const wxChar * D_CODE::ShowApertureType ( APERTURE_T  aType)
static

Return a character string telling what type of aperture type aType is.

Parameters
aTypeis 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().

Member Data Documentation

◆ m_am_params

std::vector<double> D_CODE::m_am_params
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().

◆ m_AperFunction

◆ m_ApertType

◆ m_Defined

◆ m_Drill

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().

◆ m_DrillShape

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().

◆ m_EdgesCount

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().

◆ m_InUse

◆ m_Macro

APERTURE_MACRO* D_CODE::m_Macro
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().

◆ m_Num_Dcode

◆ m_Polygon

◆ m_Rotation

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().

◆ m_Size


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