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
72
73namespace KIFONT
74{
75 class OUTLINE_FONT;
76}
77
78struct ISOLATED_ISLANDS;
79
80// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
81// It is the max dist between 2 end points to see them connected
82#define DEFAULT_CHAINING_EPSILON_MM 0.01
83
84// Forward declare endpoint from class_track.h
85enum ENDPOINT_T : int;
86
87
89{
92
93 bool operator==(const PTR_PTR_CACHE_KEY& other) const
94 {
95 return A == other.A && B == other.B;
96 }
97};
98
100{
103
104 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
105 {
106 return A == other.A && Layer == other.Layer;
107 }
108};
109
111{
115
116 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
117 {
118 return A == other.A && B == other.B && Layer == other.Layer;
119 }
120};
121
123{
125 layers(),
126 has_error( false )
127 {}
128
130 layers( { aLayer } ),
131 has_error( false )
132 {}
133
136};
137
138
139namespace std
140{
141 template <>
142 struct hash<PTR_PTR_CACHE_KEY>
143 {
144 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
145 {
146 std::size_t seed = 0xa82de1c0;
147 hash_combine( seed, k.A, k.B );
148 return seed;
149 }
150 };
151
152 template <>
154 {
155 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
156 {
157 std::size_t seed = 0xa82de1c0;
158 hash_combine( seed, k.A, k.Layer );
159 return seed;
160 }
161 };
162
163 template <>
165 {
166 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
167 {
168 std::size_t seed = 0xa82de1c0;
169 hash_combine( seed, k.A, k.B, k.Layer );
170 return seed;
171 }
172 };
173}
174
175
180{
188 LT_BACK
190
191
195struct LAYER
196{
198 {
199 clear();
200 }
201
202 void clear()
203 {
205 m_visible = true;
206 m_number = 0;
207 m_name.clear();
208 m_userName.clear();
210 }
211
212 /*
213 LAYER( const wxString& aName = wxEmptyString,
214 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
215 m_name( aName ),
216 m_type( aType ),
217 m_visible( aVisible ),
218 m_number( aNumber )
219 {
220 }
221 */
222
223 wxString m_name;
224 wxString m_userName;
229
236 static const char* ShowType( LAYER_T aType );
237
245 static LAYER_T ParseType( const char* aType );
246};
247
248
249// Helper class to handle high light nets
251{
252protected:
253 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
254 bool m_highLightOn; // highlight active
255
256 void Clear()
257 {
258 m_netCodes.clear();
259 m_highLightOn = false;
260 }
261
263 {
264 Clear();
265 }
266
267private:
268 friend class BOARD;
269};
270
276class BOARD;
277
279{
280public:
281 virtual ~BOARD_LISTENER() { }
282 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
283 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
284 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
285 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
286 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
287 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
288 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
289 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
290 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
291 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
292 std::vector<BOARD_ITEM*>& aRemovedItems,
293 std::vector<BOARD_ITEM*>& aChangedItems )
294 {
295 }
296};
297
301typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
302
306enum class BOARD_USE
307{
308 NORMAL, // A normal board
309 FPHOLDER // A board that holds a single footprint
310};
311
312
317{
318public:
319 static inline bool ClassOf( const EDA_ITEM* aItem )
320 {
321 return aItem && PCB_T == aItem->Type();
322 }
323
329 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
330
336 BOARD_USE GetBoardUse() const { return m_boardUse; }
337
338 void IncrementTimeStamp();
339
340 int GetTimeStamp() const { return m_timeStamp; }
341
347 bool IsFootprintHolder() const
348 {
349 return m_boardUse == BOARD_USE::FPHOLDER;
350 }
351
352 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
353
354 const wxString &GetFileName() const { return m_fileName; }
355
356 const TRACKS& Tracks() const { return m_tracks; }
357
358 const FOOTPRINTS& Footprints() const { return m_footprints; }
359
360 const DRAWINGS& Drawings() const { return m_drawings; }
361
362 const ZONES& Zones() const { return m_zones; }
363
364 const GENERATORS& Generators() const { return m_generators; }
365
368 void UpdateBoardOutline();
369
370 const MARKERS& Markers() const { return m_markers; }
371
372 // SWIG requires non-const accessors for some reason to make the custom iterators in board.i
373 // work. It would be good to remove this if we can figure out how to fix that.
374#ifdef SWIG
375 DRAWINGS& Drawings() { return m_drawings; }
376 TRACKS& Tracks() { return m_tracks; }
377#endif
378
380
389 const GROUPS& Groups() const { return m_groups; }
390
391 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
392
393 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
394 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
395
396 void GetContextualTextVars( wxArrayString* aVars ) const;
397 bool ResolveTextVar( wxString* token, int aDepth ) const;
398
402
406
409
410 BOARD();
411 ~BOARD();
412
413 VECTOR2I GetPosition() const override;
414 void SetPosition( const VECTOR2I& aPos ) override;
415 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
416
417 bool IsEmpty() const
418 {
419 return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
420 }
421
422 void Move( const VECTOR2I& aMoveVector ) override;
423
424 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
425
426 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
428
429 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
430 const wxString& GetGenerator() const { return m_generator; }
431
433 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
434 bool aSkipConnectivity = false ) override;
435
437 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
438
447 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
451
456 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
457
462 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
463
468 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
469
475 void FixupEmbeddedData();
476
477 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
478
479 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
480 const std::vector<ZONE*>& aZones = {} );
481
490 {
491 return m_footprints.empty() ? nullptr : m_footprints.front();
492 }
493
497 void DeleteAllFootprints();
498
502 void DetachAllFootprints();
503
508 BOARD_ITEM* ResolveItem( const KIID& aID, bool aAllowNullptrReturn = false ) const;
509
510 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
511
515 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
516 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
517
522 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
523
529 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
530
534 void DeleteMARKERs();
535
536 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
537
538 PROJECT* GetProject() const { return m_project; }
539
548 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
549
550 void ClearProject();
551
559 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
560
564 void RecordDRCExclusions();
565
570
574 void ResetNetHighLight();
575
579 const std::set<int>& GetHighLightNetCodes() const
580 {
581 return m_highLight.m_netCodes;
582 }
583
590 void SetHighLightNet( int aNetCode, bool aMulti = false );
591
596
604 void HighLightON( bool aValue = true );
605
610 {
611 HighLightON( false );
612 }
613
617 int GetCopperLayerCount() const;
618 void SetCopperLayerCount( int aCount );
619
620 int GetUserDefinedLayerCount() const;
621 void SetUserDefinedLayerCount( int aCount );
622
628
629 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
630
631 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
632
638 const LSET& GetEnabledLayers() const;
639 LSET GetLayerSet() const override { return GetEnabledLayers(); }
640
646 void SetEnabledLayers( const LSET& aLayerMask );
647 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
648
655 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
656
664 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
665
671 const LSET& GetVisibleLayers() const;
672
679 void SetVisibleLayers( const LSET& aLayerMask );
680
681 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
682 // are not stored in the bitmap.
683
691
698 void SetVisibleElements( const GAL_SET& aMask );
699
705 void SetVisibleAlls();
706
714 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
715
723 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
724
732 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
733
738 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
739
741
742 const PAGE_INFO& GetPageSettings() const { return m_paper; }
743 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
744
746 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
747
749 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
750 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
751
752 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
753
755 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
756
761 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
762
781 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
782 bool aAllowUseArcsInPolygons = false,
783 bool aIncludeNPTHAsOutlines = false );
784
794
805 void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const;
806
810 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
811
818 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
819
827 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
828
839 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
840 {
841 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
842 return LayerName( aLayerId );
843 }
844
852 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
853
857 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
858
862 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
863
870 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
871
879 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
880
885 unsigned GetNodesCount( int aNet = -1 ) const;
886
895 const std::vector<PAD*> GetPads() const;
896
898 {
900 }
901
908 NETINFO_ITEM* FindNet( int aNetcode ) const;
909
916 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
917
927 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
928
932 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
933
935 {
936 return m_NetInfo;
937 }
938
940 {
941 m_NetInfo.RemoveUnusedNets( aCommit );
942 }
943
944#ifndef SWIG
949 {
950 return m_NetInfo.begin();
951 }
952
957 {
958 return m_NetInfo.end();
959 }
960#endif
961
965 unsigned GetNetCount() const
966 {
967 return m_NetInfo.GetNetCount();
968 }
969
974
979
986 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
987
988 const BOX2I GetBoundingBox() const override
989 {
990 return ComputeBoundingBox( false );
991 }
992
1003 {
1004 return ComputeBoundingBox( true );
1005 }
1006
1007 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1008
1020 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1021 const std::vector<KICAD_T>& scanTypes ) override;
1022
1031 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1032
1039 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1040
1044 std::set<wxString> GetNetClassAssignmentCandidates() const;
1045
1053 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1054
1058 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1059
1063 void SynchronizeProperties();
1064
1069
1073 double Similarity( const BOARD_ITEM& aOther ) const override
1074 {
1075 return 1.0;
1076 }
1077
1078 bool operator==( const BOARD_ITEM& aOther ) const override;
1079
1080 wxString GetClass() const override
1081 {
1082 return wxT( "BOARD" );
1083 }
1084
1085#if defined(DEBUG)
1086 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1087#endif
1088
1089
1090 /*************************/
1091 /* Copper Areas handling */
1092 /*************************/
1093
1104
1111 ZONE* GetArea( int index ) const
1112 {
1113 if( (unsigned) index < m_zones.size() )
1114 return m_zones[index];
1115
1116 return nullptr;
1117 }
1118
1122 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1123
1127 int GetAreaCount() const
1128 {
1129 return static_cast<int>( m_zones.size() );
1130 }
1131
1132 /* Functions used in test, merge and cut outlines */
1133
1146 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1147 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1148
1156 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1157
1165 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1166 PAD* GetPad( const VECTOR2I& aPosition ) const
1167 {
1168 return GetPad( aPosition, LSET().set() );
1169 }
1170
1178 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1179
1194 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1195
1207 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1208
1216 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1217
1225 TRACKS TracksInNet( int aNetCode );
1226
1239 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1240 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1241
1247 int GetMaxClearanceValue() const;
1248
1254 void MapNets( BOARD* aDestBoard );
1255
1256 void SanitizeNetcodes();
1257
1266 void AddListener( BOARD_LISTENER* aListener );
1267
1272 void RemoveListener( BOARD_LISTENER* aListener );
1273
1277 void RemoveAllListeners();
1278
1283 void OnItemChanged( BOARD_ITEM* aItem );
1284
1289 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1290
1295 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1296 std::vector<BOARD_ITEM*>& aRemovedItems,
1297 std::vector<BOARD_ITEM*>& aChangedItems );
1298
1302 void OnRatsnestChanged();
1303
1310 wxString GroupsSanityCheck( bool repair = false );
1311
1317 wxString GroupsSanityCheckInternal( bool repair );
1318
1319 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1320 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1321
1322 EMBEDDED_FILES* GetEmbeddedFiles() override;
1323 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1324
1326
1330 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1331
1335 void EmbedFonts() override;
1336
1341
1346
1348
1349 const std::unordered_map<KIID, BOARD_ITEM*>& GetItemByIdCache() const
1350 {
1351 return m_itemByIdCache;
1352 }
1353
1354 // --------- Item order comparators ---------
1355
1357 {
1358 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1359 };
1360
1362 {
1363 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1364 };
1365
1366public:
1367 // ------------ Run-time caches -------------
1368 mutable std::shared_mutex m_CachesMutex;
1369 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsCourtyardCache;
1370 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsFCourtyardCache;
1371 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsBCourtyardCache;
1372 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_IntersectsAreaCache;
1373 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_EnclosedByAreaCache;
1374 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1375 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1376 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1377 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1378 mutable std::optional<int> m_maxClearanceValue;
1379
1380 // ------------ DRC caches -------------
1381 std::vector<ZONE*> m_DRCZones;
1382 std::vector<ZONE*> m_DRCCopperZones;
1385 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1386 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1387
1388private:
1389 // The default copy constructor & operator= are inadequate,
1390 // either write one or do not use it at all
1391 BOARD( const BOARD& aOther ) = delete;
1392
1393 BOARD& operator=( const BOARD& aOther ) = delete;
1394
1395 template <typename Func, typename... Args>
1396 void InvokeListeners( Func&& aFunc, Args&&... args )
1397 {
1398 for( auto&& l : m_listeners )
1399 ( l->*aFunc )( std::forward<Args>( args )... );
1400 }
1401
1402 // Refresh user layer opposites.
1403 void recalcOpposites();
1404
1405 friend class PCB_EDIT_FRAME;
1406
1407private:
1410
1413 int m_timeStamp; // actually a modification counter
1414
1415 wxString m_fileName;
1416
1417 // These containers only have const accessors and must only be modified by Add()/Remove()
1418 MARKERS m_markers;
1419 DRAWINGS m_drawings;
1420 FOOTPRINTS m_footprints;
1422 GROUPS m_groups;
1424 GENERATORS m_generators;
1426
1427 // Cache for fast access to items in the containers above by KIID, including children
1428 std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1429
1430 std::map<int, LAYER> m_layers; // layer data
1431
1432 HIGH_LIGHT_INFO m_highLight; // current high light data
1433 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1434
1435 int m_fileFormatVersionAtLoad; // the version loaded from the file
1436 wxString m_generator; // the generator tag from the file
1437
1438 std::map<wxString, wxString> m_properties;
1439 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1440
1442 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1444 PROJECT* m_project; // project this board is a part of
1446
1457 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1458
1463 bool m_legacyTeardrops = false;
1464
1465 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1466
1467 std::vector<BOARD_LISTENER*> m_listeners;
1468
1470
1471 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1472 // of all the parent's embedded data.
1474
1475 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1476 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1477};
1478
1479
1480#endif // CLASS_BOARD_H_
BOARD_USE
Flags to specify how the board is being used.
Definition: board.h:307
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition: board.h:180
@ LT_POWER
Definition: board.h:183
@ LT_FRONT
Definition: board.h:187
@ LT_MIXED
Definition: board.h:184
@ LT_BACK
Definition: board.h:188
@ LT_UNDEFINED
Definition: board.h:181
@ LT_JUMPER
Definition: board.h:185
@ LT_AUX
Definition: board.h:186
@ LT_SIGNAL
Definition: board.h:182
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition: board.h:301
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.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:180
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
Definition: board.h:286
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:283
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition: board.h:290
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:288
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:287
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:284
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:282
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:289
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition: board.h:291
virtual ~BOARD_LISTENER()
Definition: board.h:281
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:285
Manage layers needed to make a physical board.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
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:1950
ZONE * m_SolderMaskBridges
Definition: board.h:1385
void GetContextualTextVars(wxArrayString *aVars) const
Definition: board.cpp:474
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:1012
BOARD_STACKUP GetStackupOrDefault() const
Definition: board.cpp:2459
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: board.h:746
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition: board.h:1373
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition: board.h:1386
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition: board.cpp:882
GENERATORS m_generators
Definition: board.h:1424
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:2604
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:2806
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:934
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:404
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition: board.h:347
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:2309
int GetUserDefinedLayerCount() const
Definition: board.cpp:871
void recalcOpposites()
Definition: board.cpp:791
void SetPosition(const VECTOR2I &aPos) override
Definition: board.cpp:563
std::map< wxString, wxString > m_properties
Definition: board.h:1438
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: board.cpp:2657
int m_fileFormatVersionAtLoad
Definition: board.h:1435
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition: board.cpp:2168
std::vector< ZONE * > m_DRCCopperZones
Definition: board.h:1382
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:939
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:336
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:1147
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:579
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:2752
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition: board.h:1463
TITLE_BLOCK m_titles
Definition: board.h:1442
GAL_SET m_LegacyVisibleItems
Definition: board.h:401
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:329
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition: board.h:1111
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:1002
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:988
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition: board.h:1340
void BuildListOfNets()
Definition: board.h:897
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:1119
const GENERATORS & Generators() const
Definition: board.h:364
void SetFileName(const wxString &aFileName)
Definition: board.h:352
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:839
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:2726
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: board.h:639
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:973
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition: board.h:1409
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:2470
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition: board.cpp:2207
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1412
PCB_BOARD_OUTLINE * BoardOutline()
Definition: board.h:366
PAGE_INFO m_paper
Definition: board.h:1441
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2800
FOOTPRINTS m_footprints
Definition: board.h:1420
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:1457
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition: board.h:1325
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:2781
const PAGE_INFO & GetPageSettings() const
Definition: board.h:742
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition: board.cpp:1504
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:394
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition: board.cpp:724
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:967
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2842
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1432
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition: board.cpp:652
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:2099
EDA_UNITS m_userUnits
Definition: board.h:1445
void UpdateBoardOutline()
Definition: board.cpp:3192
const ZONES & Zones() const
Definition: board.h:362
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition: board.cpp:1293
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1396
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition: board.cpp:1030
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:921
void SanitizeNetcodes()
Definition: board.cpp:2771
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition: board.h:1473
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:2579
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition: board.cpp:718
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition: board.h:389
~BOARD()
Definition: board.cpp:152
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:186
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:933
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition: board.cpp:730
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition: board.cpp:329
DRAWINGS m_drawings
Definition: board.h:1419
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:2818
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition: board.cpp:2275
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:2234
void SynchronizeTimeDomainProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition: board.cpp:2228
EDA_UNITS GetUserUnits()
Definition: board.h:754
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2833
PCB_PLOT_PARAMS m_plotOptions
Definition: board.h:1443
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:698
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition: board.cpp:2559
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition: board.cpp:3008
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:500
const MARKERS & Markers() const
Definition: board.h:370
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:489
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition: board.cpp:852
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:2712
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: board.cpp:569
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:748
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1851
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition: board.cpp:1126
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition: board.cpp:1036
ZONES m_zones
Definition: board.h:1423
PAD * GetPad(const VECTOR2I &aPosition) const
Definition: board.h:1166
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition: board.cpp:660
HIGH_LIGHT_INFO m_highLightPrevious
Definition: board.h:1433
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: board.h:415
void HighLightOFF()
Disable net highlight.
Definition: board.h:609
NETINFO_LIST m_NetInfo
Definition: board.h:1465
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition: board.h:400
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:956
void SetOutlinesChainingEpsilon(int aValue)
Definition: board.h:793
NETINFO_LIST::iterator EndNets() const
Definition: board.h:956
int GetCopperLayerCount() const
Definition: board.cpp:859
int m_timeStamp
Definition: board.h:1413
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1467
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:393
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition: board.h:1369
void IncrementTimeStamp()
Definition: board.cpp:254
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition: board.cpp:2118
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition: board.h:1370
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition: board.h:1476
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition: board.h:939
const FOOTPRINTS & Footprints() const
Definition: board.h:358
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1439
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition: board.cpp:2675
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:1418
const BOARD_ITEM_SET GetItemSet()
Definition: board.cpp:3109
const TRACKS & Tracks() const
Definition: board.h:356
int m_DRCMaxPhysicalClearance
Definition: board.h:1384
const PCB_BOARD_OUTLINE * BoardOutline() const
Definition: board.h:367
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition: board.cpp:2195
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:1287
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: board.h:743
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition: board.h:1374
bool m_embedFonts
Definition: board.h:1469
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2878
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition: board.cpp:2827
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1732
wxString GetClass() const override
Return the class name.
Definition: board.h:1080
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition: board.h:1475
NETINFO_LIST::iterator BeginNets() const
Definition: board.h:948
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:408
void SetCopperLayerCount(int aCount)
Definition: board.cpp:865
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition: board.h:1377
wxString m_generator
Definition: board.h:1436
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition: board.h:1371
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition: board.cpp:630
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:196
PROJECT * m_project
Definition: board.h:1444
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:2495
const wxString & GetFileName() const
Definition: board.h:354
bool operator==(const BOARD_ITEM &aOther) const override
Definition: board.cpp:3124
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition: board.cpp:386
int GetPadWithCastellatedAttrCount()
Definition: board.cpp:3221
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:2183
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:1834
bool IsHighLightNetON() const
Definition: board.h:595
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition: board.cpp:1693
int GetFileFormatVersionAtLoad() const
Definition: board.h:427
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:979
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition: board.h:1376
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition: board.cpp:749
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:745
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition: board.h:1415
const wxString & GetGenerator() const
Adds an item to the container.
Definition: board.h:430
int GetAreaCount() const
Definition: board.h:1127
void DetachAllFootprints()
Remove all footprints without deleting.
Definition: board.cpp:1573
void SetLegacyTeardrops(bool aFlag)
Definition: board.h:1320
std::map< int, LAYER > m_layers
Definition: board.h:1430
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: board.cpp:591
int GetOutlinesChainingEpsilon()
Definition: board.h:792
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:2444
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:913
int m_DRCMaxClearance
Definition: board.h:1383
void ClearProject()
Definition: board.cpp:234
void SetLayerSet(const LSET &aLayerMask) override
Definition: board.h:647
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition: board.h:1375
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:1281
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition: board.cpp:895
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1563
PROJECT * GetProject() const
Definition: board.h:538
bool IsEmpty() const
Definition: board.h:417
int GetPadWithPressFitAttrCount()
Definition: board.cpp:3203
bool LegacyTeardrops() const
Definition: board.h:1319
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:1912
const TITLE_BLOCK & GetTitleBlock() const
Definition: board.h:749
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition: board.cpp:2865
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:1024
std::vector< ZONE * > m_DRCZones
Definition: board.h:1381
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:907
void SetGenerator(const wxString &aGenerator)
Definition: board.h:429
BOARD()
Definition: board.cpp:79
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:298
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1786
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition: board.cpp:2221
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition: board.h:1428
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition: board.cpp:2788
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition: board.h:1345
std::shared_mutex m_CachesMutex
Definition: board.h:1368
unsigned GetNetCount() const
Definition: board.h:965
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
Definition: board.h:1349
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition: board.cpp:2264
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1530
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:1310
GROUPS m_groups
Definition: board.h:1422
PROJECT::ELEM ProjectElementType() override
Definition: board.h:1347
MARKERS m_markers
Definition: board.h:1418
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition: board.h:1372
std::optional< int > m_maxClearanceValue
Definition: board.h:1378
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2855
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:927
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: board.h:750
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition: board.h:1421
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition: board.cpp:1583
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:405
int GetTimeStamp() const
Definition: board.h:340
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:2812
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:522
VECTOR2I GetPosition() const override
Definition: board.cpp:557
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition: board.cpp:1068
static bool ClassOf(const EDA_ITEM *aItem)
Definition: board.h:319
void SetUserUnits(EDA_UNITS aUnits)
Definition: board.h:755
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:946
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition: board.cpp:2702
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition: board.h:1073
PCB_BOARD_OUTLINE * m_boardOutline
Definition: board.h:1425
void SetUserDefinedLayerCount(int aCount)
Definition: board.cpp:877
const DRAWINGS & Drawings() const
Definition: board.h:360
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: board.cpp:1498
void SetFileFormatVersionAtLoad(int aVersion)
Definition: board.h:426
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.
Definition: pcb_netlist.h:100
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.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
Helper for storing and iterating over GAL_LAYER_IDs.
Definition: layer_ids.h:393
void Clear()
Definition: board.h:256
HIGH_LIGHT_INFO()
Definition: board.h:262
std::set< int > m_netCodes
Definition: board.h:253
bool m_highLightOn
Definition: board.h:254
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:56
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:407
Container for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:346
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
iterator begin() const
Definition: netinfo.h:452
unsigned GetNetCount() const
Definition: netinfo.h:369
iterator end() const
Definition: netinfo.h:457
void buildListOfNets()
Rebuild the list of NETINFO_ITEMs.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:274
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:59
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
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
STL namespace.
std::vector< ZONE * > ZONES
Definition: pcb_io_eagle.h:47
ENDPOINT_T
Definition: pcb_track.h:59
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: board.cpp:2968
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: board.cpp:2947
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:129
bool has_error
Definition: board.h:135
LAYERS_CHECKED()
Definition: board.h:124
LSET layers
Definition: board.h:134
Container to hold information pertinent to a layer of a BOARD.
Definition: board.h:196
int m_opposite
Similar layer on opposite side of the board, if any.
Definition: board.h:228
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition: board.cpp:778
void clear()
Definition: board.h:202
LAYER_T m_type
The type of the layer.
Definition: board.h:225
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition: board.cpp:762
LAYER()
Definition: board.h:197
wxString m_name
The canonical name of the layer.
Definition: board.h:223
wxString m_userName
The user defined name of the layer.
Definition: board.h:224
bool m_visible
Definition: board.h:226
int m_number
The layer ID.
Definition: board.h:227
BOARD_ITEM * A
Definition: board.h:101
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition: board.h:104
PCB_LAYER_ID Layer
Definition: board.h:102
BOARD_ITEM * A
Definition: board.h:90
BOARD_ITEM * B
Definition: board.h:91
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition: board.h:93
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition: board.h:116
BOARD_ITEM * B
Definition: board.h:113
BOARD_ITEM * A
Definition: board.h:112
PCB_LAYER_ID Layer
Definition: board.h:114
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition: board.h:155
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition: board.h:144
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition: board.h:166
@ 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:110
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ 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:109
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:59