KiCad PCB EDA Suite
|
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded and can be displayed there are 32 images max which can be loaded. More...
#include <gerber_file_image_list.h>
Public Member Functions | |
GERBER_FILE_IMAGE_LIST () | |
~GERBER_FILE_IMAGE_LIST () | |
GERBER_FILE_IMAGE * | GetGbrImage (int aIdx) |
unsigned | ImagesMaxCount () |
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. | |
void | DeleteAllImages () |
Remove all loaded data in list, and delete all images, freeing the memory. | |
void | DeleteImage (unsigned int aIdx) |
Delete the loaded data of image aIdx, freeing the memory. | |
const wxString | GetDisplayName (int aIdx, bool aNameOnly=false, bool aFullName=false) |
Get the display name for the layer at aIdx. | |
std::unordered_map< int, int > | SortImagesByFunction (LayerSortFunction sortFunction) |
Sort loaded images by file extension matching. | |
std::unordered_map< int, int > | SortImagesByFileExtension () |
Sort loaded images by file extension matching. | |
std::unordered_map< int, int > | SortImagesByZOrder () |
Sort loaded images by Z order priority, if they have the X2 FileFormat info (SortImagesByZOrder updates the graphic layer of these items) | |
std::unordered_map< int, int > | SwapImages (unsigned int layer1, unsigned int layer2) |
Swap two images and their orders. | |
std::unordered_map< int, int > | RemoveImage (unsigned int layer) |
Removes (and deletes) an image, rotating the removed image to the end. | |
unsigned | GetLoadedImageCount () |
Get number of loaded images. | |
Static Public Member Functions | |
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 extension. | |
static GERBER_FILE_IMAGE_LIST & | GetImagesList () |
Private Member Functions | |
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 to remap the widgets layer order. | |
Private Attributes | |
std::vector< GERBER_FILE_IMAGE * > | m_GERBER_List |
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded and can be displayed there are 32 images max which can be loaded.
Definition at line 86 of file gerber_file_image_list.h.
GERBER_FILE_IMAGE_LIST::GERBER_FILE_IMAGE_LIST | ( | ) |
Definition at line 44 of file gerber_file_image_list.cpp.
References GERBER_DRAWLAYERS_COUNT, and m_GERBER_List.
GERBER_FILE_IMAGE_LIST::~GERBER_FILE_IMAGE_LIST | ( | ) |
Definition at line 53 of file gerber_file_image_list.cpp.
References DeleteAllImages().
int GERBER_FILE_IMAGE_LIST::AddGbrImage | ( | GERBER_FILE_IMAGE * | aGbrImage, |
int | aIdx | ||
) |
Add a GERBER_FILE_IMAGE* at index aIdx or at the first free location if aIdx < 0.
aGbrImage | is the image to add. |
aIdx | is the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 ). |
Definition at line 84 of file gerber_file_image_list.cpp.
References m_GERBER_List.
Referenced by GERBVIEW_FRAME::Read_EXCELLON_File(), and GERBVIEW_FRAME::Read_GERBER_File().
void GERBER_FILE_IMAGE_LIST::DeleteAllImages | ( | ) |
Remove all loaded data in list, and delete all images, freeing the memory.
Definition at line 106 of file gerber_file_image_list.cpp.
References DeleteImage(), and m_GERBER_List.
Referenced by GERBVIEW_FRAME::Clear_DrawLayers(), ~GERBER_FILE_IMAGE_LIST(), and GERBVIEW_FRAME::~GERBVIEW_FRAME().
void GERBER_FILE_IMAGE_LIST::DeleteImage | ( | unsigned int | aIdx | ) |
Delete the loaded data of image aIdx, freeing the memory.
aIdx | is the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 ). |
Definition at line 113 of file gerber_file_image_list.cpp.
References GetGbrImage(), and m_GERBER_List.
Referenced by DeleteAllImages(), and RemoveImage().
const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName | ( | int | aIdx, |
bool | aNameOnly = false , |
||
bool | aFullName = false |
||
) |
Get the display name for the layer at aIdx.
if a file is loaded, the name is: "<aIdx+1> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found" or (if no FileFunction info) "<aIdx+1> <short filename> *" if no file loaded, the name is: "Layer n" with n = aIdx+1
aIdx | is the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 ). |
aNameOnly | set to false (default) to add the layer number (for layers manager) or true to return only the name without layer name (status bar)/ |
aFullName | set to false (default) to ellipsize the name, true to return the full name. |
Definition at line 127 of file gerber_file_image_list.cpp.
References _, X2_ATTRIBUTE_FILEFUNCTION::GetBrdLayerId(), X2_ATTRIBUTE_FILEFUNCTION::GetBrdLayerSide(), X2_ATTRIBUTE_FILEFUNCTION::GetDrillLayerPair(), X2_ATTRIBUTE_FILEFUNCTION::GetFileType(), X2_ATTRIBUTE_FILEFUNCTION::GetLPType(), X2_ATTRIBUTE_FILEFUNCTION::GetRouteType(), X2_ATTRIBUTE_FILEFUNCTION::IsCopper(), X2_ATTRIBUTE_FILEFUNCTION::IsDrillFile(), GERBER_FILE_IMAGE::m_FileFunction, GERBER_FILE_IMAGE::m_FileName, m_GERBER_List, and name.
Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME(), GERBER_DRAW_ITEM::GetItemDescription(), GBR_LAYER_PRESENTATION::getLayerName(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), and GERBER_LAYER_WIDGET::ReFill().
GERBER_FILE_IMAGE * GERBER_FILE_IMAGE_LIST::GetGbrImage | ( | int | aIdx | ) |
Definition at line 65 of file gerber_file_image_list.cpp.
References m_GERBER_List.
Referenced by GBR_LAYOUT::ComputeBoundingBox(), DeleteImage(), GBR_TO_PCB_EXPORTER::ExportPcb(), GERBVIEW_CONTROL::ExportToPcbnew(), LAYERS_MAP_DIALOG::findNumAltiumGerbersLoaded(), LAYERS_MAP_DIALOG::findNumKiCadGerbersLoaded(), LAYERS_MAP_DIALOG::findNumX2GerbersLoaded(), GERBVIEW_FRAME::GetGbrImage(), LAYERS_MAP_DIALOG::initDialog(), LAYERS_MAP_DIALOG::OnSelectLayer(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_CONTROL::ReloadAllLayers(), GERBVIEW_FRAME::RemapLayers(), GBR_LAYER_BOX_SELECTOR::Resync(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), DIALOG_DRAW_LAYERS_SETTINGS::TransferDataFromWindow(), DIALOG_PRINT_GERBVIEW::TransferDataToWindow(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), GERBVIEW_FRAME::updateComponentListSelectBox(), GERBVIEW_FRAME::updateNetnameListSelectBox(), and GBR_LAYOUT::Visit().
|
static |
Utility function to guess which PCB layer of a gerber/drill file corresponds to based on its file extension.
Supports many CAD program file extension patterns. Detects gerbers, drills, edge layers, etc.
filename | Filename to check against the extension matching table. |
order | Returns the order that this layer should be placed in a set of layers. |
matchedExtension | The actual extension pattern that this filename matched. |
Definition at line 308 of file gerber_file_image_list.cpp.
References gerberFileExtensionOrder.
Referenced by GERBVIEW_FRAME::OpenProjectFiles(), sortFileExtension(), and GERBVIEW_FRAME::unarchiveFiles().
|
static |
Definition at line 59 of file gerber_file_image_list.cpp.
References s_GERBER_List.
Referenced by GERBER_LAYER_WIDGET::GetImagesList(), GBR_LAYOUT::GetImagesList(), GERBER_DRAW_ITEM::GetItemDescription(), GBR_LAYER_PRESENTATION::getLayerName(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), GERBVIEW_CONTROL::LayerNext(), GERBVIEW_CONTROL::MoveLayerDown(), GERBVIEW_CONTROL::MoveLayerUp(), GERBVIEW_PRINTOUT::OnPrintPage(), and GBR_LAYER_BOX_SELECTOR::Resync().
|
private |
When the image order has changed, call this to get a mapping to pass to the frame's Remap() function to remap the widgets layer order.
Definition at line 415 of file gerber_file_image_list.cpp.
References m_GERBER_List, and GERBER_FILE_IMAGE::m_GraphicLayer.
Referenced by RemoveImage(), SortImagesByFunction(), and SwapImages().
unsigned GERBER_FILE_IMAGE_LIST::GetLoadedImageCount | ( | ) |
Get number of loaded images.
Definition at line 74 of file gerber_file_image_list.cpp.
References image, and m_GERBER_List.
Referenced by GERBVIEW_FRAME::LoadFileOrShowDialog(), and GERBVIEW_CONTROL::MoveLayerDown().
|
inline |
Definition at line 108 of file gerber_file_image_list.h.
References m_GERBER_List.
Referenced by GBR_LAYOUT::ComputeBoundingBox(), GBR_TO_PCB_EXPORTER::ExportPcb(), GERBVIEW_CONTROL::ExportToPcbnew(), GERBVIEW_FRAME::ImagesMaxCount(), GERBVIEW_CONTROL::ReloadAllLayers(), GBR_LAYER_BOX_SELECTOR::Resync(), DIALOG_DRAW_LAYERS_SETTINGS::TransferDataFromWindow(), DIALOG_PRINT_GERBVIEW::TransferDataToWindow(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), GERBVIEW_FRAME::updateComponentListSelectBox(), GERBVIEW_FRAME::updateNetnameListSelectBox(), and GBR_LAYOUT::Visit().
std::unordered_map< int, int > GERBER_FILE_IMAGE_LIST::RemoveImage | ( | unsigned int | layer | ) |
Removes (and deletes) an image, rotating the removed image to the end.
Definition at line 468 of file gerber_file_image_list.cpp.
References DeleteImage(), GetLayerRemap(), and m_GERBER_List.
std::unordered_map< int, int > GERBER_FILE_IMAGE_LIST::SortImagesByFileExtension | ( | ) |
Sort loaded images by file extension matching.
Definition at line 446 of file gerber_file_image_list.cpp.
References sortFileExtension(), and SortImagesByFunction().
std::unordered_map< int, int > GERBER_FILE_IMAGE_LIST::SortImagesByFunction | ( | LayerSortFunction | sortFunction | ) |
Sort loaded images by file extension matching.
Definition at line 439 of file gerber_file_image_list.cpp.
References GetLayerRemap(), and m_GERBER_List.
Referenced by SortImagesByFileExtension(), and SortImagesByZOrder().
std::unordered_map< int, int > GERBER_FILE_IMAGE_LIST::SortImagesByZOrder | ( | ) |
Sort loaded images by Z order priority, if they have the X2 FileFormat info (SortImagesByZOrder updates the graphic layer of these items)
Definition at line 452 of file gerber_file_image_list.cpp.
References SortImagesByFunction(), and sortZorder().
std::unordered_map< int, int > GERBER_FILE_IMAGE_LIST::SwapImages | ( | unsigned int | layer1, |
unsigned int | layer2 | ||
) |
Swap two images and their orders.
Definition at line 458 of file gerber_file_image_list.cpp.
References GetLayerRemap(), and m_GERBER_List.
Referenced by GERBVIEW_CONTROL::MoveLayerDown().
|
private |
Definition at line 206 of file gerber_file_image_list.h.
Referenced by AddGbrImage(), DeleteAllImages(), DeleteImage(), GERBER_FILE_IMAGE_LIST(), GetDisplayName(), GetGbrImage(), GetLayerRemap(), GetLoadedImageCount(), ImagesMaxCount(), RemoveImage(), SortImagesByFunction(), and SwapImages().