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 protected]>
5 * Copyright (C) 2020 Roberto Fernandez Bautista <[email protected]>
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#include <map>
27
28#include <io_mgr.h>
29#include <layer_ids.h> // PCB_LAYER_ID
30
35{
36 wxString Name;
39 bool Required;
40
42 : Name( wxEmptyString ),
45 Required( true )
46 {
47 }
48};
49
55using LAYER_MAPPING_HANDLER = std::function<std::map<wxString, PCB_LAYER_ID>( const std::vector<INPUT_LAYER_DESC>& )>;
56
57
62{
63public:
73 virtual void RegisterLayerMappingCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
74 {
75 m_layer_mapping_handler = aLayerMappingHandler;
76 }
77
78 virtual ~LAYER_REMAPPABLE_PLUGIN() = default;
79protected:
81};
82
83#endif // PLUGIN_COMMON_LAYER_MAPPING_H
Plugin class for import plugins that support remappable layers.
LAYER_MAPPING_HANDLER m_layer_mapping_handler
Callback to get layer mapping.
virtual void RegisterLayerMappingCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.
virtual ~LAYER_REMAPPABLE_PLUGIN()=default
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
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.
Describes an imported layer and how it could be mapped to KiCad Layers.
PCB_LAYER_ID AutoMapLayer
Best guess as to what the equivalent KiCad layer might be.
bool Required
Should we require the layer to be assigned?
LSET PermittedLayers
KiCad layers that the imported layer can be mapped onto.
wxString Name
Imported layer name as displayed in original application.