KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_pads.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) 2025 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <pcb_io/pcb_io.h>
24#include "pads_pcb_converter.h"
25
26#include <map>
27#include <memory>
28#include <string>
29#include <vector>
30
31class BOARD;
32class PCB_SHAPE;
33
34namespace PADS_IO
35{
36class PARSER;
37struct ARC_POINT;
38}
39
41{
42public:
44 ~PCB_IO_PADS() override;
45
46 const IO_FILE_DESC GetBoardFileDesc() const override;
47 const IO_FILE_DESC GetLibraryDesc() const override;
48 long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
49
50 bool CanReadBoard( const wxString& aFileName ) const override;
51
56 std::map<wxString, PCB_LAYER_ID> DefaultLayerMappingCallback(
57 const std::vector<INPUT_LAYER_DESC>& aInputLayerDescriptionVector );
58
59protected:
60 void loadBoard( const wxString& aFileName, BOARD& aBoard, bool aIsNewLoad,
61 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject ) override;
62
63private:
65 int scaleSize( double aVal ) const { return m_converter->ScaleSize( aVal ); }
66 int scaleCoord( double aVal, bool aIsX ) const { return m_converter->ScaleCoord( aVal, aIsX ); }
67 PCB_LAYER_ID getMappedLayer( int aPadsLayer ) const { return m_converter->GetMappedLayer( aPadsLayer ); }
68
72 double decalUnitScale( const std::string& aUnits ) const;
73
76 void setPcbShapeArc( PCB_SHAPE* aShape, const PADS_IO::ARC_POINT& aPrev,
77 const PADS_IO::ARC_POINT& aCurr );
78
79 void loadBoardSetup();
80 void loadNets();
81 void loadFootprints();
83 void loadTestPoints();
84 void loadTracksAndVias();
85 void loadCopperShapes();
86 void loadClusterGroups();
87 void loadZones();
88 void loadBoardOutline();
89 void loadGraphicLines();
90 void clearLoadingState();
91
92 // Valid only during LoadBoard, cleared by clearLoadingState().
93 BOARD* m_loadBoard = nullptr;
94 const PADS_IO::PARSER* m_parser = nullptr;
95 std::unique_ptr<PADS_PCB_CONVERTER> m_converter;
96 std::map<std::string, std::string> m_pinToNetMap;
97 std::map<std::string, std::string> m_partToBlockMap;
99 int m_minObjectSize = 1000;
100};
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
Plugin class for import plugins that support remappable layers.
const IO_FILE_DESC GetBoardFileDesc() const override
Returns board file description for the PCB_IO.
int scaleSize(double aVal) const
Shorthands for the converter's transform, which the loaders below use everywhere.
Definition pcb_io_pads.h:65
void loadBoardSetup()
void loadTestPoints()
~PCB_IO_PADS() override
void loadClusterGroups()
void loadTracksAndVias()
std::map< std::string, std::string > m_partToBlockMap
Definition pcb_io_pads.h:97
int scaleCoord(double aVal, bool aIsX) const
Definition pcb_io_pads.h:66
void setPcbShapeArc(PCB_SHAPE *aShape, const PADS_IO::ARC_POINT &aPrev, const PADS_IO::ARC_POINT &aCurr)
Configure a PCB_SHAPE as an arc from two consecutive PADS points, applying the Y-axis winding fix.
std::map< std::string, std::string > m_pinToNetMap
Definition pcb_io_pads.h:96
PCB_LAYER_ID getMappedLayer(int aPadsLayer) const
Definition pcb_io_pads.h:67
int m_testPointIndex
Definition pcb_io_pads.h:98
int m_minObjectSize
Definition pcb_io_pads.h:99
void loadFootprints()
bool CanReadBoard(const wxString &aFileName) const override
Checks if this PCB_IO can read the specified board file.
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
void loadCopperShapes()
BOARD * m_loadBoard
Definition pcb_io_pads.h:93
const IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
void clearLoadingState()
void loadGraphicLines()
void loadBoard(const wxString &aFileName, BOARD &aBoard, bool aIsNewLoad, const std::map< std::string, UTF8 > *aProperties, PROJECT *aProject) override
Parse aFileName into aBoard.
double decalUnitScale(const std::string &aUnits) const
Resolve a PADS decal/part UNITS letter to a nm-per-unit scale factor, or 0.0 to use the file's primar...
std::map< wxString, PCB_LAYER_ID > DefaultLayerMappingCallback(const std::vector< INPUT_LAYER_DESC > &aInputLayerDescriptionVector)
Return the automapped layers.
void loadBoardOutline()
const PADS_IO::PARSER * m_parser
Definition pcb_io_pads.h:94
void loadReuseBlockGroups()
std::unique_ptr< PADS_PCB_CONVERTER > m_converter
Definition pcb_io_pads.h:95
PCB_IO(const wxString &aName)
Definition pcb_io.h:351
Container for project specific data.
Definition project.h:63
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
Container that describes file type info.
Definition io_base.h:43
A polyline point that may instead be an arc segment.
Definition pads_parser.h:64