KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ALLEGRO::LAYER_MAPPER Class Reference

Class to handle the mapping for Allegro CLASS/SUBCLASS idiom to KiCad layers. More...

Classes

struct  CUSTOM_LAYER
 Represents the information found in a single entry of a layer list. More...
 

Public Member Functions

 LAYER_MAPPER (const BRD_DB &aRawBoard, BOARD &aBoard, const LAYER_MAPPING_HANDLER &aLayerMappingHandler)
 
void ProcessLayerList (uint8_t aClass, const BLK_0x2A_LAYER_LIST &aList)
 
void FinalizeLayers ()
 Called after all the custom layers are loaded.
 
PCB_LAYER_ID GetLayer (const LAYER_INFO &aLayerInfo)
 
PCB_LAYER_ID GetPlaceBounds (bool aTop)
 Allegro puts more graphics than just the polygon on PBT/B, but we don't want to always make a static mapping, because some things on PBT/B do belong to the courtyard layer in KiCad (polygons).
 
bool IsOutlineLayer (const LAYER_INFO &aLayerInfo) const
 Resolve the subclass name for a given class:subclass pair using the per-class custom layer list.
 

Private Member Functions

PCB_LAYER_ID mapCustomLayer (const LAYER_INFO &aLayerInfo, const wxString &aLayerName)
 
PCB_LAYER_ID mapCustomLayerByName (const wxString &aLayerName)
 Create or find a mapped layer with a given name, but not specifically bound to a specific class:subclass.
 
PCB_LAYER_ID addUserLayer (const wxString &aName)
 

Static Private Member Functions

static PCB_LAYER_ID getNthCopperLayer (int aNum, int aTotal)
 
static PCB_LAYER_ID getNthUserLayer (int aNum)
 

Private Attributes

std::unordered_map< const BLK_0x2A_LAYER_LIST *, std::vector< CUSTOM_LAYER > > m_Lists
 
std::unordered_map< uint8_t, std::vector< CUSTOM_LAYER > * > m_ClassCustomLayerLists
 
std::unordered_map< LAYER_INFO, PCB_LAYER_IDm_customLayerToKiMap
 The main map from CLASS:SUBCLASS custom mappings to KiCadLayers.
 
std::unordered_map< wxString, PCB_LAYER_IDm_MappedOptionalLayers
 This is a map of optional, Allegro layers that we have mapped to KiCad layers with given names.
 
std::unordered_map< LAYER_INFO, PCB_LAYER_IDm_staticLayerOverrides
 Overrides for the static s_LayerKiMap entries, populated by the layer mapping handler.
 
std::unordered_map< LAYER_INFO, wxString > m_customLayerDialogNames
 Names used in the layer mapping dialog for custom (non-ETCH, non-static) layers.
 
std::unordered_map< LAYER_INFO, int > m_unknownLayers
 A record of what we failed to map.
 
int m_numUserLayersUsed = 0
 
PCB_LAYER_ID m_unmappedLayer = Cmts_User
 
const LAYER_MAPPING_HANDLERm_layerMappingHandler
 
const BRD_DBm_brdDb
 
BOARDm_board
 

Detailed Description

Class to handle the mapping for Allegro CLASS/SUBCLASS idiom to KiCad layers.

Definition at line 468 of file allegro_builder.cpp.

Constructor & Destructor Documentation

◆ LAYER_MAPPER()

ALLEGRO::LAYER_MAPPER::LAYER_MAPPER ( const BRD_DB & aRawBoard,
BOARD & aBoard,
const LAYER_MAPPING_HANDLER & aLayerMappingHandler )
inline

Definition at line 484 of file allegro_builder.cpp.

References m_board, m_brdDb, and m_layerMappingHandler.

Member Function Documentation

◆ addUserLayer()

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::addUserLayer ( const wxString & aName)
inlineprivate

◆ FinalizeLayers()

◆ GetLayer()

◆ getNthCopperLayer()

static PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::getNthCopperLayer ( int aNum,
int aTotal )
inlinestaticprivate

Definition at line 733 of file allegro_builder.cpp.

References B_Cu, F_Cu, and ToLAYER_ID().

Referenced by FinalizeLayers(), and GetLayer().

◆ getNthUserLayer()

static PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::getNthUserLayer ( int aNum)
inlinestaticprivate

Definition at line 742 of file allegro_builder.cpp.

References MAX_USER_DEFINED_LAYERS, ToLAYER_ID(), and User_1.

Referenced by addUserLayer(), and FinalizeLayers().

◆ GetPlaceBounds()

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::GetPlaceBounds ( bool aTop)
inline

Allegro puts more graphics than just the polygon on PBT/B, but we don't want to always make a static mapping, because some things on PBT/B do belong to the courtyard layer in KiCad (polygons).

Use this function to create/choose a user layer instead.

Definition at line 710 of file allegro_builder.cpp.

References mapCustomLayerByName(), and name.

◆ IsOutlineLayer()

bool ALLEGRO::LAYER_MAPPER::IsOutlineLayer ( const LAYER_INFO & aLayerInfo) const
inline

Resolve the subclass name for a given class:subclass pair using the per-class custom layer list.

Returns empty string if not found.

Definition at line 720 of file allegro_builder.cpp.

References ALLEGRO::LAYER_INFO::BGEOM_OUTLINE, ALLEGRO::LAYER_INFO::BOARD_GEOMETRY, ALLEGRO::LAYER_INFO::DFMT_OUTLINE, ALLEGRO::LAYER_INFO::DRAWING_FORMAT, ALLEGRO::LAYER_INFO::m_Class, and ALLEGRO::LAYER_INFO::m_Subclass.

◆ mapCustomLayer()

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::mapCustomLayer ( const LAYER_INFO & aLayerInfo,
const wxString & aLayerName )
inlineprivate

◆ mapCustomLayerByName()

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::mapCustomLayerByName ( const wxString & aLayerName)
inlineprivate

Create or find a mapped layer with a given name, but not specifically bound to a specific class:subclass.

This is useful when some items on a class:sublcass need to be placed on a KiCad layer other than the usual mapping (non-polygon PLACE_BOUND_TOP items, for example)

Definition at line 776 of file allegro_builder.cpp.

References addUserLayer(), and m_MappedOptionalLayers.

Referenced by GetPlaceBounds().

◆ ProcessLayerList()

Member Data Documentation

◆ m_board

BOARD& ALLEGRO::LAYER_MAPPER::m_board
private

Definition at line 844 of file allegro_builder.cpp.

Referenced by addUserLayer(), FinalizeLayers(), and LAYER_MAPPER().

◆ m_brdDb

const BRD_DB& ALLEGRO::LAYER_MAPPER::m_brdDb
private

Definition at line 843 of file allegro_builder.cpp.

Referenced by LAYER_MAPPER(), and ProcessLayerList().

◆ m_ClassCustomLayerLists

std::unordered_map<uint8_t, std::vector<CUSTOM_LAYER>*> ALLEGRO::LAYER_MAPPER::m_ClassCustomLayerLists
private

Definition at line 803 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), GetLayer(), and ProcessLayerList().

◆ m_customLayerDialogNames

std::unordered_map<LAYER_INFO, wxString> ALLEGRO::LAYER_MAPPER::m_customLayerDialogNames
private

Names used in the layer mapping dialog for custom (non-ETCH, non-static) layers.

Populated during FinalizeLayers(), consumed when applying the handler result.

Definition at line 829 of file allegro_builder.cpp.

Referenced by FinalizeLayers().

◆ m_customLayerToKiMap

std::unordered_map<LAYER_INFO, PCB_LAYER_ID> ALLEGRO::LAYER_MAPPER::m_customLayerToKiMap
private

The main map from CLASS:SUBCLASS custom mappings to KiCadLayers.

This doesn't cover all the fixed layers, just created custom ones, including the copper layers.

Definition at line 811 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), GetLayer(), and mapCustomLayer().

◆ m_layerMappingHandler

const LAYER_MAPPING_HANDLER& ALLEGRO::LAYER_MAPPER::m_layerMappingHandler
private

Definition at line 841 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), and LAYER_MAPPER().

◆ m_Lists

std::unordered_map<const BLK_0x2A_LAYER_LIST*, std::vector<CUSTOM_LAYER> > ALLEGRO::LAYER_MAPPER::m_Lists
private

Definition at line 800 of file allegro_builder.cpp.

Referenced by ProcessLayerList().

◆ m_MappedOptionalLayers

std::unordered_map<wxString, PCB_LAYER_ID> ALLEGRO::LAYER_MAPPER::m_MappedOptionalLayers
private

This is a map of optional, Allegro layers that we have mapped to KiCad layers with given names.

This is done by name, because multiple class:subclass pairs may share the same name.

Definition at line 818 of file allegro_builder.cpp.

Referenced by mapCustomLayer(), and mapCustomLayerByName().

◆ m_numUserLayersUsed

int ALLEGRO::LAYER_MAPPER::m_numUserLayersUsed = 0
private

Definition at line 836 of file allegro_builder.cpp.

Referenced by addUserLayer().

◆ m_staticLayerOverrides

std::unordered_map<LAYER_INFO, PCB_LAYER_ID> ALLEGRO::LAYER_MAPPER::m_staticLayerOverrides
private

Overrides for the static s_LayerKiMap entries, populated by the layer mapping handler.

Definition at line 823 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), and GetLayer().

◆ m_unknownLayers

std::unordered_map<LAYER_INFO, int> ALLEGRO::LAYER_MAPPER::m_unknownLayers
private

A record of what we failed to map.

Definition at line 834 of file allegro_builder.cpp.

Referenced by GetLayer().

◆ m_unmappedLayer

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::m_unmappedLayer = Cmts_User
private

Definition at line 839 of file allegro_builder.cpp.

Referenced by GetLayer().


The documentation for this class was generated from the following file: