KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_pads_binary.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) 2026 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#pragma once
25
26#include <pcb_io/pcb_io.h>
29#include "pads_layer_mapper.h"
30
31#include <map>
32#include <string>
33#include <vector>
34
35class BOARD;
36
37namespace PADS_IO { class BINARY_PARSER; }
38
48{
49public:
52
53 const IO_FILE_DESC GetBoardFileDesc() const override;
54 const IO_FILE_DESC GetLibraryDesc() const override;
55 long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
56
57 bool CanReadBoard( const wxString& aFileName ) const override;
58
59 BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
60 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject ) override;
61
62 std::map<wxString, PCB_LAYER_ID> DefaultLayerMappingCallback(
63 const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector );
64
65private:
66 int scaleSize( double aVal ) const;
67 int scaleCoord( double aVal, bool aIsX ) const;
68 PCB_LAYER_ID getMappedLayer( int aPadsLayer ) const;
69 void ensureNet( const std::string& aNetName );
70
71 void loadBoardSetup();
72 void loadNets();
73 void loadFootprints();
74 void loadBoardOutline();
75 void loadTracksAndVias();
76 void loadTexts();
77 void loadZones();
78 void reportStatistics();
79 void clearLoadingState();
80
81 // Persistent state
82 std::map<wxString, PCB_LAYER_ID> m_layerMap;
83
84 // Loading state
85 BOARD* m_loadBoard = nullptr;
89 std::vector<PADS_LAYER_INFO> m_layerInfos;
90 double m_scaleFactor = 0.0;
91 double m_originX = 0.0;
92 double m_originY = 0.0;
93 std::map<std::string, std::string> m_pinToNetMap;
94};
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
Plugin class for import plugins that support remappable layers.
Parser for PADS binary PCB file format (.pcb).
Maps PADS layer numbers and names to KiCad layer IDs.
Converts PADS file format units to KiCad internal units (nanometers).
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
const IO_FILE_DESC GetBoardFileDesc() const override
Returns board file description for the PCB_IO.
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties, PROJECT *aProject) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
bool CanReadBoard(const wxString &aFileName) const override
Checks if this PCB_IO can read the specified board file.
~PCB_IO_PADS_BINARY() override
int scaleSize(double aVal) const
const IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
const PADS_IO::BINARY_PARSER * m_parser
PCB_LAYER_ID getMappedLayer(int aPadsLayer) const
PADS_UNIT_CONVERTER m_unitConverter
void ensureNet(const std::string &aNetName)
int scaleCoord(double aVal, bool aIsX) const
std::vector< PADS_LAYER_INFO > m_layerInfos
PADS_LAYER_MAPPER m_layerMapper
std::map< wxString, PCB_LAYER_ID > m_layerMap
std::map< std::string, std::string > m_pinToNetMap
std::map< wxString, PCB_LAYER_ID > DefaultLayerMappingCallback(const std::vector< INPUT_LAYER_DESC > &aInputLayerDescriptionVector)
PCB_IO(const wxString &aName)
Definition pcb_io.h:337
Container for project specific data.
Definition project.h:65
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
Container that describes file type info.
Definition io_base.h:43