KiCad PCB EDA Suite
plugin_common_layer_mapping.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2020 Jan Mr├ízek <email@honzamrazek.cz>
5  * Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
6  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef PLUGIN_COMMON_LAYER_MAPPING_H
23 #define PLUGIN_COMMON_LAYER_MAPPING_H
24 
25 #include <functional>
26 
27 #include <io_mgr.h>
28 #include <layers_id_colors_and_visibility.h> // PCB_LAYER_ID
29 
34 {
35  wxString Name;
38  bool Required;
39 
41  : Name( wxEmptyString ),
44  Required( true )
45  {
46  }
47 };
48 
54 using LAYER_MAPPING_HANDLER = std::function<std::map<wxString, PCB_LAYER_ID>( const std::vector<INPUT_LAYER_DESC>& )>;
55 
56 
61 {
62 public:
72  virtual void RegisterLayerMappingCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
73  {
74  m_layer_mapping_handler = aLayerMappingHandler;
75  }
76 protected:
78 };
79 
80 #endif // PLUGIN_COMMON_LAYER_MAPPING_H
Plugin class for import plugins that support remappable layers.
Describes an imported layer and how it could be mapped to KiCad Layers.
virtual void RegisterLayerMappingCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.
std::function< std::map< wxString, PCB_LAYER_ID >(const std::vector< INPUT_LAYER_DESC > &)> LAYER_MAPPING_HANDLER
Pointer to a function that takes a map of source and KiCad layers and returns a re-mapped version.
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
LSET PermittedLayers
KiCad layers that the imported layer can be mapped onto.
bool Required
Should we require the layer to be assigned?
LAYER_MAPPING_HANDLER m_layer_mapping_handler
Callback to get layer mapping.
Board layer functions and definitions.
wxString Name
Imported layer name as displayed in original application.
PCB_LAYER_ID AutoMapLayer
Best guess as to what the equivalent KiCad layer might be.