KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <pcb_io/pcb_io_mgr.h>
29#include <layer_ids.h> // PCB_LAYER_ID
30#include <lset.h>
31
36{
37 wxString Name;
40 bool Required;
41
43 : Name( wxEmptyString ),
46 Required( true )
47 {
48 }
49};
50
56using LAYER_MAPPING_HANDLER = std::function<std::map<wxString, PCB_LAYER_ID>( const std::vector<INPUT_LAYER_DESC>& )>;
57
58
63{
64public:
74 virtual void RegisterCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
75 {
76 m_layer_mapping_handler = aLayerMappingHandler;
77 }
78
79 virtual ~LAYER_MAPPABLE_PLUGIN() = default;
80protected:
82};
83
84#endif // PLUGIN_COMMON_LAYER_MAPPING_H
Plugin class for import plugins that support remappable layers.
virtual void RegisterCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.
virtual ~LAYER_MAPPABLE_PLUGIN()=default
LAYER_MAPPING_HANDLER m_layer_mapping_handler
Callback to get layer mapping.
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
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.