KiCad PCB EDA Suite
EXCELLON_IMAGE Class Reference

Handle a drill image. More...

#include <excellon_image.h>

Inheritance diagram for EXCELLON_IMAGE:
GERBER_FILE_IMAGE EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 EXCELLON_IMAGE (int layer)
 
 ~EXCELLON_IMAGE ()
 
virtual void ResetDefaultValues () override
 Set all parameters to a default value, before reading a file. More...
 
bool LoadFile (const wxString &aFullFileName, EXCELLON_DEFAULTS *aDefaults)
 Read and load a drill (EXCELLON format) file. More...
 
wxString GetClass () const override
 Return 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 ()
 
bool HasNegativeItems ()
 
void ClearMessageList ()
 Clear the message list. More...
 
void AddMessageToList (const wxString &aMessage)
 Add a message to the message list. More...
 
void InitToolTable ()
 
wxPoint ReadXYCoord (char *&aText, bool aExcellonMode=false)
 Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm). More...
 
wxPoint ReadIJCoord (char *&Text)
 Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) More...
 
int GCodeNumber (char *&Text)
 
int DCodeNumber (char *&Text)
 
D_CODEGetDCODEOrCreate (int aDCODE, bool aCreateIfNoExist=true)
 Return a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
D_CODEGetDCODE (int aDCODE) const
 Return a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
APERTURE_MACROFindApertureMacro (const APERTURE_MACRO &aLookup)
 Look up a previously read in aperture macro. More...
 
void StepAndRepeatItem (const GERBER_DRAW_ITEM &aItem)
 Gerber format has a command Step an Repeat. More...
 
void DisplayImageInfo (GERBVIEW_FRAME *aMainFrame)
 Display information about image parameters in the status bar. More...
 
void RemoveAttribute (X2_ATTRIBUTE &aAttribute)
 Called when a TD command is found the Gerber file. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
KICAD_T Type () const
 Returns the type of object. 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 IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear 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)
 Populate 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
 Test 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
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
virtual const EDA_RECT GetBoundingBox () const
 Return the orthogonal bounding box of this object for display purposes. More...
 
virtual wxPoint GetPosition () const
 
virtual void SetPosition (const wxPoint &aPos)
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText (EDA_UNITS aUnits) const
 Return 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 BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform 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)
 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
 < True if the draw layer is visible and must be drawn. More...
 
COLOR4D m_PositiveDrawColor
 
wxString m_FileName
 
wxString m_ImageName
 
bool m_IsX2_file
 < True if a X2 gerber attribute was found in file. More...
 
X2_ATTRIBUTE_FILEFUNCTIONm_FileFunction
 
wxString m_MD5_value
 
wxString m_PartString
 
int m_GraphicLayer
 
bool m_ImageNegative
 
bool m_ImageJustifyXCenter
 < Image Justify Center on X axis (default = false). More...
 
bool m_ImageJustifyYCenter
 Image Justify Offset on XY axis (default = 0,0). More...
 
wxPoint m_ImageJustifyOffset
 
bool m_GerbMetric
 
bool m_Relative
 < false = absolute Coord, true = relative Coord. More...
 
bool m_NoTrailingZeros
 
wxPoint m_ImageOffset
 
wxSize m_FmtScale
 < Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4. More...
 
wxSize m_FmtLen
 Image rotation (0, 90, 180, 270 only) in degrees. More...
 
int m_ImageRotation
 Local rotation in degrees added to m_ImageRotation. More...
 
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
 < Current or last pen state (0..9, set by Dn option with n < 10. More...
 
int m_CommandState
 
int m_LineNum
 < Line number of the gerber file while reading. More...
 
wxPoint m_CurrentPos
 
wxPoint m_PreviousPos
 
wxPoint m_IJPos
 
bool m_LastCoordIsIJPos
 < True if a IJ coord was read (for arcs & circles ). More...
 
int m_ArcRadius
 Identifier for arc data type (IJ (center) or A## (radius)). More...
 
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
 
FILE * m_Current_File
 
int m_Selected_Tool
 
bool m_Has_DCode
 < True if has DCodes in file or false if no DCodes found. Perhaps deprecated RS274D file. More...
 
bool m_Has_MissingDCode
 
bool m_360Arc_enbl
 
bool m_AsArcG74G75Cmd
 
bool m_PolygonFillMode
 
int m_PolygonFillModeState
 a collection of APERTURE_MACROS, sorted by name More...
 
APERTURE_MACRO_SET m_aperture_macros
 
GBR_NETLIST_METADATA m_NetAttributeDict
 
wxString m_AperFunction
 
std::map< wxString, int > m_ComponentsList
 
std::map< wxString, int > m_NetnamesList
 
D_CODEm_Aperture_List [TOOLS_MAX_COUNT]
 < Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h) More...
 
bool m_Exposure
 
GERBER_LAYER m_GBRLayerParams
 
GERBER_DRAW_ITEMS m_drawings
 
const KIID m_Uuid
 

Protected Member Functions

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

Protected Attributes

EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_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)
 
void readFileFormat (char *&aText)
 Read an Altium-specific FILE_FORMAT=X:X attribute that specifies the length and mantissa of the numbers in the gerber file. More...
 
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 ()
 End a route command started by M15 ot G01, G02 or G03 command. More...
 
void SelectUnits (bool aMetric, EXCELLON_DEFAULTS *aDefaults)
 Switch unit selection, and the coordinate format (nn:mm) if not yet set. More...
 

Private Attributes

EXCELLON_STATE m_State
 
bool m_SlotOn
 
bool m_RouteModeOn
 
std::vector< EXCELLON_ROUTE_COORDm_RoutePositions
 
bool m_hasFormat
 Excellon file do not have a format statement to specify the coordinate format like nn:mm. More...
 

Detailed Description

Handle a drill image.

It is derived from GERBER_FILE_IMAGE because there is a lot of likeness between EXCELLON files and GERBER files. DCode apertures are also similar to T Codes.

Definition at line 137 of file excellon_image.h.

Member Enumeration Documentation

◆ EXCELLON_STATE

Enumerator
READ_HEADER_STATE 
READ_PROGRAM_STATE 

Definition at line 204 of file excellon_image.h.

204  {
205  READ_HEADER_STATE, // When we are in this state, we are reading header
206  READ_PROGRAM_STATE // When we are in this state, we are reading drill data
207  };

Constructor & Destructor Documentation

◆ EXCELLON_IMAGE()

EXCELLON_IMAGE::EXCELLON_IMAGE ( int  layer)
inline

Definition at line 139 of file excellon_image.h.

139  : EXCELLON_IMAGE( int layer ) :
140  GERBER_FILE_IMAGE( layer )
141  {
143  m_SlotOn = false;
144  m_RouteModeOn = false;
145  m_hasFormat = false;
146  }
Hold the image data and parameters for one gerber file and layer parameters.
EXCELLON_STATE m_State
bool m_hasFormat
Excellon file do not have a format statement to specify the coordinate format like nn:mm.
EXCELLON_IMAGE(int layer)

References m_hasFormat, m_RouteModeOn, m_SlotOn, m_State, and READ_HEADER_STATE.

◆ ~EXCELLON_IMAGE()

EXCELLON_IMAGE::~EXCELLON_IMAGE ( )
inline

Definition at line 149 of file excellon_image.h.

149 {};

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 160 of file gerber_file_image.h.

161  {
162  m_drawings.push_back( aItem );
163  }
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()

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearMessageList()

void GERBER_FILE_IMAGE::ClearMessageList ( )
inlineinherited

Clear the message list.

Call it before reading a Gerber file

Definition at line 192 of file gerber_file_image.h.

193  {
194  m_messagesList.Clear();
195  }
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 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144  {
145  m_viewPrivData = nullptr;
146  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Create 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 FP_ZONE, ZONE, SCH_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_GLOBALLABEL, SCH_LABEL, PCB_ARC, SCH_TEXT, SCH_LINE, LIB_PIN, FP_TEXT, SCH_BUS_BUS_ENTRY, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, PCB_TEXT, SCH_BITMAP, PCB_SHAPE, PCB_GROUP, SCH_JUNCTION, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, LIB_SHAPE, PCB_TARGET, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 83 of file eda_item.cpp.

84 {
85  wxCHECK_MSG( false, nullptr, wxT( "Clone not implemented in derived class " ) + GetClass() +
86  wxT( ". Bad programmer!" ) );
87 }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), PCB_DIMENSION_BASE::GetEffectiveShape(), LIB_SYMBOL::LIB_SYMBOL(), new_clone(), LIB_SYMBOL::operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), LIB_SYMBOL::SetConversion(), LIB_SYMBOL::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ DCodeNumber()

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

Definition at line 422 of file rs274d.cpp.

423 {
424  int ii = 0;
425  char* text;
426  char line[1024];
427 
428  if( Text == nullptr )
429  return 0;
430 
431  Text++;
432  text = line;
433 
434  while( IsNumber( *Text ) )
435  *(text++) = *(Text++);
436 
437  *text = 0;
438  ii = atoi( line );
439  return ii;
440 }
#define IsNumber(x)

References IsNumber, and text.

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

◆ DisplayImageInfo()

void GERBER_FILE_IMAGE::DisplayImageInfo ( GERBVIEW_FRAME aMainFrame)
inherited

Display information about image parameters in the status bar.

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

Parameters
aMainFrameThe 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 333 of file gerber_file_image.cpp.

334 {
335  wxString msg;
336 
337  aMainFrame->ClearMsgPanel();
338 
339  // Display Image name (Image specific)
340  aMainFrame->AppendMsgPanel( _( "Image name" ), m_ImageName );
341 
342  // Display graphic layer number used to draw this Image
343  // (not a Gerber parameter but is also image specific)
344  msg.Printf( wxT( "%d" ), m_GraphicLayer + 1 );
345  aMainFrame->AppendMsgPanel( _( "Graphic layer" ), msg );
346 
347  // Display Image rotation (Image specific)
348  msg.Printf( wxT( "%d" ), m_ImageRotation );
349  aMainFrame->AppendMsgPanel( _( "Img Rot." ), msg );
350 
351  // Display Image polarity (Image specific)
352  msg = m_ImageNegative ? _("Negative") : _("Normal");
353  aMainFrame->AppendMsgPanel( _( "Polarity" ), msg );
354 
355  // Display Image justification and offset for justification (Image specific)
356  msg = m_ImageJustifyXCenter ? _("Center") : _("Normal");
357  aMainFrame->AppendMsgPanel( _( "X Justify" ), msg );
358 
359  msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
360  aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg );
361 
362  switch( aMainFrame->GetUserUnits() )
363  {
364  case EDA_UNITS::MILS:
365  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ),
366  Iu2Mils( m_ImageJustifyOffset.y ) );
367  break;
368 
369  case EDA_UNITS::INCHES:
370  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
371  Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
372  break;
373 
375  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Millimeter( m_ImageJustifyOffset.x ),
376  Iu2Millimeter( m_ImageJustifyOffset.y ) );
377  break;
378 
379  default:
380  wxASSERT_MSG( false, "Invalid unit" );
381  }
382 
383 
384  aMainFrame->AppendMsgPanel( _( "Image Justify Offset" ), msg );
385 }
bool m_ImageJustifyXCenter
< Image Justify Center on X axis (default = false).
bool m_ImageJustifyYCenter
Image Justify Offset on XY axis (default = 0,0).
#define _(s)
virtual void ClearMsgPanel()
Clear all messages from the message panel.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
int m_ImageRotation
Local rotation in degrees added to m_ImageRotation.
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.

References _, EDA_DRAW_FRAME::AppendMsgPanel(), EDA_DRAW_FRAME::ClearMsgPanel(), 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, MILLIMETRES, and MILS.

Referenced by GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ Execute_Drill_Command()

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

Definition at line 678 of file excellon_read_drill_file.cpp.

679 {
680  D_CODE* tool;
681  GERBER_DRAW_ITEM * gbritem;
682 
683  while( true )
684  {
685  switch( *text )
686  {
687  case 'X':
688  case 'Y':
689  ReadXYCoord( text, true );
690 
691  if( *text == 'I' || *text == 'J' )
692  ReadIJCoord( text );
693 
694  break;
695 
696  case 'G': // G85 is found here for oval holes
699  break;
700 
701  case 0: // E.O.L: execute command
702  if( m_RouteModeOn )
703  {
704  // We are in routing mode, and this is an intermediate point.
705  // So just store it
706  int rmode = 0; // linear routing.
707 
709  rmode = ROUTE_CW;
711  rmode = ROUTE_CCW;
712 
714  {
715  EXCELLON_ROUTE_COORD point( m_CurrentPos, m_IJPos, rmode );
716  m_RoutePositions.push_back( point );
717  }
718  else
719  {
721  m_RoutePositions.push_back( point );
722  }
723  return true;
724  }
725 
726  tool = GetDCODE( m_Current_Tool );
727  if( !tool )
728  {
729  wxString msg;
730  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
731  AddMessageToList( msg );
732  return false;
733  }
734 
735  gbritem = new GERBER_DRAW_ITEM( this );
736  AddItemToList( gbritem );
737 
738  if( m_SlotOn ) // Oblong hole
739  {
740  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
742  tool->m_Size, false );
743  // the hole is made: reset the slot on command (G85)
744  // (it is needed for each oblong hole)
745  m_SlotOn = false;
746  }
747  else
748  {
749  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
750  m_CurrentPos, tool->m_Size, false );
751  }
752 
753  StepAndRepeatItem( *gbritem );
755  return true;
756  break;
757 
758  default:
759  text++;
760  break;
761  }
762  }
763 
764  return true;
765 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:188
wxPoint ReadIJCoord(char *&Text)
Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
#define ROUTE_CCW
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:189
D_CODE * GetDCODE(int aDCODE) const
Return 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)
Initializes a given GBRITEM so that it can draw a circle which is filled and has no pen border.
Definition: rs274d.cpp:99
int m_ArcRadius
Identifier for arc data type (IJ (center) or A## (radius)).
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:190
#define _(s)
#define ROUTE_CW
wxPoint ReadXYCoord(char *&aText, bool aExcellonMode=false)
Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm).
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions
bool Execute_EXCELLON_G_Command(char *&text)
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Gerber format has a command Step an Repeat.
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw a linear D code.
Definition: rs274d.cpp:153

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, GERBER_FILE_IMAGE::StepAndRepeatItem(), and text.

Referenced by LoadFile().

◆ Execute_EXCELLON_G_Command()

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

Definition at line 811 of file excellon_read_drill_file.cpp.

812 {
813  EXCELLON_CMD* cmd = nullptr;
814  bool success = false;
815  int id = DRILL_G_UNKNOWN;
816 
817  // Search command in list
818  EXCELLON_CMD* candidate;
819  char * gcmd = text; // gcmd points the G command, for error messages.
820 
821  for( unsigned ii = 0; ; ii++ )
822  {
823  candidate = &excellon_G_CmdList[ii];
824  int len = candidate->m_Name.size();
825  if( len == 0 ) // End of list reached
826  break;
827  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
828  {
829  cmd = candidate;
830  text += len;
831  success = true;
832  id = cmd->m_Code;
833  break;
834  }
835  }
836 
837  switch( id )
838  {
839  case DRILL_G_ZERO_SET:
840  ReadXYCoord( text, true );
842  break;
843 
844  case DRILL_G_ROUT:
845  m_SlotOn = false;
846 
847  if( m_RouteModeOn )
849 
850  m_RouteModeOn = true;
851  m_RoutePositions.clear();
853  ReadXYCoord( text, true );
854  // This is the first point (starting point) of routing
855  m_RoutePositions.emplace_back( m_CurrentPos );
856  break;
857 
858  case DRILL_G_DRILL:
859  m_SlotOn = false;
860 
861  if( m_RouteModeOn )
863 
864  m_RouteModeOn = false;
865  m_RoutePositions.clear();
867  break;
868 
869  case DRILL_G_SLOT:
870  m_SlotOn = true;
871  break;
872 
873  case DRILL_G_LINEARMOVE:
876  ReadXYCoord( text, true );
877  m_RoutePositions.emplace_back( m_CurrentPos );
878  break;
879 
880  case DRILL_G_CWMOVE:
882  ReadXYCoord( text, true );
883 
884  if( *text == 'I' || *text == 'J' )
885  ReadIJCoord( text );
886 
888  m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CW );
889  else
891  break;
892 
893  case DRILL_G_CCWMOVE:
895  ReadXYCoord( text, true );
896 
897  if( *text == 'I' || *text == 'J' )
898  ReadIJCoord( text );
899 
902  else
904  break;
905 
906  case DRILL_G_ABSOLUTE:
907  m_Relative = false; // false = absolute coord
908  break;
909 
910  case DRILL_G_INCREMENTAL:
911  m_Relative = true; // true = relative coord
912  break;
913 
914  case DRILL_G_UNKNOWN:
915  default:
916  AddMessageToList( wxString::Format( _( "Unknown Excellon G Code: &lt;%s&gt;" ), FROM_UTF8(gcmd) ) );
917  while( *text )
918  text++;
919  return false;
920  }
921 
922  return success;
923 }
static EXCELLON_CMD excellon_G_CmdList[]
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
wxPoint ReadIJCoord(char *&Text)
Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
#define ROUTE_CCW
int m_ArcRadius
Identifier for arc data type (IJ (center) or A## (radius)).
#define _(s)
#define ROUTE_CW
bool m_Relative
< false = absolute Coord, true = relative Coord.
std::string m_Name
wxPoint ReadXYCoord(char *&aText, bool aExcellonMode=false)
Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm).
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
void FinishRouteCommand()
End 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, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadXYCoord(), ROUTE_CCW, ROUTE_CW, and text.

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 422 of file excellon_read_drill_file.cpp.

423 {
424  EXCELLON_CMD* cmd = nullptr;
425  wxString msg;
426 
427  // Search command in list
428  for( unsigned ii = 0; ; ii++ )
429  {
430  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
431  int len = candidate->m_Name.size();
432 
433  if( len == 0 ) // End of list reached
434  break;
435 
436  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
437  {
438  cmd = candidate;
439  text += len;
440  break;
441  }
442  }
443 
444  if( !cmd )
445  {
446  msg.Printf( _( "Unknown Excellon command &lt;%s&gt;" ), text );
447  AddMessageToList( msg );
448  while( *text )
449  text++;
450 
451  return false;
452  }
453 
454  // Execute command
455  // some do nothing
456  switch( cmd->m_Code )
457  {
458  case DRILL_SKIP:
459  case DRILL_M_UNKNOWN:
460  break;
461 
462  case DRILL_M_END:
463  case DRILL_M_ENDFILE:
464  // if a route command is in progress, finish it
465  if( m_RouteModeOn )
467 
468  break;
469 
470  case DRILL_M_MESSAGE:
471  break;
472 
473  case DRILL_M_LONGMESSAGE:
474  break;
475 
476  case DRILL_M_HEADER:
478  break;
479 
480  case DRILL_M_ENDHEADER:
482  break;
483 
484  case DRILL_REWIND_STOP: // End of header. No action in a viewer
486  break;
487 
488  case DRILL_FORMAT_ALTIUM:
489  readFileFormat( text );
490  break;
491 
492  case DRILL_HEADER_SKIP:
493  break;
494 
495  case DRILL_M_METRIC:
496  SelectUnits( true, nullptr );
497  break;
498 
499  case DRILL_IMPERIAL_HEADER: // command like INCH,TZ or INCH,LZ
500  case DRILL_METRIC_HEADER: // command like METRIC,TZ or METRIC,LZ
501  SelectUnits( cmd->m_Code == DRILL_METRIC_HEADER ? true : false, nullptr );
502 
503  if( *text != ',' )
504  {
505  // No TZ or LZ specified. Should be a decimal format
506  // but this is not always the case. Use our default setting
507  break;
508  }
509 
510  text++; // skip separator
511  if( *text == 'T' )
512  m_NoTrailingZeros = false;
513  else
514  m_NoTrailingZeros = true;
515  break;
516 
518  break;
519 
520  case DRILL_M_ENDPATTERN:
521  break;
522 
523  case DRILL_M_CANNEDTEXT:
524  break;
525 
526  case DRILL_M_TIPCHECK:
527  break;
528 
529  case DRILL_DETECT_BROKEN:
530  break;
531 
533  if( *text != ',' )
534  {
535  AddMessageToList( "ICI command has no parameter" );
536  break;
537  }
538  text++; // skip separator
539  // Parameter should be ON or OFF
540  if( strncasecmp( text, "OFF", 3 ) == 0 )
541  m_Relative = false;
542  else if( strncasecmp( text, "ON", 2 ) == 0 )
543  m_Relative = true;
544  else
545  AddMessageToList( "ICI command has incorrect parameter" );
546  break;
547 
549  break;
550 
552  break;
553 
554  case DRILL_AXIS_VERSION:
555  break;
556 
557  case DRILL_RESET_CMD:
558  break;
559 
561  break;
562 
563  case DRILL_FMT:
564  break;
565 
568  break;
569 
570  case DRILL_M_TOOL_DOWN: // tool down (starting a routed hole or polyline)
571  // Only the last position is useful:
572  if( m_RoutePositions.size() > 1 )
573  m_RoutePositions.erase( m_RoutePositions.begin(), m_RoutePositions.begin() + m_RoutePositions.size() - 1 );
574 
575  break;
576 
577  case DRILL_M_TOOL_UP: // tool up (ending a routed polyline)
579  break;
580  }
581 
582  while( *text )
583  text++;
584 
585  return true;
586 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
static EXCELLON_CMD excellonHeaderCmdList[]
void SelectUnits(bool aMetric, EXCELLON_DEFAULTS *aDefaults)
Switch unit selection, and the coordinate format (nn:mm) if not yet set.
EXCELLON_STATE m_State
#define _(s)
bool m_Relative
< false = absolute Coord, true = relative Coord.
std::string m_Name
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list.
void readFileFormat(char *&aText)
Read an Altium-specific FILE_FORMAT=X:X attribute that specifies the length and mantissa of the numbe...
void FinishRouteCommand()
End a route command started by M15 ot G01, G02 or G03 command.
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions

References _, GERBER_FILE_IMAGE::AddMessageToList(), DRILL_AUTOMATIC_SPEED, DRILL_AUTOMATIC_TOOL_CHANGE, DRILL_AXIS_VERSION, DRILL_DETECT_BROKEN, DRILL_FMT, DRILL_FORMAT_ALTIUM, DRILL_HEADER_SKIP, 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, READ_HEADER_STATE, READ_PROGRAM_STATE, readFileFormat(), readToolInformation(), SelectUnits(), and text.

Referenced by LoadFile().

◆ FindApertureMacro()

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

Look up a previously read in aperture macro.

Parameters
aLookupA dummy APERTURE_MACRO with [only] the name field set.
Returns
the aperture macro with a matching name or NULL if not found.

Definition at line 155 of file gerber_file_image.cpp.

156 {
157  APERTURE_MACRO_SET::iterator iter = m_aperture_macros.find( aLookup );
158 
159  if( iter != m_aperture_macros.end() )
160  {
161  APERTURE_MACRO* pam = (APERTURE_MACRO*) &(*iter);
162  return pam;
163  }
164 
165  return nullptr; // not found
166 }
APERTURE_MACRO_SET m_aperture_macros
Support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:167

References GERBER_FILE_IMAGE::m_aperture_macros.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

◆ FinishRouteCommand()

void EXCELLON_IMAGE::FinishRouteCommand ( )
private

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

Definition at line 984 of file excellon_read_drill_file.cpp.

985 {
986  // Ends a route command started by M15 ot G01, G02 or G03 command
987  // if a route command is not in progress, do nothing
988 
989  if( !m_RouteModeOn )
990  return;
991 
992  D_CODE* tool = GetDCODE( m_Current_Tool );
993 
994  if( !tool )
995  {
996  AddMessageToList( wxString::Format( "Unknown tool code %d", m_Current_Tool ) );
997  return;
998  }
999 
1000  for( size_t ii = 1; ii < m_RoutePositions.size(); ii++ )
1001  {
1002  GERBER_DRAW_ITEM* gbritem = new GERBER_DRAW_ITEM( this );
1003 
1004  if( m_RoutePositions[ii].m_rmode == 0 ) // linear routing
1005  {
1006  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
1007  m_RoutePositions[ii-1].GetPos(), m_RoutePositions[ii].GetPos(),
1008  tool->m_Size, false );
1009  }
1010  else // circular (cw or ccw) routing
1011  {
1012  bool rot_ccw = m_RoutePositions[ii].m_rmode == ROUTE_CW;
1013  int radius = m_RoutePositions[ii].m_radius; // Can be adjusted by computeCenter.
1014  wxPoint center;
1015 
1016  if( m_RoutePositions[ii].m_arc_type_info == ARC_INFO_TYPE_CENTER )
1017  center = wxPoint( m_RoutePositions[ii].m_cx, m_RoutePositions[ii].m_cy );
1018  else
1019  center = computeCenter( m_RoutePositions[ii-1].GetPos(),
1020  m_RoutePositions[ii].GetPos(), radius, rot_ccw );
1021 
1022  fillArcGBRITEM( gbritem, tool->m_Num_Dcode,
1023  m_RoutePositions[ii-1].GetPos(), m_RoutePositions[ii].GetPos(),
1024  center - m_RoutePositions[ii-1].GetPos(),
1025  tool->m_Size, not rot_ccw , true,
1026  false );
1027  }
1028 
1029  AddItemToList( gbritem );
1030 
1031  StepAndRepeatItem( *gbritem );
1032  }
1033 
1034  m_RoutePositions.clear();
1035  m_RouteModeOn = false;
1036 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:188
static wxPoint computeCenter(wxPoint aStart, wxPoint aEnd, int &aRadius, bool aRotCCW)
D_CODE * GetDCODE(int aDCODE) const
Return 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:190
#define ROUTE_CW
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80
std::vector< EXCELLON_ROUTE_COORD > m_RoutePositions
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Gerber format has a command Step an Repeat.
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)
Initialize a given GBRITEM so that it can draw an arc G code.
Definition: rs274d.cpp:202
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw a linear D code.
Definition: rs274d.cpp:153

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 399 of file rs274d.cpp.

400 {
401  int ii = 0;
402  char* text;
403  char line[1024];
404 
405  if( Text == nullptr )
406  return 0;
407 
408  Text++;
409  text = line;
410 
411  while( IsNumber( *Text ) )
412  {
413  *(text++) = *(Text++);
414  }
415 
416  *text = 0;
417  ii = atoi( line );
418  return ii;
419 }
#define IsNumber(x)

References IsNumber, and text.

Referenced by GERBER_FILE_IMAGE::LoadGerberFile().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
inlineinherited

Definition at line 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetBoundingBox()

const EDA_RECT EDA_ITEM::GetBoundingBox ( ) const
virtualinherited

Return 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, PAD, PCB_DIM_CENTER, SCH_HIERLABEL, SCH_GLOBALLABEL, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, SCH_SYMBOL, SCH_LABEL, DS_DRAW_ITEM_PAGE, SCH_SHEET, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, LIB_SYMBOL, SCH_TEXT, GERBER_DRAW_ITEM, FP_TEXT, LIB_ITEM, LIB_PIN, DS_DRAW_ITEM_POLYPOLYGONS, FOOTPRINT, PCB_GROUP, SCH_LINE, PCB_TEXT, DS_DRAW_ITEM_LINE, ZONE, LIB_FIELD, PCB_TRACK, SCH_FIELD, PCB_SHAPE, PCB_MARKER, SCH_BITMAP, DS_DRAW_ITEM_BASE, PCB_TARGET, SCH_BUS_ENTRY_BASE, LIB_TEXT, SCH_PIN, GBR_LAYOUT, SCH_NO_CONNECT, LIB_SHAPE, SCH_MARKER, and SCH_JUNCTION.

Definition at line 75 of file eda_item.cpp.

76 {
77  // return a zero-sized box per default. derived classes should override
78  // this
79  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
80 }
Handle the component boundary box.
Definition: eda_rect.h:42

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), CN_ITEM::BBox(), EE_RTREE::contains(), KIGFX::PCB_PAINTER::Draw(), PCB_BASE_FRAME::FocusOnItem(), LIB_ITEM::GetBoundingBox(), GetBoundingBoxes(), GERBVIEW_SELECTION::GetCenter(), BOARD_ITEM::GetCenter(), SCH_MOVE_TOOL::getConnectedDragItems(), EE_SELECTION_TOOL::GuessSelectionCandidates(), EE_RTREE::insert(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), SCH_EDIT_TOOL::Mirror(), DRC_RTREE::QueryColliding(), EE_RTREE::remove(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), GERBVIEW_SELECTION::ViewBBox(), and EDA_ITEM::ViewBBox().

◆ GetClass()

wxString GERBER_FILE_IMAGE::GetClass ( ) const
inlineoverridevirtualinherited

Return the class name.

Implements EDA_ITEM.

Definition at line 116 of file gerber_file_image.h.

117  {
118  return wxT( "GERBER_FILE_IMAGE" );
119  }

◆ GetDCODE()

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

Return 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
The D code implied by the given aDCODE or NULL if the requested aDCODE is out of range.

Definition at line 142 of file gerber_file_image.cpp.

143 {
144  unsigned ndx = aDCODE - FIRST_DCODE;
145 
146  if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
147  {
148  return m_Aperture_List[ndx];
149  }
150 
151  return nullptr;
152 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:70
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

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

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

◆ GetDCODEOrCreate()

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

Return 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
The one implied by the given aDCODE or NULL if the requested aDCODE is out of range.

Definition at line 122 of file gerber_file_image.cpp.

123 {
124  unsigned ndx = aDCODE - FIRST_DCODE;
125 
126  if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
127  {
128  // lazily create the D_CODE if it does not exist.
129  if( aCreateIfNoExist )
130  {
131  if( m_Aperture_List[ndx] == nullptr )
132  m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE );
133  }
134 
135  return m_Aperture_List[ndx];
136  }
137 
138  return nullptr;
139 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:70
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80

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

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

259 {
260  int count = 0;
261 
262  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
263  {
264  if( m_Aperture_List[ii] )
265  if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
266  ++count;
267  }
268 
269  return count;
270 }
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
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim(), GERBER_FILE_IMAGE::m_Aperture_List, and GERBER_FILE_IMAGE::m_InUse.

Referenced by GERBVIEW_INSPECTION_TOOL::ShowDCodes(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_TRACK, and PCB_SHAPE.

Definition at line 259 of file eda_item.h.

259 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252

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 153 of file gerber_file_image.h.

153 { 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 168 of file gerber_file_image.h.

169  {
170  return m_drawings.back();
171  }
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()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Return 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 ZONE, SCH_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, SCH_GLOBALLABEL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_LABEL, GERBER_DRAW_ITEM, SCH_TEXT, LIB_PIN, FP_TEXT, SCH_LINE, SCH_BUS_BUS_ENTRY, PCB_TRACK, PCB_GROUP, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, SCH_NO_CONNECT, SCH_MARKER, PCB_MARKER, PCB_TARGET, and SCH_JUNCTION.

Definition at line 211 of file eda_item.cpp.

212 {
213  return BITMAPS::dummy_item;
214 }

References dummy_item.

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

◆ GetMessages()

const wxArrayString& GERBER_FILE_IMAGE::GetMessages ( ) const
inlineinherited

◆ GetMsgPanelInfo()

◆ GetParent()

◆ GetPosition()

virtual wxPoint EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

Reimplemented in SCH_SYMBOL, PCB_VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DELETED_BOARD_ITEM, DS_DRAW_ITEM_TEXT, PCB_ARC, BOARD, DS_DRAW_ITEM_PAGE, SCH_TEXT, DS_DRAW_ITEM_RECT, SCH_LINE, LIB_PIN, SCH_FIELD, FOOTPRINT, PAD, DS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, GERBER_DRAW_ITEM, DS_DRAW_ITEM_LINE, SCH_BITMAP, PCB_DIMENSION_BASE, PCB_GROUP, ZONE, SCH_NO_CONNECT, KIGFX::ORIGIN_VIEWITEM, SCH_BUS_ENTRY_BASE, SCH_MARKER, PCB_TRACK, SCH_JUNCTION, LIB_TEXT, FP_TEXT, NETINFO_ITEM, LIB_SHAPE, SCH_PIN, PCB_SHAPE, PCB_TEXT, PCB_MARKER, and PCB_TARGET.

Definition at line 252 of file eda_item.h.

252 { return wxPoint(); }

Referenced by EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_EDIT_FRAME::DeleteJunction(), KIGFX::PCB_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), PCB_SELECTION_TOOL::FindItem(), GERBVIEW_SELECTION::GetCenter(), EDA_ITEM::GetFocusPosition(), getMinDist(), SCH_FIELD::GetParentPosition(), SCH_SCREEN::GetSheets(), PCB_SELECTION::GetTopLeftItem(), EE_SELECTION::GetTopLeftItem(), BOARD_ITEM::GetX(), BOARD_ITEM::GetY(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::nextMatch(), BOARD::cmp_items::operator()(), SCH_ITEM::operator<(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), POSITION_RELATIVE_TOOL::PositionRelative(), BACK_ANNOTATE::processNetNameChange(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), PCB_SELECTION_TOOL::selectConnectedTracks(), RC_ITEM::ShowReport(), TransformItem(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), PL_EDIT_TOOL::updateModificationPoint(), and EE_POINT_EDITOR::updatePoints().

◆ GetPositiveDrawColor()

COLOR4D GERBER_FILE_IMAGE::GetPositiveDrawColor ( ) const
inlineinherited

Definition at line 143 of file gerber_file_image.h.

143 { 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

Return 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 ZONE, SCH_SYMBOL, PAD, FOOTPRINT, BOARD, SCH_HIERLABEL, SCH_GLOBALLABEL, PCB_VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DELETED_BOARD_ITEM, DS_DRAW_ITEM_TEXT, SCH_LABEL, DS_DRAW_ITEM_PAGE, GERBER_DRAW_ITEM, PCB_DIMENSION_BASE, SCH_TEXT, DS_DRAW_ITEM_RECT, LIB_PIN, FP_TEXT, SCH_LINE, SCH_BUS_BUS_ENTRY, PCB_TRACK, PCB_GROUP, SCH_FIELD, DS_DRAW_ITEM_POLYPOLYGONS, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, DS_DRAW_ITEM_LINE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, SCH_NO_CONNECT, SCH_MARKER, PCB_MARKER, PCB_TARGET, SCH_JUNCTION, SCH_PIN, and DELETED_SHEET_ITEM.

Definition at line 109 of file eda_item.cpp.

110 {
111  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
112  GetClass() );
113 
114  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
115 }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by CONNECTION_GRAPH::buildConnectionGraph(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), DIALOG_GROUP_PROPERTIES::DoAddMember(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), DRC_ENGINE::EvalRules(), BOARD_INSPECTION_TOOL::getItemDescription(), PCB_MARKER::GetMsgPanelInfo(), RC_TREE_MODEL::GetValue(), RC_ITEM::ShowReport(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ HasFlag()

◆ HasNegativeItems()

bool GERBER_FILE_IMAGE::HasNegativeItems ( )
inherited
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 234 of file gerber_file_image.cpp.

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

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

Test 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 SCH_SYMBOL, PAD, ZONE, FOOTPRINT, PCB_VIA, SCH_GLOBALLABEL, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, PCB_ARC, SCH_TEXT, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, SCH_LINE, GERBER_DRAW_ITEM, FP_TEXT, SCH_FIELD, PCB_TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_ITEM, LIB_PIN, PCB_GROUP, SCH_BITMAP, PCB_TEXT, SCH_JUNCTION, PCB_SHAPE, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_TEXT, and LIB_SHAPE.

Definition at line 238 of file eda_item.h.

239  {
240  return false; // derived classes should override this function
241  }

◆ InitToolTable()

void GERBER_FILE_IMAGE::InitToolTable ( )
inherited

Definition at line 273 of file gerber_file_image.cpp.

274 {
275  for( int count = 0; count < TOOLS_MAX_COUNT; count++ )
276  {
277  if( m_Aperture_List[count] == nullptr )
278  continue;
279 
280  m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
282  }
283 
284  m_aperture_macros.clear();
285 }
APERTURE_MACRO_SET m_aperture_macros
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define FIRST_DCODE
Definition: dcode.h:70
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:190
#define TOOLS_MAX_COUNT
Definition: dcode.h:72
void Clear_D_CODE_Data()
Definition: dcode.cpp:71

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, and TOOLS_MAX_COUNT.

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define SELECTED

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsType()

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

Check 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 PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

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

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::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

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ LoadFile()

bool EXCELLON_IMAGE::LoadFile ( const wxString &  aFullFileName,
EXCELLON_DEFAULTS aDefaults 
)

Read and load a drill (EXCELLON format) file.

When the file cannot be loaded, warning and info messages are stored in m_Messages.

Parameters
aFullFileNameis the full filename of the Excellon file.
aDefaultsis the default values when not found in file.
Returns
true if OK, false if the gerber file was not loaded.

Definition at line 324 of file excellon_read_drill_file.cpp.

325 {
326  // Set the default parameter values:
329 
330  m_Current_File = wxFopen( aFullFileName, "rt" );
331 
332  if( m_Current_File == nullptr )
333  return false;
334 
335  // Initial format setting, usualy defined in file, but not always...
336  m_NoTrailingZeros = aDefaults->m_LeadingZero;
337  m_GerbMetric = aDefaults->m_UnitsMM;
338 
339  wxString msg;
340  m_FileName = aFullFileName;
341 
342  LOCALE_IO toggleIo;
343 
344  // FILE_LINE_READER will close the file.
345  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
346 
347  while( true )
348  {
349  if( excellonReader.ReadLine() == nullptr )
350  break;
351 
352  char* line = excellonReader.Line();
353  char* text = StrPurge( line );
354 
355  if( *text == 0 ) // Skip empty lines
356  continue;
357 
359  {
361 
362  // Now units (inch/mm) are known, set the coordinate format
363  SelectUnits( m_GerbMetric, aDefaults );
364  }
365  else
366  {
367  switch( *text )
368  {
369  case ';':
370  case 'M':
372  break;
373 
374  case 'G': // Line type Gxx : command
376  break;
377 
378  case 'X':
379  case 'Y': // command like X12550Y19250
381  break;
382 
383  case 'I':
384  case 'J': /* Auxiliary Move command */
385  m_IJPos = ReadIJCoord( text );
386  if( *text == '*' ) // command like X35142Y15945J504
387  {
389  }
390  break;
391 
392  case 'T': // Select Tool command (can also create
393  // the tool with an embedded definition)
394  Select_Tool( text );
395  break;
396 
397  case '%':
398  break;
399 
400  default:
401  msg.Printf( "Unexpected symbol 0x%2.2X &lt;%c&gt;", *text, *text );
402  AddMessageToList( msg );
403  break;
404  } // End switch
405  }
406  }
407 
408  // Add our file attribute, to identify the drill file
410  char* text = (char*)file_attribute;
411  int dummyline = 0;
412  dummy.ParseAttribCmd( nullptr, nullptr, 0, text, dummyline );
413  delete m_FileFunction;
415 
416  m_InUse = true;
417 
418  return true;
419 }
X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF....
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
The attribute value consists of a number of substrings separated by a comma.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
wxPoint ReadIJCoord(char *&Text)
Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
void SelectUnits(bool aMetric, EXCELLON_DEFAULTS *aDefaults)
Switch unit selection, and the coordinate format (nn:mm) if not yet set.
void ClearMessageList()
Clear the message list.
EXCELLON_STATE m_State
bool Select_Tool(char *&text)
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
A LINE_READER that reads from an open file.
Definition: richio.h:172
bool Execute_HEADER_And_M_Command(char *&text)
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
bool Execute_Drill_Command(char *&text)
static const char file_attribute[]
virtual void ResetDefaultValues() override
Set all parameters to a default value, before reading a file.
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_GerbMetric, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_InUse, EXCELLON_DEFAULTS::m_LeadingZero, GERBER_FILE_IMAGE::m_NoTrailingZeros, m_State, EXCELLON_DEFAULTS::m_UnitsMM, READ_HEADER_STATE, GERBER_FILE_IMAGE::ReadIJCoord(), FILE_LINE_READER::ReadLine(), ResetDefaultValues(), Select_Tool(), SelectUnits(), StrPurge(), and text.

◆ LoadGerberFile()

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

Read and load a gerber file.

If the file cannot be loaded, warning and information messages are stored in m_messagesList.

Parameters
aFullFileNameThe full filename of the Gerber file.
Returns
true if file loaded successfully, false if the gerber file was not loaded.

Definition at line 120 of file readgerb.cpp.

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

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, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadRS274XCommand(), GERBER_FILE_IMAGE::ReadXYCoord(), GERBER_FILE_IMAGE::ResetDefaultValues(), StrPurge(), and text.

◆ Matches() [1/2]

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

Compare 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_SYMBOL, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 365 of file eda_item.h.

366  {
367  return false;
368  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), inDiffPair(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Compare 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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return text.MakeUpper().Matches( searchText.MakeUpper() );
136  }
137 
138  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
139  return aText.Find( searchText ) != wxNOT_FOUND;
140 
141  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
142 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:403

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

◆ 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 171 of file eda_item.cpp.

172 {
173  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
174  GetClass() ) );
175 
176  return false;
177 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ readFileFormat()

void EXCELLON_IMAGE::readFileFormat ( char *&  aText)
private

Read an Altium-specific FILE_FORMAT=X:X attribute that specifies the length and mantissa of the numbers in the gerber file.

Parameters
aTextText containing format and mantissa

Definition at line 589 of file excellon_read_drill_file.cpp.

590 {
591  int mantissaDigits = 0;
592  int characteristicDigits = 0;
593 
594  // Example String: ;FILE_FORMAT=4:4
595  // The ;FILE_FORMAT potion will already be stripped off.
596  // Parse the rest strictly as single_digit:single_digit like 4:4 or 2:4
597  // Don't allow anything clever like spaces or multiple digits
598  if( *aText != '=' )
599  return;
600 
601  aText++;
602 
603  if( !isdigit( *aText ) )
604  return;
605 
606  characteristicDigits = *aText - '0';
607  aText++;
608 
609  if( *aText != ':' )
610  return;
611 
612  aText++;
613 
614  if( !isdigit( *aText ) )
615  return;
616 
617  mantissaDigits = *aText - '0';
618 
619  m_hasFormat = true;
620  m_FmtLen.x = m_FmtLen.y = characteristicDigits + mantissaDigits;
621  m_FmtScale.x = m_FmtScale.y = mantissaDigits;
622 }
wxSize m_FmtLen
Image rotation (0, 90, 180, 270 only) in degrees.
wxSize m_FmtScale
< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
bool m_hasFormat
Excellon file do not have a format statement to specify the coordinate format like nn:mm.

References GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, and m_hasFormat.

Referenced by Execute_HEADER_And_M_Command().

◆ ReadIJCoord()

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

Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)

These coordinates are relative, so if coordinate is absent, its value defaults to 0

Definition at line 193 of file rs274_read_XY_and_IJ_coordinates.cpp.

194 {
195  wxPoint pos( 0, 0 );
196 
197  int type_coord = 0, current_coord, nbdigits;
198  bool is_float = false;
199  char* text;
200  char line[256];
201 
202  if( Text == nullptr )
203  return pos;
204 
205  text = line;
206 
207  while( *Text )
208  {
209  if( ( *Text == 'I' ) || ( *Text == 'J' ) )
210  {
211  type_coord = *Text;
212  Text++;
213  text = line;
214  nbdigits = 0;
215 
216  while( IsNumber( *Text ) )
217  {
218  if( *Text == '.' )
219  is_float = true;
220 
221  // count digits only (sign and decimal point are not counted)
222  if( ( *Text >= '0' ) && ( *Text <= '9' ) )
223  nbdigits++;
224 
225  *(text++) = *(Text++);
226  }
227 
228  *text = 0;
229 
230  if( is_float )
231  {
232  // When X or Y values are float numbers, they are given in mm or inches
233  if( m_GerbMetric ) // units are mm
234  current_coord = KiROUND( atof( line ) * IU_PER_MILS / 0.0254 );
235  else // units are inches
236  current_coord = KiROUND( atof( line ) * IU_PER_MILS * 1000 );
237  }
238  else
239  {
240  int fmt_scale = ( type_coord == 'I' ) ? m_FmtScale.x : m_FmtScale.y;
241 
242  if( m_NoTrailingZeros )
243  {
244  int min_digit = ( type_coord == 'I' ) ? m_FmtLen.x : m_FmtLen.y;
245 
246  while( nbdigits < min_digit )
247  {
248  *(text++) = '0';
249  nbdigits++;
250  }
251 
252  *text = 0;
253  }
254 
255  current_coord = atoi( line );
256 
257  double real_scale = scale_list[fmt_scale];
258 
259  if( m_GerbMetric )
260  real_scale = real_scale / 25.4;
261 
262  current_coord = KiROUND( current_coord * real_scale );
263  }
264 
265  if( type_coord == 'I' )
266  pos.x = current_coord;
267  else if( type_coord == 'J' )
268  pos.y = current_coord;
269 
270  continue;
271  }
272  else
273  {
274  break;
275  }
276  }
277 
278  m_IJPos = pos;
280  m_LastCoordIsIJPos = true;
281 
282  return pos;
283 }
bool m_LastCoordIsIJPos
< True if a IJ coord was read (for arcs & circles ).
wxSize m_FmtLen
Image rotation (0, 90, 180, 270 only) in degrees.
wxSize m_FmtScale
< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
static double scale_list[SCALE_LIST_SIZE]
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
#define IU_PER_MILS
Definition: plotter.cpp:136
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:73
#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, scale_list, and text.

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 625 of file excellon_read_drill_file.cpp.

626 {
627  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
628  // and enter the TCODE param in list (using the D_CODE param management, which
629  // is similar to TCODE params.
630  if( *aText == 'T' ) // This is the beginning of the definition
631  aText++;
632 
633  // Read tool number:
634  int iprm = ReadInt( aText, false );
635 
636  // Skip Feed rate and Spindle speed, if any here
637  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
638  {
639  aText++;
640  ReadInt( aText, false );
641  }
642 
643  // Read tool shape
644  if( ! *aText )
646  _( "Tool definition shape not found" ) ) );
647  else if( *aText != 'C' )
649  _( "Tool definition '%c' not supported" ), *aText ) );
650  if( *aText )
651  aText++;
652 
653  //read tool diameter:
654  double dprm = ReadDouble( aText, false );
655  m_Has_DCode = true;
656 
657  // Initialize Dcode to handle this Tool
658  // Remember: dcodes are >= FIRST_DCODE
659  D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
660 
661  if( dcode == nullptr )
662  return false;
663 
664  // conv_scale = scaling factor from inch to Internal Unit
665  double conv_scale = IU_PER_MILS * 1000;
666 
667  if( m_GerbMetric )
668  conv_scale /= 25.4;
669 
670  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
671  dcode->m_Shape = APT_CIRCLE;
672  dcode->m_Defined = true;
673 
674  return true;
675 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:188
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:189
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:199
#define FIRST_DCODE
Definition: dcode.h:70
#define _(s)
bool m_Has_DCode
< True if has DCodes in file or false if no DCodes found. Perhaps deprecated RS274D file.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80
double ReadDouble(char *&text, bool aSkipSeparator=true)
Read a double precision floating point number from an ASCII character buffer.
#define IU_PER_MILS
Definition: plotter.cpp:136
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:73
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Return a pointer to the D_CODE within this GERBER for the given aDCODE.
int ReadInt(char *&text, bool aSkipSeparator=true)
Read an integer 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, 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

Return 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 forces truncation of a digit string to a maximum length because the exact coordinate format is not always known.

Definition at line 71 of file rs274_read_XY_and_IJ_coordinates.cpp.

72 {
73  wxPoint pos;
74  int type_coord = 0, current_coord, nbdigits;
75  bool is_float = false;
76  char* text;
77  char line[256];
78 
79 
80  if( m_Relative )
81  pos.x = pos.y = 0;
82  else
83  pos = m_CurrentPos;
84 
85  if( Text == nullptr )
86  return pos;
87 
88  text = line;
89 
90  while( *Text )
91  {
92  if( ( *Text == 'X' ) || ( *Text == 'Y' ) || ( *Text == 'A' ) )
93  {
94  type_coord = *Text;
95  Text++;
96  text = line;
97  nbdigits = 0;
98 
99  while( IsNumber( *Text ) )
100  {
101  if( *Text == '.' ) // Force decimal format if reading a floating point number
102  is_float = true;
103 
104  // count digits only (sign and decimal point are not counted)
105  if( (*Text >= '0') && (*Text <='9') )
106  nbdigits++;
107 
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  {
162  pos.x = current_coord;
163  }
164  else if( type_coord == 'Y' )
165  {
166  pos.y = current_coord;
167  }
168  else if( type_coord == 'A' )
169  {
170  m_ArcRadius = current_coord;
172  }
173 
174  continue;
175  }
176  else
177  {
178  break;
179  }
180  }
181 
182  if( m_Relative )
183  {
184  pos.x += m_CurrentPos.x;
185  pos.y += m_CurrentPos.y;
186  }
187 
188  m_CurrentPos = pos;
189  return pos;
190 }
wxSize m_FmtLen
Image rotation (0, 90, 180, 270 only) in degrees.
wxSize m_FmtScale
< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
int m_ArcRadius
Identifier for arc data type (IJ (center) or A## (radius)).
static double scale_list[SCALE_LIST_SIZE]
bool m_Relative
< false = absolute Coord, true = relative Coord.
LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType
#define IU_PER_MILS
Definition: plotter.cpp:136
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:73
#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, scale_list, and text.

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

◆ RemoveAttribute()

void GERBER_FILE_IMAGE::RemoveAttribute ( X2_ATTRIBUTE aAttribute)
inherited

Called when a TD command is found the Gerber file.

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

Parameters
aAttributeis the X2_ATTRIBUTE which stores the full commandMay be re-implemented for each derived class in order to handle all the types given by its member data. Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich# KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Definition at line 388 of file gerber_file_image.cpp.

389 {
390  /* Called when a %TD command is found
391  * Remove the attribute specified by the %TD command.
392  * is no attribute, all current attributes specified by the %TO and the %TA
393  * commands are cleared.
394  * if a attribute name is specified (for instance %TD.CN*%) is specified,
395  * only this attribute is cleared
396  */
397  wxString cmd = aAttribute.GetPrm( 0 );
399 
400  if( cmd.IsEmpty() || cmd == ".AperFunction" )
401  m_AperFunction.Clear();
402 }
const wxString & GetPrm(int aIdx)
GBR_NETLIST_METADATA m_NetAttributeDict
void ClearAttribute(const wxString *aName)
Remove the net attribute specified by aName.

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 ( const wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

Perform 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 145 of file eda_item.cpp.

146 {
147  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
148 
149  int result = searchString.Find( ( aSearchData.GetFlags() & wxFR_MATCHCASE ) ?
150  aSearchData.GetFindString() :
151  aSearchData.GetFindString().Upper() );
152 
153  if( result == wxNOT_FOUND )
154  return false;
155 
156  wxString prefix = aText.Left( result );
157  wxString suffix;
158 
159  if( aSearchData.GetFindString().length() + result < aText.length() )
160  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
161 
162  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
163  aText, prefix, aSearchData.GetReplaceString(), suffix );
164 
165  aText = prefix + aSearchData.GetReplaceString() + suffix;
166 
167  return true;
168 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

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

◆ Replace() [2/2]

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

Perform 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_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 392 of file eda_item.h.

393  {
394  return false;
395  }

◆ ResetDefaultValues()

void EXCELLON_IMAGE::ResetDefaultValues ( )
overridevirtual

Set all parameters to a default value, before reading a file.

Reimplemented from GERBER_FILE_IMAGE.

Definition at line 298 of file excellon_read_drill_file.cpp.

299 {
301  SelectUnits( false, nullptr ); // Default unit = inch
302  m_hasFormat = false; // will be true if a Altium file containing
303  // the nn:mm file format is read
304 
305  // Files using non decimal can use No Trailing zeros or No leading Zeros
306  // Unfortunately, the identifier (INCH,TZ or INCH,LZ for instance) is not
307  // always set in drill files.
308  // The option leading zeros looks like more frequent, so use this default
309  m_NoTrailingZeros = true;
310 }
void SelectUnits(bool aMetric, EXCELLON_DEFAULTS *aDefaults)
Switch unit selection, and the coordinate format (nn:mm) if not yet set.
bool m_hasFormat
Excellon file do not have a format statement to specify the coordinate format like nn:mm.
virtual void ResetDefaultValues()
Set all parameters to a default value, before reading a file.

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

Referenced by LoadFile().

◆ Select_Tool()

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

Definition at line 768 of file excellon_read_drill_file.cpp.

769 {
770  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
771  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
772  // in tool selection command, if the tool is not defined in list,
773  // and the definition is embedded, it will be entered in list
774  char * startline = text; // the tool id starts here.
775  int tool_id = TCodeNumber( text );
776 
777  // T0 is legal, but is not a selection tool. it is a special command
778  if( tool_id >= 0 )
779  {
780  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
781 
782  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
783  dcode_id = TOOLS_MAX_COUNT - 1;
784 
785  m_Current_Tool = dcode_id;
786  D_CODE* currDcode = GetDCODE( dcode_id );
787 
788  // if the tool does not exist, and the definition is embedded, create this tool
789  if( currDcode == nullptr && tool_id > 0 )
790  {
791  text = startline; // text starts at the beginning of the command
793  currDcode = GetDCODE( dcode_id );
794  }
795 
796  // If the Tool is still not existing, create a dummy tool
797  if( !currDcode )
798  currDcode = GetDCODEOrCreate( dcode_id, true );
799 
800  if( currDcode )
801  currDcode->m_InUse = true;
802  }
803 
804  while( *text )
805  text++;
806 
807  return tool_id >= 0;
808 }
bool m_InUse
false if the aperture (previously defined) is not used to draw something
Definition: dcode.h:197
D_CODE * GetDCODE(int aDCODE) const
Return a pointer to the D_CODE within this GERBER for the given aDCODE.
#define FIRST_DCODE
Definition: dcode.h:70
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.
A gerber DCODE (also called Aperture) definition.
Definition: dcode.h:80
#define TOOLS_MAX_COUNT
Definition: dcode.h:72
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Return 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, readToolInformation(), TCodeNumber(), text, and TOOLS_MAX_COUNT.

Referenced by LoadFile().

◆ SelectUnits()

void EXCELLON_IMAGE::SelectUnits ( bool  aMetric,
EXCELLON_DEFAULTS aDefaults 
)
private

Switch unit selection, and the coordinate format (nn:mm) if not yet set.

Definition at line 925 of file excellon_read_drill_file.cpp.

926 {
927  /* Coordinates are measured either in inch or metric (millimeters).
928  * Inch coordinates are in six digits (00.0000) with increments
929  * as small as 0.0001 (1/10,000).
930  * Metric coordinates can be measured in microns (thousandths of a millimeter)
931  * in one of the following three ways:
932  * Five digit 10 micron resolution (000.00)
933  * Six digit 10 micron resolution (0000.00)
934  * Six digit micron resolution (000.000)
935  *
936  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
937  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
938  *
939  * However some drill files do not use standard values.
940  */
941  if( aMetric )
942  {
943  m_GerbMetric = true;
944 
945  if( !m_hasFormat )
946  {
947  if( aDefaults )
948  {
949  // number of digits in mantissa
950  m_FmtScale.x = m_FmtScale.y = aDefaults->m_MmMantissaLen;
951  // number of digits (mantissa+integer)
952  m_FmtLen.x = m_FmtLen.y = aDefaults->m_MmIntegerLen
953  + aDefaults->m_MmMantissaLen;
954  }
955  else
956  {
959  }
960  }
961  }
962  else
963  {
964  m_GerbMetric = false;
965 
966  if( !m_hasFormat )
967  {
968  if( aDefaults )
969  {
970  m_FmtScale.x = m_FmtScale.y = aDefaults->m_InchMantissaLen;
971  m_FmtLen.x = m_FmtLen.y = aDefaults->m_InchIntegerLen
972  + aDefaults->m_InchMantissaLen;
973  }
974  else
975  {
978  }
979  }
980  }
981 }
#define FMT_INTEGER_INCH
wxSize m_FmtLen
Image rotation (0, 90, 180, 270 only) in degrees.
wxSize m_FmtScale
< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
bool m_hasFormat
Excellon file do not have a format statement to specify the coordinate format like nn:mm.
#define FMT_INTEGER_MM
#define FMT_MANTISSA_INCH
#define FMT_MANTISSA_MM

References FMT_INTEGER_INCH, FMT_INTEGER_MM, FMT_MANTISSA_INCH, FMT_MANTISSA_MM, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, m_hasFormat, EXCELLON_DEFAULTS::m_InchIntegerLen, EXCELLON_DEFAULTS::m_InchMantissaLen, EXCELLON_DEFAULTS::m_MmIntegerLen, and EXCELLON_DEFAULTS::m_MmMantissaLen.

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

◆ Set() [1/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ SetBrightened()

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 153 of file eda_item.h.

153 { m_flags |= aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear 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 204 of file eda_item.h.

204 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in PCB_DIMENSION_BASE.

Definition at line 116 of file eda_item.h.

116 { m_parent = aParent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479

References EDA_ITEM::m_parent.

Referenced by FOOTPRINT::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), FOOTPRINT::operator=(), LIB_SYMBOL::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), 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_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_SHEET::SwapData(), SCH_GLOBALLABEL::SwapData(), SCH_SYMBOL::SwapData(), and SwapItemData().

◆ SetPosition()

◆ SetSelected()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 142 of file eda_item.h.

143  {
144  if( state )
145  m_status |= type; // state = ON or OFF
146  else
147  m_status &= ~type;
148  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 151 of file eda_item.h.

151 { m_status = aStatus; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 128 of file eda_item.h.

128 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

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

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 421 of file eda_item.h.

421 { return *aLeft < *aRight; }

◆ StepAndRepeatItem()

void GERBER_FILE_IMAGE::StepAndRepeatItem ( const GERBER_DRAW_ITEM aItem)
inherited

Gerber format has a command Step an Repeat.

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)

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
aItem= the item to repeat

Definition at line 296 of file gerber_file_image.cpp.

297 {
298  if( GetLayerParams().m_XRepeatCount < 2 &&
299  GetLayerParams().m_YRepeatCount < 2 )
300  return; // Nothing to repeat
301 
302  // Duplicate item:
303  for( int ii = 0; ii < GetLayerParams().m_XRepeatCount; ii++ )
304  {
305  for( int jj = 0; jj < GetLayerParams().m_YRepeatCount; jj++ )
306  {
307  // the first gerber item already exists (this is the template)
308  // create duplicate only if ii or jj > 0
309  if( jj == 0 && ii == 0 )
310  continue;
311 
312  GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
313  wxPoint move_vector;
314  move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
315  GetLayerParams().m_StepForRepeatMetric );
316  move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
317  GetLayerParams().m_StepForRepeatMetric );
318  dupItem->MoveXY( move_vector );
319  AddItemToList( dupItem );
320  }
321  }
322 }
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)
Move this object.
GERBER_LAYER & GetLayerParams()

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

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 188 of file excellon_image.h.

189  {
190  return DCodeNumber( aText );
191  }
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:422

References GERBER_FILE_IMAGE::DCodeNumber().

Referenced by Select_Tool().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 113 of file eda_item.h.

113 { return m_structType; }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EDA_ITEM::m_structType.

Referenced by KIGFX::PCB_VIEW::Add(), FOOTPRINT::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_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(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), calcIsInsideArea(), calcIsInsideCourtyard(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_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_SHEET::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SYMBOL::CanConnect(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), PCB_TEXT::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), PCB_MARKER::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FP_SHAPE::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), PCB_GROUP::ClassOf(), SCH_FIELD::ClassOf(), FP_TEXT::ClassOf(), SCH_SHEET::ClassOf(), NETINFO_ITEM::ClassOf(), ZONE::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_BITMAP::ClassOf(), PCB_TRACK::ClassOf(), PAD::ClassOf(), SCH_SYMBOL::ClassOf(), FOOTPRINT::ClassOf(), SCH_SCREEN::ClassOf(), SCH_TEXT::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), PCB_ARC::ClassOf(), SCH_LABEL::ClassOf(), PCB_VIA::ClassOf(), SCH_GLOBALLABEL::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), SCH_HIERLABEL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), TRACKS_CLEANER::cleanup(), LIB_TEXT::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), LIB_SYMBOL::Compare(), EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), CONVERT_TOOL::CreateLines(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), CONVERT_TOOL::CreatePolys(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), 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(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItem(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetContextualTextVars(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), PCB_TRACK::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTIVITY_DATA::GetNetItems(), LIB_SYMBOL::GetNextDrawItem(), PCB_SHAPE::GetParentFootprint(), LIB_SYMBOL::GetPin(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), PCB_TRACK::GetSelectMenuText(), DRC_ENGINE::GetShape(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), CONVERT_TOOL::getStartEndPoints(), getTopLevelGroup(), PCB_EXPR_TYPE_REF::GetValue(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), DRC_RTREE::Insert(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), isCopper(), CN_ANCHOR::IsDangling(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), DRC_ENGINE::IsNetTie(), PCB_TRACK::IsNull(), SCH_LINE::IsParallel(), isPlated(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromSegs(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), memberOf(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_SHAPE::cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), SCH_BUS_ENTRY_BASE::operator<(), SCH_JUNCTION::operator<(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), SCH_SHEET::operator<(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_SYMBOL::operator=(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), POSITION_RELATIVE_TOOL::PositionRelative(), SCH_FIELD::Print(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshSelection(), KIGFX::PCB_VIEW::Remove(), EE_RTREE::remove(), FOOTPRINT::Remove(), CN_CONNECTIVITY_ALGO::Remove(), SCH_SCREEN::Remove(), BOARD::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), PCB_SELECTION_TOOL::RequestSelection(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), DS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_TEXT_AND_LABEL_PROPERTIES::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(), PCB_GROUP::SwapData(), PCB_TEXT::SwapData(), PCB_TRACK::SwapData(), SCH_SHEET::SwapData(), PCB_ARC::SwapData(), PCB_DIM_ALIGNED::SwapData(), PCB_DIM_ORTHOGONAL::SwapData(), SCH_SYMBOL::SwapData(), PCB_VIA::SwapData(), PCB_DIM_LEADER::SwapData(), PCB_DIM_CENTER::SwapData(), PAD::SwapData(), FOOTPRINT::SwapData(), ZONE::SwapData(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), PCB_TRACK::TransformShapeWithClearanceToPolygon(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_TEXT::UpdateDanglingState(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_BASE_FRAME::UpdateItem(), CONNECTION_GRAPH::updateItemConnectivity(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedSheet(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), PCB_TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_GLOBALLABEL::Visit(), SCH_SHEET::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Return the bounding box of the item covering all its layers.

Returns
the current bounding box.

Implements KIGFX::VIEW_ITEM.

Reimplemented in PAD, FOOTPRINT, PCB_DIM_CENTER, EDIT_POINTS, PCB_DIMENSION_BASE, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, PCB_SHAPE, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, PCB_MARKER, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::POLYGON_ITEM, RATSNEST_VIEW_ITEM, KIGFX::PREVIEW::RULER_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 194 of file eda_item.cpp.

195 {
196  // Basic fallback
197  EDA_RECT bbox = GetBoundingBox();
198 
199  return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
200 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
Handle the component boundary box.
Definition: eda_rect.h:42
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxSize GetSize() const
Definition: eda_rect.h:91

References EDA_ITEM::GetBoundingBox(), EDA_RECT::GetOrigin(), and EDA_RECT::GetSize().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), PCB_SHAPE::ViewBBox(), and PCB_DIMENSION_BASE::ViewBBox().

◆ ViewDraw()

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

Draw the parts of the object belonging to layer aLayer.

An alternative way for drawing objects 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
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in EDIT_POINTS, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::VIEW_GROUP, MY_DRAWING, KIGFX::VIEW_OVERLAY, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, and RATSNEST_VIEW_ITEM.

Definition at line 106 of file view_item.h.

107  {}

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

◆ ViewGetLayers()

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

Return the all the layers within the VIEW the object is painted on.

For instance, a 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[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Implements KIGFX::VIEW_ITEM.

Reimplemented in PAD, FOOTPRINT, EDIT_POINTS, PCB_VIA, SCH_SHEET, BOARD_ITEM, SCH_ITEM, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, LIB_SYMBOL, MY_DRAWING, ZONE, PCB_GROUP, LIB_ITEM, SCH_LINE, SCH_SYMBOL, LIB_FIELD, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, PCB_MARKER, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, DS_DRAW_ITEM_BASE, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::ORIGIN_VIEWITEM, LIB_TEXT, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, SCH_JUNCTION, SCH_MARKER, RATSNEST_VIEW_ITEM, KIGFX::PREVIEW::RULER_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 203 of file eda_item.cpp.

204 {
205  // Basic fallback
206  aCount = 1;
207  aLayers[0] = 0;
208 }

◆ ViewGetLOD()

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

Return 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
aLayeris the current drawing layer.
aViewis a pointer 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 FP_ZONE, PAD, FOOTPRINT, PCB_VIA, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

Definition at line 132 of file view_item.h.

133  {
134  // By default always show the item
135  return 0.0;
136  }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), PCB_GRID_HELPER::queryVisible(), and PCB_SELECTION_TOOL::Selectable().

◆ viewPrivData()

◆ Visit()

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

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich# KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 405 of file gerber_file_image.cpp.

406 {
407  KICAD_T stype;
409  const KICAD_T* p = scanTypes;
410  bool done = false;
411 
412  while( !done )
413  {
414  stype = *p;
415 
416  switch( stype )
417  {
418  case GERBER_IMAGE_T:
419  case GERBER_LAYOUT_T:
420  ++p;
421  break;
422 
423  case GERBER_DRAW_ITEM_T:
424  result = IterateForward( GetItems(), inspector, testData, p );
425  ++p;
426  break;
427 
428  case EOT:
429  default: // catch EOT or ANY OTHER type here and return.
430  done = true;
431  break;
432  }
433 
434  if( result == SEARCH_RESULT::QUIT )
435  break;
436  }
437 
438  return result;
439 }
GERBER_DRAW_ITEMS & GetItems()
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
static SEARCH_RESULT IterateForward(std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
This changes first parameter to avoid the DList and use the main queue instead.
Definition: eda_item.h:295
SEARCH_RESULT
Definition: eda_item.h:41

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_List

D_CODE* GERBER_FILE_IMAGE::m_Aperture_List[TOOLS_MAX_COUNT]
inherited

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

Whether an aperture macro tool is flashed on or off.

Definition at line 461 of file gerber_file_image.h.

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

◆ m_aperture_macros

APERTURE_MACRO_SET GERBER_FILE_IMAGE::m_aperture_macros
inherited

◆ m_ArcRadius

int GERBER_FILE_IMAGE::m_ArcRadius
inherited

Identifier for arc data type (IJ (center) or A## (radius)).

Definition at line 423 of file gerber_file_image.h.

Referenced by Execute_Drill_Command(), Execute_EXCELLON_G_Command(), GERBER_FILE_IMAGE::ReadXYCoord(), and GERBER_FILE_IMAGE::ResetDefaultValues().

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

◆ m_Exposure

bool GERBER_FILE_IMAGE::m_Exposure
inherited

◆ m_FileFunction

◆ m_FileName

◆ m_flags

◆ m_FmtLen

wxSize GERBER_FILE_IMAGE::m_FmtLen
inherited

◆ m_FmtScale

wxSize GERBER_FILE_IMAGE::m_FmtScale
inherited

< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.

Nb chars per coord. ex fmt 2.3, m_FmtLen = 5.

Definition at line 389 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), readFileFormat(), GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadXYCoord(), GERBER_FILE_IMAGE::ResetDefaultValues(), SelectUnits(), and GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_GBRLayerParams

GERBER_LAYER GERBER_FILE_IMAGE::m_GBRLayerParams
inherited

◆ m_GerbMetric

◆ m_GraphicLayer

◆ m_Has_DCode

bool GERBER_FILE_IMAGE::m_Has_DCode
inherited

< True if has DCodes in file or false if no DCodes found. Perhaps deprecated RS274D file.

Definition at line 432 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GERBVIEW_FRAME::Read_GERBER_File(), readToolInformation(), and GERBER_FILE_IMAGE::ResetDefaultValues().

◆ m_Has_MissingDCode

bool GERBER_FILE_IMAGE::m_Has_MissingDCode
inherited

◆ m_hasFormat

bool EXCELLON_IMAGE::m_hasFormat
private

Excellon file do not have a format statement to specify the coordinate format like nn:mm.

However Altium files have a comment to specify it (";FILE_FORMET_" m_hasFormat is set to true if this comment is found, and coordinate format is known.

Definition at line 220 of file excellon_image.h.

Referenced by EXCELLON_IMAGE(), readFileFormat(), ResetDefaultValues(), and SelectUnits().

◆ m_IJPos

◆ m_ImageJustifyOffset

◆ m_ImageJustifyXCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyXCenter
inherited

< Image Justify Center on X axis (default = false).

Image Justify Center on Y axis (default = false).

Definition at line 374 of file gerber_file_image.h.

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

◆ m_ImageJustifyYCenter

bool GERBER_FILE_IMAGE::m_ImageJustifyYCenter
inherited

Image Justify Offset on XY axis (default = 0,0).

Definition at line 377 of file gerber_file_image.h.

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

◆ m_ImageName

◆ m_ImageNegative

◆ m_ImageOffset

◆ m_ImageRotation

int GERBER_FILE_IMAGE::m_ImageRotation
inherited

Local rotation in degrees added to m_ImageRotation.

Note
This value is stored in 0.1 degrees.

Definition at line 395 of file gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE::DisplayImageInfo(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GERBER_DRAW_ITEM::GetABPosition(), GERBER_DRAW_ITEM::GetXYPosition(), and GERBER_FILE_IMAGE::ResetDefaultValues().

◆ m_InUse

◆ m_IsVisible

bool GERBER_FILE_IMAGE::m_IsVisible
inherited

< True if the draw layer is visible and must be drawn.

Definition at line 358 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

< Current or last pen state (0..9, set by Dn option with n < 10.

Definition at line 410 of file gerber_file_image.h.

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

◆ m_LastArcDataType

◆ m_LastCoordIsIJPos

bool GERBER_FILE_IMAGE::m_LastCoordIsIJPos
inherited

< True if a IJ coord was read (for arcs & circles ).

A value ( = radius in circular routing in Excellon files ).

Definition at line 420 of file gerber_file_image.h.

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

◆ 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

a collection of APERTURE_MACROS, sorted by name

Definition at line 446 of file gerber_file_image.h.

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

◆ m_PositiveDrawColor

COLOR4D GERBER_FILE_IMAGE::m_PositiveDrawColor
inherited

◆ m_PreviousPos

wxPoint GERBER_FILE_IMAGE::m_PreviousPos
inherited

◆ m_Relative

bool GERBER_FILE_IMAGE::m_Relative
inherited

◆ 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 209 of file excellon_image.h.

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

◆ m_status

◆ m_SwapAxis

bool GERBER_FILE_IMAGE::m_SwapAxis
inherited

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 475 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), BOOST_FIXTURE_TEST_CASE(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), BOARD::FillItemMap(), SCH_SHEET_LIST::FillItemMap(), PCB_BASE_FRAME::FocusOnItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_IO::format(), FormatProbeItem(), SCH_PIN::GetDefaultNetName(), BOARD::GetItem(), SCH_SHEET_LIST::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), FP_TEXT::GetParentAsString(), PAD::GetParentAsString(), FP_SHAPE::GetParentAsString(), SCH_REFERENCE::GetPath(), SCH_SCREEN::GetSheets(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), SCH_SHEET_PATH::IsContainedWithin(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_LEGACY_PLUGIN::loadSymbol(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), SCH_EDITOR_CONTROL::nextMatch(), PCB_SHAPE::cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_pads::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::parseSchSheetInstances(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), SwapItemData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_EDITOR_CONTROL::updatePastedSymbol(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().


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