49    if( gerber != 
nullptr )
 
   55    std::unique_ptr<GERBER_FILE_IMAGE> gerber_uptr = std::make_unique<GERBER_FILE_IMAGE>( layer );
 
   59    bool success = gerber_uptr->LoadGerberFile( GERBER_FullFileName );
 
   64        msg.Printf( 
_( 
"File '%s' not found" ), GERBER_FullFileName );
 
   69    gerber = gerber_uptr.release();
 
   70    wxASSERT( gerber != 
nullptr );
 
   89            msg = 
_(
"Warning: this file has no D-Code definition\n" 
   90                    "Therefore the size of some items is undefined");
 
   92            msg = 
_(
"Warning: this file has some missing D-Code definitions\n" 
   93                    "Therefore the size of some items is undefined");
 
 
  141    char* letter    = 
nullptr;
 
  142    bool  foundADD  = 
false;
 
  143    bool  foundD0   = 
false;
 
  144    bool  foundD2   = 
false;
 
  145    bool  foundM0   = 
false;
 
  146    bool  foundM2   = 
false;
 
  147    bool  foundStar = 
false;
 
  165            for( 
size_t i = 0; i < strlen( line ); i++ )
 
  167                if( !isascii( line[i] ) )
 
  171            if( strstr( line, 
"%ADD" ) )
 
  174            if( strstr( line, 
"D00" ) || strstr( line, 
"D0" ) )
 
  177            if( strstr( line, 
"D02" ) || strstr( line, 
"D2" ) )
 
  180            if( strstr( line, 
"M00" ) || strstr( line, 
"M0" ) )
 
  183            if( strstr( line, 
"M02" ) || strstr( line, 
"M2" ) )
 
  186            if( strstr( line, 
"*" ) )
 
  190            if( ( letter = strstr( line, 
"X" ) ) != 
nullptr )
 
  192                if( isdigit( letter[1] ) )
 
  196            if( ( letter = strstr( line, 
"Y" ) ) != 
nullptr )
 
  198                if( isdigit( letter[1] ) )
 
  209    if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && foundADD && foundStar
 
  210        && ( foundX || foundY ) )
 
  216    else if( ( foundD0 || foundD2 || foundM0 || foundM2 ) && !foundADD && foundStar
 
  217             && ( foundX || foundY ) )
 
 
  323                msg.Printf( wxT( 
"Unexpected char 0x%2.2X (%c)" ), *
text, *
text );
 
 
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
 
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
 
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
 
A LINE_READER that reads from an open file.
 
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
 
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
 
int AddGbrImage(GERBER_FILE_IMAGE *aGbrImage, int aIdx)
Add a GERBER_FILE_IMAGE* at index aIdx or at the first free location if aIdx < 0.
 
Hold the image data and parameters for one gerber file and layer parameters.
 
bool Execute_G_Command(char *&text, int G_command)
 
bool LoadGerberFile(const wxString &aFullFileName)
Read and load a gerber file.
 
int m_Last_Pen_Command
Current or last pen state (0..9, set by Dn option with n < 10.
 
VECTOR2I ReadIJCoord(char *&Text)
Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm)
 
static char m_LineBuffer[GERBER_BUFZ+1]
 
virtual void ResetDefaultValues()
Set all parameters to a default value, before reading a file.
 
const wxArrayString & GetMessages() const
 
void ClearMessageList()
Clear the message list.
 
wxString m_FileName
Full File Name for this layer.
 
bool m_InUse
true if this image is currently in use (a file is loaded in it) false if it must be not drawn
 
bool m_ImageNegative
true = Negative image
 
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
 
int m_LineNum
Line number of the gerber file while reading.
 
VECTOR2I m_IJPos
IJ coord (for arcs & circles )
 
bool Execute_DCODE_Command(char *&text, int D_command)
 
static bool TestFileIsRS274(const wxString &aFullFileName)
Performs a heuristics-based check of whether the file is an RS274 gerber file.
 
bool ReadRS274XCommand(char *aBuff, unsigned int aBuffSize, char *&aText)
Read a single RS274X command terminated with a %.
 
bool m_Has_DCode
< True if has DCodes in file or false if no DCodes found. Perhaps deprecated RS274D file.
 
VECTOR2I ReadXYCoord(char *&aText, bool aExcellonMode=false)
Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm).
 
int m_CommandState
state of gerber analysis command
 
VECTOR2I m_CurrentPos
current specified coord for plot
 
GERBER_DRAW_ITEMS & GetItems()
 
int CodeNumber(char *&aText)
Reads the next number and returns the value.
 
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
 
int GetActiveLayer() const
Return the active layer.
 
bool Read_GERBER_File(const wxString &GERBER_FullFileName)
 
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
 
void Erase_Current_DrawLayer(bool query)
 
void ListSet(const wxString &aList)
Add a list of items.
 
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
 
An abstract base class for deriving all objects that can be added to a VIEW.
 
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
 
char * Line() const
Return a pointer to the last line that was read in.
 
This file contains miscellaneous commonly used macros and functions.
 
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.