77 return image !=
nullptr;
142 wxString filename = fn.GetFullName();
145 const int maxlen = 30;
147 if( !aFullName && filename.Length() > maxlen )
149 wxString shortenedfn = filename.Left(2) + wxT(
"..." ) + filename.Right(maxlen-5);
150 filename = shortenedfn;
157 name.Printf( wxT(
"%s (%s, %s, %s)" ),
165 name.Printf( wxT(
"%s (%s,%s,%s,%s)" ),
174 name.Printf( wxT(
"%s (%s, %s)" ),
190 fullname.Printf( wxT(
"%d " ), aIdx + 1 );
196 name.Printf(
_(
"Graphic layer %d" ), aIdx + 1 );
309 wxString& matchedExtension )
311 order = GERBER_ORDER_ENUM::GERBER_LAYER_UNKNOWN;
312 matchedExtension =
"";
316 wxString ext = filename.Right( o.m_FilenameMask.length() ).Upper();
318 if( ext.Matches( o.m_FilenameMask ) )
321 matchedExtension = ext;
345 wxString ref_extension;
346 wxString test_extension;
357 unsigned long ref_layer_number = 0;
358 unsigned long test_layer_number = 0;
362 for( wxString::iterator it = ref_extension.begin(); it != ref_extension.end(); ++it )
364 if( !isdigit( *it ) )
368 for( wxString::iterator it = test_extension.begin(); it != test_extension.end(); ++it )
370 if( !isdigit( *it ) )
374 ref_extension.ToULong( &ref_layer_number );
375 test_extension.ToULong( &test_layer_number );
377 return ref_layer_number < test_layer_number;
380 return (
int) ref_layer < (int) test_layer;
404 if( !
test->m_FileFunction )
420 std::unordered_map<int, int> tab_lyr;
422 for(
unsigned layer = 0; layer <
m_GERBER_List.size(); ++layer )
437std::unordered_map<int, int>
458 unsigned int layer2 )
461 return std::unordered_map<int, int>();
470 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
std::string m_FilenameMask
GERBER_ORDER_ENUM m_Order