KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_writer_v9.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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 <map>
23#include <vector>
24#include <wx/string.h>
25#include <lset.h>
26#include <layer_ids.h>
27
28class BOARD;
29class BOARD_ITEM;
30class FOOTPRINT;
31class NETINFO_ITEM;
32class OUTPUTFORMATTER;
35class PCB_GROUP;
36class PCB_SHAPE;
37class PCB_TARGET;
38class PAD;
39class PADSTACK;
40class PCB_TEXT;
41class PCB_TEXTBOX;
42class PCB_TABLE;
43class PCB_GENERATOR;
44class PCB_TRACK;
45class ZONE;
48class EDA_TEXT;
49
53{
54public:
55 void SetBoard( const BOARD* aBoard );
56
57 int Translate( int aNetCode ) const
58 {
59 auto it = m_map.find( aNetCode );
60
61 // The era mapping fell back to the untranslated code.
62 return it != m_map.end() ? it->second : aNetCode;
63 }
64
65 const std::vector<NETINFO_ITEM*>& Nets() const { return m_nets; }
66
67private:
68 std::map<int, int> m_map;
69 std::vector<NETINFO_ITEM*> m_nets;
70};
71
75{
76public:
77 static constexpr int FORMAT_VERSION = 20241229;
78
80 m_board( nullptr ),
81 m_out( nullptr ),
82 m_ctl( 0 )
83 {
84 }
85
86 void SaveBoard( const wxString& aFileName, BOARD* aBoard );
87
88 void SaveFootprintFile( const wxString& aFileName, FOOTPRINT* aFootprint );
89
90private:
91 void Format( const BOARD_ITEM* aItem ) const;
92
93 void formatSetup( const BOARD* aBoard ) const;
94
95 void formatGeneral( const BOARD* aBoard ) const;
96
97 void formatBoardLayers( const BOARD* aBoard ) const;
98
99 void formatNetInformation( const BOARD* aBoard ) const;
100
101 void formatProperties( const BOARD* aBoard ) const;
102
103 void formatHeader( const BOARD* aBoard ) const;
104
105 void formatTeardropParameters( const TEARDROP_PARAMETERS& tdParams ) const;
106
107 void format( const BOARD* aBoard ) const;
108
109 void format( const PCB_DIMENSION_BASE* aDimension ) const;
110
111 void format( const PCB_REFERENCE_IMAGE* aBitmap ) const;
112
113 void format( const PCB_GROUP* aGroup ) const;
114
115 void format( const PCB_SHAPE* aSegment ) const;
116
117 void format( const PCB_TARGET* aTarget ) const;
118
119 void format( const FOOTPRINT* aFootprint ) const;
120
121 void format( const PAD* aPad ) const;
122
123 void format( const PCB_TEXT* aText ) const;
124
125 void format( const PCB_TEXTBOX* aTextBox ) const;
126
127 void format( const PCB_TABLE* aTable ) const;
128
129 void format( const PCB_GENERATOR* aGenerator ) const;
130
131 void format( const PCB_TRACK* aTrack ) const;
132
133 void format( const ZONE* aZone ) const;
134
135 void formatPolyPts( const SHAPE_LINE_CHAIN& aOutline, const FOOTPRINT* aParentFP = nullptr ) const;
136
137 void formatRenderCache( const EDA_TEXT* aText ) const;
138
139 void formatLayer( PCB_LAYER_ID aLayer, bool aIsKnockout = false ) const;
140
141 void formatLayers( LSET aLayerMask, bool aEnumerateLayers ) const;
142
143 void formatTenting( const PADSTACK& aPadstack ) const;
144
147 int m_ctl;
149};
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:410
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
Handle the data for a net.
Definition netinfo.h:50
The 9.0 format writes net declarations with consecutive codes.
void SetBoard(const BOARD *aBoard)
const std::vector< NETINFO_ITEM * > & Nets() const
std::map< int, int > m_map
int Translate(int aNetCode) const
std::vector< NETINFO_ITEM * > m_nets
An interface used to output 8 bit text in a convenient way.
Definition richio.h:294
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:156
Definition pad.h:61
Abstract dimension API.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:51
Object to handle a bitmap image that can be inserted in a PCB.
void formatHeader(const BOARD *aBoard) const
static constexpr int FORMAT_VERSION
void formatRenderCache(const EDA_TEXT *aText) const
NET_MAPPING_V9 m_mapping
void formatTenting(const PADSTACK &aPadstack) const
void Format(const BOARD_ITEM *aItem) const
void SaveFootprintFile(const wxString &aFileName, FOOTPRINT *aFootprint)
void formatLayer(PCB_LAYER_ID aLayer, bool aIsKnockout=false) const
void formatSetup(const BOARD *aBoard) const
void formatTeardropParameters(const TEARDROP_PARAMETERS &tdParams) const
void formatBoardLayers(const BOARD *aBoard) const
void formatProperties(const BOARD *aBoard) const
void SaveBoard(const wxString &aFileName, BOARD *aBoard)
void formatLayers(LSET aLayerMask, bool aEnumerateLayers) const
void formatNetInformation(const BOARD *aBoard) const
void format(const BOARD *aBoard) const
void formatPolyPts(const SHAPE_LINE_CHAIN &aOutline, const FOOTPRINT *aParentFP=nullptr) const
void formatGeneral(const BOARD *aBoard) const
OUTPUTFORMATTER * m_out
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
Handle a list of polygons defining a copper zone.
Definition zone.h:70
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56