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 IsPlaneLayer (const LAYER_INFO &aLayerInfo) const
 Plane layers are drawn as negatives, so a line on one is a void and not copper.
 
int GetEtchLayerCount () const
 Return whether this layer ID is something we mapped to, or the catch-all unmapped layer.
 
bool IsLayerMapped (PCB_LAYER_ID aLayerId) const
 
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.
 
LSET GetRuleAreaLayers (const LAYER_INFO &aLayerInfo)
 

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_ID > m_customLayerToKiMap
 The main map from CLASS:SUBCLASS custom mappings to KiCadLayers.
 
int m_etchLayerCount = 0
 
std::unordered_map< wxString, PCB_LAYER_ID > m_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_ID > m_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_HANDLER & m_layerMappingHandler
 
const BRD_DB & m_brdDb
 
BOARD & m_board
 

Detailed Description

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

Definition at line 477 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 494 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()

◆ GetEtchLayerCount()

int ALLEGRO::LAYER_MAPPER::GetEtchLayerCount ( ) const
inline

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

Definition at line 785 of file allegro_builder.cpp.

References m_etchLayerCount.

◆ GetLayer()

◆ getNthCopperLayer()

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

Definition at line 899 of file allegro_builder.cpp.

References nthCopperLayerId().

Referenced by FinalizeLayers(), and GetLayer().

◆ getNthUserLayer()

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

Definition at line 904 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 799 of file allegro_builder.cpp.

References mapCustomLayerByName(), and name.

◆ GetRuleAreaLayers()

◆ IsLayerMapped()

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

Definition at line 787 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 809 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.

◆ IsPlaneLayer()

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

Plane layers are drawn as negatives, so a line on one is a void and not copper.

This is a property of the source layer, as several source layers can share one KiCad layer.

Definition at line 766 of file allegro_builder.cpp.

References ALLEGRO::LAYER_INFO::ETCH, LAYER_PROP_PLANE, ALLEGRO::LAYER_INFO::m_Class, m_ClassCustomLayerLists, 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 828 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 916 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 985 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 984 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 943 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), GetLayer(), IsPlaneLayer(), 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 970 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 951 of file allegro_builder.cpp.

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

◆ m_etchLayerCount

int ALLEGRO::LAYER_MAPPER::m_etchLayerCount = 0
private

Definition at line 952 of file allegro_builder.cpp.

Referenced by FinalizeLayers(), and GetEtchLayerCount().

◆ m_layerMappingHandler

const LAYER_MAPPING_HANDLER& ALLEGRO::LAYER_MAPPER::m_layerMappingHandler
private

Definition at line 982 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 940 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 959 of file allegro_builder.cpp.

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

◆ m_numUserLayersUsed

int ALLEGRO::LAYER_MAPPER::m_numUserLayersUsed = 0
private

Definition at line 977 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 964 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 975 of file allegro_builder.cpp.

Referenced by GetLayer().

◆ m_unmappedLayer

PCB_LAYER_ID ALLEGRO::LAYER_MAPPER::m_unmappedLayer = Cmts_User
private

Definition at line 980 of file allegro_builder.cpp.

Referenced by GetLayer(), and IsLayerMapped().


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