KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board.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) 2007 Jean-Pierre Charras, [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
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU 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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef CLASS_BOARD_H_
26#define CLASS_BOARD_H_
27
31#include <embedded_files.h>
32#include <common.h> // Needed for stl hash extensions
33#include <convert_shape_list_to_polygon.h> // for OUTLINE_ERROR_HANDLER
34#include <hash.h>
35#include <layer_ids.h>
36#include <lset.h>
37#include <netinfo.h>
38#include <pcb_item_containers.h>
39#include <pcb_plot_params.h>
40#include <title_block.h>
41#include <tools/pcb_selection.h>
42#include <shared_mutex>
43#include <project.h>
44#include <list>
45
48class BOARD_COMMIT;
49class DRC_RTREE;
50class PCB_BASE_FRAME;
51class PCB_EDIT_FRAME;
54class BOARD;
55class FOOTPRINT;
56class ZONE;
57class PCB_TRACK;
58class PAD;
59class PCB_GROUP;
60class PCB_GENERATOR;
61class PCB_MARKER;
62class MSG_PANEL_ITEM;
63class NETLIST;
64class REPORTER;
65class SHAPE_POLY_SET;
67class COMPONENT;
68class PROJECT;
71
72namespace KIGFX
73{
74class RENDER_SETTINGS;
75};
76
77
78namespace KIFONT
79{
80 class OUTLINE_FONT;
81}
82
83struct ISOLATED_ISLANDS;
84
85// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
86// It is the max dist between 2 end points to see them connected
87#define DEFAULT_CHAINING_EPSILON_MM 0.01
88
89// Forward declare endpoint from class_track.h
90enum ENDPOINT_T : int;
91
92
94{
97
98 bool operator==(const PTR_PTR_CACHE_KEY& other) const
99 {
100 return A == other.A && B == other.B;
101 }
102};
103
105{
108
109 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
110 {
111 return A == other.A && Layer == other.Layer;
112 }
113};
114
116{
120
121 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
122 {
123 return A == other.A && B == other.B && Layer == other.Layer;
124 }
125};
126
128{
130 layers(),
131 has_error( false )
132 {}
133
135 layers( { aLayer } ),
136 has_error( false )
137 {}
138
141};
142
143
144namespace std
145{
146 template <>
147 struct hash<PTR_PTR_CACHE_KEY>
148 {
149 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
150 {
151 std::size_t seed = 0xa82de1c0;
152 hash_combine( seed, k.A, k.B );
153 return seed;
154 }
155 };
156
157 template <>
159 {
160 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
161 {
162 std::size_t seed = 0xa82de1c0;
163 hash_combine( seed, k.A, k.Layer );
164 return seed;
165 }
166 };
167
168 template <>
170 {
171 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
172 {
173 std::size_t seed = 0xa82de1c0;
174 hash_combine( seed, k.A, k.B, k.Layer );
175 return seed;
176 }
177 };
178}
179
180
195
196
200struct LAYER
201{
203 {
204 clear();
205 }
206
207 void clear()
208 {
210 m_visible = true;
211 m_number = 0;
212 m_name.clear();
213 m_userName.clear();
215 }
216
217 /*
218 LAYER( const wxString& aName = wxEmptyString,
219 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
220 m_name( aName ),
221 m_type( aType ),
222 m_visible( aVisible ),
223 m_number( aNumber )
224 {
225 }
226 */
227
228 wxString m_name;
229 wxString m_userName;
234
241 static const char* ShowType( LAYER_T aType );
242
250 static LAYER_T ParseType( const char* aType );
251};
252
253
254// Helper class to handle high light nets
256{
257protected:
258 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
259 bool m_highLightOn; // highlight active
260
261 void Clear()
262 {
263 m_netCodes.clear();
264 m_highLightOn = false;
265 }
266
268 {
269 Clear();
270 }
271
272private:
273 friend class BOARD;
274};
275
281class BOARD;
282
284{
285public:
286 virtual ~BOARD_LISTENER() { }
287 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
288 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
289 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
290 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
291 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
292 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
293 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
294 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
295 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
296 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
297 std::vector<BOARD_ITEM*>& aRemovedItems,
298 std::vector<BOARD_ITEM*>& aChangedItems )
299 {
300 }
301};
302
306typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
307
311enum class BOARD_USE
312{
313 NORMAL, // A normal board
314 FPHOLDER // A board that holds a single footprint
315};
316
317
322{
323public:
324 static inline bool ClassOf( const EDA_ITEM* aItem )
325 {
326 return aItem && PCB_T == aItem->Type();
327 }
328
334 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
335
341 BOARD_USE GetBoardUse() const { return m_boardUse; }
342
343 void IncrementTimeStamp();
344
345 int GetTimeStamp() const { return m_timeStamp; }
346
352 bool IsFootprintHolder() const
353 {
355 }
356
357 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
358
359 const wxString &GetFileName() const { return m_fileName; }
360
361 const TRACKS& Tracks() const { return m_tracks; }
362
363 const FOOTPRINTS& Footprints() const { return m_footprints; }
364
365 const DRAWINGS& Drawings() const { return m_drawings; }
366
367 const ZONES& Zones() const { return m_zones; }
368
369 const GENERATORS& Generators() const { return m_generators; }
370
373 void UpdateBoardOutline();
374
375 const MARKERS& Markers() const { return m_markers; }
376
377 const PCB_POINTS& Points() const { return m_points; }
378
379 // SWIG requires non-const accessors for some reason to make the custom iterators in board.i
380 // work. It would be good to remove this if we can figure out how to fix that.
381#ifdef SWIG
382 DRAWINGS& Drawings() { return m_drawings; }
383 TRACKS& Tracks() { return m_tracks; }
384#endif
385
387
396 const GROUPS& Groups() const { return m_groups; }
397
398 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
399
400 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
401 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
402
403 void GetContextualTextVars( wxArrayString* aVars ) const;
404 bool ResolveTextVar( wxString* token, int aDepth ) const;
405
409
413
416
417 BOARD();
418 ~BOARD();
419
420 VECTOR2I GetPosition() const override;
421 void SetPosition( const VECTOR2I& aPos ) override;
422 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
423
424 bool IsEmpty() const;
425
426 void Move( const VECTOR2I& aMoveVector ) override;
427
428 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
429
430 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
432
433 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
434 const wxString& GetGenerator() const { return m_generator; }
435
437 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
438 bool aSkipConnectivity = false ) override;
439
441 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
442
451 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
455
456 bool HasItemsOnLayer( PCB_LAYER_ID aLayer );
457
466 bool RemoveAllItemsOnLayer( PCB_LAYER_ID aLayer );
467
472 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
473
478 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
479
484 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
485
491 void FixupEmbeddedData();
492
493 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
494
495 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
496 const std::vector<ZONE*>& aZones = {} );
497
506 {
507 return m_footprints.empty() ? nullptr : m_footprints.front();
508 }
509
513 void DeleteAllFootprints();
514
518 void DetachAllFootprints();
519
524 BOARD_ITEM* ResolveItem( const KIID& aID, bool aAllowNullptrReturn = false ) const;
525
526 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
527
531 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
532 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
533
538 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
539
545 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
546
550 void DeleteMARKERs();
551
552 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
553
554 PROJECT* GetProject() const { return m_project; }
555
564 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
565
566 void ClearProject();
567
575 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
576
580 void RecordDRCExclusions();
581
586
590 void ResetNetHighLight();
591
595 const std::set<int>& GetHighLightNetCodes() const
596 {
597 return m_highLight.m_netCodes;
598 }
599
606 void SetHighLightNet( int aNetCode, bool aMulti = false );
607
611 bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
612
620 void HighLightON( bool aValue = true );
621
626 {
627 HighLightON( false );
628 }
629
633 int GetCopperLayerCount() const;
634 void SetCopperLayerCount( int aCount );
635
636 int GetUserDefinedLayerCount() const;
637 void SetUserDefinedLayerCount( int aCount );
638
644
645 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
646
647 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
648
654 const LSET& GetEnabledLayers() const;
655 LSET GetLayerSet() const override { return GetEnabledLayers(); }
656
662 void SetEnabledLayers( const LSET& aLayerMask );
663 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
664
671 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
672
680 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
681
687 const LSET& GetVisibleLayers() const;
688
695 void SetVisibleLayers( const LSET& aLayerMask );
696
697 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
698 // are not stored in the bitmap.
699
707
714 void SetVisibleElements( const GAL_SET& aMask );
715
721 void SetVisibleAlls();
722
730 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
731
739 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
740
748 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
749
754 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
755
757
758 const PAGE_INFO& GetPageSettings() const { return m_paper; }
759 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
760
762 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
763
765 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
766 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
767
768 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
769
771 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
772
777 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
778
797 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
798 bool aAllowUseArcsInPolygons = false,
799 bool aIncludeNPTHAsOutlines = false );
800
810
824 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
825
829 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
830
837 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
838
846 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
847
858 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
859 {
860 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
861 return LayerName( aLayerId );
862 }
863
871 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
872
876 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
877
881 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
882
889 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
890
898 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
899
904 unsigned GetNodesCount( int aNet = -1 ) const;
905
914 const std::vector<PAD*> GetPads() const;
915
917 {
918 m_NetInfo.buildListOfNets();
919 }
920
927 NETINFO_ITEM* FindNet( int aNetcode ) const;
928
935 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
936
946 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
947
951 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
952
954 {
955 return m_NetInfo;
956 }
957
959 {
960 m_NetInfo.RemoveUnusedNets( aCommit );
961 }
962
963#ifndef SWIG
968 {
969 return m_NetInfo.begin();
970 }
971
976 {
977 return m_NetInfo.end();
978 }
979#endif
980
984 unsigned GetNetCount() const
985 {
986 return m_NetInfo.GetNetCount();
987 }
988
993
998
1005 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
1006
1007 const BOX2I GetBoundingBox() const override
1008 {
1009 return ComputeBoundingBox( false );
1010 }
1011
1022 {
1023 return ComputeBoundingBox( true );
1024 }
1025
1026 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1027
1039 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1040 const std::vector<KICAD_T>& scanTypes ) override;
1041
1050 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1051
1058 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1059
1063 std::set<wxString> GetNetClassAssignmentCandidates() const;
1064
1072 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1073
1077 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1078
1082 void SynchronizeProperties();
1083
1088
1092 double Similarity( const BOARD_ITEM& aOther ) const override
1093 {
1094 return 1.0;
1095 }
1096
1097 bool operator==( const BOARD_ITEM& aOther ) const override;
1098
1099 wxString GetClass() const override
1100 {
1101 return wxT( "BOARD" );
1102 }
1103
1104#if defined(DEBUG)
1105 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1106#endif
1107
1108
1109 /*************************/
1110 /* Copper Areas handling */
1111 /*************************/
1112
1123
1130 ZONE* GetArea( int index ) const
1131 {
1132 if( (unsigned) index < m_zones.size() )
1133 return m_zones[index];
1134
1135 return nullptr;
1136 }
1137
1141 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1142
1146 int GetAreaCount() const
1147 {
1148 return static_cast<int>( m_zones.size() );
1149 }
1150
1151 /* Functions used in test, merge and cut outlines */
1152
1165 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1166 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1167
1175 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1176
1184 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1185 PAD* GetPad( const VECTOR2I& aPosition ) const
1186 {
1187 return GetPad( aPosition, LSET().set() );
1188 }
1189
1197 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1198
1213 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1214
1226 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1227
1235 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1236
1244 TRACKS TracksInNet( int aNetCode );
1245
1258 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1259 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1260
1266 int GetMaxClearanceValue() const;
1267
1273 void MapNets( BOARD* aDestBoard );
1274
1275 void SanitizeNetcodes();
1276
1285 void AddListener( BOARD_LISTENER* aListener );
1286
1291 void RemoveListener( BOARD_LISTENER* aListener );
1292
1296 void RemoveAllListeners();
1297
1302 void OnItemChanged( BOARD_ITEM* aItem );
1303
1308 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1309
1314 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1315 std::vector<BOARD_ITEM*>& aRemovedItems,
1316 std::vector<BOARD_ITEM*>& aChangedItems );
1317
1321 void OnRatsnestChanged();
1322
1329 wxString GroupsSanityCheck( bool repair = false );
1330
1336 wxString GroupsSanityCheckInternal( bool repair );
1337
1338 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1339 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1340
1341 EMBEDDED_FILES* GetEmbeddedFiles() override;
1342 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1343
1345
1349 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1350
1354 void EmbedFonts() override;
1355
1360
1365
1367
1368 const std::unordered_map<KIID, BOARD_ITEM*>& GetItemByIdCache() const
1369 {
1370 return m_itemByIdCache;
1371 }
1372
1373 // --------- Item order comparators ---------
1374
1376 {
1377 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1378 };
1379
1381 {
1382 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1383 };
1384
1385public:
1386 // ------------ Run-time caches -------------
1387 mutable std::shared_mutex m_CachesMutex;
1388 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsCourtyardCache;
1389 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsFCourtyardCache;
1390 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsBCourtyardCache;
1391 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_IntersectsAreaCache;
1392 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_EnclosedByAreaCache;
1393 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1394 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1395 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1396 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1397 mutable std::optional<int> m_maxClearanceValue;
1398
1399 // ------------ DRC caches -------------
1400 std::vector<ZONE*> m_DRCZones;
1401 std::vector<ZONE*> m_DRCCopperZones;
1404 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1405 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1406
1407private:
1408 // The default copy constructor & operator= are inadequate,
1409 // either write one or do not use it at all
1410 BOARD( const BOARD& aOther ) = delete;
1411
1412 BOARD& operator=( const BOARD& aOther ) = delete;
1413
1414 template <typename Func, typename... Args>
1415 void InvokeListeners( Func&& aFunc, Args&&... args )
1416 {
1417 for( auto&& l : m_listeners )
1418 ( l->*aFunc )( std::forward<Args>( args )... );
1419 }
1420
1421 // Refresh user layer opposites.
1422 void recalcOpposites();
1423
1424 friend class PCB_EDIT_FRAME;
1425
1426private:
1429
1432 int m_timeStamp; // actually a modification counter
1433
1434 wxString m_fileName;
1435
1436 // These containers only have const accessors and must only be modified by Add()/Remove()
1437 MARKERS m_markers;
1438 DRAWINGS m_drawings;
1439 FOOTPRINTS m_footprints;
1441 GROUPS m_groups;
1443 GENERATORS m_generators;
1445 PCB_POINTS m_points;
1446
1447 // Cache for fast access to items in the containers above by KIID, including children
1448 std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1449
1450 std::map<int, LAYER> m_layers; // layer data
1451
1452 HIGH_LIGHT_INFO m_highLight; // current high light data
1453 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1454
1455 int m_fileFormatVersionAtLoad; // the version loaded from the file
1456 wxString m_generator; // the generator tag from the file
1457
1458 std::map<wxString, wxString> m_properties;
1459 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1460
1462 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1464 PROJECT* m_project; // project this board is a part of
1466
1477 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1478
1483 bool m_legacyTeardrops = false;
1484
1485 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1486
1487 std::vector<BOARD_LISTENER*> m_listeners;
1488
1490
1491 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1492 // of all the parent's embedded data.
1494
1495 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1496 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1497};
1498
1499
1500#endif // CLASS_BOARD_H_
@ NORMAL
Use all material properties from model file.
Definition 3d_enums.h:72
BOARD_USE
Flags to specify how the board is being used.
Definition board.h:312
@ FPHOLDER
Definition board.h:314
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:185
@ LT_POWER
Definition board.h:188
@ LT_FRONT
Definition board.h:192
@ LT_MIXED
Definition board.h:189
@ LT_BACK
Definition board.h:193
@ LT_UNDEFINED
Definition board.h:186
@ LT_JUMPER
Definition board.h:190
@ LT_AUX
Definition board.h:191
@ LT_SIGNAL
Definition board.h:187
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition board.h:306
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Container for design settings for a BOARD object.
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:81
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
Definition board.h:291
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition board.h:288
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition board.h:295
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition board.h:293
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:292
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:289
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:287
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition board.h:294
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition board.h:296
virtual ~BOARD_LISTENER()
Definition board.h:286
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition board.h:290
Manage layers needed to make a physical board.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition board.cpp:2123
ZONE * m_SolderMaskBridges
Definition board.h:1404
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:477
bool IsFootprintLayerVisible(PCB_LAYER_ID aLayer) const
Expect either of the two layers on which a footprint can reside, and returns whether that layer is vi...
Definition board.cpp:1029
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:2642
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition board.h:762
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition board.h:1392
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1405
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:899
GENERATORS m_generators
Definition board.h:1443
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
Definition board.cpp:2787
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
Definition board.cpp:2989
const NETINFO_LIST & GetNetInfo() const
Definition board.h:953
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition board.h:411
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition board.h:352
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition board.cpp:2492
int GetUserDefinedLayerCount() const
Definition board.cpp:888
void recalcOpposites()
Definition board.cpp:808
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:572
std::map< wxString, wxString > m_properties
Definition board.h:1458
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:2840
int m_fileFormatVersionAtLoad
Definition board.h:1455
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:2351
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1401
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition board.cpp:956
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition board.h:341
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1164
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:595
void MapNets(BOARD *aDestBoard)
Map all nets in the given board to nets with the same name (if any) in the destination board.
Definition board.cpp:2935
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition board.h:1483
TITLE_BLOCK m_titles
Definition board.h:1462
GAL_SET m_LegacyVisibleItems
Definition board.h:408
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition board.h:334
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition board.h:1130
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1021
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1007
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1359
void BuildListOfNets()
Definition board.h:916
void RunOnNestedEmbeddedFiles(const std::function< void(EMBEDDED_FILES *)> &aFunction) override
Provide access to nested embedded files, such as symbols in schematics and footprints in boards.
Definition board.cpp:1136
const GENERATORS & Generators() const
Definition board.h:369
void SetFileName(const wxString &aFileName)
Definition board.h:357
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition board.h:858
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:2909
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition board.h:655
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:990
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1428
std::tuple< int, double, double, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
Definition board.cpp:2653
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:2390
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1431
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:371
PAGE_INFO m_paper
Definition board.h:1461
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:2983
FOOTPRINTS m_footprints
Definition board.h:1439
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
Definition board.h:1477
friend class PCB_EDIT_FRAME
Definition board.h:1424
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1344
const PCB_POINTS & Points() const
Definition board.h:377
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition board.cpp:3198
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
Definition board.cpp:2964
const PAGE_INFO & GetPageSettings() const
Definition board.h:758
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition board.cpp:1663
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:401
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:741
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:984
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3025
HIGH_LIGHT_INFO m_highLight
Definition board.h:1452
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:664
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2282
EDA_UNITS m_userUnits
Definition board.h:1465
void UpdateBoardOutline()
Definition board.cpp:3387
const ZONES & Zones() const
Definition board.h:367
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition board.cpp:1315
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1415
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1047
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:938
void SanitizeNetcodes()
Definition board.cpp:2954
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1493
ZONE * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
Add an empty copper area to board areas list.
Definition board.cpp:2762
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:735
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition board.h:396
~BOARD()
Definition board.cpp:154
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
Definition board.cpp:189
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition board.cpp:950
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:747
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition board.cpp:332
DRAWINGS m_drawings
Definition board.h:1438
void OnItemsCompositeUpdate(std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Notify the board and its listeners that items on the board have been modified in a composite operatio...
Definition board.cpp:3001
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:2458
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:2417
void SynchronizeTimeDomainProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:2411
EDA_UNITS GetUserUnits()
Definition board.h:770
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3016
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1463
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:710
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:2742
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:503
const MARKERS & Markers() const
Definition board.h:375
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:505
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:869
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:2895
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:578
TITLE_BLOCK & GetTitleBlock()
Definition board.h:764
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition board.cpp:2019
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1143
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1053
ZONES m_zones
Definition board.h:1442
PAD * GetPad(const VECTOR2I &aPosition) const
Definition board.h:1185
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:672
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1453
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition board.h:422
void HighLightOFF()
Disable net highlight.
Definition board.h:625
NETINFO_LIST m_NetInfo
Definition board.h:1485
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition board.h:407
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition board.cpp:973
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:809
NETINFO_LIST::iterator EndNets() const
Definition board.h:975
int GetCopperLayerCount() const
Definition board.cpp:876
int m_timeStamp
Definition board.h:1432
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1487
bool RemoveAllItemsOnLayer(PCB_LAYER_ID aLayer)
Removes all owned items other than footprints existing on the given board layer, and modifies the sta...
Definition board.cpp:1577
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:400
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1388
void IncrementTimeStamp()
Definition board.cpp:257
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:2301
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1389
PCB_POINTS m_points
Definition board.h:1445
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1496
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:958
const FOOTPRINTS & Footprints() const
Definition board.h:363
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1459
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:2858
void RemoveAll(std::initializer_list< KICAD_T > aTypes={ PCB_NETINFO_T, PCB_MARKER_T, PCB_GROUP_T, PCB_ZONE_T, PCB_GENERATOR_T, PCB_FOOTPRINT_T, PCB_TRACE_T, PCB_SHAPE_T })
An efficient way to remove all items of a certain type from the board.
Definition board.cpp:1445
const BOARD_ITEM_SET GetItemSet()
Definition board.cpp:3303
const TRACKS & Tracks() const
Definition board.h:361
int m_DRCMaxPhysicalClearance
Definition board.h:1403
const PCB_BOARD_OUTLINE * BoardOutline() const
Definition board.h:372
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition board.cpp:2378
void FinalizeBulkRemove(std::vector< BOARD_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
Definition board.cpp:1309
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:759
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1393
bool m_embedFonts
Definition board.h:1489
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:3061
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:3010
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:1900
wxString GetClass() const override
Return the class name.
Definition board.h:1099
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1495
NETINFO_LIST::iterator BeginNets() const
Definition board.h:967
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:415
void SetCopperLayerCount(int aCount)
Definition board.cpp:882
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1396
wxString m_generator
Definition board.h:1456
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1390
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:642
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:199
PROJECT * m_project
Definition board.h:1464
FOOTPRINT * GetFootprint(const VECTOR2I &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
Get a footprint by its bounding rectangle at aPosition on aLayer.
Definition board.cpp:2678
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1531
const wxString & GetFileName() const
Definition board.h:359
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:3319
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition board.cpp:389
int GetPadWithCastellatedAttrCount()
Definition board.cpp:3416
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:2366
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2002
bool IsHighLightNetON() const
Definition board.h:611
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition board.cpp:1858
int GetFileFormatVersionAtLoad() const
Definition board.h:431
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:996
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1395
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:766
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:761
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1434
const wxString & GetGenerator() const
Adds an item to the container.
Definition board.h:434
int GetAreaCount() const
Definition board.h:1146
void DetachAllFootprints()
Remove all footprints without deleting.
Definition board.cpp:1732
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1339
std::map< int, LAYER > m_layers
Definition board.h:1450
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition board.cpp:600
int GetOutlinesChainingEpsilon()
Definition board.h:808
void GetSortedPadListByXthenYCoord(std::vector< PAD * > &aVector, int aNetCode=-1) const
First empties then fills the vector with all pads and sorts them by increasing x coordinate,...
Definition board.cpp:2627
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition board.cpp:930
int m_DRCMaxClearance
Definition board.h:1402
void ClearProject()
Definition board.cpp:237
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:663
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1394
void FinalizeBulkAdd(std::vector< BOARD_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
Definition board.cpp:1303
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:912
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:1722
PROJECT * GetProject() const
Definition board.h:554
bool IsEmpty() const
Definition board.cpp:560
int GetPadWithPressFitAttrCount()
Definition board.cpp:3398
bool LegacyTeardrops() const
Definition board.h:1338
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition board.cpp:2085
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:765
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition board.cpp:3048
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1041
std::vector< ZONE * > m_DRCZones
Definition board.h:1400
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:924
void SetGenerator(const wxString &aGenerator)
Definition board.h:433
BOARD()
Definition board.cpp:81
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:301
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition board.cpp:1954
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2404
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition board.h:1448
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:2971
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1364
std::shared_mutex m_CachesMutex
Definition board.h:1387
unsigned GetNetCount() const
Definition board.h:984
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
Definition board.h:1368
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:2447
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:1689
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1332
GROUPS m_groups
Definition board.h:1441
PROJECT::ELEM ProjectElementType() override
Definition board.h:1366
MARKERS m_markers
Definition board.h:1437
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1391
std::optional< int > m_maxClearanceValue
Definition board.h:1397
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3038
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:944
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:766
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1440
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:1742
bool m_LegacyCopperEdgeClearanceLoaded
Definition board.h:412
int GetTimeStamp() const
Definition board.h:345
void OnItemsChanged(std::vector< BOARD_ITEM * > &aItems)
Notify the board and its listeners that an item on the board has been modified in some way.
Definition board.cpp:2995
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:538
VECTOR2I GetPosition() const override
Definition board.cpp:566
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition board.cpp:1085
static bool ClassOf(const EDA_ITEM *aItem)
Definition board.h:324
void SetUserUnits(EDA_UNITS aUnits)
Definition board.h:771
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:963
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:2885
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1092
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1444
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:894
const DRAWINGS & Drawings() const
Definition board.h:365
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition board.cpp:1657
void SetFileFormatVersionAtLoad(int aVersion)
Definition board.h:430
constexpr const Vec GetCenter() const
Definition box2.h:230
A class to manage Component Classes in a board context.
Store all of the related footprint information found in a netlist.
Implement an R-tree for fast spatial and layer indexing of connectable items.
Definition drc_rtree.h:48
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
EMBEDDED_FILES()=default
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:403
void Clear()
Definition board.h:261
friend class BOARD
Definition board.h:273
std::set< int > m_netCodes
Definition board.h:258
bool m_highLightOn
Definition board.h:259
Class OUTLINE_FONT implements outline font drawing.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
Definition kiid.h:49
Class which calculates lengths (and associated routing statistics) in a BOARD context.
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:54
Handle the data for a net.
Definition netinfo.h:54
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition netinfo.h:391
Container for NETINFO_ITEM elements, which are the nets.
Definition netinfo.h:330
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:54
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:79
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
Parameters and options when plotting/printing a board.
A holder to handle information on schematic or board items.
A progress reporter interface for use in multi-threaded environments.
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
Definition project.h:97
Container for project specific data.
Definition project.h:65
ELEM
The set of #_ELEMs that a PROJECT can hold.
Definition project.h:71
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
Represent a set of closed polygons.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:41
Handle a list of polygons defining a copper zone.
Definition zone.h:74
The common library.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
#define LAYER(n, l)
RECURSE_MODE
Definition eda_item.h:50
INSPECT_RESULT
Definition eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
EDA_UNITS
Definition eda_units.h:48
static constexpr void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
Definition hash.h:32
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition layer_id.cpp:31
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:228
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:33
STL namespace.
std::vector< ZONE * > ZONES
ENDPOINT_T
Definition pcb_track.h:60
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:3151
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:3130
A struct recording the isolated and single-pad islands within a zone.
Definition zone.h:61
LAYERS_CHECKED(PCB_LAYER_ID aLayer)
Definition board.h:134
bool has_error
Definition board.h:140
LSET layers
Definition board.h:139
int m_opposite
Similar layer on opposite side of the board, if any.
Definition board.h:233
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition board.cpp:795
void clear()
Definition board.h:207
LAYER_T m_type
The type of the layer.
Definition board.h:230
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition board.cpp:779
LAYER()
Definition board.h:202
wxString m_name
The canonical name of the layer.
Definition board.h:228
wxString m_userName
The user defined name of the layer.
Definition board.h:229
bool m_visible
Definition board.h:231
int m_number
The layer ID.
Definition board.h:232
BOARD_ITEM * A
Definition board.h:106
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition board.h:109
PCB_LAYER_ID Layer
Definition board.h:107
BOARD_ITEM * A
Definition board.h:95
BOARD_ITEM * B
Definition board.h:96
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition board.h:98
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition board.h:121
BOARD_ITEM * B
Definition board.h:118
BOARD_ITEM * A
Definition board.h:117
PCB_LAYER_ID Layer
Definition board.h:119
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition board.h:160
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition board.h:149
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition board.h:171
@ PCB_T
Definition typeinfo.h:82
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:88
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:91
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:111
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:108
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:99
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition typeinfo.h:110
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:96
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.