KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_pcb_utils.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) 2023 Jon Evans <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef KICAD_API_PCB_UTLIS_H
22#define KICAD_API_PCB_UTLIS_H
23
24#include <map>
25#include <memory>
26#include <vector>
27#include <core/typeinfo.h>
28#include <import_export.h>
29#include <board_item.h>
30#include <layer_ids.h>
31#include <lset.h>
32#include <api/common/types/base_types.pb.h>
33#include <api/common/types/embedded_files.pb.h>
34#include <api/common/commands/cross_probe_commands.pb.h>
35#include <api/board/board_types.pb.h>
36
37class BOARD;
38class BOARD_ITEM;
41
42std::unique_ptr<BOARD_ITEM> CreateItemForType( KICAD_T aType, BOARD_ITEM_CONTAINER* aContainer );
43
44namespace kiapi::board
45{
46
47class BoardStackup;
48
49void PackLayerSet( google::protobuf::RepeatedField<int>& aOutput, const LSET& aLayerSet );
50
51LSET UnpackLayerSet( const google::protobuf::RepeatedField<int>& aInput );
52
53void PackBoardStackup( const BOARD& aBoard, BoardStackup& aOut );
54
55void PackTeardropSettings( types::PadTeardropSettings& aOutput, const TEARDROP_PARAMETERS& aParams );
56
57void UnpackTeardropSettings( TEARDROP_PARAMETERS& aOutput, const types::PadTeardropSettings& aProto );
58
59void PackZoneLayerOverrides( google::protobuf::RepeatedPtrField<types::ZoneLayerOverrideEntry>* aOutput,
60 const std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE>& aInput );
61
62void UnpackZoneLayerOverrides( std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE>& aOutput,
63 const google::protobuf::RepeatedPtrField<types::ZoneLayerOverrideEntry>& aInput );
64
65void PackEmbeddedFiles( kiapi::common::types::EmbeddedFiles& aOutput, const EMBEDDED_FILES& aFiles );
66
67bool UnpackEmbeddedFiles( EMBEDDED_FILES& aOutput, const kiapi::common::types::EmbeddedFiles& aProto );
68
76std::vector<BOARD_ITEM*> FindItemsFromSyncSelection(
77 const BOARD* aBoard,
78 const google::protobuf::RepeatedPtrField<kiapi::common::commands::SelectionSpec>& aItems );
79
80} // namespace kiapi::board
81
82#endif //KICAD_API_PCB_UTLIS_H
std::unique_ptr< BOARD_ITEM > CreateItemForType(KICAD_T aType, BOARD_ITEM_CONTAINER *aContainer)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
void PackLayerSet(google::protobuf::RepeatedField< int > &aOutput, const LSET &aLayerSet)
void PackBoardStackup(const BOARD &aBoard, BoardStackup &aOut)
void PackEmbeddedFiles(common::types::EmbeddedFiles &aOutput, const EMBEDDED_FILES &aFiles)
void PackZoneLayerOverrides(google::protobuf::RepeatedPtrField< types::ZoneLayerOverrideEntry > *aOutput, const std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > &aInput)
void UnpackTeardropSettings(TEARDROP_PARAMETERS &aOutput, const types::PadTeardropSettings &aProto)
bool UnpackEmbeddedFiles(EMBEDDED_FILES &aOutput, const common::types::EmbeddedFiles &aProto)
LSET UnpackLayerSet(const google::protobuf::RepeatedField< int > &aProtoLayerSet)
std::vector< BOARD_ITEM * > FindItemsFromSyncSelection(const BOARD *aBoard, const google::protobuf::RepeatedPtrField< kiapi::common::commands::SelectionSpec > &aItems)
Resolve a cross-probe selection request against a board.
void UnpackZoneLayerOverrides(std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > &aOutput, const google::protobuf::RepeatedPtrField< types::ZoneLayerOverrideEntry > &aInput)
void PackTeardropSettings(types::PadTeardropSettings &aOutput, const TEARDROP_PARAMETERS &aParams)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70