35#include <wx/filename.h> 
   78        return image != 
nullptr;
 
 
  143        wxString filename = fn.GetFullName();
 
  146        const int maxlen = 30;
 
  148        if( !aFullName && filename.Length() > maxlen )
 
  150            wxString shortenedfn = filename.Left(2) + wxT( 
"..." ) + filename.Right(maxlen-5);
 
  151            filename = shortenedfn;
 
  158                name.Printf( wxT( 
"%s (%s, %s, %s)" ),
 
  166                name.Printf( wxT( 
"%s (%s,%s,%s,%s)" ),
 
  175                name.Printf( wxT( 
"%s (%s, %s)" ),
 
  191        fullname.Printf( wxT( 
"%d " ), aIdx + 1 );
 
  197        name.Printf( 
_( 
"Graphic layer %d" ), aIdx + 1 );
 
 
  310                                                         wxString&               matchedExtension )
 
  313    matchedExtension = 
"";
 
  317        wxString ext = filename.Right( o.m_FilenameMask.length() ).Upper();
 
  319        if( ext.Matches( o.m_FilenameMask ) )
 
  322            matchedExtension = ext;
 
 
  346    wxString               ref_extension;
 
  347    wxString               test_extension;
 
  358        unsigned long ref_layer_number = 0;
 
  359        unsigned long test_layer_number = 0;
 
  363        for( wxString::iterator it = ref_extension.begin(); it != ref_extension.end(); ++it )
 
  365            if( !isdigit( *it ) )
 
  369        for( wxString::iterator it = test_extension.begin(); it != test_extension.end(); ++it )
 
  371            if( !isdigit( *it ) )
 
  375        ref_extension.ToULong( &ref_layer_number );
 
  376        test_extension.ToULong( &test_layer_number );
 
  378        return ref_layer_number < test_layer_number;
 
  381    return (
int) ref_layer < (int) test_layer;
 
 
  405    if( !
test->m_FileFunction )
 
 
  421    std::unordered_map<int, int> tab_lyr;
 
  423    for( 
unsigned layer = 0; layer < 
m_GERBER_List.size(); ++layer )
 
 
  438std::unordered_map<int, int>
 
  459                                                                 unsigned int layer2 )
 
  462        return std::unordered_map<int, int>();
 
 
  471        return std::unordered_map<int, int>();
 
 
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.
 
std::unordered_map< int, int > SwapImages(unsigned int layer1, unsigned int layer2)
Swap two images and their orders.
 
unsigned GetLoadedImageCount()
Get number of loaded images.
 
static void GetGerberLayerFromFilename(const wxString &filename, enum GERBER_ORDER_ENUM &order, wxString &matchedExtension)
Utility function to guess which PCB layer of a gerber/drill file corresponds to based on its file ext...
 
std::unordered_map< int, int > SortImagesByZOrder()
Sort loaded images by Z order priority, if they have the X2 FileFormat info (SortImagesByZOrder updat...
 
void DeleteImage(unsigned int aIdx)
Delete the loaded data of image aIdx, freeing the memory.
 
std::unordered_map< int, int > SortImagesByFileExtension()
Sort loaded images by file extension matching.
 
static GERBER_FILE_IMAGE_LIST & GetImagesList()
 
const wxString GetDisplayName(int aIdx, bool aNameOnly=false, bool aFullName=false)
Get the display name for the layer at aIdx.
 
void DeleteAllImages()
Remove all loaded data in list, and delete all images, freeing the memory.
 
std::vector< GERBER_FILE_IMAGE * > m_GERBER_List
 
std::unordered_map< int, int > RemoveImage(unsigned int layer)
Removes (and deletes) an image, rotating the removed image to the end.
 
~GERBER_FILE_IMAGE_LIST()
 
std::unordered_map< int, int > GetLayerRemap()
When the image order has changed, call this to get a mapping to pass to the frame's Remap() function ...
 
std::unordered_map< int, int > SortImagesByFunction(LayerSortFunction sortFunction)
Sort loaded images by file extension matching.
 
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
 
Hold the image data and parameters for one gerber file and layer parameters.
 
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
file function parameters, found in a TF command or a G04
 
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
 
int m_GraphicLayer
Graphic layer Number.
 
bool IsCopper()
return true if the filefunction type is "Copper"
 
const wxString & GetLPType()
 
const wxString & GetRouteType()
 
const wxString & GetBrdLayerSide()
the brd layer Pos: Top, Bot, Inr same as GetBrdLayerId() for non copper type
 
const wxString & GetFileType()
the type of layer (Copper, Soldermask ... )
 
int GetZSubOrder()
the Order of the bdr copper layer, from front (Top) side to back (Bot) side
 
const wxString & GetBrdLayerId()
the brd layer identifier: Ln, only for Copper type or Top, Bot for other types
 
const wxString GetDrillLayerPair()
 
int GetZOrder()
the Order of the board layer, from front (Top) side to back (Bot) side
 
static struct GERBER_ORDER gerberFileExtensionOrder[]
 
static bool sortZorder(const GERBER_FILE_IMAGE *const &ref, const GERBER_FILE_IMAGE *const &test)
 
GERBER_FILE_IMAGE_LIST s_GERBER_List
 
static bool sortFileExtension(const GERBER_FILE_IMAGE *const &ref, const GERBER_FILE_IMAGE *const &test)
 
bool LayerSortFunction(const GERBER_FILE_IMAGE *const &ref, const GERBER_FILE_IMAGE *const &test)
 
@ GERBER_BOTTOM_SILK_SCREEN
 
@ GERBER_BOTTOM_SOLDER_MASK
 
#define GERBER_DRAWLAYERS_COUNT
Number of draw layers in Gerbview.
 
std::string m_FilenameMask
 
GERBER_ORDER_ENUM m_Order