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*>& aBoardItems ) { }
289 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
290 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
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*>& aBoardItems ) { }
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
799 bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool aInferOutlineIfNecessary,
800 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
801 bool aAllowUseArcsInPolygons = false, bool aIncludeNPTHAsOutlines = false );
802
812
826 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
827
831 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
832
839 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
840
848 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
849
860 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
861 {
862 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
863 return LayerName( aLayerId );
864 }
865
873 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
874
878 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
879
883 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
884
891 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
892
900 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
901
906 unsigned GetNodesCount( int aNet = -1 ) const;
907
916 const std::vector<PAD*> GetPads() const;
917
919 {
920 m_NetInfo.buildListOfNets();
921 }
922
929 NETINFO_ITEM* FindNet( int aNetcode ) const;
930
937 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
938
948 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
949
953 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
954
956 {
957 return m_NetInfo;
958 }
959
961 {
962 m_NetInfo.RemoveUnusedNets( aCommit );
963 }
964
965#ifndef SWIG
970 {
971 return m_NetInfo.begin();
972 }
973
978 {
979 return m_NetInfo.end();
980 }
981#endif
982
986 unsigned GetNetCount() const
987 {
988 return m_NetInfo.GetNetCount();
989 }
990
995
1000
1007 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
1008
1009 const BOX2I GetBoundingBox() const override
1010 {
1011 return ComputeBoundingBox( false );
1012 }
1013
1024 {
1025 return ComputeBoundingBox( true );
1026 }
1027
1028 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1029
1041 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1042 const std::vector<KICAD_T>& scanTypes ) override;
1043
1052 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1053
1060 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1061
1065 std::set<wxString> GetNetClassAssignmentCandidates() const;
1066
1074 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1075
1079 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1080
1084 void SynchronizeProperties();
1085
1090
1094 double Similarity( const BOARD_ITEM& aOther ) const override
1095 {
1096 return 1.0;
1097 }
1098
1099 bool operator==( const BOARD_ITEM& aOther ) const override;
1100
1101 wxString GetClass() const override
1102 {
1103 return wxT( "BOARD" );
1104 }
1105
1106#if defined(DEBUG)
1107 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1108#endif
1109
1110
1111 /*************************/
1112 /* Copper Areas handling */
1113 /*************************/
1114
1125
1132 ZONE* GetArea( int index ) const
1133 {
1134 if( (unsigned) index < m_zones.size() )
1135 return m_zones[index];
1136
1137 return nullptr;
1138 }
1139
1143 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1144
1148 int GetAreaCount() const
1149 {
1150 return static_cast<int>( m_zones.size() );
1151 }
1152
1153 /* Functions used in test, merge and cut outlines */
1154
1167 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1168 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1169
1177 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1178
1186 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1187 PAD* GetPad( const VECTOR2I& aPosition ) const
1188 {
1189 return GetPad( aPosition, LSET().set() );
1190 }
1191
1199 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1200
1215 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1216
1228 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1229
1237 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1238
1246 TRACKS TracksInNet( int aNetCode );
1247
1260 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1261 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1262
1268 int GetMaxClearanceValue() const;
1269
1275 void MapNets( BOARD* aDestBoard );
1276
1277 void SanitizeNetcodes();
1278
1287 void AddListener( BOARD_LISTENER* aListener );
1288
1293 void RemoveListener( BOARD_LISTENER* aListener );
1294
1298 void RemoveAllListeners();
1299
1304 void OnItemChanged( BOARD_ITEM* aItem );
1305
1310 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1311
1316 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1317 std::vector<BOARD_ITEM*>& aRemovedItems,
1318 std::vector<BOARD_ITEM*>& aChangedItems );
1319
1323 void OnRatsnestChanged();
1324
1331 wxString GroupsSanityCheck( bool repair = false );
1332
1338 wxString GroupsSanityCheckInternal( bool repair );
1339
1340 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1341 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1342
1343 EMBEDDED_FILES* GetEmbeddedFiles() override;
1344 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1345
1347
1351 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1352
1356 void EmbedFonts() override;
1357
1362
1367
1369
1378 void SaveToHistory( const wxString& aProjectPath, std::vector<wxString>& aFiles );
1379
1380 const std::unordered_map<KIID, BOARD_ITEM*>& GetItemByIdCache() const
1381 {
1382 return m_itemByIdCache;
1383 }
1384
1385 // --------- Item order comparators ---------
1386
1388 {
1389 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1390 };
1391
1393 {
1394 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1395 };
1396
1397public:
1398 // ------------ Run-time caches -------------
1399 mutable std::shared_mutex m_CachesMutex;
1400 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsCourtyardCache;
1401 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsFCourtyardCache;
1402 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsBCourtyardCache;
1403 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_IntersectsAreaCache;
1404 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_EnclosedByAreaCache;
1405 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1406 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1407 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1408 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1409 mutable std::optional<int> m_maxClearanceValue;
1410
1411 // ------------ DRC caches -------------
1412 std::vector<ZONE*> m_DRCZones;
1413 std::vector<ZONE*> m_DRCCopperZones;
1416 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1417 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1418
1419private:
1420 // The default copy constructor & operator= are inadequate,
1421 // either write one or do not use it at all
1422 BOARD( const BOARD& aOther ) = delete;
1423
1424 BOARD& operator=( const BOARD& aOther ) = delete;
1425
1426 template <typename Func, typename... Args>
1427 void InvokeListeners( Func&& aFunc, Args&&... args )
1428 {
1429 for( auto&& l : m_listeners )
1430 ( l->*aFunc )( std::forward<Args>( args )... );
1431 }
1432
1433 // Refresh user layer opposites.
1434 void recalcOpposites();
1435
1436 friend class PCB_EDIT_FRAME;
1437
1438private:
1441
1444 int m_timeStamp; // actually a modification counter
1445
1446 wxString m_fileName;
1447
1448 // These containers only have const accessors and must only be modified by Add()/Remove()
1449 MARKERS m_markers;
1450 DRAWINGS m_drawings;
1451 FOOTPRINTS m_footprints;
1453 GROUPS m_groups;
1455 GENERATORS m_generators;
1457 PCB_POINTS m_points;
1458
1459 // Cache for fast access to items in the containers above by KIID, including children
1460 std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1461
1462 std::map<int, LAYER> m_layers; // layer data
1463
1464 HIGH_LIGHT_INFO m_highLight; // current high light data
1465 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1466
1467 int m_fileFormatVersionAtLoad; // the version loaded from the file
1468 wxString m_generator; // the generator tag from the file
1469
1470 std::map<wxString, wxString> m_properties;
1471 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1472
1474 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1476 PROJECT* m_project; // project this board is a part of
1478
1489 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1490
1495 bool m_legacyTeardrops = false;
1496
1497 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1498
1499 std::vector<BOARD_LISTENER*> m_listeners;
1500
1502
1503 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1504 // of all the parent's embedded data.
1506
1507 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1508 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1509};
1510
1511
1512#endif // CLASS_BOARD_H_
int index
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:83
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:85
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 OnBoardRatsnestChanged(BOARD &aBoard)
Definition board.h:295
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:288
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 OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:290
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 void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:293
virtual ~BOARD_LISTENER()
Definition board.h:286
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:2180
ZONE * m_SolderMaskBridges
Definition board.h:1416
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:473
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:1058
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:2687
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:1404
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1417
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:929
GENERATORS m_generators
Definition board.h:1455
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:3031
const NETINFO_LIST & GetNetInfo() const
Definition board.h:955
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:2537
int GetUserDefinedLayerCount() const
Definition board.cpp:918
void recalcOpposites()
Definition board.cpp:839
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:596
std::map< wxString, wxString > m_properties
Definition board.h:1470
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:2883
int m_fileFormatVersionAtLoad
Definition board.h:1467
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:2398
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1413
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:986
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:1195
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:2978
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition board.h:1495
TITLE_BLOCK m_titles
Definition board.h:1474
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:1132
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1023
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1009
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1361
void BuildListOfNets()
Definition board.h:918
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:1167
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:860
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:2952
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:1020
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1440
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:2698
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:2437
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1443
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:371
PAGE_INFO m_paper
Definition board.h:1473
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3025
FOOTPRINTS m_footprints
Definition board.h:1451
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:1489
friend class PCB_EDIT_FRAME
Definition board.h:1436
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1346
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:3238
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:3006
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:1669
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:401
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:764
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1014
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3065
HIGH_LIGHT_INFO m_highLight
Definition board.h:1464
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:687
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2331
EDA_UNITS m_userUnits
Definition board.h:1477
void UpdateBoardOutline()
Definition board.cpp:3424
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:1337
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1427
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1075
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:968
void SanitizeNetcodes()
Definition board.cpp:2996
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1505
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:2807
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:758
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition board.h:396
~BOARD()
Definition board.cpp:156
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:191
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:980
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:770
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition board.cpp:328
DRAWINGS m_drawings
Definition board.h:1450
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:3043
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:2503
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:2464
EDA_UNITS GetUserUnits()
Definition board.h:770
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3056
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1475
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:733
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:2787
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:498
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:899
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:2938
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:602
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:2076
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1174
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1081
ZONES m_zones
Definition board.h:1454
PAD * GetPad(const VECTOR2I &aPosition) const
Definition board.h:1187
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:695
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1465
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:1497
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:1003
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:811
NETINFO_LIST::iterator EndNets() const
Definition board.h:977
int GetCopperLayerCount() const
Definition board.cpp:906
int m_timeStamp
Definition board.h:1444
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1499
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:1583
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:400
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1400
void IncrementTimeStamp()
Definition board.cpp:259
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:2350
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1401
PCB_POINTS m_points
Definition board.h:1457
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1508
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:960
const FOOTPRINTS & Footprints() const
Definition board.h:363
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1471
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:2901
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:1456
const BOARD_ITEM_SET GetItemSet()
Definition board.cpp:3340
const TRACKS & Tracks() const
Definition board.h:361
int m_DRCMaxPhysicalClearance
Definition board.h:1415
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:2425
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:1331
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:759
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1405
bool m_embedFonts
Definition board.h:1501
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:3102
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:3050
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:1906
wxString GetClass() const override
Return the class name.
Definition board.h:1101
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1507
NETINFO_LIST::iterator BeginNets() const
Definition board.h:969
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, bool aInferOutlineIfNecessary, 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:2832
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:415
void SetCopperLayerCount(int aCount)
Definition board.cpp:912
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1408
wxString m_generator
Definition board.h:1468
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1402
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:665
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:201
PROJECT * m_project
Definition board.h:1476
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:2723
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1537
const wxString & GetFileName() const
Definition board.h:359
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:3356
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition board.cpp:385
int GetPadWithCastellatedAttrCount()
Definition board.cpp:3453
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:2413
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2059
bool IsHighLightNetON() const
Definition board.h:611
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition board.cpp:1864
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:1026
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1407
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:789
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:761
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1446
const wxString & GetGenerator() const
Adds an item to the container.
Definition board.h:434
int GetAreaCount() const
Definition board.h:1148
void DetachAllFootprints()
Remove all footprints without deleting.
Definition board.cpp:1736
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1341
std::map< int, LAYER > m_layers
Definition board.h:1462
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition board.cpp:623
int GetOutlinesChainingEpsilon()
Definition board.h:810
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:2672
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:960
int m_DRCMaxClearance
Definition board.h:1414
void ClearProject()
Definition board.cpp:239
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:663
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1406
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:1325
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:942
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:1724
PROJECT * GetProject() const
Definition board.h:554
bool IsEmpty() const
Definition board.cpp:584
int GetPadWithPressFitAttrCount()
Definition board.cpp:3435
bool LegacyTeardrops() const
Definition board.h:1340
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:2142
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:765
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition board.cpp:3088
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1069
std::vector< ZONE * > m_DRCZones
Definition board.h:1412
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:954
void SetGenerator(const wxString &aGenerator)
Definition board.h:433
BOARD()
Definition board.cpp:84
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:297
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition board.cpp:1986
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2451
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition board.h:1460
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:3013
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1366
std::shared_mutex m_CachesMutex
Definition board.h:1399
unsigned GetNetCount() const
Definition board.h:986
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
Definition board.h:1380
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:2494
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:1691
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1354
GROUPS m_groups
Definition board.h:1453
PROJECT::ELEM ProjectElementType() override
Definition board.h:1368
MARKERS m_markers
Definition board.h:1449
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1403
std::optional< int > m_maxClearanceValue
Definition board.h:1409
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3078
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:974
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:766
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:2458
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1452
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:1748
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:3037
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:590
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition board.cpp:1113
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:993
void SaveToHistory(const wxString &aProjectPath, std::vector< wxString > &aFiles)
Save board file to the .history directory.
Definition board.cpp:3471
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:2928
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1094
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1456
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:924
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:1663
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 component information found in a netlist.
Implement an R-tree for fast spatial and layer indexing of connectable items.
Definition drc_rtree.h:50
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:273
Container for NETINFO_ITEM elements, which are the nets.
Definition netinfo.h:212
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:55
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:92
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
NORMAL
Follows standard pretty-printing rules.
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:3192
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:3171
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:818
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:802
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.