|
KiCad PCB EDA Suite
|
Maps PADS layer numbers and names to KiCad layer IDs. More...
#include <pads_layer_mapper.h>
Public Member Functions | |
| PADS_LAYER_MAPPER () | |
| void | SetCopperLayerCount (int aLayerCount) |
| Set the total number of copper layers in the PADS design. | |
| int | GetCopperLayerCount () const |
| Get the current copper layer count. | |
| PADS_LAYER_TYPE | GetLayerType (int aPadsLayer) const |
| Parse a PADS layer number and return its type. | |
| PADS_LAYER_TYPE | ParseLayerName (const std::string &aLayerName) const |
| Parse a PADS layer name and return its type. | |
| PCB_LAYER_ID | GetAutoMapLayer (int aPadsLayer, PADS_LAYER_TYPE aType=PADS_LAYER_TYPE::UNKNOWN) const |
| Get the suggested KiCad layer for a PADS layer. | |
| LSET | GetPermittedLayers (PADS_LAYER_TYPE aType) const |
| Get the permitted KiCad layers for a given PADS layer type. | |
| std::vector< INPUT_LAYER_DESC > | BuildInputLayerDescriptions (const std::vector< PADS_LAYER_INFO > &aLayerInfos) const |
| Build a vector of INPUT_LAYER_DESC from parsed PADS layer information. | |
| void | AddLayerNameMapping (const std::string &aName, PADS_LAYER_TYPE aType) |
| Add or update a layer name to type mapping. | |
Static Public Member Functions | |
| static std::string | LayerTypeToString (PADS_LAYER_TYPE aType) |
| Convert a layer type to a human-readable string. | |
Static Public Attributes | |
| static constexpr int | LAYER_PAD_STACK_TOP = -2 |
| Pad stack: Top copper. | |
| static constexpr int | LAYER_PAD_STACK_BOTTOM = -1 |
| Pad stack: Bottom copper. | |
| static constexpr int | LAYER_PAD_STACK_INNER = 0 |
| Pad stack: Inner copper. | |
| static constexpr int | LAYER_DRILL_DRAWING = 18 |
| static constexpr int | LAYER_DIMENSIONS = 19 |
| static constexpr int | LAYER_PLACEMENT_OUTLINE = 20 |
| static constexpr int | LAYER_ASSEMBLY_TOP = 21 |
| static constexpr int | LAYER_ASSEMBLY_BOTTOM = 22 |
| static constexpr int | LAYER_SOLDERMASK_TOP = 25 |
| static constexpr int | LAYER_SILKSCREEN_TOP = 26 |
| static constexpr int | LAYER_SILKSCREEN_BOTTOM = 27 |
| static constexpr int | LAYER_SOLDERMASK_BOTTOM = 28 |
| static constexpr int | LAYER_PASTE_TOP = 29 |
| static constexpr int | LAYER_PASTE_BOTTOM = 30 |
| static constexpr int | LAYER_BOARD_OUTLINE = 1 |
Private Member Functions | |
| PCB_LAYER_ID | mapInnerCopperLayer (int aPadsLayer) const |
| std::string | normalizeLayerName (const std::string &aName) const |
Private Attributes | |
| int | m_copperLayerCount |
| std::map< std::string, PADS_LAYER_TYPE > | m_layerNameMap |
Maps PADS layer numbers and names to KiCad layer IDs.
PADS uses a different layer numbering scheme than KiCad:
This class handles the translation between these systems and provides auto-mapping suggestions for the layer mapping dialog.
Definition at line 81 of file pads_layer_mapper.h.
| PADS_LAYER_MAPPER::PADS_LAYER_MAPPER | ( | ) |
Definition at line 28 of file pads_layer_mapper.cpp.
References ASSEMBLY_BOTTOM, ASSEMBLY_TOP, BOARD_OUTLINE, DOCUMENTATION, m_copperLayerCount, m_layerNameMap, PASTE_BOTTOM, PASTE_TOP, SILKSCREEN_BOTTOM, SILKSCREEN_TOP, SOLDERMASK_BOTTOM, and SOLDERMASK_TOP.
| void PADS_LAYER_MAPPER::AddLayerNameMapping | ( | const std::string & | aName, |
| PADS_LAYER_TYPE | aType ) |
Add or update a layer name to type mapping.
| aName | The PADS layer name |
| aType | The layer type it represents |
Definition at line 336 of file pads_layer_mapper.cpp.
References m_layerNameMap, and normalizeLayerName().
Referenced by BOOST_AUTO_TEST_CASE().
| std::vector< INPUT_LAYER_DESC > PADS_LAYER_MAPPER::BuildInputLayerDescriptions | ( | const std::vector< PADS_LAYER_INFO > & | aLayerInfos | ) | const |
Build a vector of INPUT_LAYER_DESC from parsed PADS layer information.
This is used to populate the layer mapping dialog.
| aLayerInfos | Vector of parsed layer information |
Definition at line 314 of file pads_layer_mapper.cpp.
References INPUT_LAYER_DESC::AutoMapLayer, GetAutoMapLayer(), GetPermittedLayers(), info, INPUT_LAYER_DESC::Name, INPUT_LAYER_DESC::PermittedLayers, and INPUT_LAYER_DESC::Required.
Referenced by BOOST_AUTO_TEST_CASE().
| PCB_LAYER_ID PADS_LAYER_MAPPER::GetAutoMapLayer | ( | int | aPadsLayer, |
| PADS_LAYER_TYPE | aType = PADS_LAYER_TYPE::UNKNOWN ) const |
Get the suggested KiCad layer for a PADS layer.
| aPadsLayer | The PADS layer number |
| aType | Optional override for the layer type (if known) |
Definition at line 216 of file pads_layer_mapper.cpp.
References ASSEMBLY_BOTTOM, ASSEMBLY_TOP, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, BOARD_OUTLINE, Cmts_User, COPPER_BOTTOM, COPPER_INNER, COPPER_TOP, DOCUMENTATION, DRILL_DRAWING, Dwgs_User, Edge_Cuts, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, GetLayerType(), mapInnerCopperLayer(), PASTE_BOTTOM, PASTE_TOP, SILKSCREEN_BOTTOM, SILKSCREEN_TOP, SOLDERMASK_BOTTOM, SOLDERMASK_TOP, UNDEFINED_LAYER, and UNKNOWN.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BuildInputLayerDescriptions().
|
inline |
Get the current copper layer count.
Definition at line 96 of file pads_layer_mapper.h.
References m_copperLayerCount.
| PADS_LAYER_TYPE PADS_LAYER_MAPPER::GetLayerType | ( | int | aPadsLayer | ) | const |
Parse a PADS layer number and return its type.
| aPadsLayer | The PADS layer number |
Definition at line 109 of file pads_layer_mapper.cpp.
References ASSEMBLY_BOTTOM, ASSEMBLY_TOP, COPPER_BOTTOM, COPPER_INNER, COPPER_TOP, DOCUMENTATION, DRILL_DRAWING, LAYER_ASSEMBLY_BOTTOM, LAYER_ASSEMBLY_TOP, LAYER_DIMENSIONS, LAYER_DRILL_DRAWING, LAYER_PAD_STACK_BOTTOM, LAYER_PAD_STACK_INNER, LAYER_PAD_STACK_TOP, LAYER_PASTE_BOTTOM, LAYER_PASTE_TOP, LAYER_PLACEMENT_OUTLINE, LAYER_SILKSCREEN_BOTTOM, LAYER_SILKSCREEN_TOP, LAYER_SOLDERMASK_BOTTOM, LAYER_SOLDERMASK_TOP, m_copperLayerCount, PASTE_BOTTOM, PASTE_TOP, SILKSCREEN_BOTTOM, SILKSCREEN_TOP, SOLDERMASK_BOTTOM, SOLDERMASK_TOP, and UNKNOWN.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetAutoMapLayer().
| LSET PADS_LAYER_MAPPER::GetPermittedLayers | ( | PADS_LAYER_TYPE | aType | ) | const |
Get the permitted KiCad layers for a given PADS layer type.
| aType | The PADS layer type |
Definition at line 273 of file pads_layer_mapper.cpp.
References LSET::AllCuMask(), LSET::AllLayersMask(), LSET::AllNonCuMask(), ASSEMBLY_BOTTOM, ASSEMBLY_TOP, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, BOARD_OUTLINE, Cmts_User, COPPER_BOTTOM, COPPER_INNER, COPPER_TOP, DOCUMENTATION, DRILL_DRAWING, Dwgs_User, Edge_Cuts, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, PASTE_BOTTOM, PASTE_TOP, SILKSCREEN_BOTTOM, SILKSCREEN_TOP, SOLDERMASK_BOTTOM, SOLDERMASK_TOP, and UNKNOWN.
Referenced by BOOST_AUTO_TEST_CASE(), and BuildInputLayerDescriptions().
|
static |
Convert a layer type to a human-readable string.
Definition at line 343 of file pads_layer_mapper.cpp.
References ASSEMBLY_BOTTOM, ASSEMBLY_TOP, BOARD_OUTLINE, COPPER_BOTTOM, COPPER_INNER, COPPER_TOP, DOCUMENTATION, DRILL_DRAWING, PASTE_BOTTOM, PASTE_TOP, SILKSCREEN_BOTTOM, SILKSCREEN_TOP, SOLDERMASK_BOTTOM, SOLDERMASK_TOP, and UNKNOWN.
Referenced by BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 200 of file pads_layer_mapper.cpp.
References In1_Cu.
Referenced by GetAutoMapLayer().
|
private |
Definition at line 95 of file pads_layer_mapper.cpp.
Referenced by AddLayerNameMapping(), and ParseLayerName().
| PADS_LAYER_TYPE PADS_LAYER_MAPPER::ParseLayerName | ( | const std::string & | aLayerName | ) | const |
Parse a PADS layer name and return its type.
Recognizes common PADS layer names like "Silkscreen Top", "Solder Mask Top", etc.
| aLayerName | The PADS layer name |
Definition at line 166 of file pads_layer_mapper.cpp.
References COPPER_BOTTOM, COPPER_INNER, COPPER_TOP, m_layerNameMap, normalizeLayerName(), and UNKNOWN.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| void PADS_LAYER_MAPPER::SetCopperLayerCount | ( | int | aLayerCount | ) |
Set the total number of copper layers in the PADS design.
| aLayerCount | Total copper layers (e.g., 2 for a 2-layer board) |
Definition at line 86 of file pads_layer_mapper.cpp.
References m_copperLayerCount.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
staticconstexpr |
Definition at line 169 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 168 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 176 of file pads_layer_mapper.h.
|
staticconstexpr |
Definition at line 166 of file pads_layer_mapper.h.
Referenced by GetLayerType().
|
staticconstexpr |
Definition at line 165 of file pads_layer_mapper.h.
Referenced by GetLayerType().
|
staticconstexpr |
Pad stack: Bottom copper.
Definition at line 161 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Pad stack: Inner copper.
Definition at line 162 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Pad stack: Top copper.
Definition at line 160 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 175 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 174 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 167 of file pads_layer_mapper.h.
Referenced by GetLayerType().
|
staticconstexpr |
Definition at line 172 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 171 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 173 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
staticconstexpr |
Definition at line 170 of file pads_layer_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetLayerType().
|
private |
Definition at line 179 of file pads_layer_mapper.h.
Referenced by GetCopperLayerCount(), GetLayerType(), PADS_LAYER_MAPPER(), and SetCopperLayerCount().
|
private |
Definition at line 180 of file pads_layer_mapper.h.
Referenced by AddLayerNameMapping(), PADS_LAYER_MAPPER(), and ParseLayerName().