KiCad PCB EDA Suite
EXCELLON_IMAGE Class Reference

#include <excellon_image.h>

Inheritance diagram for EXCELLON_IMAGE:
GERBER_FILE_IMAGE EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 EXCELLON_IMAGE (int layer)
 
 ~EXCELLON_IMAGE ()
 
virtual void ResetDefaultValues () override
 
bool LoadFile (const wxString &aFullFileName)
 Read and load a drill (EXCELLON format) file. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
bool LoadGerberFile (const wxString &aFullFileName)
 Read and load a gerber file. More...
 
const wxArrayString & GetMessages () const
 
int GetDcodesCount ()
 
COLOR4D GetPositiveDrawColor () const
 
GERBER_DRAW_ITEMSGetItems ()
 
int GetItemsCount ()
 
void AddItemToList (GERBER_DRAW_ITEM *aItem)
 Add a new GERBER_DRAW_ITEM item to the drawings list. More...
 
GERBER_DRAW_ITEMGetLastItemInList () const
 
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...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () 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[]) const
 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...
 
bool IsForceVisible () const
 
virtual void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, 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 const wxPoint GetPosition () const
 
virtual const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. 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 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

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

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_AsArcG74G75Cmd
 
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
 
const KIID m_Uuid
 

Protected Member Functions

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

Protected Attributes

STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Private Types

enum  excellon_state { READ_HEADER_STATE, READ_PROGRAM_STATE }
 

Private Member Functions

bool Execute_HEADER_And_M_Command (char *&text)
 
bool Select_Tool (char *&text)
 
bool Execute_EXCELLON_G_Command (char *&text)
 
bool Execute_Drill_Command (char *&text)
 
bool readToolInformation (char *&aText)
 Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list. More...
 
int TCodeNumber (char *&aText)
 
void FinishRouteCommand ()
 Ends a route command started by M15 ot G01, G02 or G03 command. More...
 
void SelectUnits (bool aMetric)
 

Private Attributes

excellon_state m_State
 
bool m_SlotOn
 
bool m_RouteModeOn
 
std::vector< EXCELLON_ROUTE_COORDm_RoutePositions
 

Detailed Description

Definition at line 133 of file excellon_image.h.

Member Enumeration Documentation

◆ excellon_state

Enumerator
READ_HEADER_STATE 
READ_PROGRAM_STATE 

Definition at line 136 of file excellon_image.h.

136  {
137  READ_HEADER_STATE, // When we are in this state, we are reading header
138  READ_PROGRAM_STATE // When we are in this state, we are reading drill data
139  };

Constructor & Destructor Documentation

◆ EXCELLON_IMAGE()

EXCELLON_IMAGE::EXCELLON_IMAGE ( int  layer)
inline

Definition at line 147 of file excellon_image.h.

147  : EXCELLON_IMAGE( int layer ) :
148  GERBER_FILE_IMAGE( layer )
149  {
151  m_SlotOn = false;
152  m_RouteModeOn = false;
153  }
GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters (TODO:...
EXCELLON_IMAGE(int layer)
excellon_state m_State

References m_RouteModeOn, m_SlotOn, m_State, and READ_HEADER_STATE.

◆ ~EXCELLON_IMAGE()

EXCELLON_IMAGE::~EXCELLON_IMAGE ( )
inline

Definition at line 156 of file excellon_image.h.

156 {};

Member Function Documentation

◆ AddItemToList()

void GERBER_FILE_IMAGE::AddItemToList ( GERBER_DRAW_ITEM aItem)
inlineinherited

Add a new GERBER_DRAW_ITEM item to the drawings list.

Parameters
aItemis the GERBER_DRAW_ITEM to add to list

Definition at line 290 of file gerber_file_image.h.

291  {
292  m_drawings.push_back( aItem );
293  }
GERBER_DRAW_ITEMS m_drawings

References GERBER_FILE_IMAGE::m_drawings.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), Execute_Drill_Command(), FinishRouteCommand(), and GERBER_FILE_IMAGE::StepAndRepeatItem().

◆ AddMessageToList()

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

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 240 of file base_struct.h.

240 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

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(), MICROWAVE_TOOL::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(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), 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_SEXPR_PLUGIN_CACHE::savePin(), 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 218 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearMessageList()

void GERBER_FILE_IMAGE::ClearMessageList ( )
inlineinherited

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

Definition at line 325 of file gerber_file_image.h.

326  {
327  m_messagesList.Clear();
328  }
wxArrayString m_messagesList

References GERBER_FILE_IMAGE::m_messagesList.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 252 of file base_struct.h.

253  {
255  DO_NOT_DRAW | FLAG0 | FLAG1 | BUSY );
256  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define FLAG1
Pcbnew: flag used in local computations.
Definition: base_struct.h:133
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:137
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:134
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:240
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

References BUSY, CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, FLAG0, FLAG1, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

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, SCH_HIERLABEL, LIB_PIN, VIA, SCH_GLOBALLABEL, SCH_LABEL, ARC, SCH_TEXT, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_LINE, TRACK, SCH_SHEET_PIN, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, SCH_NO_CONNECT, LIB_POLYLINE, SCH_MARKER, LIB_TEXT, PCB_TARGET, SCH_JUNCTION, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 108 of file base_struct.cpp.

109 {
110  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
111  wxT( ". Bad programmer!" ) );
112 }
#define NULL
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), LIB_PART::operator=(), LIB_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), 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)
inherited

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 NULL
#define IsNumber(x)

References IsNumber, and NULL.

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

◆ DisplayImageInfo()

void GERBER_FILE_IMAGE::DisplayImageInfo ( GERBVIEW_FRAME aMainFrame)
inherited

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 334 of file gerber_file_image.cpp.

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

Referenced by GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ Execute_Drill_Command()

bool EXCELLON_IMAGE::Execute_Drill_Command ( char *&  text)
private

Definition at line 611 of file excellon_read_drill_file.cpp.

612 {
613  D_CODE* tool;
614  GERBER_DRAW_ITEM * gbritem;
615 
616  while( true )
617  {
618  switch( *text )
619  {
620  case 'X':
621  case 'Y':
622  ReadXYCoord( text, true );
623 
624  if( *text == 'I' || *text == 'J' )
625  ReadIJCoord( text );
626 
627  break;
628 
629  case 'G': // G85 is found here for oval holes
632  break;
633 
634  case 0: // E.O.L: execute command
635  if( m_RouteModeOn )
636  {
637  // We are in routing mode, and this is an intermediate point.
638  // So just store it
639  int rmode = 0; // linear routing.
640 
642  rmode = ROUTE_CW;
644  rmode = ROUTE_CCW;
645 
647  {
648  EXCELLON_ROUTE_COORD point( m_CurrentPos, m_IJPos, rmode );
649  m_RoutePositions.push_back( point );
650  }
651  else
652  {
654  m_RoutePositions.push_back( point );
655  }
656  return true;
657  }
658 
659  tool = GetDCODE( m_Current_Tool );
660  if( !tool )
661  {
662  wxString msg;
663  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
664  AddMessageToList( msg );
665  return false;
666  }
667 
668  gbritem = new GERBER_DRAW_ITEM( this );
669  AddItemToList( gbritem );
670 
671  if( m_SlotOn ) // Oblong hole
672  {
673  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
675  tool->m_Size, false );
676  // the hole is made: reset the slot on command (G85)
677  // (it is needed for each oblong hole)
678  m_SlotOn = false;
679  }
680  else
681  {
682  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
683  m_CurrentPos, tool->m_Size, false );
684  }
685 
686  StepAndRepeatItem( *gbritem );
688  return true;
689  break;
690 
691  default:
692  text++;
693  break;
694  }
695  }
696 
697  return true;
698 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
wxPoint ReadIJCoord(char *&Text)
Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are rela...
#define ROUTE_CCW
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
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
void AddItemToList(GERBER_DRAW_ITEM *aItem)
Add a new GERBER_DRAW_ITEM item to the drawings list.
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
#define ROUTE_CW
wxPoint ReadXYCoord(char *&aText, bool aExcellonMode=false)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define _(s)
Definition: 3d_actions.cpp:33
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions
bool Execute_EXCELLON_G_Command(char *&text)
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
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

References _, GERBER_FILE_IMAGE::AddItemToList(), GERBER_FILE_IMAGE::AddMessageToList(), ARC_INFO_TYPE_CENTER, Execute_EXCELLON_G_Command(), fillFlashedGBRITEM(), fillLineGBRITEM(), GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::m_ArcRadius, GERBER_FILE_IMAGE::m_Current_Tool, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_Iterpolation, GERBER_FILE_IMAGE::m_LastArcDataType, D_CODE::m_Num_Dcode, GERBER_FILE_IMAGE::m_PreviousPos, m_RouteModeOn, m_RoutePositions, D_CODE::m_Shape, D_CODE::m_Size, m_SlotOn, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadXYCoord(), ROUTE_CCW, ROUTE_CW, and GERBER_FILE_IMAGE::StepAndRepeatItem().

Referenced by LoadFile().

◆ Execute_EXCELLON_G_Command()

bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command ( char *&  text)
private

Definition at line 739 of file excellon_read_drill_file.cpp.

740 {
741  EXCELLON_CMD* cmd = NULL;
742  bool success = false;
743  int id = DRILL_G_UNKNOWN;
744 
745  // Search command in list
746  EXCELLON_CMD* candidate;
747  char * gcmd = text; // gcmd points the G command, for error messages.
748 
749  for( unsigned ii = 0; ; ii++ )
750  {
751  candidate = &excellon_G_CmdList[ii];
752  int len = candidate->m_Name.size();
753  if( len == 0 ) // End of list reached
754  break;
755  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
756  {
757  cmd = candidate;
758  text += len;
759  success = true;
760  id = cmd->m_Code;
761  break;
762  }
763  }
764 
765  switch( id )
766  {
767  case DRILL_G_ZERO_SET:
768  ReadXYCoord( text, true );
770  break;
771 
772  case DRILL_G_ROUT:
773  m_SlotOn = false;
774 
775  if( m_RouteModeOn )
777 
778  m_RouteModeOn = true;
779  m_RoutePositions.clear();
781  ReadXYCoord( text, true );
782  // This is the first point (starting point) of routing
783  m_RoutePositions.emplace_back( m_CurrentPos );
784  break;
785 
786  case DRILL_G_DRILL:
787  m_SlotOn = false;
788 
789  if( m_RouteModeOn )
791 
792  m_RouteModeOn = false;
793  m_RoutePositions.clear();
795  break;
796 
797  case DRILL_G_SLOT:
798  m_SlotOn = true;
799  break;
800 
801  case DRILL_G_LINEARMOVE:
804  ReadXYCoord( text, true );
805  m_RoutePositions.emplace_back( m_CurrentPos );
806  break;
807 
808  case DRILL_G_CWMOVE:
810  ReadXYCoord( text, true );
811 
812  if( *text == 'I' || *text == 'J' )
813  ReadIJCoord( text );
814 
816  m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CW );
817  else
819  break;
820 
821  case DRILL_G_CCWMOVE:
823  ReadXYCoord( text, true );
824 
825  if( *text == 'I' || *text == 'J' )
826  ReadIJCoord( text );
827 
830  else
832  break;
833 
834  case DRILL_G_ABSOLUTE:
835  m_Relative = false; // false = absolute coord
836  break;
837 
838  case DRILL_G_INCREMENTAL:
839  m_Relative = true; // true = relative coord
840  break;
841 
842  case DRILL_G_UNKNOWN:
843  default:
844  AddMessageToList( wxString::Format( _( "Unknown Excellon G Code: &lt;%s&gt;" ), FROM_UTF8(gcmd) ) );
845  while( *text )
846  text++;
847  return false;
848  }
849 
850  return success;
851 }
static EXCELLON_CMD excellon_G_CmdList[]
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
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:114
wxPoint ReadIJCoord(char *&Text)
Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are rela...
#define ROUTE_CCW
#define NULL
#define ROUTE_CW
std::string m_Name
wxPoint ReadXYCoord(char *&aText, bool aExcellonMode=false)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
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
#define _(s)
Definition: 3d_actions.cpp:33
void FinishRouteCommand()
Ends a route command started by M15 ot G01, G02 or G03 command.
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions

References _, GERBER_FILE_IMAGE::AddMessageToList(), ARC_INFO_TYPE_CENTER, ARC_INFO_TYPE_NONE, DRILL_G_ABSOLUTE, DRILL_G_CCWMOVE, DRILL_G_CWMOVE, DRILL_G_DRILL, DRILL_G_INCREMENTAL, DRILL_G_LINEARMOVE, DRILL_G_ROUT, DRILL_G_SLOT, DRILL_G_UNKNOWN, DRILL_G_ZERO_SET, excellon_G_CmdList, FinishRouteCommand(), Format(), FROM_UTF8(), GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GERBER_FILE_IMAGE::m_ArcRadius, EXCELLON_CMD::m_Code, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_Iterpolation, GERBER_FILE_IMAGE::m_LastArcDataType, EXCELLON_CMD::m_Name, GERBER_FILE_IMAGE::m_Offset, GERBER_FILE_IMAGE::m_Relative, m_RouteModeOn, m_RoutePositions, m_SlotOn, NULL, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadXYCoord(), ROUTE_CCW, and ROUTE_CW.

Referenced by Execute_Drill_Command(), and LoadFile().

◆ Execute_HEADER_And_M_Command()

bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command ( char *&  text)
private

Definition at line 397 of file excellon_read_drill_file.cpp.

398 {
399  EXCELLON_CMD* cmd = NULL;
400  wxString msg;
401 
402  // Search command in list
403  for( unsigned ii = 0; ; ii++ )
404  {
405  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
406  int len = candidate->m_Name.size();
407 
408  if( len == 0 ) // End of list reached
409  break;
410 
411  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
412  {
413  cmd = candidate;
414  text += len;
415  break;
416  }
417  }
418 
419  if( !cmd )
420  {
421  msg.Printf( _( "Unknown Excellon command &lt;%s&gt;" ), text );
422  AddMessageToList( msg );
423  while( *text )
424  text++;
425 
426  return false;
427  }
428 
429  // Execute command
430  // some do nothing
431  switch( cmd->m_Code )
432  {
433  case DRILL_SKIP:
434  case DRILL_M_UNKNOWN:
435  break;
436 
437  case DRILL_M_END:
438  case DRILL_M_ENDFILE:
439  // if a route command is in progress, finish it
440  if( m_RouteModeOn )
442 
443  break;
444 
445  case DRILL_M_MESSAGE:
446  break;
447 
448  case DRILL_M_LONGMESSAGE:
449  break;
450 
451  case DRILL_M_HEADER:
453  break;
454 
455  case DRILL_M_ENDHEADER:
457  break;
458 
459  case DRILL_REWIND_STOP: // End of header. No action in a viewer
461  break;
462 
463  case DRILL_M_METRIC:
464  SelectUnits( true );
465  break;
466 
467  case DRILL_IMPERIAL_HEADER: // command like INCH,TZ or INCH,LZ
468  case DRILL_METRIC_HEADER: // command like METRIC,TZ or METRIC,LZ
469  SelectUnits( cmd->m_Code == DRILL_METRIC_HEADER ? true : false );
470 
471  if( *text != ',' )
472  {
473  // No TZ or LZ specified. Should be a decimal format
474  // but this is not always the case. Use default TZ setting as default
475  m_NoTrailingZeros = false;
476  break;
477  }
478 
479  text++; // skip separator
480  if( *text == 'T' )
481  m_NoTrailingZeros = false;
482  else
483  m_NoTrailingZeros = true;
484  break;
485 
487  break;
488 
489  case DRILL_M_ENDPATTERN:
490  break;
491 
492  case DRILL_M_CANNEDTEXT:
493  break;
494 
495  case DRILL_M_TIPCHECK:
496  break;
497 
498  case DRILL_DETECT_BROKEN:
499  break;
500 
502  if( *text != ',' )
503  {
504  AddMessageToList( "ICI command has no parameter" );
505  break;
506  }
507  text++; // skip separator
508  // Parameter should be ON or OFF
509  if( strncasecmp( text, "OFF", 3 ) == 0 )
510  m_Relative = false;
511  else if( strncasecmp( text, "ON", 2 ) == 0 )
512  m_Relative = true;
513  else
514  AddMessageToList( "ICI command has incorrect parameter" );
515  break;
516 
518  break;
519 
521  break;
522 
523  case DRILL_AXIS_VERSION:
524  break;
525 
526  case DRILL_RESET_CMD:
527  break;
528 
530  break;
531 
532  case DRILL_FMT:
533  break;
534 
536  readToolInformation( text );
537  break;
538 
539  case DRILL_M_TOOL_DOWN: // tool down (starting a routed hole or polyline)
540  // Only the last position is usefull:
541  if( m_RoutePositions.size() > 1 )
542  m_RoutePositions.erase( m_RoutePositions.begin(), m_RoutePositions.begin() + m_RoutePositions.size() - 1 );
543 
544  break;
545 
546  case DRILL_M_TOOL_UP: // tool up (ending a routed polyline)
548  break;
549  }
550 
551  while( *text )
552  text++;
553 
554  return true;
555 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
static EXCELLON_CMD excellonHeaderCmdList[]
#define NULL
std::string m_Name
excellon_state m_State
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list.
#define _(s)
Definition: 3d_actions.cpp:33
void FinishRouteCommand()
Ends a route command started by M15 ot G01, G02 or G03 command.
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions
void SelectUnits(bool aMetric)

References _, GERBER_FILE_IMAGE::AddMessageToList(), DRILL_AUTOMATIC_SPEED, DRILL_AUTOMATIC_TOOL_CHANGE, DRILL_AXIS_VERSION, DRILL_DETECT_BROKEN, DRILL_FMT, DRILL_IMPERIAL_HEADER, DRILL_INCREMENTALHEADER, DRILL_M_BEGINPATTERN, DRILL_M_CANNEDTEXT, DRILL_M_END, DRILL_M_ENDFILE, DRILL_M_ENDHEADER, DRILL_M_ENDPATTERN, DRILL_M_HEADER, DRILL_M_LONGMESSAGE, DRILL_M_MESSAGE, DRILL_M_METRIC, DRILL_M_TIPCHECK, DRILL_M_TOOL_DOWN, DRILL_M_TOOL_UP, DRILL_M_UNKNOWN, DRILL_METRIC_HEADER, DRILL_RESET_CMD, DRILL_REWIND_STOP, DRILL_SKIP, DRILL_TOOL_CHANGE_STOP, DRILL_TOOL_INFORMATION, excellonHeaderCmdList, FinishRouteCommand(), EXCELLON_CMD::m_Code, EXCELLON_CMD::m_Name, GERBER_FILE_IMAGE::m_NoTrailingZeros, GERBER_FILE_IMAGE::m_Relative, m_RouteModeOn, m_RoutePositions, m_State, NULL, READ_HEADER_STATE, READ_PROGRAM_STATE, readToolInformation(), and SelectUnits().

Referenced by LoadFile().

◆ FindApertureMacro()

APERTURE_MACRO * GERBER_FILE_IMAGE::FindApertureMacro ( const APERTURE_MACRO aLookup)
inherited

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 156 of file gerber_file_image.cpp.

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

References GERBER_FILE_IMAGE::m_aperture_macros, and NULL.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

◆ FinishRouteCommand()

void EXCELLON_IMAGE::FinishRouteCommand ( )
private

Ends a route command started by M15 ot G01, G02 or G03 command.

Definition at line 884 of file excellon_read_drill_file.cpp.

885 {
886  // Ends a route command started by M15 ot G01, G02 or G03 command
887  // if a route command is not in progress, do nothing
888 
889  if( !m_RouteModeOn )
890  return;
891 
892  D_CODE* tool = GetDCODE( m_Current_Tool );
893 
894  if( !tool )
895  {
896  AddMessageToList( wxString::Format( "Unknown tool code %d", m_Current_Tool ) );
897  return;
898  }
899 
900  for( size_t ii = 1; ii < m_RoutePositions.size(); ii++ )
901  {
902  GERBER_DRAW_ITEM* gbritem = new GERBER_DRAW_ITEM( this );
903 
904  if( m_RoutePositions[ii].m_rmode == 0 ) // linear routing
905  {
906  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
907  m_RoutePositions[ii-1].GetPos(), m_RoutePositions[ii].GetPos(),
908  tool->m_Size, false );
909  }
910  else // circular (cw or ccw) routing
911  {
912  bool rot_ccw = m_RoutePositions[ii].m_rmode == ROUTE_CW;
913  int radius = m_RoutePositions[ii].m_radius; // Can be adjusted by computeCenter.
914  wxPoint center;
915 
916  if( m_RoutePositions[ii].m_arc_type_info == ARC_INFO_TYPE_CENTER )
917  center = wxPoint( m_RoutePositions[ii].m_cx, m_RoutePositions[ii].m_cy );
918  else
919  center = computeCenter( m_RoutePositions[ii-1].GetPos(),
920  m_RoutePositions[ii].GetPos(), radius, rot_ccw );
921 
922  fillArcGBRITEM( gbritem, tool->m_Num_Dcode,
923  m_RoutePositions[ii-1].GetPos(), m_RoutePositions[ii].GetPos(),
924  center - m_RoutePositions[ii-1].GetPos(),
925  tool->m_Size, not rot_ccw , true,
926  false );
927  }
928 
929  AddItemToList( gbritem );
930 
931  StepAndRepeatItem( *gbritem );
932  }
933 
934  m_RoutePositions.clear();
935  m_RouteModeOn = false;
936 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
static wxPoint computeCenter(wxPoint aStart, wxPoint aEnd, int &aRadius, bool aRotCCW)
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
void AddItemToList(GERBER_DRAW_ITEM *aItem)
Add a new GERBER_DRAW_ITEM item to the drawings list.
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
#define ROUTE_CW
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
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
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
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
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

References GERBER_FILE_IMAGE::AddItemToList(), GERBER_FILE_IMAGE::AddMessageToList(), ARC_INFO_TYPE_CENTER, computeCenter(), fillArcGBRITEM(), fillLineGBRITEM(), Format(), GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::m_Current_Tool, D_CODE::m_Num_Dcode, m_RouteModeOn, m_RoutePositions, D_CODE::m_Size, ROUTE_CW, and GERBER_FILE_IMAGE::StepAndRepeatItem().

Referenced by Execute_EXCELLON_G_Command(), and Execute_HEADER_And_M_Command().

◆ GCodeNumber()

int GERBER_FILE_IMAGE::GCodeNumber ( char *&  Text)
inherited

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 NULL
#define IsNumber(x)

References IsNumber, and NULL.

Referenced by GERBER_FILE_IMAGE::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_HIERLABEL, SCH_SHEET, SCH_GLOBALLABEL, SCH_COMPONENT, SCH_LABEL, WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, SCH_TEXT, WS_DRAW_ITEM_PAGE, DIMENSION, DRAWSEGMENT, LIB_PART, GERBER_DRAW_ITEM, WS_DRAW_ITEM_RECT, LIB_ITEM, TEXTE_MODULE, WS_DRAW_ITEM_POLYPOLYGONS, MODULE, LIB_FIELD, SCH_LINE, WS_DRAW_ITEM_LINE, TEXTE_PCB, TRACK, LIB_PIN, SCH_FIELD, ZONE_CONTAINER, SCH_BITMAP, MARKER_PCB, PCB_TARGET, WS_DRAW_ITEM_BASE, SCH_BUS_ENTRY_BASE, SCH_PIN, GBR_LAYOUT, LIB_POLYLINE, LIB_ARC, SCH_NO_CONNECT, LIB_TEXT, LIB_BEZIER, SCH_MARKER, LIB_RECTANGLE, LIB_CIRCLE, and SCH_JUNCTION.

Definition at line 95 of file base_struct.cpp.

96 {
97 #if defined(DEBUG)
98  printf( "Missing GetBoundingBox()\n" );
99  Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
100 #endif
101 
102  // return a zero-sized box per default. derived classes should override
103  // this
104  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
105 }
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

Referenced by CN_ITEM::BBox(), EE_RTREE::contains(), MODULE::CoverageRatio(), SELECTION::GetBoundingBox(), LIB_ITEM::GetBoundingBox(), GetBoundingBoxes(), GERBVIEW_SELECTION::GetCenter(), getRect(), EE_RTREE::insert(), SCH_EDIT_TOOL::Mirror(), SCH_EAGLE_PLUGIN::moveLabels(), EE_RTREE::remove(), GERBVIEW_SELECTION::ViewBBox(), and EDA_ITEM::ViewBBox().

◆ GetClass()

wxString GERBER_FILE_IMAGE::GetClass ( ) const
inlineoverridevirtualinherited

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 251 of file gerber_file_image.h.

252  {
253  return wxT( "GERBER_FILE_IMAGE" );
254  }

◆ GetDCODE()

D_CODE * GERBER_FILE_IMAGE::GetDCODE ( int  aDCODE) const
inherited

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 143 of file gerber_file_image.cpp.

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

References arrayDim(), FIRST_DCODE, GERBER_FILE_IMAGE::m_Aperture_List, and NULL.

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

◆ GetDCODEOrCreate()

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

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 123 of file gerber_file_image.cpp.

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

References arrayDim(), FIRST_DCODE, GERBER_FILE_IMAGE::m_Aperture_List, and NULL.

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

◆ GetDcodesCount()

int GERBER_FILE_IMAGE::GetDcodesCount ( )
inherited
Returns
the count of Dcode tools in use in the image

Definition at line 259 of file gerber_file_image.cpp.

260 {
261  int count = 0;
262 
263  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
264  {
265  if( m_Aperture_List[ii] )
266  if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
267  ++count;
268  }
269 
270  return count;
271 }
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:160

References arrayDim(), GERBER_FILE_IMAGE::m_Aperture_List, and GERBER_FILE_IMAGE::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 244 of file base_struct.h.

245  {
246  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
248 
249  return m_Flags & mask;
250  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:180
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_Flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), 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_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in TRACK.

Definition at line 351 of file base_struct.h.

351 { return GetPosition(); }
virtual const wxPoint GetPosition() const
Definition: base_struct.h:344

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetItems()

◆ GetItemsCount()

int GERBER_FILE_IMAGE::GetItemsCount ( )
inlineinherited
Returns
the count of GERBER_DRAW_ITEMS in the image

Definition at line 284 of file gerber_file_image.h.

284 { return m_drawings.size(); }
GERBER_DRAW_ITEMS m_drawings

References GERBER_FILE_IMAGE::m_drawings.

Referenced by GERBVIEW_FRAME::Read_GERBER_File().

◆ GetLastItemInList()

GERBER_DRAW_ITEM* GERBER_FILE_IMAGE::GetLastItemInList ( ) const
inlineinherited
Returns
the last GERBER_DRAW_ITEM* item of the items list

Definition at line 298 of file gerber_file_image.h.

299  {
300  return m_drawings.back();
301  }
GERBER_DRAW_ITEMS m_drawings

References GERBER_FILE_IMAGE::m_drawings.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), and GERBER_FILE_IMAGE::Execute_G_Command().

◆ GetLayerParams()

GERBER_LAYER& GERBER_FILE_IMAGE::GetLayerParams ( )
inlineinherited

◆ 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, SCH_HIERLABEL, LIB_PIN, VIA, SCH_GLOBALLABEL, SCH_LABEL, SCH_TEXT, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, TRACK, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, SCH_BUS_WIRE_ENTRY, EDGE_MODULE, SCH_BITMAP, LIB_ARC, TEXTE_PCB, LIB_POLYLINE, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, PCB_TARGET, MARKER_PCB, LIB_CIRCLE, LIB_RECTANGLE, and SCH_JUNCTION.

Definition at line 233 of file base_struct.cpp.

234 {
235  return dummy_xpm;
236 }
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
inlineinherited

◆ GetMsgPanelInfo()

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

◆ GetParent()

◆ GetPosition()

virtual const wxPoint EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

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

Definition at line 344 of file base_struct.h.

344 { return wxPoint(); }

Referenced by GRID_HELPER::computeAnchors(), SCH_EDIT_FRAME::DeleteJunction(), KIGFX::PCB_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckNoConnects(), SELECTION_TOOL::findCallback(), GERBVIEW_SELECTION::GetCenter(), BOARD_ITEM::GetCenter(), EDA_ITEM::GetFocusPosition(), SCH_FIELD::GetParentPosition(), POSITION_RELATIVE_TOOL::GetSelectionAnchorPosition(), SCH_SCREEN::GetSheets(), PCBNEW_SELECTION::GetTopLeftItem(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_ITEM::operator<(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), SELECTION_TOOL::selectConnectedTracks(), RC_ITEM::ShowReport(), DRC::testDisabledLayers(), TransformItem(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), and EE_POINT_EDITOR::updatePoints().

◆ GetPositiveDrawColor()

COLOR4D GERBER_FILE_IMAGE::GetPositiveDrawColor ( ) const
inlineinherited

Definition at line 274 of file gerber_file_image.h.

274 { return m_PositiveDrawColor; }

References GERBER_FILE_IMAGE::m_PositiveDrawColor.

Referenced by GERBER_DRAW_ITEM::Print().

◆ GetSelectMenuText()

wxString EDA_ITEM::GetSelectMenuText ( EDA_UNITS  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, SCH_HIERLABEL, LIB_PIN, VIA, SCH_GLOBALLABEL, SCH_LABEL, WS_DRAW_ITEM_BITMAP, SCH_TEXT, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DRAWSEGMENT, WS_DRAW_ITEM_PAGE, DIMENSION, WS_DRAW_ITEM_RECT, TEXTE_MODULE, TRACK, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BUS_WIRE_ENTRY, WS_DRAW_ITEM_LINE, EDGE_MODULE, LIB_ARC, SCH_BITMAP, TEXTE_PCB, LIB_POLYLINE, SCH_NO_CONNECT, LIB_TEXT, PCB_TARGET, SCH_MARKER, MARKER_PCB, LIB_CIRCLE, LIB_RECTANGLE, SCH_JUNCTION, SCH_PIN, and DELETED_BOARD_ITEM.

Definition at line 134 of file base_struct.cpp.

135 {
136  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
137  GetClass() );
138 
139  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
140 }
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(), MARKER_PCB::GetMsgPanelInfo(), RC_TREE_MODEL::GetValue(), DRC_ITEM::ShowHtml(), RC_ITEM::ShowReport(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 223 of file base_struct.h.

224  {
225  return m_Status & type;
226  }
STATUS_FLAGS m_Status
Definition: base_struct.h:177

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 236 of file base_struct.h.

236 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:177

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ HasFlag()

◆ HasNegativeItems()

bool GERBER_FILE_IMAGE::HasNegativeItems ( )
inherited

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 235 of file gerber_file_image.cpp.

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

References GERBER_FILE_IMAGE::GetItems(), GERBER_FILE_IMAGE::m_GraphicLayer, GERBER_FILE_IMAGE::m_hasNegativeItems, and GERBER_FILE_IMAGE::m_ImageNegative.

◆ HitTest() [1/2]

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

◆ 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, VIA, ZONE_CONTAINER, WS_DRAW_ITEM_BITMAP, SCH_TEXT, ARC, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DIMENSION, DRAWSEGMENT, SCH_LINE, TEXTE_MODULE, LIB_ITEM, SCH_FIELD, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, TEXTE_PCB, WS_DRAW_ITEM_BASE, SCH_JUNCTION, PCB_TARGET, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, and LIB_CIRCLE.

Definition at line 328 of file base_struct.h.

329  {
330  return false; // derived classes should override this function
331  }

◆ InitToolTable()

void GERBER_FILE_IMAGE::InitToolTable ( )
inherited

Function InitToolTable.

Definition at line 274 of file gerber_file_image.cpp.

275 {
276  for( int count = 0; count < TOOLS_MAX_COUNT; count++ )
277  {
278  if( m_Aperture_List[count] == NULL )
279  continue;
280 
281  m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
283  }
284 
285  m_aperture_macros.clear();
286 }
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 NULL
#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, GERBER_FILE_IMAGE::m_Aperture_List, GERBER_FILE_IMAGE::m_aperture_macros, D_CODE::m_Num_Dcode, NULL, and TOOLS_MAX_COUNT.

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 205 of file base_struct.h.

205 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 293 of file base_struct.h.

293 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:179

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 209 of file base_struct.h.

209 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:139
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

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_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 508 of file base_struct.h.

508 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 208 of file base_struct.h.

208 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:180
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

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[]) const
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, VIA, D_PAD, DIMENSION, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, EDGE_MODULE, and TEXTE_PCB.

Definition at line 269 of file base_struct.h.

270  {
271  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
272  return true;
273 
274  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
275  {
276  if( m_StructType == *p )
277  return true;
278  }
279 
280  return false;
281  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:174
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 GetRule(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), TEXTE_PCB::IsType(), EDGE_MODULE::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), TEXTE_MODULE::IsType(), DRAWSEGMENT::IsType(), DIMENSION::IsType(), D_PAD::IsType(), VIA::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 206 of file base_struct.h.

206 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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 390 of file base_struct.h.

394  {
395  for( auto it : aList )
396  {
397  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
399  return SEARCH_RESULT::QUIT;
400  }
401 
403  }
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 CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/2]

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 411 of file base_struct.h.

413  {
414  for( auto it : aList )
415  {
416  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
418  return SEARCH_RESULT::QUIT;
419  }
420 
422  }
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 CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ LoadFile()

bool EXCELLON_IMAGE::LoadFile ( const wxString &  aFullFileName)

Read and load a drill (EXCELLON format) file.

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

Definition at line 308 of file excellon_read_drill_file.cpp.

309 {
310  // Set the default parmeter values:
313 
314  m_Current_File = wxFopen( aFullFileName, "rt" );
315 
316  if( m_Current_File == NULL )
317  return false;
318 
319  wxString msg;
320  m_FileName = aFullFileName;
321 
322  LOCALE_IO toggleIo;
323 
324  // FILE_LINE_READER will close the file.
325  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
326 
327  while( true )
328  {
329  if( excellonReader.ReadLine() == 0 )
330  break;
331 
332  char* line = excellonReader.Line();
333  char* text = StrPurge( line );
334 
335  if( *text == ';' || *text == 0 ) // comment: skip line or empty malformed line
336  continue;
337 
339  {
341  }
342  else
343  {
344  switch( *text )
345  {
346  case 'M':
348  break;
349 
350  case 'G': // Line type Gxx : command
352  break;
353 
354  case 'X':
355  case 'Y': // command like X12550Y19250
356  Execute_Drill_Command(text);
357  break;
358 
359  case 'I':
360  case 'J': /* Auxiliary Move command */
361  m_IJPos = ReadIJCoord( text );
362  if( *text == '*' ) // command like X35142Y15945J504
363  {
364  Execute_Drill_Command( text);
365  }
366  break;
367 
368  case 'T': // Tool command
369  Select_Tool( text );
370  break;
371 
372  case '%':
373  break;
374 
375  default:
376  msg.Printf( "Unexpected symbol 0x%2.2X &lt;%c&gt;", *text, *text );
377  AddMessageToList( msg );
378  break;
379  } // End switch
380  }
381  }
382 
383  // Add our file attribute, to identify the drill file
385  char* text = (char*)file_attribute;
386  int dummyline = 0;
387  dummy.ParseAttribCmd( NULL, NULL, 0, text, dummyline );
388  delete m_FileFunction;
390 
391  m_InUse = true;
392 
393  return true;
394 }
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
X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma.
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
Definition: string.cpp:344
virtual void ResetDefaultValues() override
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:214
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.
bool Select_Tool(char *&text)
FILE_LINE_READER is a LINE_READER that reads from an open file.
Definition: richio.h:180
bool Execute_HEADER_And_M_Command(char *&text)
#define NULL
bool Execute_Drill_Command(char *&text)
excellon_state m_State
static const char file_attribute[]
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
bool Execute_EXCELLON_G_Command(char *&text)

References GERBER_FILE_IMAGE::AddMessageToList(), GERBER_FILE_IMAGE::ClearMessageList(), dummy(), Execute_Drill_Command(), Execute_EXCELLON_G_Command(), Execute_HEADER_And_M_Command(), file_attribute, LINE_READER::Line(), GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_FileFunction, GERBER_FILE_IMAGE::m_FileName, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_InUse, m_State, NULL, READ_HEADER_STATE, GERBER_FILE_IMAGE::ReadIJCoord(), FILE_LINE_READER::ReadLine(), ResetDefaultValues(), Select_Tool(), and StrPurge().

Referenced by GERBVIEW_FRAME::Read_EXCELLON_File().

◆ LoadGerberFile()

bool GERBER_FILE_IMAGE::LoadGerberFile ( const wxString &  aFullFileName)
inherited

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:587
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
Definition: string.cpp:344
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:214
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
#define NULL
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:144
virtual void ResetDefaultValues()

References GERBER_FILE_IMAGE::AddMessageToList(), GERBER_FILE_IMAGE::ClearMessageList(), CMD_IDLE, GERBER_FILE_IMAGE::DCodeNumber(), END_BLOCK, ENTER_RS274X_CMD, GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), GERBER_FILE_IMAGE::GCodeNumber(), GERBER_BUFZ, lineBuffer, GERBER_FILE_IMAGE::m_CommandState, GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_FileName, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_InUse, GERBER_FILE_IMAGE::m_Last_Pen_Command, GERBER_FILE_IMAGE::m_LineNum, NULL, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadRS274XCommand(), GERBER_FILE_IMAGE::ReadXYCoord(), GERBER_FILE_IMAGE::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_TEXT, SCH_SHEET_PIN, SCH_FIELD, LIB_PIN, SCH_PIN, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, and TEXTE_PCB.

Definition at line 464 of file base_struct.h.

465  {
466  return false;
467  }

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

◆ 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 143 of file base_struct.cpp.

144 {
145  wxString text = aText;
146  wxString searchText = aSearchData.GetFindString();
147 
148  // Don't match if searching for replaceable item and the item doesn't support text replace.
149  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
150  return false;
151 
152  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
153  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
154 
155  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
156  {
157  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
158  return text.Matches( searchText );
159 
160  return text.MakeUpper().Matches( searchText.MakeUpper() );
161  }
162 
163  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
164  return aText.Find( searchText ) != wxNOT_FOUND;
165 
166  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
167 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:508

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

◆ 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 197 of file base_struct.cpp.

198 {
199  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
200  GetChars( GetClass() ) ) );
201 
202  return false;
203 }
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:153
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().

◆ ReadIJCoord()

wxPoint GERBER_FILE_IMAGE::ReadIJCoord ( char *&  Text)
inherited

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 191 of file rs274_read_XY_and_IJ_coordinates.cpp.

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

References ARC_INFO_TYPE_CENTER, IsNumber, IU_PER_MILS, KiROUND(), GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_LastArcDataType, GERBER_FILE_IMAGE::m_LastCoordIsIJPos, GERBER_FILE_IMAGE::m_NoTrailingZeros, NULL, scale_list, wxPoint::x, and wxPoint::y.

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

◆ readToolInformation()

bool EXCELLON_IMAGE::readToolInformation ( char *&  aText)
private

Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list.

Definition at line 558 of file excellon_read_drill_file.cpp.

559 {
560  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
561  // and enter the TCODE param in list (using the D_CODE param management, which
562  // is similar to TCODE params.
563  if( *aText == 'T' ) // This is the beginning of the definition
564  aText++;
565 
566  // Read tool number:
567  int iprm = ReadInt( aText, false );
568 
569  // Skip Feed rate and Spindle speed, if any here
570  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
571  {
572  aText++;
573  ReadInt( aText, false );
574  }
575 
576  // Read tool shape
577  if( ! *aText )
579  _( "Tool definition shape not found" ) ) );
580  else if( *aText != 'C' )
582  _( "Tool definition '%c' not supported" ), *aText ) );
583  if( *aText )
584  aText++;
585 
586  //read tool diameter:
587  double dprm = ReadDouble( aText, false );
588  m_Has_DCode = true;
589 
590  // Initialize Dcode to handle this Tool
591  // Remember: dcodes are >= FIRST_DCODE
592  D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
593 
594  if( dcode == NULL )
595  return false;
596 
597  // conv_scale = scaling factor from inch to Internal Unit
598  double conv_scale = IU_PER_MILS * 1000;
599 
600  if( m_GerbMetric )
601  conv_scale /= 25.4;
602 
603  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
604  dcode->m_Shape = APT_CIRCLE;
605  dcode->m_Defined = true;
606 
607  return true;
608 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
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
#define _(s)
Definition: 3d_actions.cpp:33
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
#define IU_PER_MILS
Definition: plotter.cpp:138
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE.
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.

References _, GERBER_FILE_IMAGE::AddMessageToList(), APT_CIRCLE, FIRST_DCODE, Format(), GERBER_FILE_IMAGE::GetDCODEOrCreate(), IU_PER_MILS, KiROUND(), D_CODE::m_Defined, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_Has_DCode, D_CODE::m_Shape, D_CODE::m_Size, NULL, ReadDouble(), and ReadInt().

Referenced by Execute_HEADER_And_M_Command(), and Select_Tool().

◆ ReadXYCoord()

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

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 73 of file rs274_read_XY_and_IJ_coordinates.cpp.

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

References ARC_INFO_TYPE_RADIUS, IsNumber, IU_PER_MILS, KiROUND(), GERBER_FILE_IMAGE::m_ArcRadius, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_LastArcDataType, GERBER_FILE_IMAGE::m_NoTrailingZeros, GERBER_FILE_IMAGE::m_Relative, NULL, scale_list, wxPoint::x, and wxPoint::y.

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

◆ RemoveAttribute()

void GERBER_FILE_IMAGE::RemoveAttribute ( X2_ATTRIBUTE aAttribute)
inherited

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 374 of file gerber_file_image.cpp.

375 {
376  /* Called when a %TD command is found
377  * Remove the attribute specified by the %TD command.
378  * is no attribute, all current attributes specified by the %TO and the %TA
379  * commands are cleared.
380  * if a attribute name is specified (for instance %TD.CN*%) is specified,
381  * only this attribute is cleared
382  */
383  wxString cmd = aAttribute.GetPrm( 0 );
385 
386  if( cmd.IsEmpty() || cmd == ".AperFunction" )
387  m_AperFunction.Clear();
388 }
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(), GERBER_FILE_IMAGE::m_AperFunction, and GERBER_FILE_IMAGE::m_NetAttributeDict.

Referenced by GERBER_FILE_IMAGE::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 170 of file base_struct.cpp.

171 {
172  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
173 
174  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
175  aSearchData.GetFindString() :
176  aSearchData.GetFindString().Upper() );
177 
178  if( result == wxNOT_FOUND )
179  return false;
180 
181  wxString prefix = aText.Left( result );
182  wxString suffix;
183 
184  if( aSearchData.GetFindString().length() + result < aText.length() )
185  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
186 
187  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
188  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
189  GetChars( suffix ) );
190 
191  aText = prefix + aSearchData.GetReplaceString() + suffix;
192 
193  return true;
194 }
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:153

References GetChars(), and traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::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_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 496 of file base_struct.h.

496 { return false; }

◆ ResetDefaultValues()

virtual void EXCELLON_IMAGE::ResetDefaultValues ( )
inlineoverridevirtual

Reimplemented from GERBER_FILE_IMAGE.

Definition at line 158 of file excellon_image.h.

159  {
161  SelectUnits( false );
162  }
void SelectUnits(bool aMetric)
virtual void ResetDefaultValues()

References GERBER_FILE_IMAGE::ResetDefaultValues(), and SelectUnits().

Referenced by LoadFile().

◆ Select_Tool()

bool EXCELLON_IMAGE::Select_Tool ( char *&  text)
private

Definition at line 701 of file excellon_read_drill_file.cpp.

702 {
703  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
704  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
705  // in tool selection command, if the tool is not defined in list,
706  // and the definition is embedded, it will be entered in list
707  char * startline = text; // the tool id starts here.
708  int tool_id = TCodeNumber( text );
709 
710  // T0 is legal, but is not a selection tool. it is a special command
711  if( tool_id >= 0 )
712  {
713  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
714 
715  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
716  dcode_id = TOOLS_MAX_COUNT - 1;
717 
718  m_Current_Tool = dcode_id;
719  D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true );
720 
721  if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it
722  {
723  text = startline; // text starts at the beginning of the command
724  readToolInformation( text );
725  currDcode = GetDCODE( dcode_id );
726  }
727 
728  if( currDcode )
729  currDcode->m_InUse = true;
730  }
731 
732  while( *text )
733  text++;
734 
735  return tool_id >= 0;
736 }
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.
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
int TCodeNumber(char *&aText)
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list.
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE.

References FIRST_DCODE, GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetDCODEOrCreate(), GERBER_FILE_IMAGE::m_Current_Tool, D_CODE::m_InUse, NULL, readToolInformation(), TCodeNumber(), and TOOLS_MAX_COUNT.

Referenced by LoadFile().

◆ SelectUnits()

void EXCELLON_IMAGE::SelectUnits ( bool  aMetric)
private

Definition at line 853 of file excellon_read_drill_file.cpp.

854 {
855  /* Coordinates are measured either in inch or metric (millimeters).
856  * Inch coordinates are in six digits (00.0000) with increments
857  * as small as 0.0001 (1/10,000).
858  * Metric coordinates can be measured in microns (thousandths of a millimeter)
859  * in one of the following three ways:
860  * Five digit 10 micron resolution (000.00)
861  * Six digit 10 micron resolution (0000.00)
862  * Six digit micron resolution (000.000)
863  *
864  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
865  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
866  */
867  if( aMetric )
868  {
869  m_GerbMetric = true;
870  // number of digits in mantissa
872  // number of digits (mantissa+interger)
874  }
875  else
876  {
877  m_GerbMetric = false;
880  }
881 }
static const int fmtMantissaInch
static const int fmtIntegerInch
static const int fmtMantissaMM
static const int fmtIntegerMM

References fmtIntegerInch, fmtIntegerMM, fmtMantissaInch, fmtMantissaMM, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, and GERBER_FILE_IMAGE::m_GerbMetric.

Referenced by Execute_HEADER_And_M_Command(), and ResetDefaultValues().

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 239 of file base_struct.h.

239 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:180

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), LIB_MOVE_TOOL::moveItem(), SCH_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_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::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 291 of file base_struct.h.

291 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: base_struct.h:179

References EDA_ITEM::m_forceVisible.

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 214 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetModified()

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Definition at line 200 of file base_struct.h.

200 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:178

References EDA_ITEM::m_Parent.

Referenced by MODULE::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewComponent(), SCH_SHEET::AddPin(), LIB_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), LIB_PART::operator=(), PCB_PARSER::parseMODULE_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), LIB_EDIT_TOOL::Paste(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteModuleItemsToModEdit(), SCH_DRAWING_TOOLS::PlaceComponent(), PCB_EDITOR_CONTROL::PlaceModule(), BOARD_COMMIT::Push(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), LIB_PART::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), SwapItemData(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ SetSelected()

◆ SetState()

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

Definition at line 228 of file base_struct.h.

229  {
230  if( state )
231  m_Status |= type; // state = ON or OFF
232  else
233  m_Status &= ~type;
234  }
STATUS_FLAGS m_Status
Definition: base_struct.h:177

References EDA_ITEM::m_Status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 237 of file base_struct.h.

237 { m_Status = aStatus; }
STATUS_FLAGS m_Status
Definition: base_struct.h:177

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 212 of file base_struct.h.

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

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 527 of file base_struct.h.

527 { return *aLeft < *aRight; }

◆ StepAndRepeatItem()

void GERBER_FILE_IMAGE::StepAndRepeatItem ( const GERBER_DRAW_ITEM aItem)
inherited

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 297 of file gerber_file_image.cpp.

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

References GERBER_FILE_IMAGE::AddItemToList(), GERBER_FILE_IMAGE::GetLayerParams(), GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, GERBER_DRAW_ITEM::MoveXY(), scaletoIU(), wxPoint::x, and wxPoint::y.

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

◆ TCodeNumber()

int EXCELLON_IMAGE::TCodeNumber ( char *&  aText)
inlineprivate

Definition at line 185 of file excellon_image.h.

186  {
187  return DCodeNumber( aText );
188  }
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:434

References GERBER_FILE_IMAGE::DCodeNumber().

Referenced by Select_Tool().

◆ 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 197 of file base_struct.h.

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

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(), SCH_SCREEN::Append(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_SCREENS::buildScreenList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), TEXTE_PCB::ClassOf(), MARKER_PCB::ClassOf(), SCH_NO_CONNECT::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(), ZONE_CONTAINER::ClassOf(), SCH_BITMAP::ClassOf(), DIMENSION::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), SCH_SHEET_PIN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), D_PAD::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_SCREEN::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_TEXT::ClassOf(), BOARD::ClassOf(), SCH_SHEET::ClassOf(), ARC::ClassOf(), VIA::ClassOf(), SCH_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_ITEM::compare(), LIB_PIN::compare(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), DIALOG_TEXT_PROPERTIES::convertKIIDsToReferences(), DIALOG_LABEL_EDITOR::convertKIIDsToReferences(), MODULE::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewModule(), SCH_DRAWING_TOOLS::createNewText(), BOARD_ADAPTER::createNewTrack(), D_PAD::D_PAD(), 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(), 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(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), MODULE::DuplicateItem(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckLabels(), NETLIST_EXPORTER::findNextComponent(), PCB_BASE_FRAME::FocusOnItem(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetContextualTextVars(), CONNECTION_GRAPH::getDefaultConnection(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), getRect(), KIGFX::SCH_PAINTER::getRenderColor(), TEXTE_PCB::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hash_eda(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), highlightNet(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_FIELD::IsReplaceable(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), POINT_EDITOR::OnSelectionChange(), SCH_JUNCTION::operator<(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_TEXT::operator<(), SCH_ITEM::operator<(), SCH_SHEET::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), SCH_FIELD::Print(), SCH_SCREEN::Print(), 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(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RefreshSelection(), EE_RTREE::remove(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), SCH_SCREEN::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), WS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), SCH_TEXT::Rotate(), DRC_TEXTVAR_TESTER::RunDRC(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_SEXPR_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_SEXPR_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_SEXPR_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectConnectedTracks(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_FIELD::SwapData(), TEXTE_PCB::SwapData(), TRACK::SwapData(), DIMENSION::SwapData(), ARC::SwapData(), SCH_SHEET::SwapData(), VIA::SwapData(), SCH_COMPONENT::SwapData(), MODULE::SwapData(), ZONE_CONTAINER::SwapData(), D_PAD::SwapData(), SwapItemData(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), LIB_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), SCH_TEXT::UpdateDanglingState(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), CONNECTION_GRAPH::updateItemConnectivity(), 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(), 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, TEXTE_MODULE, TRACK, ROUTER_PREVIEW_ITEM, MARKER_PCB, KIGFX::WS_PROXY_VIEW_ITEM, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, 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 218 of file base_struct.cpp.

219 {
220  // Basic fallback
221  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
222  VECTOR2I( GetBoundingBox().GetSize() ) );
223 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: base_struct.cpp:95

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, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::WS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, 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, GERBER_DRAW_ITEM, BOARD_ITEM, SCH_ITEM, TEXTE_MODULE, TRACK, LIB_PART, LIB_ITEM, SCH_COMPONENT, MY_DRAWING, LIB_FIELD, ZONE_CONTAINER, SCH_LINE, ROUTER_PREVIEW_ITEM, SCH_BITMAP, MARKER_PCB, KIGFX::WS_PROXY_VIEW_ITEM, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, WS_DRAW_ITEM_BASE, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, LIB_TEXT, BRIGHT_BOX, SCH_JUNCTION, SCH_MARKER, KIGFX::RATSNEST_VIEWITEM, and KIGFX::PREVIEW::RULER_ITEM.

Definition at line 226 of file base_struct.cpp.

227 {
228  // Basic fallback
229  aCount = 1;
230  aLayers[0] = 0;
231 }

◆ 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[] 
)
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 391 of file gerber_file_image.cpp.

392 {
393  KICAD_T stype;
395  const KICAD_T* p = scanTypes;
396  bool done = false;
397 
398  while( !done )
399  {
400  stype = *p;
401 
402  switch( stype )
403  {
404  case GERBER_IMAGE_T:
405  case GERBER_LAYOUT_T:
406  ++p;
407  break;
408 
409  case GERBER_DRAW_ITEM_T:
410  result = IterateForward( GetItems(), inspector, testData, p );
411  ++p;
412  break;
413 
414  case EOT:
415  default: // catch EOT or ANY OTHER type here and return.
416  done = true;
417  break;
418  }
419 
420  if( result == SEARCH_RESULT::QUIT )
421  break;
422  }
423 
424  return result;
425 }
GERBER_DRAW_ITEMS & GetItems()
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
static SEARCH_RESULT IterateForward(std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )
Definition: base_struct.h:390
SEARCH_RESULT
Definition: base_struct.h:51

References CONTINUE, EOT, GERBER_DRAW_ITEM_T, GERBER_IMAGE_T, GERBER_LAYOUT_T, GERBER_FILE_IMAGE::GetItems(), EDA_ITEM::IterateForward(), and QUIT.

Referenced by GBR_LAYOUT::Visit().

Member Data Documentation

◆ m_360Arc_enbl

bool GERBER_FILE_IMAGE::m_360Arc_enbl
inherited

◆ m_AperFunction

wxString GERBER_FILE_IMAGE::m_AperFunction
inherited

◆ m_aperture_macros

APERTURE_MACRO_SET GERBER_FILE_IMAGE::m_aperture_macros
inherited

a collection of APERTURE_MACROS, sorted by name

Definition at line 175 of file gerber_file_image.h.

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

◆ m_ArcRadius

int GERBER_FILE_IMAGE::m_ArcRadius
inherited

◆ m_AsArcG74G75Cmd

bool GERBER_FILE_IMAGE::m_AsArcG74G75Cmd
inherited

◆ m_CommandState

int GERBER_FILE_IMAGE::m_CommandState
inherited

◆ m_ComponentsList

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

◆ m_Current_File

◆ m_Current_Tool

◆ m_CurrentPos

◆ m_FileFunction

◆ m_FileName

◆ m_Flags

◆ m_FmtLen

◆ m_FmtScale

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_GerbMetric

◆ m_GraphicLayer

◆ m_Has_DCode

◆ m_Has_MissingDCode

bool GERBER_FILE_IMAGE::m_Has_MissingDCode
inherited

◆ m_IJPos

◆ m_ImageJustifyOffset

◆ m_ImageJustifyXCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyXCenter
inherited

◆ m_ImageJustifyYCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyYCenter
inherited

◆ m_ImageName

◆ m_ImageNegative

◆ m_ImageOffset

◆ m_ImageRotation

◆ m_InUse

◆ m_IsVisible

bool GERBER_FILE_IMAGE::m_IsVisible
inherited

Definition at line 121 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE::GERBER_FILE_IMAGE().

◆ m_IsX2_file

bool GERBER_FILE_IMAGE::m_IsX2_file
inherited

◆ m_Iterpolation

◆ m_Last_Pen_Command

int GERBER_FILE_IMAGE::m_Last_Pen_Command
inherited

◆ m_LastArcDataType

◆ m_LastCoordIsIJPos

bool GERBER_FILE_IMAGE::m_LastCoordIsIJPos
inherited

◆ m_LineNum

◆ m_LocalRotation

double GERBER_FILE_IMAGE::m_LocalRotation
inherited

◆ m_MD5_value

wxString GERBER_FILE_IMAGE::m_MD5_value
inherited

◆ m_MirrorA

bool GERBER_FILE_IMAGE::m_MirrorA
inherited

◆ m_MirrorB

bool GERBER_FILE_IMAGE::m_MirrorB
inherited

◆ m_NetAttributeDict

◆ m_NetnamesList

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

◆ m_NoTrailingZeros

◆ m_Offset

◆ m_Parent

◆ m_PartString

wxString GERBER_FILE_IMAGE::m_PartString
inherited

◆ m_PolygonFillMode

bool GERBER_FILE_IMAGE::m_PolygonFillMode
inherited

◆ m_PolygonFillModeState

int GERBER_FILE_IMAGE::m_PolygonFillModeState
inherited

◆ m_PositiveDrawColor

COLOR4D GERBER_FILE_IMAGE::m_PositiveDrawColor
inherited

◆ m_PreviousPos

wxPoint GERBER_FILE_IMAGE::m_PreviousPos
inherited

◆ m_Relative

◆ m_RouteModeOn

bool EXCELLON_IMAGE::m_RouteModeOn
private

◆ m_RoutePositions

std::vector<EXCELLON_ROUTE_COORD> EXCELLON_IMAGE::m_RoutePositions
private

◆ m_Scale

wxRealPoint GERBER_FILE_IMAGE::m_Scale
inherited

◆ m_Selected_Tool

◆ m_SlotOn

bool EXCELLON_IMAGE::m_SlotOn
private

◆ m_State

excellon_state EXCELLON_IMAGE::m_State
private

Definition at line 141 of file excellon_image.h.

Referenced by EXCELLON_IMAGE(), Execute_HEADER_And_M_Command(), and LoadFile().

◆ m_Status

STATUS_FLAGS EDA_ITEM::m_Status
protectedinherited

◆ m_SwapAxis

bool GERBER_FILE_IMAGE::m_SwapAxis
inherited

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 166 of file base_struct.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_COMPONENT::AddHierarchicalReference(), SCH_EDIT_FRAME::AnnotateComponents(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_SHEET_PATH::Cmp(), DIALOG_LABEL_EDITOR::convertReferencesToKIIDs(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), PCB_BASE_FRAME::FocusOnItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_IO::format(), FormatProbeItem(), SCH_PIN::GetDefaultNetName(), BOARD::GetItem(), SCH_SHEET::GetMsgPanelInfo(), SCH_REFERENCE::GetPath(), SCH_COMPONENT::GetRef(), SCH_MARKER::GetUUID(), MARKER_PCB::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadComponent(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), LEGACY_PLUGIN::loadTrackList(), NETLIST_EXPORTER_GENERIC::makeComponents(), SCH_EDIT_FRAME::mapExistingAnnotation(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_COMPONENT::ReplaceInstanceSheetPath(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_COMPONENT::SCH_COMPONENT(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), RC_ITEM::SetItems(), SwapItemData(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().


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