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)
 
bool IsLayerMapped (PCB_LAYER_ID aLayerId) const
 Return whether this layer ID is something we mapped to, or the catch-all unmapped layer.
 
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.
 
PCB_LAYER_ID MapCustomLayer (const LAYER_INFO &aLayerInfo, const wxString &aLayerName)
 Record a specific class:subclass layer as mapping to some KiCad user layer, with a given name.
 

Private Member Functions

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 585 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 601 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 925 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 934 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 873 of file allegro_builder.cpp.

References mapCustomLayerByName(), and name.

◆ IsLayerMapped()

bool ALLEGRO::LAYER_MAPPER::IsLayerMapped ( PCB_LAYER_ID aLayerId) const
inline

Return whether this layer ID is something we mapped to, or the catch-all unmapped layer.

Definition at line 862 of file allegro_builder.cpp.

References m_unmappedLayer.

◆ 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 883 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 )
inline

Record a specific class:subclass layer as mapping to some KiCad user layer, with a given name.

Usually, you don't need this as they are registered as needed based on layers found in the board, but sometimes you need to override the default mapping, say when you detect that the "lumped" layers need to be split.

Definition at line 902 of file allegro_builder.cpp.

References addUserLayer(), ALLEGRO::LAYER_INFO::m_Class, m_customLayerToKiMap, m_MappedOptionalLayers, ALLEGRO::LAYER_INFO::m_Subclass, and traceAllegroBuilder.

Referenced by GetLayer().

◆ 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:subclass need to be placed on a KiCad layer other than the usual mapping (non-polygon PLACE_BOUND_TOP items, for example)

Definition at line 946 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 1014 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 1013 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 973 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 999 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 981 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 1011 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 970 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 988 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), MapCustomLayer(), and mapCustomLayerByName().

◆ m_numUserLayersUsed

int ALLEGRO::LAYER_MAPPER::m_numUserLayersUsed = 0
private

Definition at line 1006 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 993 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 1004 of file allegro_builder.cpp.

Referenced by GetLayer().

◆ m_unmappedLayer

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::m_unmappedLayer = Cmts_User
private

Definition at line 1009 of file allegro_builder.cpp.

Referenced by GetLayer(), and IsLayerMapped().


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