KiCad PCB EDA Suite
GERBER_FILE_IMAGE Class Reference

Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO: move them in GERBER_LAYER class. More...

#include <gerber_file_image.h>

Inheritance diagram for GERBER_FILE_IMAGE:
EDA_ITEM KIGFX::VIEW_ITEM EXCELLON_IMAGE

Public Member Functions

 GERBER_FILE_IMAGE (int layer)
 
virtual ~GERBER_FILE_IMAGE ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
void Clear_GERBER_FILE_IMAGE ()
 
bool LoadGerberFile (const wxString &aFullFileName)
 Read and load a gerber file. More...
 
const wxArrayString & GetMessages () const
 
int GetDcodesCount ()
 
virtual void ResetDefaultValues ()
 
COLOR4D GetPositiveDrawColor () const
 
GERBER_DRAW_ITEMGetItemsList ()
 Function GetItemsList. More...
 
GERBER_LAYERGetLayerParams ()
 Function GetLayerParams. More...
 
bool HasNegativeItems ()
 Function HasNegativeItems. More...
 
void ClearMessageList ()
 Function ClearMessageList Clear the message list Call it before reading a Gerber file. More...
 
void AddMessageToList (const wxString &aMessage)
 Function AddMessageToList Add a message to the message list. More...
 
void InitToolTable ()
 Function InitToolTable. More...
 
wxPoint ReadXYCoord (char *&aText, bool aExcellonMode=false)
 Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) More...
 
wxPoint ReadIJCoord (char *&Text)
 Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are relative, so if coordinate is absent, it's value defaults to 0. More...
 
int GCodeNumber (char *&Text)
 
int DCodeNumber (char *&Text)
 
D_CODEGetDCODEOrCreate (int aDCODE, bool aCreateIfNoExist=true)
 Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
D_CODEGetDCODE (int aDCODE) const
 Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
APERTURE_MACROFindApertureMacro (const APERTURE_MACRO &aLookup)
 Function FindApertureMacro looks up a previously read in aperture macro. More...
 
void StepAndRepeatItem (const GERBER_DRAW_ITEM &aItem)
 Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called when reading a gerber file and after creating a new gerber item that must be repeated (i.e when m_XRepeatCount or m_YRepeatCount are > 1) More...
 
void DisplayImageInfo (GERBVIEW_FRAME *aMainFrame)
 Function DisplayImageInfo has knowledge about the frame and how and where to put status information about this object into the frame's message panel. More...
 
void RemoveAttribute (X2_ATTRIBUTE &aAttribute)
 Function RemoveAttribute. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 

More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () const
 
EDA_ITEMGetParent () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[])
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual void GetMsgPanelInfo (EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList)
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
virtual bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
virtual const EDA_RECT GetBoundingBox () const
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText (EDA_UNITS_T aUnits) const
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
virtual BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

DLIST< GERBER_DRAW_ITEMm_Drawings
 
bool m_InUse
 
bool m_IsVisible
 
COLOR4D m_PositiveDrawColor
 
wxString m_FileName
 
wxString m_ImageName
 
bool m_IsX2_file
 
X2_ATTRIBUTE_FILEFUNCTIONm_FileFunction
 
wxString m_MD5_value
 
wxString m_PartString
 
int m_GraphicLayer
 
bool m_ImageNegative
 
bool m_ImageJustifyXCenter
 
bool m_ImageJustifyYCenter
 
wxPoint m_ImageJustifyOffset
 
bool m_GerbMetric
 
bool m_Relative
 
bool m_NoTrailingZeros
 
wxPoint m_ImageOffset
 
wxSize m_FmtScale
 
wxSize m_FmtLen
 
int m_ImageRotation
 
double m_LocalRotation
 
wxPoint m_Offset
 
wxRealPoint m_Scale
 
bool m_SwapAxis
 
bool m_MirrorA
 
bool m_MirrorB
 
int m_Iterpolation
 
int m_Current_Tool
 
int m_Last_Pen_Command
 
int m_CommandState
 
int m_LineNum
 
wxPoint m_CurrentPos
 
wxPoint m_PreviousPos
 
wxPoint m_IJPos
 
bool m_LastCoordIsIJPos
 
int m_ArcRadius
 
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
 
FILE * m_Current_File
 
int m_Selected_Tool
 
bool m_Has_DCode
 
bool m_Has_MissingDCode
 
bool m_360Arc_enbl
 
bool m_PolygonFillMode
 
int m_PolygonFillModeState
 
APERTURE_MACRO_SET m_aperture_macros
 a collection of APERTURE_MACROS, sorted by name More...
 
GBR_NETLIST_METADATA m_NetAttributeDict
 
wxString m_AperFunction
 
std::map< wxString, int > m_ComponentsList
 
std::map< wxString, int > m_NetnamesList
 

Protected Member Functions

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

char * GetNextLine (char *aBuff, unsigned int aBuffSize, char *aText, FILE *aFile)
 test for an end of line if a end of line is found: read a new line More...
 
bool GetEndOfBlock (char *aBuff, unsigned int aBuffSize, char *&aText, FILE *aGerberFile)
 
bool ReadRS274XCommand (char *aBuff, unsigned int aBuffSize, char *&aText)
 reads a single RS274X command terminated with a % More...
 
bool ExecuteRS274XCommand (int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
 executes a RS274X command More...
 
int ReadXCommandID (char *&text)
 reads two bytes of data and assembles them into an int with the first byte in the sequence put into the most significant part of a 16 bit value to build a RS274X command identifier. More...
 
bool ReadApertureMacro (char *aBuff, unsigned int aBuffSize, char *&text, FILE *gerber_file)
 reads in an aperture macro and saves it in m_aperture_macros. More...
 
bool Execute_G_Command (char *&text, int G_command)
 
bool Execute_DCODE_Command (char *&text, int D_command)
 

Private Attributes

D_CODEm_Aperture_List [TOOLS_MAX_COUNT]
 Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h) More...
 
bool m_Exposure
 whether an aperture macro tool is flashed on or off More...
 
GERBER_LAYER m_GBRLayerParams
 
wxArrayString m_messagesList
 
int m_hasNegativeItems
 

Detailed Description

Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO: move them in GERBER_LAYER class.

Definition at line 107 of file gerber_file_image.h.

Constructor & Destructor Documentation

◆ GERBER_FILE_IMAGE()

GERBER_FILE_IMAGE::GERBER_FILE_IMAGE ( int  layer)

Definition at line 89 of file gerber_file_image.cpp.

89  :
91 {
92  m_GraphicLayer = aLayer; // Graphic layer Number
93  m_IsVisible = true; // must be drawn
94  m_PositiveDrawColor = WHITE; // The color used to draw positive items for this image
95 
96  m_Selected_Tool = 0;
97  m_FileFunction = NULL; // file function parameters
98 
100 
101  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
102  m_Aperture_List[ii] = 0;
103 }
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:62
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
Definition: colors.h:49
virtual void ResetDefaultValues()

References arrayDim(), m_Aperture_List, m_FileFunction, m_GraphicLayer, m_IsVisible, m_PositiveDrawColor, m_Selected_Tool, ResetDefaultValues(), and WHITE.

◆ ~GERBER_FILE_IMAGE()

GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE ( )
virtual

Definition at line 106 of file gerber_file_image.cpp.

107 {
109 
110  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
111  {
112  delete m_Aperture_List[ii];
113  }
114 
115  delete m_FileFunction;
116 }
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:44
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
DLIST< GERBER_DRAW_ITEM > m_Drawings

References arrayDim(), DHEAD::DeleteAll(), m_Aperture_List, m_Drawings, and m_FileFunction.

Member Function Documentation

◆ AddMessageToList()

void GERBER_FILE_IMAGE::AddMessageToList ( const wxString &  aMessage)
inline

◆ Back()

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

219 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:177

References EDA_ITEM::Pback.

Referenced by DHEAD::insert(), and DHEAD::remove().

◆ Clear_GERBER_FILE_IMAGE()

void GERBER_FILE_IMAGE::Clear_GERBER_FILE_IMAGE ( )

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 245 of file base_struct.h.

245 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 266 of file base_struct.h.

266 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::CreateMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), EDIT_POINTS_FACTORY::Make(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 244 of file base_struct.h.

244 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearMessageList()

void GERBER_FILE_IMAGE::ClearMessageList ( )
inline

Function ClearMessageList Clear the message list Call it before reading a Gerber file.

Definition at line 303 of file gerber_file_image.h.

304  {
305  m_messagesList.Clear();
306  }
wxArrayString m_messagesList

References m_messagesList.

Referenced by EXCELLON_IMAGE::LoadFile(), and LoadGerberFile().

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 278 of file base_struct.h.

279  {
281  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, and STARTPOINT.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented in MODULE_ZONE_CONTAINER, D_PAD, SCH_COMPONENT, ZONE_CONTAINER, MODULE, SCH_SHEET, LIB_PIN, SCH_HIERLABEL, VIA, SCH_GLOBALLABEL, DRAWSEGMENT, SCH_LABEL, DIMENSION, TRACK, TEXTE_MODULE, SCH_LINE, SCH_TEXT, SCH_BUS_BUS_ENTRY, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, SCH_NO_CONNECT, LIB_POLYLINE, SCH_JUNCTION, PCB_TARGET, SCH_MARKER, LIB_TEXT, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 121 of file base_struct.cpp.

122 {
123  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
124  wxT( ". Bad programmer!" ) );
125 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), LIB_EDIT_TOOL::Paste(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), LIB_PART::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ DCodeNumber()

int GERBER_FILE_IMAGE::DCodeNumber ( char *&  Text)

Definition at line 434 of file rs274d.cpp.

435 {
436  int ii = 0;
437  char* text;
438  char line[1024];
439 
440  if( Text == NULL )
441  return 0;
442 
443  Text++;
444  text = line;
445  while( IsNumber( *Text ) )
446  *(text++) = *(Text++);
447 
448  *text = 0;
449  ii = atoi( line );
450  return ii;
451 }
#define IsNumber(x)

References IsNumber.

Referenced by Execute_G_Command(), LoadGerberFile(), and EXCELLON_IMAGE::TCodeNumber().

◆ DisplayImageInfo()

void GERBER_FILE_IMAGE::DisplayImageInfo ( GERBVIEW_FRAME aMainFrame)

Function DisplayImageInfo has knowledge about the frame and how and where to put status information about this object into the frame's message panel.

Display info about Image Parameters.

Parameters
aMainFrame= the GERBVIEW_FRAME to display messages

Display info about Image Parameters. These parameters are valid for the entire file, and must set only once (If more than once, only the last value is used)

Definition at line 337 of file gerber_file_image.cpp.

338 {
339  wxString msg;
340 
341  aMainFrame->ClearMsgPanel();
342 
343  // Display Image name (Image specific)
344  aMainFrame->AppendMsgPanel( _( "Image name" ), m_ImageName, CYAN );
345 
346  // Display graphic layer number used to draw this Image
347  // (not a Gerber parameter but is also image specific)
348  msg.Printf( wxT( "%d" ), m_GraphicLayer + 1 );
349  aMainFrame->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );
350 
351  // Display Image rotation (Image specific)
352  msg.Printf( wxT( "%d" ), m_ImageRotation );
353  aMainFrame->AppendMsgPanel( _( "Img Rot." ), msg, CYAN );
354 
355  // Display Image polarity (Image specific)
356  msg = m_ImageNegative ? _("Negative") : _("Normal");
357  aMainFrame->AppendMsgPanel( _( "Polarity" ), msg, BROWN );
358 
359  // Display Image justification and offset for justification (Image specific)
360  msg = m_ImageJustifyXCenter ? _("Center") : _("Normal");
361  aMainFrame->AppendMsgPanel( _( "X Justify" ), msg, DARKRED );
362 
363  msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
364  aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
365 
366  if( aMainFrame->GetUserUnits() == INCHES )
367  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
368  Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
369  else
370  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Millimeter( m_ImageJustifyOffset.x ),
371  Iu2Millimeter( m_ImageJustifyOffset.y ) );
372 
373  aMainFrame->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
374 }
Definition: colors.h:54
Definition: common.h:134
Definition: colors.h:59
virtual void ClearMsgPanel()
Clear all messages from the message panel.
#define _(s)
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
Definition: colors.h:62

References _, EDA_DRAW_FRAME::AppendMsgPanel(), BROWN, EDA_DRAW_FRAME::ClearMsgPanel(), CYAN, DARKRED, EDA_BASE_FRAME::GetUserUnits(), INCHES, m_GraphicLayer, m_ImageJustifyOffset, m_ImageJustifyXCenter, m_ImageJustifyYCenter, m_ImageName, m_ImageNegative, and m_ImageRotation.

Referenced by GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ Execute_DCODE_Command()

bool GERBER_FILE_IMAGE::Execute_DCODE_Command ( char *&  text,
int  D_command 
)
private

Definition at line 582 of file rs274d.cpp.

583 {
584  wxSize size( 15, 15 );
585 
586  APERTURE_T aperture = APT_CIRCLE;
587  GERBER_DRAW_ITEM* gbritem;
588 
589  int dcode = 0;
590  D_CODE* tool = NULL;
591  wxString msg;
592 
593  if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
594  {
595  if( D_commande > (TOOLS_MAX_COUNT - 1) )
596  D_commande = TOOLS_MAX_COUNT - 1;
597 
598  // remember which tool is selected, nothing is done with it in this
599  // call
600  m_Current_Tool = D_commande;
601 
602  D_CODE* pt_Dcode = GetDCODE( D_commande );
603 
604  if( pt_Dcode )
605  pt_Dcode->m_InUse = true;
606  else
607  m_Has_MissingDCode = true;
608 
609  return true;
610  }
611  else // D_commande = 0..9: this is a pen command (usually D1, D2 or D3)
612  {
613  m_Last_Pen_Command = D_commande;
614  }
615 
616  if( m_PolygonFillMode ) // Enter a polygon description:
617  {
618  switch( D_commande )
619  {
620  case 1: // code D01 Draw line, exposure ON
621  if( !m_Exposure ) // Start a new polygon outline:
622  {
623  m_Exposure = true;
624  gbritem = new GERBER_DRAW_ITEM( this );
625  m_Drawings.Append( gbritem );
626  gbritem->m_Shape = GBR_POLYGON;
627  gbritem->m_Flashed = false;
628  gbritem->m_DCode = 0; // No DCode for a Polygon (Region in Gerber dialect)
629 
630 
631  if( gbritem->m_GerberImageFile )
632  {
634  gbritem->m_AperFunction = gbritem->m_GerberImageFile->m_AperFunction;
635  }
636  }
637 
638  switch( m_Iterpolation )
639  {
642  gbritem = m_Drawings.GetLast();
643 
644  fillArcPOLY( gbritem, m_PreviousPos,
646  ( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
647  m_360Arc_enbl, GetLayerParams().m_LayerNegative );
648  break;
649 
650  default:
651  gbritem = m_Drawings.GetLast();
652 
653  gbritem->m_Start = m_PreviousPos; // m_Start is used as temporary storage
654  if( gbritem->m_Polygon.OutlineCount() == 0 )
655  {
656  gbritem->m_Polygon.NewOutline();
657  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_Start ) );
658  }
659 
660  gbritem->m_End = m_CurrentPos; // m_End is used as temporary storage
661  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_End ) );
662  break;
663  }
664 
667  break;
668 
669  case 2: // code D2: exposure OFF (i.e. "move to")
670  if( m_Exposure && GetItemsList() ) // End of polygon
671  {
672  gbritem = m_Drawings.GetLast();
673  gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
674  StepAndRepeatItem( *gbritem );
675  }
676  m_Exposure = false;
679  break;
680 
681  default:
682  return false;
683  }
684  }
685  else
686  {
687  switch( D_commande )
688  {
689  case 1: // code D01 Draw line, exposure ON
690  m_Exposure = true;
691 
692  tool = GetDCODE( m_Current_Tool );
693 
694  if( tool )
695  {
696  size = tool->m_Size;
697  dcode = tool->m_Num_Dcode;
698  aperture = tool->m_Shape;
699  }
700 
701  switch( m_Iterpolation )
702  {
704  gbritem = new GERBER_DRAW_ITEM( this );
705  m_Drawings.Append( gbritem );
706 
707  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
708  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
709  StepAndRepeatItem( *gbritem );
710  break;
711 
714  gbritem = new GERBER_DRAW_ITEM( this );
715  m_Drawings.Append( gbritem );
716 
717  if( m_LastCoordIsIJPos )
718  {
719  fillArcGBRITEM( gbritem, dcode, m_PreviousPos,
720  m_CurrentPos, m_IJPos, size,
722  false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
723  m_LastCoordIsIJPos = false;
724  }
725  else
726  {
727  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
728  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
729  }
730 
731  StepAndRepeatItem( *gbritem );
732 
733  break;
734 
735  default:
736  msg.Printf( wxT( "RS274D: DCODE Command: interpol error (type %X)" ),
737  m_Iterpolation );
738  AddMessageToList( msg );
739  break;
740  }
741 
743  break;
744 
745  case 2: // code D2: exposure OFF (i.e. "move to")
746  m_Exposure = false;
748  break;
749 
750  case 3: // code D3: flash aperture
751  tool = GetDCODE( m_Current_Tool );
752  if( tool )
753  {
754  size = tool->m_Size;
755  dcode = tool->m_Num_Dcode;
756  aperture = tool->m_Shape;
757  }
758 
759  gbritem = new GERBER_DRAW_ITEM( this );
760  m_Drawings.Append( gbritem );
761  fillFlashedGBRITEM( gbritem, aperture, dcode, m_CurrentPos,
762  size, GetLayerParams().m_LayerNegative );
763  StepAndRepeatItem( *gbritem );
765  break;
766 
767  default:
768  return false;
769  }
770  }
771 
772  return true;
773 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
int OutlineCount() const
Returns the number of outlines in the set
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
static void fillArcPOLY(GERBER_DRAW_ITEM *aGbrItem, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &rel_center, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcPOLY creates an arc G code when found in poly outlines.
Definition: rs274d.cpp:334
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:170
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
void SetNetAttributes(const GBR_NETLIST_METADATA &aNetAttributes)
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Function fillLineGBRITEM initializes a given GBRITEM so that it can draw a linear D code.
Definition: rs274d.cpp:158
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
SHAPE_POLY_SET m_Polygon
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
#define FIRST_DCODE
Definition: dcode.h:71
APERTURE_T
Enum APERTURE_T is the set of all gerber aperture types allowed, according to page 16 of http://gerbv...
Definition: dcode.h:50
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
int NewOutline()
Creates a new empty polygon in the set and returns its index
void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcGBRITEM initializes a given GBRITEM so that it can draw an arc G code.
Definition: rs274d.cpp:207
bool m_Exposure
whether an aperture macro tool is flashed on or off
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const wxPoint &aPos, wxSize aSize, bool aLayerNegative)
Function fillFlashedGBRITEM initializes a given GBRITEM so that it can draw a circle which is filled ...
Definition: rs274d.cpp:103
DLIST< GERBER_DRAW_ITEM > m_Drawings
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
GBR_NETLIST_METADATA m_NetAttributeDict
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
GERBER_FILE_IMAGE * m_GerberImageFile
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
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)

References AddMessageToList(), DLIST< T >::Append(), SHAPE_POLY_SET::Append(), APT_CIRCLE, fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), fillLineGBRITEM(), FIRST_DCODE, GBR_POLYGON, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GetDCODE(), GetItemsList(), DLIST< T >::GetLast(), GetLayerParams(), m_360Arc_enbl, GERBER_DRAW_ITEM::m_AperFunction, m_AperFunction, m_Current_Tool, m_CurrentPos, GERBER_DRAW_ITEM::m_DCode, m_Drawings, GERBER_DRAW_ITEM::m_End, m_Exposure, GERBER_DRAW_ITEM::m_Flashed, GERBER_DRAW_ITEM::m_GerberImageFile, m_Has_MissingDCode, m_IJPos, D_CODE::m_InUse, m_Iterpolation, m_Last_Pen_Command, m_LastCoordIsIJPos, m_NetAttributeDict, D_CODE::m_Num_Dcode, GERBER_DRAW_ITEM::m_Polygon, m_PolygonFillMode, m_PolygonFillModeState, m_PreviousPos, GERBER_DRAW_ITEM::m_Shape, D_CODE::m_Shape, D_CODE::m_Size, GERBER_DRAW_ITEM::m_Start, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), GERBER_DRAW_ITEM::SetNetAttributes(), StepAndRepeatItem(), TOOLS_MAX_COUNT, and SHAPE_POLY_SET::Vertex().

Referenced by LoadGerberFile().

◆ Execute_G_Command()

bool GERBER_FILE_IMAGE::Execute_G_Command ( char *&  text,
int  G_command 
)
private

Definition at line 454 of file rs274d.cpp.

455 {
456 // D( printf( "%22s: G_CODE<%d>\n", __func__, G_command ); )
457 
458  switch( G_command )
459  {
460  case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can
461  // be safely ignored
462  break;
463 
466  break;
467 
470  break;
471 
474  break;
475 
476  case GC_COMMENT:
477  // Skip comment, but only if the line does not start by "G04 #@! "
478  // which is a metadata, i.e. a X2 command inside the comment.
479  // this comment is called a "structured comment"
480  if( strncmp( text, " #@! ", 5 ) == 0 )
481  {
482  text += 5;
483  // The string starting at text is the same as the X2 attribute,
484  // but a X2 attribute ends by '%'. So we build the X2 attribute string
485  std::string x2buf;
486 
487  while( *text && (*text != '*') )
488  {
489  x2buf += *text;
490  text++;
491  }
492  // add the end of X2 attribute string
493  x2buf += "*%";
494  x2buf += '\0';
495 
496  char* cptr = (char*)x2buf.data();
497  int code_command = ReadXCommandID( cptr );
498  ExecuteRS274XCommand( code_command, NULL, 0, cptr );
499  }
500 
501  while( *text && (*text != '*') )
502  text++;
503  break;
504 
505  case GC_SELECT_TOOL:
506  {
507  int D_commande = DCodeNumber( text );
508 
509  if( D_commande < FIRST_DCODE )
510  return false;
511  if( D_commande > (TOOLS_MAX_COUNT - 1) )
512  D_commande = TOOLS_MAX_COUNT - 1;
513  m_Current_Tool = D_commande;
514  D_CODE* pt_Dcode = GetDCODE( D_commande );
515 
516  if( pt_Dcode )
517  pt_Dcode->m_InUse = true;
518 
519  break;
520  }
521 
522  case GC_SPECIFY_INCHES:
523  m_GerbMetric = false; // false = Inches, true = metric
524  break;
525 
527  m_GerbMetric = true; // false = Inches, true = metric
528  break;
529 
530  case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
531  m_360Arc_enbl = false;
532  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
533  break;
534 
536  m_360Arc_enbl = true;
537  break;
538 
540  m_Relative = false; // false = absolute Coord, true = relative
541  // Coord
542  break;
543 
545  m_Relative = true; // false = absolute Coord, true = relative
546  // Coord
547  break;
548 
550  m_PolygonFillMode = true;
551  m_Exposure = false;
552  break;
553 
555  if( m_Exposure && GetItemsList() ) // End of polygon
556  {
557  GERBER_DRAW_ITEM * gbritem = m_Drawings.GetLast();
558  gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
559  StepAndRepeatItem( *gbritem );
560  }
561  m_Exposure = false;
562  m_PolygonFillMode = false;
564  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
565  break;
566 
567  case GC_MOVE: // Non existent
568  default:
569  {
570  wxString msg;
571  msg.Printf( wxT( "G%0.2d command not handled" ), G_command );
572  AddMessageToList( msg );
573  return false;
574  }
575  }
576 
577 
578  return true;
579 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty.
Definition: dlist.h:170
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
SHAPE_POLY_SET m_Polygon
int ReadXCommandID(char *&text)
reads two bytes of data and assembles them into an int with the first byte in the sequence put into t...
Definition: rs274x.cpp:115
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
bool ExecuteRS274XCommand(int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
executes a RS274X command
Definition: rs274x.cpp:196
#define FIRST_DCODE
Definition: dcode.h:71
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:434
bool m_Exposure
whether an aperture macro tool is flashed on or off
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
DLIST< GERBER_DRAW_ITEM > m_Drawings
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
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)

References AddMessageToList(), SHAPE_POLY_SET::Append(), DCodeNumber(), ExecuteRS274XCommand(), FIRST_DCODE, GC_CIRCLE_NEG_INTERPOL, GC_CIRCLE_POS_INTERPOL, GC_COMMENT, GC_LINEAR_INTERPOL_1X, GC_MOVE, GC_PHOTO_MODE, GC_SELECT_TOOL, GC_SPECIFY_ABSOLUES_COORD, GC_SPECIFY_INCHES, GC_SPECIFY_MILLIMETERS, GC_SPECIFY_RELATIVEES_COORD, GC_TURN_OFF_360_INTERPOL, GC_TURN_OFF_POLY_FILL, GC_TURN_ON_360_INTERPOL, GC_TURN_ON_POLY_FILL, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GetDCODE(), GetItemsList(), DLIST< T >::GetLast(), m_360Arc_enbl, m_Current_Tool, m_Drawings, m_Exposure, m_GerbMetric, D_CODE::m_InUse, m_Iterpolation, GERBER_DRAW_ITEM::m_Polygon, m_PolygonFillMode, m_PolygonFillModeState, m_Relative, ReadXCommandID(), StepAndRepeatItem(), TOOLS_MAX_COUNT, and SHAPE_POLY_SET::Vertex().

Referenced by LoadGerberFile().

◆ ExecuteRS274XCommand()

bool GERBER_FILE_IMAGE::ExecuteRS274XCommand ( int  aCommand,
char *  aBuff,
unsigned int  aBuffSize,
char *&  aText 
)
private

executes a RS274X command

Definition at line 196 of file rs274x.cpp.

198 {
199  int code;
200  int seq_len; // not used, just provided
201  int seq_char;
202  bool ok = true;
203  wxString msg;
204  double fcoord;
205  bool x_fmt_known = false;
206  bool y_fmt_known = false;
207 
208  // conv_scale = scaling factor from inch to Internal Unit
209  double conv_scale = IU_PER_MILS * 1000;
210 
211  if( m_GerbMetric )
212  conv_scale /= 25.4;
213 
214  switch( aCommand )
215  {
216  case FORMAT_STATEMENT:
217  seq_len = 2;
218 
219  while( *aText != '*' )
220  {
221  switch( *aText )
222  {
223  case ' ':
224  aText++;
225  break;
226 
227  case 'D': // Non-standard option for all zeros (leading + tailing)
228  msg.Printf( _( "RS274X: Invalid GERBER format command '%c' at line %d: \"%s\"" ),
229  'D', m_LineNum, aBuff );
230  AddMessageToList( msg );
231  msg.Printf( _("GERBER file \"%s\" may not display as intended." ),
232  m_FileName.ToAscii() );
233  AddMessageToList( msg );
234  // Fallthrough
235 
236  case 'L': // No Leading 0
237  m_NoTrailingZeros = false;
238  aText++;
239  break;
240 
241  case 'T': // No trailing 0
242  m_NoTrailingZeros = true;
243  aText++;
244  break;
245 
246  case 'A': // Absolute coord
247  m_Relative = false;
248  aText++;
249  break;
250 
251  case 'I': // Relative coord
252  m_Relative = true;
253  aText++;
254  break;
255 
256  case 'G':
257  case 'N': // Sequence code (followed by one digit: the sequence len)
258  // (sometimes found before the X,Y sequence)
259  // Obscure option
260  aText++;
261  seq_char = *aText++;
262  if( (seq_char >= '0') && (seq_char <= '9') )
263  seq_len = seq_char - '0';
264  break;
265 
266  case 'M': // Sequence code (followed by one digit: the sequence len)
267  // (sometimes found after the X,Y sequence)
268  // Obscure option
269  code = *aText++;
270  if( ( *aText >= '0' ) && ( *aText<= '9' ) )
271  aText++; // skip the digit
272  break;
273 
274  case 'X':
275  case 'Y':
276  {
277  code = *(aText++);
278  char ctmp = *(aText++) - '0';
279  if( code == 'X' )
280  {
281  x_fmt_known = true;
282  // number of digits after the decimal point (0 to 7 allowed)
283  m_FmtScale.x = *aText - '0';
284  m_FmtLen.x = ctmp + m_FmtScale.x;
285 
286  // m_FmtScale is 0 to 7
287  // (Old Gerber specification was 0 to 6)
288  if( m_FmtScale.x < 0 )
289  m_FmtScale.x = 0;
290  if( m_FmtScale.x > 7 )
291  m_FmtScale.x = 7;
292  }
293  else
294  {
295  y_fmt_known = true;
296  m_FmtScale.y = *aText - '0';
297  m_FmtLen.y = ctmp + m_FmtScale.y;
298  if( m_FmtScale.y < 0 )
299  m_FmtScale.y = 0;
300  if( m_FmtScale.y > 7 )
301  m_FmtScale.y = 7;
302  }
303  aText++;
304  }
305  break;
306 
307  case '*':
308  break;
309 
310  default:
311  msg.Printf( wxT( "Unknown id (%c) in FS command" ),
312  *aText );
313  AddMessageToList( msg );
314  GetEndOfBlock( aBuff, aBuffSize, aText, m_Current_File );
315  ok = false;
316  break;
317  }
318  }
319  if( !x_fmt_known || !y_fmt_known )
320  AddMessageToList( wxT( "RS274X: Format Statement (FS) without X or Y format" ) );
321 
322  break;
323 
324  case AXIS_SELECT: // command ASAXBY*% or %ASAYBX*%
325  m_SwapAxis = false;
326  if( strncasecmp( aText, "AYBX", 4 ) == 0 )
327  m_SwapAxis = true;
328  break;
329 
330  case MIRROR_IMAGE: // command %MIA0B0*%, %MIA0B1*%, %MIA1B0*%, %MIA1B1*%
331  m_MirrorA = m_MirrorB = 0;
332  while( *aText && *aText != '*' )
333  {
334  switch( *aText )
335  {
336  case 'A': // Mirror A axis ?
337  aText++;
338  if( *aText == '1' )
339  m_MirrorA = true;
340  break;
341 
342  case 'B': // Mirror B axis ?
343  aText++;
344  if( *aText == '1' )
345  m_MirrorB = true;
346  break;
347 
348  default:
349  aText++;
350  break;
351  }
352  }
353  break;
354 
355  case MODE_OF_UNITS:
356  code = ReadXCommandID( aText );
357  if( code == INCH )
358  m_GerbMetric = false;
359  else if( code == MILLIMETER )
360  m_GerbMetric = true;
361  conv_scale = m_GerbMetric ? IU_PER_MILS / 25.4 : IU_PER_MILS;
362  break;
363 
364  case FILE_ATTRIBUTE: // Command %TF ...
365  m_IsX2_file = true;
366  {
368  dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum );
369 
370  if( dummy.IsFileFunction() )
371  {
372  delete m_FileFunction;
374  }
375  else if( dummy.IsFileMD5() )
376  {
377  m_MD5_value = dummy.GetPrm( 1 );
378  }
379  else if( dummy.IsFilePart() )
380  {
381  m_PartString = dummy.GetPrm( 1 );
382  }
383  }
384  break;
385 
386  case APERTURE_ATTRIBUTE: // Command %TA
387  {
389  dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum );
390 
391  if( dummy.GetAttribute() == ".AperFunction" )
392  {
393  m_AperFunction = dummy.GetPrm( 1 );
394 
395  // A few function values can have other parameters. Add them
396  for( int ii = 2; ii < dummy.GetPrmCount(); ii++ )
397  m_AperFunction << "," << dummy.GetPrm( ii );
398  }
399  }
400  break;
401 
402  case NET_ATTRIBUTE: // Command %TO currently %TO.P %TO.N and %TO.C
403  {
405 
406  dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum );
407 
408  if( dummy.GetAttribute() == ".N" )
409  {
412  }
413  else if( dummy.GetAttribute() == ".C" )
414  {
417  }
418  else if( dummy.GetAttribute() == ".P" )
419  {
423  }
424  }
425  break;
426 
427  case REMOVE_APERTURE_ATTRIBUTE: // Command %TD ...
428  {
430  dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum );
432  }
433  break;
434 
435  case OFFSET: // command: OFAnnBnn (nn = float number) = layer Offset
436  m_Offset.x = m_Offset.y = 0;
437  while( *aText != '*' )
438  {
439  switch( *aText )
440  {
441  case 'A': // A axis offset in current unit (inch or mm)
442  aText++;
443  fcoord = ReadDouble( aText );
444  m_Offset.x = KiROUND( fcoord * conv_scale );
445  break;
446 
447  case 'B': // B axis offset in current unit (inch or mm)
448  aText++;
449  fcoord = ReadDouble( aText );
450  m_Offset.y = KiROUND( fcoord * conv_scale );
451  break;
452  }
453  }
454  break;
455 
456  case SCALE_FACTOR:
457  m_Scale.x = m_Scale.y = 1.0;
458  while( *aText != '*' )
459  {
460  switch( *aText )
461  {
462  case 'A': // A axis scale
463  aText++;
464  m_Scale.x = ReadDouble( aText );
465  break;
466 
467  case 'B': // B axis scale
468  aText++;
469  m_Scale.y = ReadDouble( aText );
470  break;
471  }
472  }
473  break;
474 
475  case IMAGE_OFFSET: // command: IOAnnBnn (nn = float number) = Image Offset
476  m_ImageOffset.x = m_ImageOffset.y = 0;
477  while( *aText != '*' )
478  {
479  switch( *aText )
480  {
481  case 'A': // A axis offset in current unit (inch or mm)
482  aText++;
483  fcoord = ReadDouble( aText );
484  m_ImageOffset.x = KiROUND( fcoord * conv_scale );
485  break;
486 
487  case 'B': // B axis offset in current unit (inch or mm)
488  aText++;
489  fcoord = ReadDouble( aText );
490  m_ImageOffset.y = KiROUND( fcoord * conv_scale );
491  break;
492  }
493  }
494  break;
495 
496  case IMAGE_ROTATION: // command IR0* or IR90* or IR180* or IR270*
497  if( strncasecmp( aText, "0*", 2 ) == 0 )
498  m_ImageRotation = 0;
499  else if( strncasecmp( aText, "90*", 3 ) == 0 )
500  m_ImageRotation = 90;
501  else if( strncasecmp( aText, "180*", 4 ) == 0 )
502  m_ImageRotation = 180;
503  else if( strncasecmp( aText, "270*", 4 ) == 0 )
504  m_ImageRotation = 270;
505  else
506  AddMessageToList( _( "RS274X: Command \"IR\" rotation value not allowed" ) );
507  break;
508 
509  case STEP_AND_REPEAT: // command SR, like %SRX3Y2I5.0J2*%
510  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
512  GetLayerParams().m_StepForRepeat.x = 0.0; // offset for Step and Repeat command
514  GetLayerParams().m_YRepeatCount = 1; // The repeat count
515  GetLayerParams().m_StepForRepeatMetric = m_GerbMetric; // the step units
516  while( *aText && *aText != '*' )
517  {
518  switch( *aText )
519  {
520  case 'I': // X axis offset
521  aText++;
523  break;
524 
525  case 'J': // Y axis offset
526  aText++;
528  break;
529 
530  case 'X': // X axis repeat count
531  aText++;
533  break;
534 
535  case 'Y': // Y axis offset
536  aText++;
538  break;
539  default:
540  aText++;
541  break;
542  }
543  }
544  break;
545 
546  case IMAGE_JUSTIFY: // Command IJAnBn*
547  m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
548  m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
549  m_ImageJustifyOffset = wxPoint(0,0); // Image Justify Offset on XY axis (default = 0,0)
550  while( *aText && *aText != '*' )
551  {
552  // IJ command is (for A or B axis) AC or AL or A<coordinate>
553  switch( *aText )
554  {
555  case 'A': // A axis justify
556  aText++;
557  if( *aText == 'C' )
558  {
559  m_ImageJustifyXCenter = true;
560  aText++;
561  }
562  else if( *aText == 'L' )
563  {
564  m_ImageJustifyXCenter = true;
565  aText++;
566  }
567  else m_ImageJustifyOffset.x = KiROUND( ReadDouble( aText ) * conv_scale);
568  break;
569 
570  case 'B': // B axis justify
571  aText++;
572  if( *aText == 'C' )
573  {
574  m_ImageJustifyYCenter = true;
575  aText++;
576  }
577  else if( *aText == 'L' )
578  {
579  m_ImageJustifyYCenter = true;
580  aText++;
581  }
582  else m_ImageJustifyOffset.y = KiROUND( ReadDouble( aText ) * conv_scale);
583  break;
584  default:
585  aText++;
586  break;
587  }
588  }
590  m_ImageJustifyOffset.x = 0;
592  m_ImageJustifyOffset.y = 0;
593  break;
594 
595  case KNOCKOUT:
596  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
597  msg = _( "RS274X: Command KNOCKOUT ignored by GerbView" ) ;
598  AddMessageToList( msg );
599  break;
600 
601  case ROTATE: // Layer rotation: command like %RO45*%
602  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
603  m_LocalRotation =ReadDouble( aText ); // Store layer rotation in degrees
604  break;
605 
606  case IMAGE_NAME:
607  m_ImageName.Empty();
608  while( *aText != '*' )
609  {
610  m_ImageName.Append( *aText++ );
611  }
612 
613  break;
614 
615  case LOAD_NAME:
616  // %LN is a (deprecated) equivalentto G04: a comment
617  while( *aText && *aText != '*' )
618  {
619  aText++; // Skip text
620  }
621 
622  break;
623 
624  case IMAGE_POLARITY:
625  if( strncasecmp( aText, "NEG", 3 ) == 0 )
626  m_ImageNegative = true;
627  else
628  m_ImageNegative = false;
629 
630  break;
631 
632  case LOAD_POLARITY:
633  if( *aText == 'C' )
635  else
637 
638  break;
639 
640  case AP_MACRO: // lines like %AMMYMACRO*
641  // 5,1,8,0,0,1.08239X$1,22.5*
642  // %
643  /*ok = */ReadApertureMacro( aBuff, aBuffSize, aText, m_Current_File );
644  break;
645 
646  case AP_DEFINITION:
647  /* input example: %ADD30R,0.081800X0.101500*%
648  * Aperture definition has 4 options: C, R, O, P
649  * (Circle, Rect, Oval, regular Polygon)
650  * and shapes can have a hole (round or rectangular).
651  * All optional parameters values start by X
652  * at this point, text points to 2nd 'D'
653  */
654  if( *aText++ != 'D' )
655  {
656  ok = false;
657  break;
658  }
659 
660  m_Has_DCode = true;
661 
662  code = ReadInt( aText );
663 
664  D_CODE* dcode;
665  dcode = GetDCODEOrCreate( code );
666 
667  if( dcode == NULL )
668  break;
669 
671 
672  // at this point, text points to character after the ADD<num>,
673  // i.e. R in example above. If aText[0] is one of the usual
674  // apertures: (C,R,O,P), there is a comma after it.
675  if( aText[1] == ',' )
676  {
677  char stdAperture = *aText;
678 
679  aText += 2; // skip "C," for example
680 
681  dcode->m_Size.x = KiROUND( ReadDouble( aText ) * conv_scale );
682  dcode->m_Size.y = dcode->m_Size.x;
683 
684  switch( stdAperture ) // Aperture desceiption has optional parameters. Read them
685  {
686  case 'C': // Circle
687  dcode->m_Shape = APT_CIRCLE;
688  while( *aText == ' ' )
689  aText++;
690 
691  if( *aText == 'X' )
692  {
693  aText++;
694  dcode->m_Drill.x = dcode->m_Drill.y =
695  KiROUND( ReadDouble( aText ) * conv_scale );
697  }
698 
699  while( *aText == ' ' )
700  aText++;
701 
702  if( *aText == 'X' )
703  {
704  aText++;
705  dcode->m_Drill.y =
706  KiROUND( ReadDouble( aText ) * conv_scale );
707 
709  }
710  dcode->m_Defined = true;
711  break;
712 
713  case 'O': // oval
714  case 'R': // rect
715  dcode->m_Shape = (stdAperture == 'O') ? APT_OVAL : APT_RECT;
716 
717  while( *aText == ' ' )
718  aText++;
719 
720  if( *aText == 'X' )
721  {
722  aText++;
723  dcode->m_Size.y =
724  KiROUND( ReadDouble( aText ) * conv_scale );
725  }
726 
727  while( *aText == ' ' )
728  aText++;
729 
730  if( *aText == 'X' )
731  {
732  aText++;
733  dcode->m_Drill.x = KiROUND( ReadDouble( aText ) * conv_scale );
734  dcode->m_Drill.y = dcode->m_Drill.x;
736  }
737 
738  while( *aText == ' ' )
739  aText++;
740 
741  if( *aText == 'X' )
742  {
743  aText++;
744  dcode->m_Drill.y =
745  KiROUND( ReadDouble( aText ) * conv_scale );
747  }
748  dcode->m_Defined = true;
749  break;
750 
751  case 'P':
752 
753  /* Regular polygon: a command line like %ADD12P,0.040X10X25X0.025X0.025X0.0150*%
754  * params are: <diameter>, X<edge count>, X<Rotation>, X<X hole dim>, X<Y hole dim>
755  */
756  dcode->m_Shape = APT_POLYGON;
757  while( *aText == ' ' )
758  aText++;
759 
760  if( *aText == 'X' )
761  {
762  aText++;
763  dcode->m_EdgesCount = ReadInt( aText );
764  }
765 
766  while( *aText == ' ' )
767  aText++;
768 
769  if( *aText == 'X' )
770  {
771  aText++;
772  dcode->m_Rotation = ReadDouble( aText );
773  }
774 
775  while( *aText == ' ' )
776  aText++;
777 
778  if( *aText == 'X' )
779  {
780  aText++;
781  dcode->m_Drill.x = KiROUND( ReadDouble( aText ) * conv_scale );
782  dcode->m_Drill.y = dcode->m_Drill.x;
784  }
785 
786  while( *aText == ' ' )
787  aText++;
788 
789  if( *aText == 'X' )
790  {
791  aText++;
792  dcode->m_Drill.y = KiROUND( ReadDouble( aText ) * conv_scale );
794  }
795  dcode->m_Defined = true;
796  break;
797  }
798  }
799  else // aText[0] starts an aperture macro name
800  {
801  APERTURE_MACRO am_lookup;
802 
803  while( *aText && *aText != '*' && *aText != ',' )
804  am_lookup.name.Append( *aText++ );
805 
806  // When an aperture definition is like %AMLINE2* 22,1,$1,$2,0,0,-45*
807  // the ADDxx<MACRO_NAME> command has parameters, like %ADD14LINE2,0.8X0.5*%
808  if( *aText == ',' )
809  { // Read aperture macro parameters and store them
810  aText++; // aText points the first parameter
811 
812  while( *aText && *aText != '*' )
813  {
814  double param = ReadDouble( aText );
815  dcode->AppendParam( param );
816 
817  while( isspace( *aText ) )
818  aText++;
819 
820  // Skip 'X' separator:
821  if( *aText == 'X' || *aText == 'x' )
822  aText++;
823  }
824  }
825 
826  // lookup the aperture macro here.
827  APERTURE_MACRO* pam = FindApertureMacro( am_lookup );
828 
829  if( !pam )
830  {
831  msg.Printf( wxT( "RS274X: aperture macro %s not found\n" ),
832  TO_UTF8( am_lookup.name ) );
833  AddMessageToList( msg );
834  ok = false;
835  break;
836  }
837 
838  dcode->m_Shape = APT_MACRO;
839  dcode->SetMacro( pam );
840  }
841 
842  break;
843 
844  default:
845  ok = false;
846  break;
847  }
848 
849  (void) seq_len; // quiet g++, or delete the unused variable.
850 
851  ok = GetEndOfBlock( aBuff, aBuffSize, aText, m_Current_File );
852 
853  return ok;
854 }
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF....
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma
wxString name
The name of the aperture macro.
Definition: am_primitive.h:165
print info associated to a component (TO.C attribute)
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
Definition: dcode.h:53
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
double m_Rotation
shape rotation in degrees
Definition: dcode.h:99
wxSize m_Drill
dimension of the hole (if any) (draill file)
Definition: dcode.h:97
wxRealPoint m_StepForRepeat
wxString m_Cmpref
the component reference parent of the data
int ReadXCommandID(char *&text)
reads two bytes of data and assembles them into an int with the first byte in the sequence put into t...
Definition: rs274x.cpp:115
Definition: dcode.h:52
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
void AppendParam(double aValue)
AppendParam() Add a parameter to the D_CODE parameter list.
Definition: dcode.h:122
wxString m_Netname
for items associated to a net: the netname
APERTURE_MACRO * FindApertureMacro(const APERTURE_MACRO &aLookup)
Function FindApertureMacro looks up a previously read in aperture macro.
bool m_StepForRepeatMetric
#define _(s)
bool ReadApertureMacro(char *aBuff, unsigned int aBuffSize, char *&text, FILE *gerber_file)
reads in an aperture macro and saves it in m_aperture_macros.
Definition: rs274x.cpp:911
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE
Definition: dcode.h:105
void RemoveAttribute(X2_ATTRIBUTE &aAttribute)
Function RemoveAttribute.
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:98
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: rs274x.cpp:63
GBR_NETLIST_METADATA m_NetAttributeDict
void SetMacro(APERTURE_MACRO *aMacro)
Definition: dcode.h:151
bool GetEndOfBlock(char *aBuff, unsigned int aBuffSize, char *&aText, FILE *aGerberFile)
Definition: rs274x.cpp:857
#define IU_PER_MILS
Definition: plotter.cpp:136
int m_EdgesCount
in aperture definition Polygon only: number of edges for the polygon
Definition: dcode.h:100
print info associated to a flashed pad (TO.P attribute)
wxString FormatStringFromGerber(const wxString &aString)
This helper function make the inverse conversion of FormatStringToGerber() It converts a "normalized"...
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:163
print info associated to a net (TO.N attribute)
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE.
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114
int m_NetAttribType
the type of net info (used to define the gerber string to create)

References _, AddMessageToList(), AP_DEFINITION, AP_MACRO, APERTURE_ATTRIBUTE, D_CODE::AppendParam(), APT_CIRCLE, APT_DEF_RECT_HOLE, APT_DEF_ROUND_HOLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, AXIS_SELECT, dummy(), FILE_ATTRIBUTE, FindApertureMacro(), FORMAT_STATEMENT, FormatStringFromGerber(), GBR_NETLIST_METADATA::GBR_NETINFO_CMP, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_PAD, GERB_INTERPOL_LINEAR_1X, GetDCODEOrCreate(), GetEndOfBlock(), GetLayerParams(), IMAGE_JUSTIFY, IMAGE_NAME, IMAGE_OFFSET, IMAGE_POLARITY, IMAGE_ROTATION, INCH, IU_PER_MILS, KiROUND(), KNOCKOUT, LOAD_NAME, LOAD_POLARITY, D_CODE::m_AperFunction, m_AperFunction, GBR_NETLIST_METADATA::m_Cmpref, m_Current_File, D_CODE::m_Defined, D_CODE::m_Drill, D_CODE::m_DrillShape, D_CODE::m_EdgesCount, m_FileFunction, m_FileName, m_FmtLen, m_FmtScale, m_GerbMetric, m_Has_DCode, m_ImageJustifyOffset, m_ImageJustifyXCenter, m_ImageJustifyYCenter, m_ImageName, m_ImageNegative, m_ImageOffset, m_ImageRotation, m_IsX2_file, m_Iterpolation, GERBER_LAYER::m_LayerNegative, m_LineNum, m_LocalRotation, m_MD5_value, m_MirrorA, m_MirrorB, GBR_NETLIST_METADATA::m_NetAttribType, m_NetAttributeDict, GBR_NETLIST_METADATA::m_Netname, m_NoTrailingZeros, m_Offset, GBR_NETLIST_METADATA::m_Padname, m_PartString, m_Relative, D_CODE::m_Rotation, m_Scale, D_CODE::m_Shape, D_CODE::m_Size, GERBER_LAYER::m_StepForRepeat, GERBER_LAYER::m_StepForRepeatMetric, m_SwapAxis, GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, MILLIMETER, MIRROR_IMAGE, MODE_OF_UNITS, APERTURE_MACRO::name, NET_ATTRIBUTE, OFFSET, ReadApertureMacro(), ReadDouble(), ReadInt(), ReadXCommandID(), REMOVE_APERTURE_ATTRIBUTE, RemoveAttribute(), ROTATE, SCALE_FACTOR, D_CODE::SetMacro(), STEP_AND_REPEAT, and TO_UTF8.

Referenced by Execute_G_Command(), and ReadRS274XCommand().

◆ FindApertureMacro()

APERTURE_MACRO * GERBER_FILE_IMAGE::FindApertureMacro ( const APERTURE_MACRO aLookup)

Function FindApertureMacro looks up a previously read in aperture macro.

Parameters
aLookupA dummy APERTURE_MACRO with [only] the name field set.
Returns
APERTURE_MACRO* - the one with a matching name, or NULL if not found.

Definition at line 161 of file gerber_file_image.cpp.

162 {
163  APERTURE_MACRO_SET::iterator iter = m_aperture_macros.find( aLookup );
164 
165  if( iter != m_aperture_macros.end() )
166  {
167  APERTURE_MACRO* pam = (APERTURE_MACRO*) &(*iter);
168  return pam;
169  }
170 
171  return NULL; // not found
172 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:163

References m_aperture_macros.

Referenced by ExecuteRS274XCommand().

◆ GCodeNumber()

int GERBER_FILE_IMAGE::GCodeNumber ( char *&  Text)

Definition at line 411 of file rs274d.cpp.

412 {
413  int ii = 0;
414  char* text;
415  char line[1024];
416 
417  if( Text == NULL )
418  return 0;
419  Text++;
420  text = line;
421  while( IsNumber( *Text ) )
422  {
423  *(text++) = *(Text++);
424  }
425 
426  *text = 0;
427  ii = atoi( line );
428  return ii;
429 }
#define IsNumber(x)

References IsNumber.

Referenced by LoadGerberFile().

◆ GetBoundingBox()

const EDA_RECT EDA_ITEM::GetBoundingBox ( ) const
virtualinherited

Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented in BOARD, D_PAD, SCH_SHEET, LIB_PART, SCH_HIERLABEL, WS_DRAW_ITEM_BITMAP, SCH_COMPONENT, WS_DRAW_ITEM_TEXT, SCH_GLOBALLABEL, WS_DRAW_ITEM_PAGE, GERBER_DRAW_ITEM, SCH_LABEL, DIMENSION, DRAWSEGMENT, WS_DRAW_ITEM_RECT, LIB_ITEM, TEXTE_MODULE, MODULE, WS_DRAW_ITEM_POLYPOLYGONS, SCH_TEXT, LIB_FIELD, ZONE_CONTAINER, SCH_LINE, WS_DRAW_ITEM_LINE, LIB_PIN, SCH_FIELD, TRACK, TEXTE_PCB, MARKER_PCB, LIB_ALIAS, PCB_TARGET, SCH_BITMAP, SCH_BUS_ENTRY_BASE, GBR_LAYOUT, WS_DRAW_ITEM_BASE, SCH_PIN, LIB_POLYLINE, LIB_BEZIER, LIB_ARC, LIB_TEXT, SCH_NO_CONNECT, SCH_JUNCTION, SCH_MARKER, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 108 of file base_struct.cpp.

109 {
110 #if defined(DEBUG)
111  printf( "Missing GetBoundingBox()\n" );
112  Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
113 #endif
114 
115  // return a zero-sized box per default. derived classes should override
116  // this
117  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
118 }
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

Referenced by CN_ITEM::BBox(), MODULE::CoverageRatio(), SCH_EDITOR_CONTROL::FindNext(), SELECTION::GetBoundingBox(), LIB_ITEM::GetBoundingBox(), GetBoundingBoxes(), GERBVIEW_SELECTION::GetCenter(), getRect(), getSheetBbox(), SCH_EDIT_TOOL::Mirror(), GERBVIEW_SELECTION::ViewBBox(), and EDA_ITEM::ViewBBox().

◆ GetClass()

wxString GERBER_FILE_IMAGE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 248 of file gerber_file_image.h.

249  {
250  return wxT( "GERBER_FILE_IMAGE" );
251  }

Referenced by Visit().

◆ GetDCODE()

D_CODE * GERBER_FILE_IMAGE::GetDCODE ( int  aDCODE) const

Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.

Parameters
aDCODEThe numeric value of the D_CODE to look up.
Returns
D_CODE* - the one implied by the given aDCODE, or NULL if the requested aDCODE is out of range.

Definition at line 148 of file gerber_file_image.cpp.

149 {
150  unsigned ndx = aDCODE - FIRST_DCODE;
151 
152  if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
153  {
154  return m_Aperture_List[ndx];
155  }
156 
157  return NULL;
158 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:71
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), FIRST_DCODE, and m_Aperture_List.

Referenced by Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), Execute_G_Command(), EXCELLON_IMAGE::FinishRouteCommand(), GERBER_DRAW_ITEM::GetDcodeDescr(), GERBVIEW_FRAME::Liste_D_Codes(), EXCELLON_IMAGE::Select_Tool(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().

◆ GetDCODEOrCreate()

D_CODE * GERBER_FILE_IMAGE::GetDCODEOrCreate ( int  aDCODE,
bool  aCreateIfNoExist = true 
)

Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE.

Parameters
aDCODEThe numeric value of the D_CODE to look up.
aCreateIfNoExistIf true, then create the D_CODE if it does not exist in list.
Returns
D_CODE* - the one implied by the given aDCODE, or NULL if the requested aDCODE is out of range.

Definition at line 128 of file gerber_file_image.cpp.

129 {
130  unsigned ndx = aDCODE - FIRST_DCODE;
131 
132  if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
133  {
134  // lazily create the D_CODE if it does not exist.
135  if( aCreateIfNoExist )
136  {
137  if( m_Aperture_List[ndx] == NULL )
138  m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE );
139  }
140 
141  return m_Aperture_List[ndx];
142  }
143 
144  return NULL;
145 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:71
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82

References arrayDim(), FIRST_DCODE, and m_Aperture_List.

Referenced by ExecuteRS274XCommand(), EXCELLON_IMAGE::readToolInformation(), and EXCELLON_IMAGE::Select_Tool().

◆ GetDcodesCount()

int GERBER_FILE_IMAGE::GetDcodesCount ( )
Returns
the count of Dcode tools in used by the image

Definition at line 263 of file gerber_file_image.cpp.

264 {
265  int count = 0;
266 
267  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
268  {
269  if( m_Aperture_List[ii] )
270  if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
271  ++count;
272  }
273 
274  return count;
275 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim(), m_Aperture_List, and m_InUse.

Referenced by GERBVIEW_FRAME::Liste_D_Codes(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 270 of file base_struct.h.

271  {
275  return m_Flags & mask;
276  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:154
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editComponentFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), BOARD::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ GetEndOfBlock()

bool GERBER_FILE_IMAGE::GetEndOfBlock ( char *  aBuff,
unsigned int  aBuffSize,
char *&  aText,
FILE *  aGerberFile 
)
private

Definition at line 857 of file rs274x.cpp.

858 {
859  for( ; ; )
860  {
861  while( (aText < aBuff + aBuffSize) && *aText )
862  {
863  if( *aText == '*' )
864  return true;
865 
866  if( *aText == '%' )
867  return true;
868 
869  aText++;
870  }
871 
872  if( fgets( aBuff, aBuffSize, gerber_file ) == NULL )
873  break;
874 
875  m_LineNum++;
876  aText = aBuff;
877  }
878 
879  return false;
880 }

References m_LineNum.

Referenced by ExecuteRS274XCommand().

◆ GetFlags()

◆ GetItemsList()

GERBER_DRAW_ITEM * GERBER_FILE_IMAGE::GetItemsList ( )

◆ GetLayerParams()

GERBER_LAYER& GERBER_FILE_IMAGE::GetLayerParams ( )
inline

Function GetLayerParams.

Returns
the current layers params

Definition at line 285 of file gerber_file_image.h.

286  {
287  return m_GBRLayerParams;
288  }
GERBER_LAYER m_GBRLayerParams

References m_GBRLayerParams.

Referenced by Execute_DCODE_Command(), ExecuteRS274XCommand(), GERBER_DRAW_ITEM::SetLayerParameters(), StepAndRepeatItem(), and GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:178

References EDA_ITEM::m_List.

Referenced by DHEAD::insert(), DHEAD::remove(), BOARD_ITEM::UnLink(), and GERBER_DRAW_ITEM::UnLink().

◆ GetMenuImage()

BITMAP_DEF EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, SCH_HIERLABEL, VIA, GERBER_DRAW_ITEM, SCH_GLOBALLABEL, DRAWSEGMENT, SCH_LABEL, DIMENSION, TRACK, TEXTE_MODULE, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_TEXT, LIB_FIELD, SCH_SHEET_PIN, SCH_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, MARKER_PCB, LIB_POLYLINE, SCH_NO_CONNECT, PCB_TARGET, LIB_TEXT, SCH_JUNCTION, SCH_MARKER, LIB_CIRCLE, and LIB_RECTANGLE.

Definition at line 251 of file base_struct.cpp.

252 {
253  return dummy_xpm;
254 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:54

References dummy_xpm.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), and SELECTION_TOOL::doSelectionMenu().

◆ GetMessages()

const wxArrayString& GERBER_FILE_IMAGE::GetMessages ( ) const
inline

Definition at line 264 of file gerber_file_image.h.

264 { return m_messagesList; }
wxArrayString m_messagesList

References m_messagesList.

Referenced by GERBVIEW_FRAME::Read_EXCELLON_File(), and GERBVIEW_FRAME::Read_GERBER_File().

◆ GetMsgPanelInfo()

virtual void EDA_ITEM::GetMsgPanelInfo ( EDA_UNITS_T  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
inlinevirtualinherited

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented in BOARD, D_PAD, MODULE, SCH_SHEET, SCH_COMPONENT, GERBER_DRAW_ITEM, NETINFO_ITEM, DIMENSION, DRAWSEGMENT, SCH_LINE, SCH_TEXT, LIB_ITEM, TEXTE_MODULE, TRACK, LIB_FIELD, SCH_BITMAP, EDGE_MODULE, SCH_BUS_ENTRY_BASE, LIB_PIN, MARKER_PCB, ZONE_CONTAINER, LIB_BEZIER, SCH_MARKER, TEXTE_PCB, LIB_POLYLINE, LIB_ARC, LIB_TEXT, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 328 of file base_struct.h.

329  {
330  }

Referenced by EDA_DRAW_FRAME::SetMsgPanel(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), and FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel().

◆ GetNextLine()

char * GERBER_FILE_IMAGE::GetNextLine ( char *  aBuff,
unsigned int  aBuffSize,
char *  aText,
FILE *  aFile 
)
private

test for an end of line if a end of line is found: read a new line

Parameters
aBuff= buffer (size = GERBER_BUFZ) to fill with a new line
aText= pointer to the last useful char in aBuff on return: points the beginning of the next line.
aBuffSize= the size in bytes of aBuff
aFile= the opened GERBER file to read
Returns
a pointer to the beginning of the next line or NULL if end of file

Definition at line 883 of file rs274x.cpp.

884 {
885  for( ; ; )
886  {
887  switch (*aText )
888  {
889  case ' ': // skip blanks
890  case '\n':
891  case '\r': // Skip line terminators
892  ++aText;
893  break;
894 
895  case 0: // End of text found in aBuff: Read a new string
896  if( fgets( aBuff, aBuffSize, aFile ) == NULL )
897  return NULL;
898 
899  m_LineNum++;
900  aText = aBuff;
901  return aText;
902 
903  default:
904  return aText;
905  }
906  }
907  return aText;
908 }

References m_LineNum.

Referenced by ReadApertureMacro().

◆ GetParent()

◆ GetPositiveDrawColor()

COLOR4D GERBER_FILE_IMAGE::GetPositiveDrawColor ( ) const
inline

Definition at line 273 of file gerber_file_image.h.

273 { return m_PositiveDrawColor; }

References m_PositiveDrawColor.

Referenced by GERBER_DRAW_ITEM::Print().

◆ GetSelectMenuText()

wxString EDA_ITEM::GetSelectMenuText ( EDA_UNITS_T  aUnits) const
virtualinherited

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, BOARD, SCH_SHEET, LIB_PIN, SCH_HIERLABEL, WS_DRAW_ITEM_BITMAP, VIA, GERBER_DRAW_ITEM, WS_DRAW_ITEM_TEXT, SCH_GLOBALLABEL, WS_DRAW_ITEM_PAGE, DRAWSEGMENT, SCH_LABEL, DIMENSION, WS_DRAW_ITEM_RECT, TRACK, TEXTE_MODULE, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_TEXT, LIB_FIELD, SCH_SHEET_PIN, SCH_FIELD, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BUS_WIRE_ENTRY, WS_DRAW_ITEM_LINE, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, MARKER_PCB, LIB_POLYLINE, PCB_TARGET, LIB_TEXT, SCH_NO_CONNECT, LIB_CIRCLE, LIB_RECTANGLE, SCH_JUNCTION, SCH_MARKER, SCH_PIN, and DELETED_BOARD_ITEM.

Definition at line 147 of file base_struct.cpp.

148 {
149  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
150  GetClass() );
151 
152  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
153 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::buildConnectionGraph(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_SUBGRAPH::ResolveDrivers(), DRC_ITEM::SetData(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 249 of file base_struct.h.

250  {
251  return m_Status & type;
252  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 262 of file base_struct.h.

262 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTimeStamp()

◆ HasFlag()

bool EDA_ITEM::HasFlag ( STATUS_FLAGS  aFlag)
inlineinherited

◆ HasNegativeItems()

bool GERBER_FILE_IMAGE::HasNegativeItems ( )

Function HasNegativeItems.

Returns
true if at least one item must be drawn in background color used to optimize screen refresh (when no items are in background color refresh can be faster)

Definition at line 239 of file gerber_file_image.cpp.

240 {
241  if( m_hasNegativeItems < 0 ) // negative items are not yet searched: find them if any
242  {
243  if( m_ImageNegative ) // A negative layer is expected having always negative objects.
244  m_hasNegativeItems = 1;
245  else
246  {
247  m_hasNegativeItems = 0;
248  for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
249  {
250  if( item->GetLayer() != m_GraphicLayer )
251  continue;
252  if( item->HasNegativeItems() )
253  {
254  m_hasNegativeItems = 1;
255  break;
256  }
257  }
258  }
259  }
260  return m_hasNegativeItems == 1;
261 }
GERBER_DRAW_ITEM * Next() const
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.

References GetItemsList(), m_GraphicLayer, m_hasNegativeItems, m_ImageNegative, and GERBER_DRAW_ITEM::Next().

◆ HitTest() [1/2]

virtual bool EDA_ITEM::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Function HitTest tests if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, WS_DRAW_ITEM_BITMAP, VIA, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, WS_DRAW_ITEM_PAGE, ZONE_CONTAINER, DIMENSION, DRAWSEGMENT, WS_DRAW_ITEM_RECT, SCH_LINE, SCH_TEXT, TEXTE_MODULE, SCH_FIELD, SCH_SHEET_PIN, TRACK, LIB_ITEM, WS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, SCH_BITMAP, WS_DRAW_ITEM_LINE, LIB_PIN, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, SCH_JUNCTION, SCH_MARKER, MARKER_PCB, PCB_TARGET, WS_DRAW_ITEM_BASE, TEXTE_PCB, SCH_PIN, LIB_POLYLINE, LIB_BEZIER, LIB_ARC, LIB_TEXT, LIB_RECTANGLE, LIB_CIRCLE, and KIGFX::RATSNEST_VIEWITEM.

Definition at line 340 of file base_struct.h.

341  {
342  return false; // derived classes should override this function
343  }

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), PL_SELECTION_TOOL::guessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), WS_DRAW_ITEM_BASE::HitTest(), LIB_ITEM::HitTest(), EE_COLLECTOR::Inspect(), GERBER_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), EE_SELECTION_TOOL::selectMultiple(), and SELECTION_TOOL::selectMultiple().

◆ HitTest() [2/2]

virtual bool EDA_ITEM::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, ZONE_CONTAINER, WS_DRAW_ITEM_BITMAP, VIA, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DIMENSION, DRAWSEGMENT, SCH_LINE, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, TRACK, LIB_ITEM, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, SCH_JUNCTION, WS_DRAW_ITEM_BASE, PCB_TARGET, TEXTE_PCB, LIB_POLYLINE, LIB_BEZIER, LIB_ARC, LIB_TEXT, and LIB_CIRCLE.

Definition at line 354 of file base_struct.h.

355  {
356  return false; // derived classes should override this function
357  }

◆ InitToolTable()

void GERBER_FILE_IMAGE::InitToolTable ( )

Function InitToolTable.

Definition at line 278 of file gerber_file_image.cpp.

279 {
280  for( int count = 0; count < TOOLS_MAX_COUNT; count++ )
281  {
282  if( m_Aperture_List[count] == NULL )
283  continue;
284 
285  m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
287  }
288 
289  m_aperture_macros.clear();
290 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:71
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void Clear_D_CODE_Data()
Definition: dcode.cpp:77

References D_CODE::Clear_D_CODE_Data(), FIRST_DCODE, m_Aperture_List, m_aperture_macros, D_CODE::m_Num_Dcode, and TOOLS_MAX_COUNT.

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

231 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), KIGFX::SCH_PAINTER::setDeviceColors(), and ShowClearance().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

235 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), KIGFX::SCH_PAINTER::getRenderColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 556 of file base_struct.h.

556 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

234 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

References IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsSelected()

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
inlinevirtualinherited

Function IsType Checks whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 294 of file base_struct.h.

295  {
296  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
297  return true;
298 
299  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
300  {
301  if( m_StructType == *p )
302  return true;
303  }
304 
305  return false;
306  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_SCREEN::GetItem(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 232 of file base_struct.h.

232 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/3]

static SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 418 of file base_struct.h.

423  {
424  for( EDA_ITEM* p = listStart; p; p = p->Pnext )
425  {
426  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
427  return SEARCH_QUIT;
428  }
429 
430  return SEARCH_CONTINUE;
431  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by EE_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), nextMatch(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDITOR_CONTROL::UpdateFind(), Visit(), and BOARD::Visit().

◆ IterateForward() [2/3]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use the main queue instead

Definition at line 439 of file base_struct.h.

443  {
444  for( auto it : aList )
445  {
446  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) == SEARCH_QUIT )
447  return SEARCH_QUIT;
448  }
449 
450  return SEARCH_CONTINUE;
451  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

References SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

◆ IterateForward() [3/3]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 459 of file base_struct.h.

461  {
462  for( auto it : aList )
463  {
464  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
465  == SEARCH_QUIT )
466  return SEARCH_QUIT;
467  }
468 
469  return SEARCH_CONTINUE;
470  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

References SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

◆ LoadGerberFile()

bool GERBER_FILE_IMAGE::LoadGerberFile ( const wxString &  aFullFileName)

Read and load a gerber file.

Parameters
aFullFileName= the full filename of the Gerber file when the file cannot be loaded Warning and info messages are stored in m_messagesList
Returns
bool if OK, false if the gerber file was not loaded

Definition at line 117 of file readgerb.cpp.

118 {
119  int G_command = 0; // command number for G commands like G04
120  int D_commande = 0; // command number for D commands like D02
121  char* text;
122 
123  ClearMessageList( );
125 
126  // Read the gerber file */
127  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
128 
129  if( m_Current_File == 0 )
130  return false;
131 
132  m_FileName = aFullFileName;
133 
134  LOCALE_IO toggleIo;
135 
136  wxString msg;
137 
138  while( true )
139  {
140  if( fgets( lineBuffer, GERBER_BUFZ, m_Current_File ) == NULL )
141  break;
142 
143  m_LineNum++;
144  text = StrPurge( lineBuffer );
145 
146  while( text && *text )
147  {
148  switch( *text )
149  {
150  case ' ':
151  case '\r':
152  case '\n':
153  text++;
154  break;
155 
156  case '*': // End command
158  text++;
159  break;
160 
161  case 'M': // End file
163  while( *text )
164  text++;
165  break;
166 
167  case 'G': /* Line type Gxx : command */
168  G_command = GCodeNumber( text );
169  Execute_G_Command( text, G_command );
170  break;
171 
172  case 'D': /* Line type Dxx : Tool selection (xx > 0) or
173  * command if xx = 0..9 */
174  D_commande = DCodeNumber( text );
175  Execute_DCODE_Command( text, D_commande );
176  break;
177 
178  case 'X':
179  case 'Y': /* Move or draw command */
180  m_CurrentPos = ReadXYCoord( text );
181  if( *text == '*' ) // command like X12550Y19250*
182  {
184  }
185  break;
186 
187  case 'I':
188  case 'J': /* Auxiliary Move command */
189  m_IJPos = ReadIJCoord( text );
190 
191  if( *text == '*' ) // command like X35142Y15945J504*
192  {
194  }
195  break;
196 
197  case '%':
199  {
202  }
203  else //Error
204  {
205  AddMessageToList( "Expected RS274X Command" );
207  text++;
208  }
209  break;
210 
211  default:
212  msg.Printf( "Unexpected char 0x%2.2X &lt;%c&lt;", *text, *text );
213  AddMessageToList( msg );
214  text++;
215  break;
216  }
217  }
218  }
219 
220  fclose( m_Current_File );
221 
222  m_InUse = true;
223 
224  return true;
225 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
bool Execute_DCODE_Command(char *&text, int D_command)
Definition: rs274d.cpp:582
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
Definition: string.cpp:310
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:154
wxPoint ReadIJCoord(char *&Text)
Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are rela...
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
int GCodeNumber(char *&Text)
Definition: rs274d.cpp:411
static char lineBuffer[GERBER_BUFZ+1]
Definition: readgerb.cpp:115
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:434
#define GERBER_BUFZ
Definition: readgerb.cpp:113
wxPoint ReadXYCoord(char *&aText, bool aExcellonMode=false)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)
bool Execute_G_Command(char *&text, int G_command)
Definition: rs274d.cpp:454
bool ReadRS274XCommand(char *aBuff, unsigned int aBuffSize, char *&aText)
reads a single RS274X command terminated with a %
Definition: rs274x.cpp:143
virtual void ResetDefaultValues()

References AddMessageToList(), ClearMessageList(), CMD_IDLE, DCodeNumber(), END_BLOCK, ENTER_RS274X_CMD, Execute_DCODE_Command(), Execute_G_Command(), GCodeNumber(), GERBER_BUFZ, lineBuffer, m_CommandState, m_Current_File, m_CurrentPos, m_FileName, m_IJPos, m_InUse, m_Last_Pen_Command, m_LineNum, ReadIJCoord(), ReadRS274XCommand(), ReadXYCoord(), ResetDefaultValues(), and StrPurge().

Referenced by GERBVIEW_FRAME::Read_GERBER_File().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_FIELD, SCH_SHEET_PIN, SCH_TEXT, LIB_PIN, SCH_PIN, SCH_MARKER, TEXTE_MODULE, and TEXTE_PCB.

Definition at line 512 of file base_struct.h.

513  {
514  return false;
515  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET::Matches(), nextMatch(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 156 of file base_struct.cpp.

157 {
158  wxString text = aText;
159  wxString searchText = aSearchData.GetFindString();
160 
161  // Don't match if searching for replaceable item and the item doesn't support text replace.
162  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
163  return false;
164 
165  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
166  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
167 
168  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
169  {
170  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
171  return text.Matches( searchText );
172 
173  return text.MakeUpper().Matches( searchText.MakeUpper() );
174  }
175 
176  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
177  return aText.Find( searchText ) != wxNOT_FOUND;
178 
179  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
180 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:556

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, and EDA_ITEM::IsReplaceable().

◆ Next()

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 210 of file base_struct.cpp.

211 {
212  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
213  GetChars( GetClass() ) ) );
214 
215  return false;
216 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

References Format(), GetChars(), and EDA_ITEM::GetClass().

◆ ReadApertureMacro()

bool GERBER_FILE_IMAGE::ReadApertureMacro ( char *  aBuff,
unsigned int  aBuffSize,
char *&  text,
FILE *  gerber_file 
)
private

reads in an aperture macro and saves it in m_aperture_macros.

Parameters
aBuffa character buffer at least GERBER_BUFZ long that can be used to read successive lines from the gerber file.
textA reference to a character pointer which gives the initial text to read from.
aBuffSizeis the size of aBuff
gerber_fileWhich file to read from for continuation.
Returns
bool - true if a macro was read in successfully, else false.

Definition at line 911 of file rs274x.cpp.

914 {
915  wxString msg;
916  APERTURE_MACRO am;
917 
918  // read macro name
919  while( *aText )
920  {
921  if( *aText == '*' )
922  {
923  ++aText;
924  break;
925  }
926 
927  am.name.Append( *aText++ );
928  }
929 
930  // Read aperture macro parameters
931  for( ; ; )
932  {
933  if( *aText == '*' )
934  ++aText;
935 
936  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
937 
938  if( aText == NULL ) // End of File
939  return false;
940 
941  // aText points the beginning of a new line.
942 
943  // Test for the last line in aperture macro lis:
944  // last line is % or *% sometime found.
945  if( *aText == '*' )
946  ++aText;
947 
948  if( *aText == '%' )
949  break; // exit with aText still pointing at %
950 
951  int paramCount = 0; // will be set to the minimal parameters count,
952  // depending on the actual primitive
953  int primitive_type = AMP_UNKNOWN;
954  // Test for a valid symbol at the beginning of a description:
955  // it can be: a parameter declaration like $1=$2/4
956  // or a digit (macro primitive selection)
957  // all other symbols are illegal.
958  if( *aText == '$' ) // local parameter declaration, inside the aperture macro
959  {
960  am.m_localparamStack.push_back( AM_PARAM() );
961  AM_PARAM& param = am.m_localparamStack.back();
962  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
963  if( aText == NULL) // End of File
964  return false;
965  param.ReadParam( aText );
966  continue;
967  }
968  else if( !isdigit(*aText) ) // Ill. symbol
969  {
970  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
971  GetChars( am.name ), GetChars( FROM_UTF8( aBuff ) ) );
972  AddMessageToList( msg );
973  primitive_type = AMP_COMMENT;
974  }
975  else
976  primitive_type = ReadInt( aText );
977 
978  bool is_comment = false;
979 
980  switch( primitive_type )
981  {
982  case AMP_COMMENT: // lines starting by 0 are a comment
983  paramCount = 0;
984  is_comment = true;
985  // Skip comment
986  while( *aText && ( *aText != '*' ) )
987  aText++;
988  break;
989 
990  case AMP_CIRCLE:
991  paramCount = 4; // minimal count. can have a optional parameter (rotation)
992  break;
993 
994  case AMP_LINE2:
995  case AMP_LINE20:
996  paramCount = 7;
997  break;
998 
999  case AMP_LINE_CENTER:
1000  case AMP_LINE_LOWER_LEFT:
1001  paramCount = 6;
1002  break;
1003 
1004  case AMP_EOF:
1005  paramCount = 0;
1006  break;
1007 
1008  case AMP_OUTLINE:
1009  paramCount = 4;
1010  break;
1011 
1012  case AMP_POLYGON:
1013  paramCount = 6;
1014  break;
1015 
1016  case AMP_MOIRE:
1017  paramCount = 9;
1018  break;
1019 
1020  case AMP_THERMAL:
1021  paramCount = 6;
1022  break;
1023 
1024  default:
1025  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line %d: \"%s\"" ),
1026  GetChars( am.name ), primitive_type, m_LineNum, GetChars( FROM_UTF8( aBuff ) ) );
1027  AddMessageToList( msg );
1028  return false;
1029  }
1030 
1031  if( is_comment )
1032  continue;
1033 
1034  AM_PRIMITIVE prim( m_GerbMetric );
1035  prim.primitive_id = (AM_PRIMITIVE_ID) primitive_type;
1036  int ii;
1037 
1038  for( ii = 0; ii < paramCount && *aText && *aText != '*'; ++ii )
1039  {
1040  prim.params.push_back( AM_PARAM() );
1041 
1042  AM_PARAM& param = prim.params.back();
1043 
1044  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
1045 
1046  if( aText == NULL) // End of File
1047  return false;
1048 
1049  param.ReadParam( aText );
1050  }
1051 
1052  if( ii < paramCount )
1053  {
1054  // maybe some day we can throw an exception and track a line number
1055  msg.Printf( wxT( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n" ),
1056  prim.primitive_id, ii );
1057  AddMessageToList( msg );
1058  }
1059  // there are more parameters to read if this is an AMP_OUTLINE
1060  if( prim.primitive_id == AMP_OUTLINE )
1061  {
1062  // so far we have read [0]:exposure, [1]:#points, [2]:X start, [3]: Y start
1063  // Now read all the points, plus trailing rotation in degrees.
1064 
1065  // params[1] is a count of polygon points, so it must be given
1066  // in advance, i.e. be immediate.
1067  wxASSERT( prim.params[1].IsImmediate() );
1068 
1069  paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1;
1070 
1071  for( int jj = 0; jj < paramCount && *aText != '*'; ++jj )
1072  {
1073  prim.params.push_back( AM_PARAM() );
1074 
1075  AM_PARAM& param = prim.params.back();
1076 
1077  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
1078 
1079  if( aText == NULL ) // End of File
1080  return false;
1081 
1082  param.ReadParam( aText );
1083  }
1084  }
1085 
1086  am.primitives.push_back( prim );
1087  }
1088 
1089  m_aperture_macros.insert( am );
1090 
1091  return true;
1092 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
wxString name
The name of the aperture macro.
Definition: am_primitive.h:165
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:62
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
bool ReadParam(char *&aText)
Function ReadParam Read one aperture macro parameter a parameter can be: a number a reference to an a...
Definition: am_param.cpp:171
AM_PARAMS m_localparamStack
Definition: am_primitive.h:174
char * GetNextLine(char *aBuff, unsigned int aBuffSize, char *aText, FILE *aFile)
test for an end of line if a end of line is found: read a new line
Definition: rs274x.cpp:883
Class AM_PARAM holds a parameter value for an "aperture macro" as defined within standard RS274X.
Definition: am_param.h:286
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
AM_PRIMITIVES primitives
A sequence of AM_PRIMITIVEs.
Definition: am_primitive.h:166
Struct AM_PRIMITIVE holds an aperture macro primitive as given in Table 3 of http://gerbv....
Definition: am_primitive.h:92
AM_PRIMITIVE_ID
Enum AM_PRIMITIVE_ID is the set of all "aperture macro primitives" (primitive numbers).
Definition: am_primitive.h:71
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:163

References AddMessageToList(), AMP_CIRCLE, AMP_COMMENT, AMP_EOF, AMP_LINE2, AMP_LINE20, AMP_LINE_CENTER, AMP_LINE_LOWER_LEFT, AMP_MOIRE, AMP_OUTLINE, AMP_POLYGON, AMP_THERMAL, AMP_UNKNOWN, FROM_UTF8(), GetChars(), GetNextLine(), m_aperture_macros, m_GerbMetric, m_LineNum, APERTURE_MACRO::m_localparamStack, APERTURE_MACRO::name, AM_PRIMITIVE::params, AM_PRIMITIVE::primitive_id, APERTURE_MACRO::primitives, ReadInt(), and AM_PARAM::ReadParam().

Referenced by ExecuteRS274XCommand().

◆ ReadIJCoord()

wxPoint GERBER_FILE_IMAGE::ReadIJCoord ( char *&  Text)

Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are relative, so if coordinate is absent, it's value defaults to 0.

Definition at line 190 of file rs274_read_XY_and_IJ_coordinates.cpp.

191 {
192  wxPoint pos( 0, 0 );
193 
194  int type_coord = 0, current_coord, nbdigits;
195  bool is_float = false;
196  char* text;
197  char line[256];
198 
199  if( Text == NULL )
200  return pos;
201 
202  text = line;
203  while( *Text )
204  {
205  if( (*Text == 'I') || (*Text == 'J') )
206  {
207  type_coord = *Text;
208  Text++;
209  text = line;
210  nbdigits = 0;
211  while( IsNumber( *Text ) )
212  {
213  if( *Text == '.' )
214  is_float = true;
215 
216  // count digits only (sign and decimal point are not counted)
217  if( (*Text >= '0') && (*Text <='9') )
218  nbdigits++;
219 
220  *(text++) = *(Text++);
221  }
222 
223  *text = 0;
224  if( is_float )
225  {
226  // When X or Y values are float numbers, they are given in mm or inches
227  if( m_GerbMetric ) // units are mm
228  current_coord = KiROUND( atof( line ) * IU_PER_MILS / 0.0254 );
229  else // units are inches
230  current_coord = KiROUND( atof( line ) * IU_PER_MILS * 1000 );
231  }
232  else
233  {
234  int fmt_scale =
235  (type_coord == 'I') ? m_FmtScale.x : m_FmtScale.y;
236 
237  if( m_NoTrailingZeros )
238  {
239  int min_digit =
240  (type_coord == 'I') ? m_FmtLen.x : m_FmtLen.y;
241  while( nbdigits < min_digit )
242  {
243  *(text++) = '0';
244  nbdigits++;
245  }
246 
247  *text = 0;
248  }
249 
250  current_coord = atoi( line );
251 
252  double real_scale = scale_list[fmt_scale];
253 
254  if( m_GerbMetric )
255  real_scale = real_scale / 25.4;
256 
257  current_coord = KiROUND( current_coord * real_scale );
258  }
259  if( type_coord == 'I' )
260  pos.x = current_coord;
261  else if( type_coord == 'J' )
262  pos.y = current_coord;
263 
264  continue;
265  }
266  else
267  break;
268  }
269 
270  m_IJPos = pos;
272  m_LastCoordIsIJPos = true;
273 
274  return pos;
275 }
static double scale_list[SCALE_LIST_SIZE]
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
#define IU_PER_MILS
Definition: plotter.cpp:136
#define IsNumber(x)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114

References ARC_INFO_TYPE_CENTER, IsNumber, IU_PER_MILS, KiROUND(), m_FmtLen, m_FmtScale, m_GerbMetric, m_IJPos, m_LastArcDataType, m_LastCoordIsIJPos, m_NoTrailingZeros, and scale_list.

Referenced by EXCELLON_IMAGE::Execute_Drill_Command(), EXCELLON_IMAGE::Execute_EXCELLON_G_Command(), EXCELLON_IMAGE::LoadFile(), and LoadGerberFile().

◆ ReadRS274XCommand()

bool GERBER_FILE_IMAGE::ReadRS274XCommand ( char *  aBuff,
unsigned int  aBuffSize,
char *&  aText 
)
private

reads a single RS274X command terminated with a %

Definition at line 143 of file rs274x.cpp.

144 {
145  bool ok = true;
146  int code_command;
147 
148  aText++;
149 
150  for( ; ; )
151  {
152  while( *aText )
153  {
154  switch( *aText )
155  {
156  case '%': // end of command
157  aText++;
159  goto exit; // success completion
160 
161  case ' ':
162  case '\r':
163  case '\n':
164  aText++;
165  break;
166 
167  case '*':
168  aText++;
169  break;
170 
171  default:
172  code_command = ReadXCommandID( aText );
173  ok = ExecuteRS274XCommand( code_command, aBuff, aBuffSize, aText );
174  if( !ok )
175  goto exit;
176  break;
177  }
178  }
179 
180  // end of current line, read another one.
181  if( fgets( aBuff, aBuffSize, m_Current_File ) == NULL )
182  {
183  // end of file
184  ok = false;
185  break;
186  }
187  m_LineNum++;
188  aText = aBuff;
189  }
190 
191 exit:
192  return ok;
193 }
int ReadXCommandID(char *&text)
reads two bytes of data and assembles them into an int with the first byte in the sequence put into t...
Definition: rs274x.cpp:115
bool ExecuteRS274XCommand(int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
executes a RS274X command
Definition: rs274x.cpp:196

References CMD_IDLE, ExecuteRS274XCommand(), m_CommandState, m_Current_File, m_LineNum, and ReadXCommandID().

Referenced by LoadGerberFile().

◆ ReadXCommandID()

int GERBER_FILE_IMAGE::ReadXCommandID ( char *&  text)
private

reads two bytes of data and assembles them into an int with the first byte in the sequence put into the most significant part of a 16 bit value to build a RS274X command identifier.

Parameters
textA reference to a pointer to read bytes from and to advance as they are read.
Returns
a RS274X command identifier.

Definition at line 115 of file rs274x.cpp.

116 {
117  /* reads two bytes of data and assembles them into an int with the first
118  * byte in the sequence put into the most significant part of a 16 bit value
119  */
120  int result;
121  int currbyte;
122 
123  if( text && *text )
124  {
125  currbyte = *text++;
126  result = ( currbyte & 0xFF ) << 8;
127  }
128  else
129  return -1;
130 
131  if( text && *text )
132  {
133  currbyte = *text++;
134  result += currbyte & 0xFF;
135  }
136  else
137  return -1;
138 
139  return result;
140 }

Referenced by Execute_G_Command(), ExecuteRS274XCommand(), and ReadRS274XCommand().

◆ ReadXYCoord()

wxPoint GERBER_FILE_IMAGE::ReadXYCoord ( char *&  aText,
bool  aExcellonMode = false 
)

Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)

Parameters
aTextis a pointer to the text to parse.
aExcellonMode= true to parse a Excellon drill file. it force truncation of a digit string to a max len because the exact coordinate format is not always known

Definition at line 72 of file rs274_read_XY_and_IJ_coordinates.cpp.

73 {
74  wxPoint pos;
75  int type_coord = 0, current_coord, nbdigits;
76  bool is_float = false;
77  char* text;
78  char line[256];
79 
80 
81  if( m_Relative )
82  pos.x = pos.y = 0;
83  else
84  pos = m_CurrentPos;
85 
86  if( Text == NULL )
87  return pos;
88 
89  text = line;
90  while( *Text )
91  {
92  if( (*Text == 'X') || (*Text == 'Y') || (*Text == 'A') )
93  {
94  type_coord = *Text;
95  Text++;
96  text = line;
97  nbdigits = 0;
98 
99  while( IsNumber( *Text ) )
100  {
101  if( *Text == '.' ) // Force decimat format if reading a floating point number
102  is_float = true;
103 
104  // count digits only (sign and decimal point are not counted)
105  if( (*Text >= '0') && (*Text <='9') )
106  nbdigits++;
107  *(text++) = *(Text++);
108  }
109 
110  *text = 0;
111 
112  if( is_float )
113  {
114  // When X or Y (or A) values are float numbers, they are given in mm or inches
115  if( m_GerbMetric ) // units are mm
116  current_coord = KiROUND( atof( line ) * IU_PER_MILS / 0.0254 );
117  else // units are inches
118  current_coord = KiROUND( atof( line ) * IU_PER_MILS * 1000 );
119  }
120  else
121  {
122  int fmt_scale = (type_coord == 'X') ? m_FmtScale.x : m_FmtScale.y;
123 
124  if( m_NoTrailingZeros )
125  {
126  // no trailing zero format, we need to add missing zeros.
127  int digit_count = (type_coord == 'X') ? m_FmtLen.x : m_FmtLen.y;
128 
129  while( nbdigits < digit_count )
130  {
131  *(text++) = '0';
132  nbdigits++;
133  }
134 
135  if( aExcellonMode )
136  {
137  // Truncate the extra digits if the len is more than expected
138  // because the conversion to internal units expect exactly
139  // digit_count digits
140  while( nbdigits > digit_count )
141  {
142  *(text--) = 0;
143  nbdigits--;
144  }
145  }
146 
147  *text = 0;
148  }
149 
150  current_coord = atoi( line );
151  double real_scale = scale_list[fmt_scale];
152 
153  if( m_GerbMetric )
154  real_scale = real_scale / 25.4;
155 
156  current_coord = KiROUND( current_coord * real_scale );
157  }
158 
159  if( type_coord == 'X' )
160  pos.x = current_coord;
161  else if( type_coord == 'Y' )
162  pos.y = current_coord;
163  else if( type_coord == 'A' )
164  {
165  m_ArcRadius = current_coord;
167  }
168 
169  continue;
170  }
171  else
172  break;
173  }
174 
175  if( m_Relative )
176  {
177  pos.x += m_CurrentPos.x;
178  pos.y += m_CurrentPos.y;
179  }
180 
181  m_CurrentPos = pos;
182  return pos;
183 }
static double scale_list[SCALE_LIST_SIZE]
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
#define IU_PER_MILS
Definition: plotter.cpp:136
#define IsNumber(x)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114

References ARC_INFO_TYPE_RADIUS, IsNumber, IU_PER_MILS, KiROUND(), m_ArcRadius, m_CurrentPos, m_FmtLen, m_FmtScale, m_GerbMetric, m_LastArcDataType, m_NoTrailingZeros, m_Relative, and scale_list.

Referenced by EXCELLON_IMAGE::Execute_Drill_Command(), EXCELLON_IMAGE::Execute_EXCELLON_G_Command(), and LoadGerberFile().

◆ RemoveAttribute()

void GERBER_FILE_IMAGE::RemoveAttribute ( X2_ATTRIBUTE aAttribute)

Function RemoveAttribute.

Called when a TD command is found the Gerber file

Parameters
aAttributeis the X2_ATTRIBUTE which stores the full command Remove the attribute specified by the TD command. is no attribute, all current attributes specified by the TO and the TA commands are cleared. if a attribute name is specified (for instance TD.CN*%) is specified, only this attribute is cleared

Definition at line 377 of file gerber_file_image.cpp.

378 {
379  /* Called when a %TD command is found
380  * Remove the attribute specified by the %TD command.
381  * is no attribute, all current attributes specified by the %TO and the %TA
382  * commands are cleared.
383  * if a attribute name is specified (for instance %TD.CN*%) is specified,
384  * only this attribute is cleared
385  */
386  m_NetAttributeDict.ClearAttribute( &aAttribute.GetPrm( 1 ) );
387 
388  if( aAttribute.GetPrm( 1 ).IsEmpty() || aAttribute.GetPrm( 1 ) == ".AperFunction" )
389  m_AperFunction.Clear();
390 }
const wxString & GetPrm(int aIdx)
GBR_NETLIST_METADATA m_NetAttributeDict
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes

References GBR_NETLIST_METADATA::ClearAttribute(), X2_ATTRIBUTE::GetPrm(), m_AperFunction, and m_NetAttributeDict.

Referenced by ExecuteRS274XCommand().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 183 of file base_struct.cpp.

184 {
185  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
186 
187  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
188  aSearchData.GetFindString() :
189  aSearchData.GetFindString().Upper() );
190 
191  if( result == wxNOT_FOUND )
192  return false;
193 
194  wxString prefix = aText.Left( result );
195  wxString suffix;
196 
197  if( aSearchData.GetFindString().length() + result < aText.length() )
198  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
199 
200  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
201  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
202  GetChars( suffix ) );
203 
204  aText = prefix + aSearchData.GetReplaceString() + suffix;
205 
206  return true;
207 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101

References GetChars(), and traceFindReplace.

Referenced by FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), SCH_FIELD::Replace(), EDA_TEXT::Replace(), SCH_SHEET::Replace(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_SHEET, SCH_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 544 of file base_struct.h.

544 { return false; }

◆ ResetDefaultValues()

void GERBER_FILE_IMAGE::ResetDefaultValues ( )
virtual

Reimplemented in EXCELLON_IMAGE.

Definition at line 175 of file gerber_file_image.cpp.

176 {
177  m_InUse = false;
179  m_FileName.Empty();
180  m_ImageName = wxT( "no name" ); // Image name from the IN command
181  m_ImageNegative = false; // true = Negative image
182  m_IsX2_file = false; // true only if a %TF, %TA or %TD command
183  delete m_FileFunction; // file function parameters
184  m_FileFunction = NULL;
185  m_MD5_value.Empty(); // MD5 value found in a %TF.MD5 command
186  m_PartString.Empty(); // string found in a %TF.Part command
187  m_hasNegativeItems = -1; // set to uninitialized
188  m_ImageJustifyOffset = wxPoint(0,0); // Image justify Offset
189  m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
190  m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
191  m_GerbMetric = false; // false = Inches (default), true = metric
192  m_Relative = false; // false = absolute Coord,
193  // true = relative Coord
194  m_NoTrailingZeros = false; // true: trailing zeros deleted
195  m_ImageOffset.x = m_ImageOffset.y = 0; // Coord Offset, from IO command
196  m_ImageRotation = 0; // Allowed 0, 90, 180, 270 (in degree)
197  m_LocalRotation = 0.0; // Layer totation from RO command (in 0.1 degree)
198  m_Offset.x = 0;
199  m_Offset.y = 0; // Coord Offset, from OF command
200  m_Scale.x = m_Scale.y = 1.0; // scale (A and B) this layer
201  m_MirrorA = false; // true: miror / axe A (default = X)
202  m_MirrorB = false; // true: miror / axe B (default = Y)
203  m_SwapAxis = false; // false if A = X, B = Y; true if A =Y, B = Y
204  m_Has_DCode = false; // true = DCodes in file
205  // false = no DCode-> perhaps deprecated RS274D file
206  m_Has_MissingDCode = false; // true = some D_Codes are used, but not defined
207  // perhaps deprecated RS274D file
208  m_FmtScale.x = m_FmtScale.y = 4; // Initialize default format to 3.4 => 4
209  m_FmtLen.x = m_FmtLen.y = 3 + 4; // Initialize default format len = 3+4
210 
211  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
212  m_360Arc_enbl = false; // 360 deg circular
213  // interpolation disable
214  m_Current_Tool = 0; // Current Dcode selected
215  m_CommandState = 0; // State of the current command
216  m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
217  m_PreviousPos.x = m_PreviousPos.y = 0; // last specified coord
218  m_IJPos.x = m_IJPos.y = 0; // current centre coord for
219  // plot arcs & circles
220  m_LastCoordIsIJPos = false; // True only after a IJ coordinate is read
221  m_ArcRadius = 0; // radius of arcs in circular interpol (given by A## command).
222  // in command like X##Y##A##
223  m_LastArcDataType = ARC_INFO_TYPE_NONE; // Extra coordinate info type for arcs
224  // (radius or IJ center coord)
225  m_LineNum = 0; // line number in file being read
226  m_Current_File = NULL; // Gerber file to read
227  m_PolygonFillMode = false;
229  m_Selected_Tool = 0;
230  m_Last_Pen_Command = 0;
231  m_Exposure = false;
232 }
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
GERBER_LAYER m_GBRLayerParams
bool m_Exposure
whether an aperture macro tool is flashed on or off
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType

References ARC_INFO_TYPE_NONE, GERB_INTERPOL_LINEAR_1X, m_360Arc_enbl, m_ArcRadius, m_CommandState, m_Current_File, m_Current_Tool, m_CurrentPos, m_Exposure, m_FileFunction, m_FileName, m_FmtLen, m_FmtScale, m_GBRLayerParams, m_GerbMetric, m_Has_DCode, m_Has_MissingDCode, m_hasNegativeItems, m_IJPos, m_ImageJustifyOffset, m_ImageJustifyXCenter, m_ImageJustifyYCenter, m_ImageName, m_ImageNegative, m_ImageOffset, m_ImageRotation, m_InUse, m_IsX2_file, m_Iterpolation, m_Last_Pen_Command, m_LastArcDataType, m_LastCoordIsIJPos, m_LineNum, m_LocalRotation, m_MD5_value, m_MirrorA, m_MirrorB, m_NoTrailingZeros, m_Offset, m_PartString, m_PolygonFillMode, m_PolygonFillModeState, m_PreviousPos, m_Relative, m_Scale, m_Selected_Tool, m_SwapAxis, and GERBER_LAYER::ResetDefaultValues().

Referenced by GERBER_FILE_IMAGE(), LoadGerberFile(), and EXCELLON_IMAGE::ResetDefaultValues().

◆ SetBack()

void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 224 of file base_struct.h.

224 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:177

References EDA_ITEM::Pback.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), and DHEAD::remove().

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 241 of file base_struct.h.

241 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 265 of file base_struct.h.

265 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::CreateNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), LIB_DRAWING_TOOLS::DrawShape(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 316 of file base_struct.h.

316 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:184

References EDA_ITEM::m_forceVisible.

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 240 of file base_struct.h.

240 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetList()

void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 226 of file base_struct.h.

226 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:178

References EDA_ITEM::m_List.

Referenced by DHEAD::append(), DHEAD::insert(), and DHEAD::remove().

◆ SetModified()

◆ SetNext()

void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 223 of file base_struct.h.

223 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), and DHEAD::remove().

◆ SetParent()

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

◆ SetState()

void EDA_ITEM::SetState ( int  type,
int  state 
)
inlineinherited

Definition at line 254 of file base_struct.h.

255  {
256  if( state )
257  m_Status |= type; // state = ON or OFF
258  else
259  m_Status &= ~type;
260  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), and TRACK::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 263 of file base_struct.h.

263 { m_Status = aStatus; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetTimeStamp()

void EDA_ITEM::SetTimeStamp ( timestamp_t  aNewTimeStamp)
inlineinherited

Definition at line 215 of file base_struct.h.

215 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:181

References EDA_ITEM::m_TimeStamp.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), Diagnose(), SCH_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), SCH_EDIT_FRAME::LoadSheetFromFile(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_TOOL::RepeatDrawItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), and TestMultiunitFootprints().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 238 of file base_struct.h.

238 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 575 of file base_struct.h.

575 { return *aLeft < *aRight; }

◆ StepAndRepeatItem()

void GERBER_FILE_IMAGE::StepAndRepeatItem ( const GERBER_DRAW_ITEM aItem)

Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called when reading a gerber file and after creating a new gerber item that must be repeated (i.e when m_XRepeatCount or m_YRepeatCount are > 1)

Parameters
aItem= the item to repeat

Definition at line 301 of file gerber_file_image.cpp.

302 {
303  if( GetLayerParams().m_XRepeatCount < 2 &&
304  GetLayerParams().m_YRepeatCount < 2 )
305  return; // Nothing to repeat
306 
307  // Duplicate item:
308  for( int ii = 0; ii < GetLayerParams().m_XRepeatCount; ii++ )
309  {
310  for( int jj = 0; jj < GetLayerParams().m_YRepeatCount; jj++ )
311  {
312  // the first gerber item already exists (this is the template)
313  // create duplicate only if ii or jj > 0
314  if( jj == 0 && ii == 0 )
315  continue;
316  GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
317  wxPoint move_vector;
318  move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
319  GetLayerParams().m_StepForRepeatMetric );
320  move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
321  GetLayerParams().m_StepForRepeatMetric );
322  dupItem->MoveXY( move_vector );
323  m_Drawings.Append( dupItem );
324  }
325  }
326 }
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
int scaletoIU(double aCoord, bool isMetric)
Function scaletoIU converts a distance given in floating point to our internal units.
DLIST< GERBER_DRAW_ITEM > m_Drawings
void MoveXY(const wxPoint &aMoveVector)
Function MoveXY move this object.
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.

References DLIST< T >::Append(), GetLayerParams(), m_Drawings, GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, GERBER_DRAW_ITEM::MoveXY(), and scaletoIU().

Referenced by Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), Execute_G_Command(), and EXCELLON_IMAGE::FinishRouteCommand().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 210 of file base_struct.h.

211  {
212  return m_StructType;
213  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172

References EDA_ITEM::m_StructType.

Referenced by MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), CONNECTION_GRAPH::buildConnectionGraph(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_NO_CONNECT::ClassOf(), TEXTE_PCB::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_PIN::ClassOf(), EDGE_MODULE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), SCH_FIELD::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), MARKER_PCB::ClassOf(), TRACK::ClassOf(), SCH_BITMAP::ClassOf(), ZONE_CONTAINER::ClassOf(), DIMENSION::ClassOf(), NETINFO_ITEM::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_TEXT::ClassOf(), SCH_SCREEN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_COMPONENT::ClassOf(), D_PAD::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), SCH_LABEL::ClassOf(), SCH_SHEET::ClassOf(), SCH_GLOBALLABEL::ClassOf(), VIA::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), SCH_SHEET::CleanupSheet(), EE_COLLECTOR::Collect(), LIB_RECTANGLE::compare(), LIB_CIRCLE::compare(), LIB_BEZIER::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), SCH_EDIT_FRAME::ConvertTextType(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), MODULE::CoverageRatio(), CINFO3D_VISU::createLayers(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), D_PAD::D_PAD(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_ERC::DisplayERC_MarkersList(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), DRC::doTrackDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), CN_ITEM::Dump(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), MODULE::Duplicate(), SCH_EDIT_TOOL::EditField(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), CONNECTION_GRAPH::ercCheckLabels(), SCH_EDITOR_CONTROL::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), EDIT_TOOL::FootprintFilter(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), SCH_SCREEN::GetHierarchicalItems(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), KIGFX::SCH_PAINTER::getRenderColor(), PCBNEW_SELECTION::GetTopLeftItem(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isNewSegment(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_SHEET::LocatePathOfScreen(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), SCH_MOVE_TOOL::moveItem(), SCH_CONNECTION::Name(), nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), POINT_EDITOR::OnSelectionChange(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), SCH_BASE_FRAME::RefreshItem(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_SCREEN::ReplaceWires(), CONNECTION_SUBGRAPH::ResolveDrivers(), WS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), SCH_TEXT::Rotate(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), ITEM_PICKER::SetItem(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), ShowClearance(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), SCH_FIELD::SwapData(), TRACK::SwapData(), DIMENSION::SwapData(), VIA::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), MODULE::SwapData(), ZONE_CONTAINER::SwapData(), D_PAD::SwapData(), SwapItemData(), TestDuplicateSheetNames(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), LIB_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), SCH_SHEET_PATH::UpdateAllScreenReferences(), SCH_TEXT::UpdateDanglingState(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_SHEET::Visit(), SCH_COMPONENT::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Function ViewBBox() returns the bounding box of the item covering all its layers.

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TRACK, TEXTE_MODULE, LIB_ALIAS, MARKER_PCB, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 236 of file base_struct.cpp.

237 {
238  // Basic fallback
239  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
240  VECTOR2I( GetBoundingBox().GetSize() ) );
241 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:520
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References EDA_ITEM::GetBoundingBox().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), and BRIGHT_BOX::ViewDraw().

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewDraw() Draws the parts of the object belonging to layer aLayer.

viewDraw() is an alternative way for drawing objects if if there is no PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on

Reimplemented in EDIT_POINTS, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::VIEW_OVERLAY, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 116 of file view_item.h.

117  {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void EDA_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.

For instance, a D_PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]output layer index array
aCountnumber of layer indices in aLayers[]

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, SCH_SHEET, EDIT_POINTS, VIA, LIB_PART, GERBER_DRAW_ITEM, BOARD_ITEM, TEXTE_MODULE, TRACK, SCH_ITEM, LIB_ALIAS, LIB_ITEM, SCH_COMPONENT, ZONE_CONTAINER, LIB_FIELD, SCH_LINE, MARKER_PCB, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, SCH_BITMAP, SCH_BUS_ENTRY_BASE, WS_DRAW_ITEM_BASE, SCH_NO_CONNECT, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, SCH_JUNCTION, LIB_TEXT, BRIGHT_BOX, KIGFX::RATSNEST_VIEWITEM, SCH_MARKER, and KIGFX::PREVIEW::RULER_ITEM.

Definition at line 244 of file base_struct.cpp.

245 {
246  // Basic fallback
247  aCount = 1;
248  aLayers[0] = 0;
249 }

◆ ViewGetLOD()

virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewGetLOD() Returns the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in MODULE_ZONE_CONTAINER, D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TEXTE_MODULE, TRACK, and EDGE_MODULE.

Definition at line 140 of file view_item.h.

141  {
142  // By default always show the item
143  return 0;
144  }

Referenced by KIGFX::VIEW::drawItem::operator()(), GRID_HELPER::queryVisible(), and SELECTION_TOOL::Selectable().

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT GERBER_FILE_IMAGE::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 393 of file gerber_file_image.cpp.

394 {
395  KICAD_T stype;
397  const KICAD_T* p = scanTypes;
398  bool done = false;
399 
400 #if 0 && defined(DEBUG)
401  std::cout << GetClass().mb_str() << ' ';
402 #endif
403 
404  while( !done )
405  {
406  stype = *p;
407 
408  switch( stype )
409  {
410  case GERBER_IMAGE_T:
411  case GERBER_IMAGE_LIST_T:
412  ++p;
413  break;
414 
415  case GERBER_DRAW_ITEM_T:
416  result = IterateForward( &m_Drawings[0], inspector, testData, p );
417  ++p;
418  break;
419 
420  default: // catch EOT or ANY OTHER type here and return.
421  done = true;
422  break;
423  }
424 
425  if( result == SEARCH_QUIT )
426  break;
427  }
428 
429  return result;
430 }
wxString GetClass() const override
Function GetClass returns the class name.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
static SEARCH_RESULT IterateForward(EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function IterateForward walks through the object tree calling the inspector() on each object type req...
Definition: base_struct.h:418
DLIST< GERBER_DRAW_ITEM > m_Drawings
SEARCH_RESULT
Definition: base_struct.h:54

References GERBER_DRAW_ITEM_T, GERBER_IMAGE_LIST_T, GERBER_IMAGE_T, GetClass(), EDA_ITEM::IterateForward(), m_Drawings, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by GBR_LAYOUT::Visit().

Member Data Documentation

◆ m_360Arc_enbl

bool GERBER_FILE_IMAGE::m_360Arc_enbl

◆ m_AperFunction

wxString GERBER_FILE_IMAGE::m_AperFunction

◆ m_Aperture_List

D_CODE* GERBER_FILE_IMAGE::m_Aperture_List[TOOLS_MAX_COUNT]
private

Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)

Definition at line 109 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE(), GetDCODE(), GetDCODEOrCreate(), GetDcodesCount(), InitToolTable(), and ~GERBER_FILE_IMAGE().

◆ m_aperture_macros

APERTURE_MACRO_SET GERBER_FILE_IMAGE::m_aperture_macros

a collection of APERTURE_MACROS, sorted by name

Definition at line 172 of file gerber_file_image.h.

Referenced by FindApertureMacro(), InitToolTable(), and ReadApertureMacro().

◆ m_ArcRadius

int GERBER_FILE_IMAGE::m_ArcRadius

◆ m_CommandState

int GERBER_FILE_IMAGE::m_CommandState

Definition at line 153 of file gerber_file_image.h.

Referenced by LoadGerberFile(), ReadRS274XCommand(), and ResetDefaultValues().

◆ m_ComponentsList

std::map<wxString, int> GERBER_FILE_IMAGE::m_ComponentsList

◆ m_Current_File

FILE* GERBER_FILE_IMAGE::m_Current_File

◆ m_Current_Tool

◆ m_CurrentPos

◆ m_Drawings

◆ m_Exposure

bool GERBER_FILE_IMAGE::m_Exposure
private

whether an aperture macro tool is flashed on or off

Definition at line 111 of file gerber_file_image.h.

Referenced by Execute_DCODE_Command(), Execute_G_Command(), and ResetDefaultValues().

◆ m_FileFunction

◆ m_FileName

◆ m_Flags

◆ m_FmtLen

◆ m_FmtScale

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

Set to true to override the visibility setting of the item.

Definition at line 184 of file base_struct.h.

Referenced by EDA_ITEM::initVars(), EDA_ITEM::operator=(), SCH_FIELD::Print(), and EDA_ITEM::SetForceVisible().

◆ m_GBRLayerParams

GERBER_LAYER GERBER_FILE_IMAGE::m_GBRLayerParams
private

Definition at line 113 of file gerber_file_image.h.

Referenced by GetLayerParams(), and ResetDefaultValues().

◆ m_GerbMetric

◆ m_GraphicLayer

◆ m_Has_DCode

bool GERBER_FILE_IMAGE::m_Has_DCode

◆ m_Has_MissingDCode

bool GERBER_FILE_IMAGE::m_Has_MissingDCode

◆ m_hasNegativeItems

int GERBER_FILE_IMAGE::m_hasNegativeItems
private

Definition at line 184 of file gerber_file_image.h.

Referenced by HasNegativeItems(), and ResetDefaultValues().

◆ m_IJPos

◆ m_ImageJustifyOffset

wxPoint GERBER_FILE_IMAGE::m_ImageJustifyOffset

◆ m_ImageJustifyXCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyXCenter

Definition at line 132 of file gerber_file_image.h.

Referenced by DisplayImageInfo(), ExecuteRS274XCommand(), and ResetDefaultValues().

◆ m_ImageJustifyYCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyYCenter

Definition at line 133 of file gerber_file_image.h.

Referenced by DisplayImageInfo(), ExecuteRS274XCommand(), and ResetDefaultValues().

◆ m_ImageName

wxString GERBER_FILE_IMAGE::m_ImageName

◆ m_ImageNegative

◆ m_ImageOffset

wxPoint GERBER_FILE_IMAGE::m_ImageOffset

◆ m_ImageRotation

◆ m_InUse

bool GERBER_FILE_IMAGE::m_InUse

◆ m_IsVisible

bool GERBER_FILE_IMAGE::m_IsVisible

Definition at line 120 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE(), and GERBVIEW_FRAME::Locate().

◆ m_IsX2_file

bool GERBER_FILE_IMAGE::m_IsX2_file

◆ m_Iterpolation

◆ m_Last_Pen_Command

int GERBER_FILE_IMAGE::m_Last_Pen_Command

Definition at line 152 of file gerber_file_image.h.

Referenced by Execute_DCODE_Command(), LoadGerberFile(), and ResetDefaultValues().

◆ m_LastArcDataType

◆ m_LastCoordIsIJPos

bool GERBER_FILE_IMAGE::m_LastCoordIsIJPos

Definition at line 158 of file gerber_file_image.h.

Referenced by Execute_DCODE_Command(), ReadIJCoord(), and ResetDefaultValues().

◆ m_LineNum

◆ m_List

DHEAD* EDA_ITEM::m_List
protectedinherited

which DLIST I am on.

Definition at line 178 of file base_struct.h.

Referenced by EDA_ITEM::GetList(), EDA_ITEM::initVars(), and EDA_ITEM::SetList().

◆ m_LocalRotation

double GERBER_FILE_IMAGE::m_LocalRotation

◆ m_MD5_value

wxString GERBER_FILE_IMAGE::m_MD5_value

Definition at line 128 of file gerber_file_image.h.

Referenced by ExecuteRS274XCommand(), and ResetDefaultValues().

◆ m_messagesList

wxArrayString GERBER_FILE_IMAGE::m_messagesList
private

Definition at line 183 of file gerber_file_image.h.

Referenced by AddMessageToList(), ClearMessageList(), and GetMessages().

◆ m_MirrorA

bool GERBER_FILE_IMAGE::m_MirrorA

◆ m_MirrorB

bool GERBER_FILE_IMAGE::m_MirrorB

◆ m_NetAttributeDict

◆ m_NetnamesList

std::map<wxString, int> GERBER_FILE_IMAGE::m_NetnamesList

◆ m_NoTrailingZeros

◆ m_Offset

◆ m_Parent

◆ m_PartString

wxString GERBER_FILE_IMAGE::m_PartString

Definition at line 129 of file gerber_file_image.h.

Referenced by ExecuteRS274XCommand(), and ResetDefaultValues().

◆ m_PolygonFillMode

bool GERBER_FILE_IMAGE::m_PolygonFillMode

◆ m_PolygonFillModeState

int GERBER_FILE_IMAGE::m_PolygonFillModeState

◆ m_PositiveDrawColor

COLOR4D GERBER_FILE_IMAGE::m_PositiveDrawColor

Definition at line 122 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE(), and GetPositiveDrawColor().

◆ m_PreviousPos

wxPoint GERBER_FILE_IMAGE::m_PreviousPos