KiCad PCB EDA Suite
GERBER_FILE_IMAGE Class Reference

Hold the image data and parameters for one gerber file and layer parameters. More...

#include <gerber_file_image.h>

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

Public Member Functions

 GERBER_FILE_IMAGE (int layer)
 
virtual ~GERBER_FILE_IMAGE ()
 
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 ()
 
virtual void ResetDefaultValues ()
 
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 (int type) const
 
void SetState (int type, bool state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) const
 
STATUS_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 BITMAP_DEF 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

STATUS_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_flags
 

Private Member Functions

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

Private Attributes

wxArrayString m_messagesList
 
int m_hasNegativeItems
 True if the image is negative or has some negative items. More...
 

Detailed Description

Hold the image data and parameters for one gerber file and layer parameters.

Todo:
: Move them in GERBER_LAYER class.

Definition at line 110 of file gerber_file_image.h.

Constructor & Destructor Documentation

◆ GERBER_FILE_IMAGE()

GERBER_FILE_IMAGE::GERBER_FILE_IMAGE ( int  layer)

Definition at line 88 of file gerber_file_image.cpp.

88  :
90 {
91  m_GraphicLayer = aLayer; // Graphic layer Number
92  m_IsVisible = true; // must be drawn
93  m_PositiveDrawColor = WHITE; // The color used to draw positive items for this image
94 
95  m_Selected_Tool = 0;
96  m_FileFunction = NULL; // file function parameters
97 
99 
100  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
101  m_Aperture_List[ii] = 0;
102 }
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
bool m_IsVisible
< True if the draw layer is visible and must be drawn.
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define NULL
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: eda_item.cpp:51
Definition: color4d.h:48
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149
virtual void ResetDefaultValues()

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

◆ ~GERBER_FILE_IMAGE()

GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE ( )
virtual

Definition at line 105 of file gerber_file_image.cpp.

106 {
107 
108  for( auto item : GetItems() )
109  delete item;
110 
111  m_drawings.clear();
112 
113  for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
114  {
115  delete m_Aperture_List[ii];
116  }
117 
118  delete m_FileFunction;
119 }
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
GERBER_DRAW_ITEMS & GetItems()
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
GERBER_DRAW_ITEMS m_drawings
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim(), GetItems(), m_Aperture_List, m_drawings, and m_FileFunction.

Member Function Documentation

◆ AddItemToList()

void GERBER_FILE_IMAGE::AddItemToList ( GERBER_DRAW_ITEM aItem)
inline

Add a new GERBER_DRAW_ITEM item to the drawings list.

Parameters
aItemis the GERBER_DRAW_ITEM to add to list

Definition at line 157 of file gerber_file_image.h.

158  {
159  m_drawings.push_back( aItem );
160  }
GERBER_DRAW_ITEMS m_drawings

References m_drawings.

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

◆ AddMessageToList()

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 203 of file eda_item.h.

203 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:530

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(), DRAWING_TOOL::PlaceText(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_PIN_TOOL::RepeatPin(), 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 ( )
inline

Clear the message list.

Call it before reading a Gerber file

Definition at line 189 of file gerber_file_image.h.

190  {
191  m_messagesList.Clear();
192  }
wxArrayString m_messagesList

References m_messagesList.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 215 of file eda_item.h.

216  {
218  DO_NOT_DRAW );
219  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: eda_item.h:103
#define CANDIDATE
flag indicating that the structure is connected
Definition: eda_item.h:116
#define DO_NOT_DRAW
Used to disable draw function.
Definition: eda_item.h:118
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:203
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:117

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 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

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_COMPONENT, PAD, SCH_SHEET, FOOTPRINT, CENTER_DIMENSION, SCH_HIERLABEL, LEADER, ORTHOGONAL_DIMENSION, VIA, SCH_GLOBALLABEL, SCH_LABEL, ALIGNED_DIMENSION, PCB_SHAPE, ARC, SCH_TEXT, LIB_PIN, SCH_LINE, FP_TEXT, TRACK, SCH_SHEET_PIN, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, SCH_BITMAP, PCB_TEXT, LIB_ARC, PCB_GROUP, LIB_TEXT, SCH_JUNCTION, SCH_NO_CONNECT, LIB_POLYLINE, SCH_MARKER, PCB_TARGET, LIB_RECTANGLE, LIB_CIRCLE, LIB_BEZIER, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 97 of file eda_item.cpp.

98 {
99  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
100  wxT( ". Bad programmer!" ) );
101 }
#define NULL
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), DIMENSION_BASE::GetEffectiveShape(), LIB_PART::LIB_PART(), new_clone(), LIB_PART::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_PART::SetConversion(), LIB_PART::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)

Definition at line 428 of file rs274d.cpp.

429 {
430  int ii = 0;
431  char* text;
432  char line[1024];
433 
434  if( Text == NULL )
435  return 0;
436 
437  Text++;
438  text = line;
439  while( IsNumber( *Text ) )
440  *(text++) = *(Text++);
441 
442  *text = 0;
443  ii = atoi( line );
444  return ii;
445 }
#define NULL
#define IsNumber(x)

References IsNumber, and NULL.

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

◆ DisplayImageInfo()

void GERBER_FILE_IMAGE::DisplayImageInfo ( GERBVIEW_FRAME aMainFrame)

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).
virtual void ClearMsgPanel()
Clear all messages from the message panel.
#define _(s)
Definition: 3d_actions.cpp:33
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, m_GraphicLayer, m_ImageJustifyOffset, m_ImageJustifyXCenter, m_ImageJustifyYCenter, m_ImageName, m_ImageNegative, m_ImageRotation, MILLIMETRES, and MILS.

Referenced by GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ Execute_DCODE_Command()

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

Definition at line 581 of file rs274d.cpp.

582 {
583  wxSize size( 15, 15 );
584 
585  APERTURE_T aperture = APT_CIRCLE;
586  GERBER_DRAW_ITEM* gbritem;
587 
588  int dcode = 0;
589  D_CODE* tool = NULL;
590  wxString msg;
591 
592  if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
593  {
594  if( D_commande > (TOOLS_MAX_COUNT - 1) )
595  D_commande = TOOLS_MAX_COUNT - 1;
596 
597  // remember which tool is selected, nothing is done with it in this
598  // call
599  m_Current_Tool = D_commande;
600 
601  D_CODE* pt_Dcode = GetDCODE( D_commande );
602 
603  if( pt_Dcode )
604  pt_Dcode->m_InUse = true;
605  else
606  m_Has_MissingDCode = true;
607 
608  return true;
609  }
610  else // D_commande = 0..9: this is a pen command (usually D1, D2 or D3)
611  {
612  m_Last_Pen_Command = D_commande;
613  }
614 
615  if( m_PolygonFillMode ) // Enter a polygon description:
616  {
617  switch( D_commande )
618  {
619  case 1: // code D01 Draw line, exposure ON
620  if( !m_Exposure ) // Start a new polygon outline:
621  {
622  m_Exposure = true;
623  gbritem = new GERBER_DRAW_ITEM( this );
624  AddItemToList( gbritem );
625  gbritem->m_Shape = GBR_POLYGON;
626  gbritem->m_Flashed = false;
627  gbritem->m_DCode = 0; // No DCode for a Polygon (Region in Gerber dialect)
628 
629 
630  if( gbritem->m_GerberImageFile )
631  {
633  gbritem->m_AperFunction = gbritem->m_GerberImageFile->m_AperFunction;
634  }
635  }
636 
637  switch( m_Iterpolation )
638  {
641  // Before any arc command, a G74 or G75 command must be set.
642  // Otherwise the Gerber file is invalid
643  if( !m_AsArcG74G75Cmd )
644  {
645  AddMessageToList( _( "Invalid Gerber file: missing G74 or G75 arc command" ) );
646  // Disable further warning messages:
647  m_AsArcG74G75Cmd = true;
648  }
649 
650  gbritem = GetLastItemInList();
651 
652  fillArcPOLY( gbritem, m_PreviousPos,
654  ( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
655  m_360Arc_enbl, GetLayerParams().m_LayerNegative );
656  break;
657 
658  default:
659  gbritem = GetLastItemInList();
660 
661  gbritem->m_Start = m_PreviousPos; // m_Start is used as temporary storage
662  if( gbritem->m_Polygon.OutlineCount() == 0 )
663  {
664  gbritem->m_Polygon.NewOutline();
665  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_Start ) );
666  }
667 
668  gbritem->m_End = m_CurrentPos; // m_End is used as temporary storage
669  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_End ) );
670  break;
671  }
672 
675  break;
676 
677  case 2: // code D2: exposure OFF (i.e. "move to")
678  if( m_Exposure && GetLastItemInList() ) // End of polygon
679  {
680  gbritem = GetLastItemInList();
681  gbritem->m_Polygon.Append( gbritem->m_Polygon.CVertex( 0 ) );
682  StepAndRepeatItem( *gbritem );
683  }
684  m_Exposure = false;
687  break;
688 
689  default:
690  return false;
691  }
692  }
693  else
694  {
695  switch( D_commande )
696  {
697  case 1: // code D01 Draw line, exposure ON
698  m_Exposure = true;
699 
700  tool = GetDCODE( m_Current_Tool );
701 
702  if( tool )
703  {
704  size = tool->m_Size;
705  dcode = tool->m_Num_Dcode;
706  aperture = tool->m_Shape;
707  }
708 
709  switch( m_Iterpolation )
710  {
712  gbritem = new GERBER_DRAW_ITEM( this );
713  AddItemToList( gbritem );
714 
715  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
716  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
717  StepAndRepeatItem( *gbritem );
718  break;
719 
722  gbritem = new GERBER_DRAW_ITEM( this );
723  AddItemToList( gbritem );
724 
725  if( m_LastCoordIsIJPos )
726  {
727  fillArcGBRITEM( gbritem, dcode, m_PreviousPos,
728  m_CurrentPos, m_IJPos, size,
730  false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
731  m_LastCoordIsIJPos = false;
732  }
733  else
734  {
735  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
736  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
737  }
738 
739  StepAndRepeatItem( *gbritem );
740 
741  break;
742 
743  default:
744  msg.Printf( wxT( "RS274D: DCODE Command: interpol error (type %X)" ),
745  m_Iterpolation );
746  AddMessageToList( msg );
747  break;
748  }
749 
751  break;
752 
753  case 2: // code D2: exposure OFF (i.e. "move to")
754  m_Exposure = false;
756  break;
757 
758  case 3: // code D3: flash aperture
759  tool = GetDCODE( m_Current_Tool );
760  if( tool )
761  {
762  size = tool->m_Size;
763  dcode = tool->m_Num_Dcode;
764  aperture = tool->m_Shape;
765  }
766 
767  gbritem = new GERBER_DRAW_ITEM( this );
768  AddItemToList( gbritem );
769  fillFlashedGBRITEM( gbritem, aperture, dcode, m_CurrentPos,
770  size, GetLayerParams().m_LayerNegative );
771  StepAndRepeatItem( *gbritem );
773  break;
774 
775  default:
776  return false;
777  }
778  }
779 
780  return true;
781 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
int m_Last_Pen_Command
< Current or last pen state (0..9, set by Dn option with n < 10.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
static void fillArcPOLY(GERBER_DRAW_ITEM *aGbrItem, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &rel_center, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcPOLY creates an arc G code when found in poly outlines.
Definition: rs274d.cpp:331
bool m_LastCoordIsIJPos
< True if a IJ coord was read (for arcs & circles ).
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
D_CODE * GetDCODE(int aDCODE) const
Return a pointer to the D_CODE within this GERBER for the given aDCODE.
void SetNetAttributes(const GBR_NETLIST_METADATA &aNetAttributes)
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Function fillLineGBRITEM initializes a given GBRITEM so that it can draw a linear D code.
Definition: rs274d.cpp:155
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
SHAPE_POLY_SET m_Polygon
int m_PolygonFillModeState
a collection of APERTURE_MACROS, sorted by name
GERBER_DRAW_ITEM * GetLastItemInList() const
void AddItemToList(GERBER_DRAW_ITEM *aItem)
Add a new GERBER_DRAW_ITEM item to the drawings list.
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
APERTURE_T
Enum APERTURE_T is the set of all gerber aperture types allowed, according to page 16 of http://gerbv...
Definition: dcode.h:50
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
int NewOutline()
Creates a new hole in a given outline.
void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcGBRITEM initializes a given GBRITEM so that it can draw an arc G code.
Definition: rs274d.cpp:204
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const wxPoint &aPos, wxSize aSize, bool aLayerNegative)
Function fillFlashedGBRITEM initializes a given GBRITEM so that it can draw a circle which is filled ...
Definition: rs274d.cpp:100
#define _(s)
Definition: 3d_actions.cpp:33
GBR_NETLIST_METADATA m_NetAttributeDict
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Gerber format has a command Step an Repeat.
GERBER_FILE_IMAGE * m_GerberImageFile
GERBER_LAYER & GetLayerParams()
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References _, AddItemToList(), AddMessageToList(), SHAPE_POLY_SET::Append(), APT_CIRCLE, SHAPE_POLY_SET::CVertex(), fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), fillLineGBRITEM(), FIRST_DCODE, GBR_POLYGON, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GetDCODE(), GetLastItemInList(), GetLayerParams(), m_360Arc_enbl, GERBER_DRAW_ITEM::m_AperFunction, m_AperFunction, m_AsArcG74G75Cmd, m_Current_Tool, m_CurrentPos, GERBER_DRAW_ITEM::m_DCode, GERBER_DRAW_ITEM::m_End, m_Exposure, GERBER_DRAW_ITEM::m_Flashed, GERBER_DRAW_ITEM::m_GerberImageFile, m_Has_MissingDCode, m_IJPos, D_CODE::m_InUse, m_Iterpolation, m_Last_Pen_Command, m_LastCoordIsIJPos, m_NetAttributeDict, D_CODE::m_Num_Dcode, GERBER_DRAW_ITEM::m_Polygon, m_PolygonFillMode, m_PolygonFillModeState, m_PreviousPos, D_CODE::m_Shape, GERBER_DRAW_ITEM::m_Shape, D_CODE::m_Size, GERBER_DRAW_ITEM::m_Start, SHAPE_POLY_SET::NewOutline(), NULL, SHAPE_POLY_SET::OutlineCount(), GERBER_DRAW_ITEM::SetNetAttributes(), StepAndRepeatItem(), and TOOLS_MAX_COUNT.

Referenced by LoadGerberFile().

◆ Execute_G_Command()

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

Definition at line 448 of file rs274d.cpp.

449 {
450 // D( printf( "%22s: G_CODE<%d>\n", __func__, G_command ); )
451 
452  switch( G_command )
453  {
454  case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can
455  // be safely ignored
456  break;
457 
460  break;
461 
464  break;
465 
468  break;
469 
470  case GC_COMMENT:
471  // Skip comment, but only if the line does not start by "G04 #@! "
472  // which is a metadata, i.e. a X2 command inside the comment.
473  // this comment is called a "structured comment"
474  if( strncmp( text, " #@! ", 5 ) == 0 )
475  {
476  text += 5;
477  // The string starting at text is the same as the X2 attribute,
478  // but a X2 attribute ends by '%'. So we build the X2 attribute string
479  std::string x2buf;
480 
481  while( *text && (*text != '*') )
482  {
483  x2buf += *text;
484  text++;
485  }
486  // add the end of X2 attribute string
487  x2buf += "*%";
488  x2buf += '\0';
489 
490  char* cptr = (char*)x2buf.data();
491  int code_command = ReadXCommandID( cptr );
492  ExecuteRS274XCommand( code_command, NULL, 0, cptr );
493  }
494 
495  while( *text && (*text != '*') )
496  text++;
497  break;
498 
499  case GC_SELECT_TOOL:
500  {
501  int D_commande = DCodeNumber( text );
502 
503  if( D_commande < FIRST_DCODE )
504  return false;
505  if( D_commande > (TOOLS_MAX_COUNT - 1) )
506  D_commande = TOOLS_MAX_COUNT - 1;
507  m_Current_Tool = D_commande;
508  D_CODE* pt_Dcode = GetDCODE( D_commande );
509 
510  if( pt_Dcode )
511  pt_Dcode->m_InUse = true;
512 
513  break;
514  }
515 
516  case GC_SPECIFY_INCHES:
517  m_GerbMetric = false; // false = Inches, true = metric
518  break;
519 
521  m_GerbMetric = true; // false = Inches, true = metric
522  break;
523 
524  case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
525  m_360Arc_enbl = false;
526  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
527  m_AsArcG74G75Cmd = true;
528  break;
529 
531  m_360Arc_enbl = true;
532  m_AsArcG74G75Cmd = true;
533  break;
534 
536  m_Relative = false; // false = absolute Coord, true = relative
537  // Coord
538  break;
539 
541  m_Relative = true; // false = absolute Coord, true = relative
542  // Coord
543  break;
544 
546  m_PolygonFillMode = true;
547  m_Exposure = false;
548  break;
549 
551  if( m_Exposure && GetLastItemInList() ) // End of polygon
552  {
553  GERBER_DRAW_ITEM * gbritem = GetLastItemInList();
554 
555  if( gbritem->m_Polygon.VertexCount() )
556  gbritem->m_Polygon.Append( gbritem->m_Polygon.CVertex( 0 ) );
557 
558  StepAndRepeatItem( *gbritem );
559  }
560  m_Exposure = false;
561  m_PolygonFillMode = false;
563  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
564  break;
565 
566  case GC_MOVE: // Non existent
567  default:
568  {
569  wxString msg;
570  msg.Printf( wxT( "G%0.2d command not handled" ), G_command );
571  AddMessageToList( msg );
572  return false;
573  }
574  }
575 
576 
577  return true;
578 }
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
int VertexCount(int aOutline=-1, int aHole=-1) const
Returns the number of holes in a given outline.
D_CODE * GetDCODE(int aDCODE) const
Return a pointer to the D_CODE within this GERBER for the given aDCODE.
SHAPE_POLY_SET m_Polygon
int ReadXCommandID(char *&text)
Read two bytes of data and assembles them into an int with the first byte in the sequence put into th...
Definition: rs274x.cpp:114
int m_PolygonFillModeState
a collection of APERTURE_MACROS, sorted by name
bool ExecuteRS274XCommand(int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
Execute a RS274X command.
Definition: rs274x.cpp:197
GERBER_DRAW_ITEM * GetLastItemInList() const
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:428
bool m_Relative
< false = absolute Coord, true = relative Coord.
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Gerber format has a command Step an Repeat.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References AddMessageToList(), SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::CVertex(), DCodeNumber(), ExecuteRS274XCommand(), FIRST_DCODE, GC_CIRCLE_NEG_INTERPOL, GC_CIRCLE_POS_INTERPOL, GC_COMMENT, GC_LINEAR_INTERPOL_1X, GC_MOVE, GC_PHOTO_MODE, GC_SELECT_TOOL, GC_SPECIFY_ABSOLUES_COORD, GC_SPECIFY_INCHES, GC_SPECIFY_MILLIMETERS, GC_SPECIFY_RELATIVEES_COORD, GC_TURN_OFF_360_INTERPOL, GC_TURN_OFF_POLY_FILL, GC_TURN_ON_360_INTERPOL, GC_TURN_ON_POLY_FILL, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GetDCODE(), GetLastItemInList(), m_360Arc_enbl, m_AsArcG74G75Cmd, m_Current_Tool, m_Exposure, m_GerbMetric, D_CODE::m_InUse, m_Iterpolation, GERBER_DRAW_ITEM::m_Polygon, m_PolygonFillMode, m_PolygonFillModeState, m_Relative, NULL, ReadXCommandID(), StepAndRepeatItem(), TOOLS_MAX_COUNT, and SHAPE_POLY_SET::VertexCount().

Referenced by LoadGerberFile().

◆ ExecuteRS274XCommand()

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

Execute a RS274X command.

Definition at line 197 of file rs274x.cpp.

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

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

Referenced by Execute_G_Command(), and ReadRS274XCommand().

◆ FindApertureMacro()

APERTURE_MACRO * GERBER_FILE_IMAGE::FindApertureMacro ( const APERTURE_MACRO aLookup)

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 NULL; // not found
166 }
APERTURE_MACRO_SET m_aperture_macros
#define NULL
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:162

References m_aperture_macros, and NULL.

Referenced by ExecuteRS274XCommand().

◆ GCodeNumber()

int GERBER_FILE_IMAGE::GCodeNumber ( char *&  Text)

Definition at line 405 of file rs274d.cpp.

406 {
407  int ii = 0;
408  char* text;
409  char line[1024];
410 
411  if( Text == NULL )
412  return 0;
413  Text++;
414  text = line;
415  while( IsNumber( *Text ) )
416  {
417  *(text++) = *(Text++);
418  }
419 
420  *text = 0;
421  ii = atoi( line );
422  return ii;
423 }
#define NULL
#define IsNumber(x)

References IsNumber, and NULL.

Referenced by LoadGerberFile().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
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 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 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
T get(void *aObject)
Definition: property.h:266
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 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
T get(void *aObject)
Definition: property.h:266
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, CENTER_DIMENSION, SCH_HIERLABEL, SCH_SHEET, SCH_GLOBALLABEL, SCH_COMPONENT, DS_DRAW_ITEM_BITMAP, SCH_LABEL, DS_DRAW_ITEM_TEXT, PCB_SHAPE, DS_DRAW_ITEM_PAGE, SCH_TEXT, DIMENSION_BASE, DS_DRAW_ITEM_RECT, LIB_PIN, LIB_PART, GERBER_DRAW_ITEM, FP_TEXT, DS_DRAW_ITEM_POLYPOLYGONS, LIB_ITEM, FOOTPRINT, SCH_LINE, PCB_GROUP, LIB_FIELD, ZONE, DS_DRAW_ITEM_LINE, PCB_TEXT, TRACK, SCH_FIELD, PCB_MARKER, SCH_BITMAP, SCH_PIN, PCB_TARGET, DS_DRAW_ITEM_BASE, LIB_TEXT, SCH_BUS_ENTRY_BASE, LIB_POLYLINE, GBR_LAYOUT, LIB_ARC, SCH_NO_CONNECT, LIB_BEZIER, SCH_MARKER, LIB_RECTANGLE, SCH_JUNCTION, and LIB_CIRCLE.

Definition at line 89 of file eda_item.cpp.

90 {
91  // return a zero-sized box per default. derived classes should override
92  // this
93  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
94 }
Handle the component boundary box.
Definition: eda_rect.h:42

Referenced by CN_ITEM::BBox(), EE_RTREE::contains(), LIB_ITEM::GetBoundingBox(), GetBoundingBoxes(), GERBVIEW_SELECTION::GetCenter(), BOARD_ITEM::GetCenter(), SCH_MOVE_TOOL::getConnectedDragItems(), EE_SELECTION_TOOL::GuessSelectionCandidates(), EE_RTREE::insert(), insideArea(), insideCourtyard(), SCH_EDIT_TOOL::Mirror(), SCH_EAGLE_PLUGIN::moveLabels(), 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
inlineoverridevirtual

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

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 NULL;
152 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

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

Referenced by Execute_DCODE_Command(), EXCELLON_IMAGE::Execute_Drill_Command(), Execute_G_Command(), EXCELLON_IMAGE::FinishRouteCommand(), GERBER_DRAW_ITEM::GetDcodeDescr(), EXCELLON_IMAGE::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 
)

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] == NULL )
132  m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE );
133  }
134 
135  return m_Aperture_List[ndx];
136  }
137 
138  return NULL;
139 }
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h)
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82

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

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

◆ GetDcodesCount()

int GERBER_FILE_IMAGE::GetDcodesCount ( )
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(), m_Aperture_List, and m_InUse.

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

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 207 of file eda_item.h.

208  {
209  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
211 
212  return m_flags & mask;
213  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:119
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:530
#define IS_NEW
New item, just created.
Definition: eda_item.h:106

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

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::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_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ GetEndOfBlock()

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

Definition at line 907 of file rs274x.cpp.

908 {
909  for( ; ; )
910  {
911  while( (aText < aBuff + aBuffSize) && *aText )
912  {
913  if( *aText == '*' )
914  return true;
915 
916  if( *aText == '%' )
917  return true;
918 
919  aText++;
920  }
921 
922  if( fgets( aBuff, aBuffSize, gerber_file ) == NULL )
923  break;
924 
925  m_LineNum++;
926  aText = aBuff;
927  }
928 
929  return false;
930 }
int m_LineNum
< Line number of the gerber file while reading.
#define NULL

References m_LineNum, and NULL.

Referenced by ExecuteRS274XCommand().

◆ 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_SHAPE, and TRACK.

Definition at line 308 of file eda_item.h.

308 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:301

References EDA_ITEM::GetPosition().

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

◆ GetItems()

GERBER_DRAW_ITEMS& GERBER_FILE_IMAGE::GetItems ( )
inline

◆ GetItemsCount()

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

Definition at line 150 of file gerber_file_image.h.

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

References m_drawings.

Referenced by GERBVIEW_FRAME::Read_GERBER_File().

◆ GetLastItemInList()

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

Definition at line 165 of file gerber_file_image.h.

166  {
167  return m_drawings.back();
168  }
GERBER_DRAW_ITEMS m_drawings

References m_drawings.

Referenced by Execute_DCODE_Command(), and Execute_G_Command().

◆ GetLayerParams()

GERBER_LAYER& GERBER_FILE_IMAGE::GetLayerParams ( )
inline
Returns
the current layers params.

Definition at line 173 of file gerber_file_image.h.

174  {
175  return m_GBRLayerParams;
176  }
GERBER_LAYER m_GBRLayerParams

References m_GBRLayerParams.

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

◆ GetMenuImage()

BITMAP_DEF 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_COMPONENT, PAD, SCH_SHEET, FOOTPRINT, CENTER_DIMENSION, SCH_HIERLABEL, LEADER, ORTHOGONAL_DIMENSION, SCH_GLOBALLABEL, VIA, SCH_LABEL, ALIGNED_DIMENSION, PCB_SHAPE, SCH_TEXT, LIB_PIN, GERBER_DRAW_ITEM, SCH_LINE, FP_TEXT, TRACK, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, PCB_GROUP, SCH_BUS_WIRE_ENTRY, FP_SHAPE, SCH_BITMAP, LIB_ARC, PCB_TEXT, LIB_TEXT, LIB_POLYLINE, SCH_NO_CONNECT, SCH_MARKER, PCB_TARGET, SCH_JUNCTION, LIB_RECTANGLE, PCB_MARKER, and LIB_CIRCLE.

Definition at line 222 of file eda_item.cpp.

223 {
224  return dummy_xpm;
225 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: eda_item.cpp:48

References dummy_xpm.

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
inline

Definition at line 131 of file gerber_file_image.h.

131 { return m_messagesList; }
wxArrayString m_messagesList

References m_messagesList.

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

◆ GetMsgPanelInfo()

◆ GetNextLine()

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

Test for an end of line.

If a end of line is found, read a new line.

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

Definition at line 933 of file rs274x.cpp.

934 {
935  for( ; ; )
936  {
937  switch (*aText )
938  {
939  case ' ': // skip blanks
940  case '\n':
941  case '\r': // Skip line terminators
942  ++aText;
943  break;
944 
945  case 0: // End of text found in aBuff: Read a new string
946  if( fgets( aBuff, aBuffSize, aFile ) == NULL )
947  return NULL;
948 
949  m_LineNum++;
950  aText = aBuff;
951  return aText;
952 
953  default:
954  return aText;
955  }
956  }
957  return aText;
958 }
int m_LineNum
< Line number of the gerber file while reading.
#define NULL

References m_LineNum, and NULL.

Referenced by ReadApertureMacro().

◆ GetParent()

◆ GetPosition()

virtual wxPoint EDA_ITEM::GetPosition ( ) const
inlinevirtualinherited

Reimplemented in SCH_COMPONENT, SCH_SHEET, VIA, DELETED_BOARD_ITEM, DS_DRAW_ITEM_BITMAP, BOARD, DS_DRAW_ITEM_TEXT, SCH_TEXT, ARC, DS_DRAW_ITEM_PAGE, LIB_PIN, SCH_LINE, DS_DRAW_ITEM_RECT, SCH_FIELD, FOOTPRINT, LIB_FIELD, PAD, DS_DRAW_ITEM_POLYPOLYGONS, GERBER_DRAW_ITEM, SCH_BITMAP, PCB_SHAPE, DS_DRAW_ITEM_LINE, DIMENSION_BASE, PCB_GROUP, ZONE, SCH_NO_CONNECT, TRACK, SCH_MARKER, KIGFX::ORIGIN_VIEWITEM, SCH_BUS_ENTRY_BASE, LIB_TEXT, SCH_JUNCTION, LIB_POLYLINE, LIB_ARC, SCH_PIN, FP_TEXT, NETINFO_ITEM, LIB_BEZIER, LIB_RECTANGLE, LIB_CIRCLE, PCB_TEXT, PCB_MARKER, and PCB_TARGET.

Definition at line 301 of file eda_item.h.

301 { 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::findCallback(), GERBVIEW_SELECTION::GetCenter(), EDA_ITEM::GetFocusPosition(), 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_ITEM::operator<(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceText(), 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
inline

Definition at line 140 of file gerber_file_image.h.

140 { return m_PositiveDrawColor; }

References 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_COMPONENT, PAD, BOARD, SCH_SHEET, FOOTPRINT, SCH_HIERLABEL, SCH_GLOBALLABEL, VIA, DELETED_BOARD_ITEM, SCH_LABEL, DS_DRAW_ITEM_BITMAP, PCB_SHAPE, DS_DRAW_ITEM_TEXT, SCH_TEXT, DS_DRAW_ITEM_PAGE, LIB_PIN, GERBER_DRAW_ITEM, DIMENSION_BASE, DS_DRAW_ITEM_RECT, SCH_LINE, FP_TEXT, TRACK, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, DS_DRAW_ITEM_POLYPOLYGONS, PCB_GROUP, SCH_BUS_WIRE_ENTRY, FP_SHAPE, DS_DRAW_ITEM_LINE, LIB_ARC, PCB_TEXT, SCH_BITMAP, LIB_TEXT, LIB_POLYLINE, SCH_NO_CONNECT, SCH_MARKER, PCB_TARGET, LIB_RECTANGLE, PCB_MARKER, LIB_CIRCLE, SCH_JUNCTION, SCH_PIN, and DELETED_SHEET_ITEM.

Definition at line 123 of file eda_item.cpp.

124 {
125  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
126  GetClass() );
127 
128  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
129 }
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(), BOARD_INSPECTION_TOOL::InspectClearance(), RC_ITEM::ShowReport(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 186 of file eda_item.h.

187  {
188  return m_status & type;
189  }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 199 of file eda_item.h.

199 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

◆ HasFlag()

◆ HasNegativeItems()

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

Definition at line 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 GetItems(), m_GraphicLayer, m_hasNegativeItems, and 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_COMPONENT, PAD, SCH_SHEET, ZONE, FOOTPRINT, VIA, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, SCH_TEXT, ARC, PCB_SHAPE, SCH_LINE, DIMENSION_BASE, DS_DRAW_ITEM_RECT, GERBER_DRAW_ITEM, LIB_PIN, SCH_FIELD, FP_TEXT, TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_ITEM, PCB_GROUP, SCH_BITMAP, SCH_JUNCTION, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, PCB_TEXT, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 287 of file eda_item.h.

288  {
289  return false; // derived classes should override this function
290  }

◆ InitToolTable()

void GERBER_FILE_IMAGE::InitToolTable ( )

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] == NULL )
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 NULL
#define FIRST_DCODE
Definition: dcode.h:71
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void Clear_D_CODE_Data()
Definition: dcode.cpp:76

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

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 170 of file eda_item.h.

170 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_DRAGGED, and EDA_ITEM::m_flags.

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

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:137
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 255 of file eda_item.h.

255 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:529

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

167 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:102
STATUS_FLAGS m_flags
Definition: eda_item.h:530

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

Definition at line 452 of file eda_item.h.

452 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_RESIZED, and EDA_ITEM::m_flags.

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

◆ IsSelected()

◆ IsType()

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

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 VIA, SCH_LABEL, DIMENSION_BASE, PAD, PCB_SHAPE, SCH_FIELD, SCH_LINE, FP_TEXT, FP_SHAPE, and PCB_TEXT.

Definition at line 232 of file eda_item.h.

233  {
234  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
235  return true;
236 
237  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
238  {
239  if( m_structType == *p )
240  return true;
241  }
242 
243  return false;
244  }
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:537

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(), FP_TEXT::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), PCB_SHAPE::IsType(), PAD::IsType(), DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), 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 171 of file eda_item.h.

171 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:530

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

348  {
349  for( auto it : aList )
350  {
351  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
353  return SEARCH_RESULT::QUIT;
354  }
355 
357  }
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:107

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

Referenced by 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 363 of file eda_item.h.

365  {
366  for( auto it : aList )
367  {
368  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
370  return SEARCH_RESULT::QUIT;
371  }
372 
374  }
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:107

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

◆ LoadGerberFile()

bool GERBER_FILE_IMAGE::LoadGerberFile ( const wxString &  aFullFileName)

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 117 of file readgerb.cpp.

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

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

Referenced by GERBVIEW_FRAME::Read_GERBER_File().

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

Definition at line 414 of file eda_item.h.

415  {
416  return false;
417  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::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 132 of file eda_item.cpp.

133 {
134  wxString text = aText;
135  wxString searchText = aSearchData.GetFindString();
136 
137  // Don't match if searching for replaceable item and the item doesn't support text replace.
138  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
139  return false;
140 
141  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
142  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
143 
144  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
145  {
146  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
147  return text.Matches( searchText );
148 
149  return text.MakeUpper().Matches( searchText.MakeUpper() );
150  }
151 
152  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
153  return aText.Find( searchText ) != wxNOT_FOUND;
154 
155  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
156 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:452

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

◆ operator<()

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

Test if another item is less than this object.

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

Definition at line 185 of file eda_item.cpp.

186 {
187  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
188  GetClass() ) );
189 
190  return false;
191 }
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().

◆ ReadApertureMacro()

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

Read in an aperture macro and saves it in m_aperture_macros.

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

Definition at line 961 of file rs274x.cpp.

964 {
965  wxString msg;
966  APERTURE_MACRO am;
967 
968  // read macro name
969  while( *aText )
970  {
971  if( *aText == '*' )
972  {
973  ++aText;
974  break;
975  }
976 
977  am.name.Append( *aText++ );
978  }
979 
980  // Read aperture macro parameters
981  for( ; ; )
982  {
983  if( *aText == '*' )
984  ++aText;
985 
986  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
987 
988  if( aText == NULL ) // End of File
989  return false;
990 
991  // aText points the beginning of a new line.
992 
993  // Test for the last line in aperture macro lis:
994  // last line is % or *% sometime found.
995  if( *aText == '*' )
996  ++aText;
997 
998  if( *aText == '%' )
999  break; // exit with aText still pointing at %
1000 
1001  int paramCount = 0; // will be set to the minimal parameters count,
1002  // depending on the actual primitive
1003  int primitive_type = AMP_UNKNOWN;
1004  // Test for a valid symbol at the beginning of a description:
1005  // it can be: a parameter declaration like $1=$2/4
1006  // or a digit (macro primitive selection)
1007  // all other symbols are illegal.
1008  if( *aText == '$' ) // local parameter declaration, inside the aperture macro
1009  {
1010  am.m_localparamStack.push_back( AM_PARAM() );
1011  AM_PARAM& param = am.m_localparamStack.back();
1012  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
1013  if( aText == NULL) // End of File
1014  return false;
1015  param.ReadParam( aText );
1016  continue;
1017  }
1018  else if( !isdigit(*aText) ) // Ill. symbol
1019  {
1020  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
1021  am.name, FROM_UTF8( aBuff ) );
1022  AddMessageToList( msg );
1023  primitive_type = AMP_COMMENT;
1024  }
1025  else
1026  primitive_type = ReadInt( aText );
1027 
1028  bool is_comment = false;
1029 
1030  switch( primitive_type )
1031  {
1032  case AMP_COMMENT: // lines starting by 0 are a comment
1033  paramCount = 0;
1034  is_comment = true;
1035 
1036  // Skip comment
1037  while( *aText && ( *aText != '*' ) )
1038  aText++;
1039 
1040  break;
1041 
1042  case AMP_CIRCLE:
1043  paramCount = 4; // minimal count. can have a optional parameter (rotation)
1044  break;
1045 
1046  case AMP_LINE2:
1047  case AMP_LINE20:
1048  paramCount = 7;
1049  break;
1050 
1051  case AMP_LINE_CENTER:
1052  case AMP_LINE_LOWER_LEFT:
1053  paramCount = 6;
1054  break;
1055 
1056  case AMP_EOF:
1057  paramCount = 0;
1058  break;
1059 
1060  case AMP_OUTLINE:
1061  paramCount = 4; // partial count. other parameters are vertices and rotation
1062  // Second parameter is vertice (coordinate pairs) count.
1063  break;
1064 
1065  case AMP_POLYGON:
1066  paramCount = 6;
1067  break;
1068 
1069  case AMP_MOIRE:
1070  paramCount = 9;
1071  break;
1072 
1073  case AMP_THERMAL:
1074  paramCount = 6;
1075  break;
1076 
1077  default:
1078  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line %d: \"%s\"" ),
1079  am.name, primitive_type, m_LineNum, FROM_UTF8( aBuff ) );
1080  AddMessageToList( msg );
1081  return false;
1082  }
1083 
1084  if( is_comment )
1085  continue;
1086 
1087  AM_PRIMITIVE prim( m_GerbMetric );
1088  prim.primitive_id = (AM_PRIMITIVE_ID) primitive_type;
1089  int ii;
1090 
1091  for( ii = 0; ii < paramCount && *aText && *aText != '*'; ++ii )
1092  {
1093  prim.params.push_back( AM_PARAM() );
1094 
1095  AM_PARAM& param = prim.params.back();
1096 
1097  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
1098 
1099  if( aText == NULL) // End of File
1100  return false;
1101 
1102  param.ReadParam( aText );
1103  }
1104 
1105  if( ii < paramCount )
1106  {
1107  // maybe some day we can throw an exception and track a line number
1108  msg.Printf( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n",
1109  prim.primitive_id, ii );
1110  AddMessageToList( msg );
1111  }
1112 
1113  // there are more parameters to read if this is an AMP_OUTLINE
1114  if( prim.primitive_id == AMP_OUTLINE )
1115  {
1116  // so far we have read [0]:exposure, [1]:#points, [2]:X start, [3]: Y start
1117  // Now read all the points, plus trailing rotation in degrees.
1118 
1119  // params[1] is a count of polygon points, so it must be given
1120  // in advance, i.e. be immediate.
1121  wxASSERT( prim.params[1].IsImmediate() );
1122 
1123  paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1;
1124 
1125  for( int jj = 0; jj < paramCount && *aText != '*'; ++jj )
1126  {
1127  prim.params.push_back( AM_PARAM() );
1128 
1129  AM_PARAM& param = prim.params.back();
1130 
1131  aText = GetNextLine( aBuff, aBuffSize, aText, gerber_file );
1132 
1133  if( aText == NULL ) // End of File
1134  return false;
1135 
1136  param.ReadParam( aText );
1137  }
1138  }
1139 
1140  // AMP_CIRCLE can have a optional parameter (rotation)
1141  if( prim.primitive_id == AMP_CIRCLE && aText && *aText != '*' )
1142  {
1143  prim.params.push_back( AM_PARAM() );
1144  AM_PARAM& param = prim.params.back();
1145  param.ReadParam( aText );
1146  }
1147 
1148  am.primitives.push_back( prim );
1149  }
1150 
1151  m_aperture_macros.insert( am );
1152 
1153  return true;
1154 }
APERTURE_MACRO_SET m_aperture_macros
int m_LineNum
< Line number of the gerber file while reading.
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
wxString name
The name of the aperture macro.
Definition: am_primitive.h:164
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
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
bool ReadParam(char *&aText)
Function ReadParam Read one aperture macro parameter a parameter can be: a number a reference to an a...
Definition: am_param.cpp:177
AM_PARAMS m_localparamStack
Definition: am_primitive.h:173
char * GetNextLine(char *aBuff, unsigned int aBuffSize, char *aText, FILE *aFile)
Test for an end of line.
Definition: rs274x.cpp:933
#define NULL
AM_PARAM holds a parameter value for an "aperture macro" as defined within standard RS274X.
Definition: am_param.h:286
AM_PRIMITIVES primitives
A sequence of AM_PRIMITIVEs.
Definition: am_primitive.h:165
Struct AM_PRIMITIVE holds an aperture macro primitive as given in Table 3 of http://gerbv....
Definition: am_primitive.h:91
AM_PRIMITIVE_ID
Enum AM_PRIMITIVE_ID is the set of all "aperture macro primitives" (primitive numbers).
Definition: am_primitive.h:70
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
Definition: am_primitive.h:162

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

Referenced by ExecuteRS274XCommand().

◆ ReadIJCoord()

wxPoint GERBER_FILE_IMAGE::ReadIJCoord ( char *&  Text)

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

These coordinates are relative, so if coordinate is absent, it's value defaults to 0

Definition at line 189 of file rs274_read_XY_and_IJ_coordinates.cpp.

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

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

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

◆ ReadRS274XCommand()

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

Read a single RS274X command terminated with a %.

Definition at line 142 of file rs274x.cpp.

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

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

Referenced by LoadGerberFile().

◆ ReadXCommandID()

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

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

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

Definition at line 114 of file rs274x.cpp.

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

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

◆ ReadXYCoord()

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

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

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

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

◆ RemoveAttribute()

void GERBER_FILE_IMAGE::RemoveAttribute ( X2_ATTRIBUTE aAttribute)

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(), m_AperFunction, and m_NetAttributeDict.

Referenced by 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 159 of file eda_item.cpp.

160 {
161  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
162 
163  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
164  aSearchData.GetFindString() :
165  aSearchData.GetFindString().Upper() );
166 
167  if( result == wxNOT_FOUND )
168  return false;
169 
170  wxString prefix = aText.Left( result );
171  wxString suffix;
172 
173  if( aSearchData.GetFindString().length() + result < aText.length() )
174  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
175 
176  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
177  aText, prefix, aSearchData.GetReplaceString(), suffix );
178 
179  aText = prefix + aSearchData.GetReplaceString() + suffix;
180 
181  return true;
182 }
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_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 441 of file eda_item.h.

442  {
443  return false;
444  }

◆ ResetDefaultValues()

void GERBER_FILE_IMAGE::ResetDefaultValues ( )
virtual

Reimplemented in EXCELLON_IMAGE.

Definition at line 169 of file gerber_file_image.cpp.

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

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

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

◆ Set() [1/3]

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

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );
48 
49  return object != nullptr;
50  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
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 53 of file inspectable.h.

54  {
56  TYPE_ID thisType = TYPE_HASH( *this );
57  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
58 
59  if( object )
60  aProperty->set<T>( object, aValue );
61 
62  return object != nullptr;
63  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
void set(void *aObject, T aValue)
Definition: property.h:259
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 66 of file inspectable.h.

67  {
69  TYPE_ID thisType = TYPE_HASH( *this );
70  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71  void* object = nullptr;
72 
73  if( prop )
74  {
75  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76 
77  if( object )
78  prop->set<T>( object, aValue );
79  }
80 
81  return object != nullptr;
82  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
void set(void *aObject, T aValue)
Definition: property.h:259
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()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 202 of file eda_item.h.

202 { m_flags |= aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:530

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(), TRACKS_CLEANER::cleanup(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SYMBOL_EDITOR_PIN_TOOL::CreatePin(), 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(), SCH_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), 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(), SCH_DRAWING_TOOLS::PlaceComponent(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), 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_EDITOR_PIN_TOOL::RepeatPin(), 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_TEXT::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_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 253 of file eda_item.h.

253 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:529

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

Definition at line 165 of file eda_item.h.

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

References EDA_ITEM::m_parent.

Referenced by FOOTPRINT::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewComponent(), 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::CreateNewPart(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_PART::Flatten(), FOOTPRINT::FOOTPRINT(), GPCB_PLUGIN::FootprintLoad(), LEGACY_PLUGIN::FootprintLoad(), EAGLE_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), LIB_PART::LIB_PART(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), FOOTPRINT::operator=(), LIB_PART::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(), SCH_DRAWING_TOOLS::PlaceComponent(), 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_PART::SetFields(), DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_GLOBALLABEL::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), and SwapItemData().

◆ SetPosition()

◆ SetSelected()

◆ SetState()

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

Definition at line 191 of file eda_item.h.

192  {
193  if( state )
194  m_status |= type; // state = ON or OFF
195  else
196  m_status &= ~type;
197  }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 200 of file eda_item.h.

200 { m_status = aStatus; }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 177 of file eda_item.h.

177 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:202
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110

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

470 { return *aLeft < *aRight; }

◆ StepAndRepeatItem()

void GERBER_FILE_IMAGE::StepAndRepeatItem ( const GERBER_DRAW_ITEM aItem)

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 AddItemToList(), GetLayerParams(), GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, GERBER_DRAW_ITEM::MoveXY(), and scaletoIU().

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

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

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

162 { 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:537

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(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), 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_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), SCH_EDIT_TOOL::ChangeTextType(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), PCB_TEXT::ClassOf(), PCB_MARKER::ClassOf(), FP_SHAPE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_NO_CONNECT::ClassOf(), PCB_GROUP::ClassOf(), PCB_TARGET::ClassOf(), SCH_PIN::ClassOf(), SCH_LINE::ClassOf(), FP_TEXT::ClassOf(), SCH_FIELD::ClassOf(), NETINFO_ITEM::ClassOf(), PCB_SHAPE::ClassOf(), ZONE::ClassOf(), SCH_BITMAP::ClassOf(), PAD::ClassOf(), TRACK::ClassOf(), SCH_SHEET_PIN::ClassOf(), FOOTPRINT::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_SCREEN::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_TEXT::ClassOf(), SCH_SHEET::ClassOf(), BOARD::ClassOf(), ARC::ClassOf(), SCH_LABEL::ClassOf(), VIA::ClassOf(), ALIGNED_DIMENSION::ClassOf(), SCH_GLOBALLABEL::ClassOf(), ORTHOGONAL_DIMENSION::ClassOf(), SCH_HIERLABEL::ClassOf(), LEADER::ClassOf(), CENTER_DIMENSION::ClassOf(), TRACKS_CLEANER::cleanup(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), LIB_PART::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(), EDIT_TOOL::CreateArray(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::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::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), NETLIST_EXPORTER_BASE::findNextSymbol(), EDIT_TOOL::Flip(), 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(), 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(), DIMENSION_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), PCB_SHAPE::GetParentFootprint(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), DRC_ENGINE::GetShape(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), CONVERT_TOOL::getStartEndPoints(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), EE_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(), insideCourtyard(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), 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(), TRACK::IsNull(), SCH_LINE::IsParallel(), isPlated(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CONVERT_TOOL::LinesToPoly(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_POINT_EDITOR::Main(), 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(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), memberOf(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), 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(), TRACK::cmp_tracks::operator()(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), SCH_BUS_ENTRY_BASE::operator<(), SCH_JUNCTION::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), SCH_TEXT::operator<(), SCH_ITEM::operator<(), SCH_SHEET::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::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(), CONVERT_TOOL::PolyToLines(), 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(), SCH_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_PART::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(), EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_SEXPR_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_SEXPR_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_SEXPR_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), PCB_GROUP::SwapData(), SCH_FIELD::SwapData(), PCB_TEXT::SwapData(), TRACK::SwapData(), ARC::SwapData(), ALIGNED_DIMENSION::SwapData(), ORTHOGONAL_DIMENSION::SwapData(), SCH_SHEET::SwapData(), LEADER::SwapData(), VIA::SwapData(), SCH_COMPONENT::SwapData(), CENTER_DIMENSION::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(), PCB_GROUP::TopLevelGroup(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), 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_EDIT_ONE_FIELD::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::updatePastedInstances(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_GLOBALLABEL::Visit(), SCH_SHEET::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), PCB_GROUP::WithinScope(), 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, CENTER_DIMENSION, EDIT_POINTS, PCB_SHAPE, DIMENSION_BASE, GERBER_DRAW_ITEM, FP_TEXT, TRACK, 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, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 206 of file eda_item.cpp.

207 {
208  // Basic fallback
209  EDA_RECT bbox = GetBoundingBox();
210 
211  return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
212 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
const wxPoint GetOrigin() const
Definition: eda_rect.h:106
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:89
const wxSize GetSize() const
Definition: eda_rect.h:96

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

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), BRIGHT_BOX::ViewBBox(), DIMENSION_BASE::ViewBBox(), PCB_SHAPE::ViewBBox(), and BRIGHT_BOX::ViewDraw().

◆ 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::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, KIGFX::VIEW_OVERLAY, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, RATSNEST_VIEW_ITEM, and PCB_BRIGHT_BOX.

Definition at line 111 of file view_item.h.

112  {}

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, SCH_SHEET, EDIT_POINTS, VIA, BOARD_ITEM, SCH_ITEM, GERBER_DRAW_ITEM, FP_TEXT, TRACK, LIB_PART, MY_DRAWING, ZONE, SCH_COMPONENT, PCB_GROUP, SCH_LINE, LIB_ITEM, LIB_FIELD, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, SCH_BITMAP, PCB_MARKER, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, DS_DRAW_ITEM_BASE, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::ORIGIN_VIEWITEM, LIB_TEXT, SCH_JUNCTION, BRIGHT_BOX, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, SCH_MARKER, RATSNEST_VIEW_ITEM, KIGFX::PREVIEW::RULER_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 215 of file eda_item.cpp.

216 {
217  // Basic fallback
218  aCount = 1;
219  aLayers[0] = 0;
220 }

◆ 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, VIA, GERBER_DRAW_ITEM, FP_TEXT, TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

Definition at line 137 of file view_item.h.

138  {
139  // By default always show the item
140  return 0.0;
141  }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::drawItem::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[] 
)
overridevirtual

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 }