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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef CLASS_BOARD_H_
22#define CLASS_BOARD_H_
23
24#include <atomic>
27#include <core/mirror.h>
31#include <embedded_files.h>
32#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 <zone_settings.h>
42#include <shared_mutex>
43#include <sharded_cache.h>
44#include <unordered_set>
45#include <project.h>
46#include <list>
47
51class BOARD_COMMIT;
53class DRC_RTREE;
54class PCB_BASE_FRAME;
55class PCB_EDIT_FRAME;
58class BOARD;
59class FOOTPRINT;
61class ZONE;
62class PCB_TRACK;
63class PCB_VIA;
64class PAD;
65class PCB_DRILL_MAP;
66class PCB_GROUP;
67class PCB_GENERATOR;
68class PCB_MARKER;
69class MSG_PANEL_ITEM;
70class NETLIST;
71class REPORTER;
73class COMPONENT;
74class PROJECT;
77
78namespace KIGFX
79{
80class RENDER_SETTINGS;
81};
82
83
84namespace KIFONT
85{
86 class OUTLINE_FONT;
87}
88
89struct ISOLATED_ISLANDS;
90
91// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
92// It is the max dist between 2 end points to see them connected
93#define DEFAULT_CHAINING_EPSILON_MM 0.01
94
95// Forward declare endpoint from class_track.h
96enum ENDPOINT_T : int;
97
98
100{
103
104 bool operator==(const PTR_PTR_CACHE_KEY& other) const
105 {
106 return A == other.A && B == other.B;
107 }
108};
109
111{
114
115 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
116 {
117 return A == other.A && Layer == other.Layer;
118 }
119};
120
122{
126
127 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
128 {
129 return A == other.A && B == other.B && Layer == other.Layer;
130 }
131};
132
133// Caches the whole-predicate result of a footprint-selector query (e.g. intersectsCourtyard)
134// for one item, so a rule set that repeats the same condition does not re-scan every footprint.
136{
137 const BOARD_ITEM* A;
138 wxString Selector; // the selector argument string, compared verbatim
140 int Constraint; // some predicates (intersectsArea) branch on the constraint
141
142 bool operator==( const ITEM_SELECTOR_LAYER_CACHE_KEY& other ) const
143 {
144 return A == other.A && Selector == other.Selector && Layer == other.Layer
145 && Constraint == other.Constraint;
146 }
147};
148
149// Caches getField('x') text per (item, field name)
151{
152 const BOARD_ITEM* A;
153 std::size_t FieldHash;
154
155 bool operator==( const ITEM_FIELD_CACHE_KEY& other ) const
156 {
157 return A == other.A && FieldHash == other.FieldHash;
158 }
159};
160
162{
164 layers(),
165 has_error( false )
166 {}
167
169 layers( { aLayer } ),
170 has_error( false )
171 {}
172
175};
176
177
178namespace std
179{
180 template <>
181 struct hash<PTR_PTR_CACHE_KEY>
182 {
183 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
184 {
185 std::size_t seed = 0xa82de1c0;
186 hash_combine( seed, k.A, k.B );
187 return seed;
188 }
189 };
190
191 template <>
193 {
194 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
195 {
196 std::size_t seed = 0xa82de1c0;
197 hash_combine( seed, k.A, k.Layer );
198 return seed;
199 }
200 };
201
202 template <>
204 {
205 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
206 {
207 std::size_t seed = 0xa82de1c0;
208 hash_combine( seed, k.A, k.B, k.Layer );
209 return seed;
210 }
211 };
212
213 template <>
215 {
216 std::size_t operator()( const ITEM_SELECTOR_LAYER_CACHE_KEY& k ) const
217 {
218 std::size_t seed = 0xa82de1c0;
219 hash_combine( seed, k.A, k.Selector, k.Layer, k.Constraint );
220 return seed;
221 }
222 };
223
224 template <>
226 {
227 std::size_t operator()( const ITEM_FIELD_CACHE_KEY& k ) const
228 {
229 std::size_t seed = 0xa82de1c0;
230 hash_combine( seed, k.A, k.FieldHash );
231 return seed;
232 }
233 };
234}
235
236
251
252
256struct LAYER
257{
259 {
260 clear();
261 }
262
263 void clear()
264 {
266 m_visible = true;
267 m_number = 0;
268 m_name.clear();
269 m_userName.clear();
271 }
272
273 /*
274 LAYER( const wxString& aName = wxEmptyString,
275 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
276 m_name( aName ),
277 m_type( aType ),
278 m_visible( aVisible ),
279 m_number( aNumber )
280 {
281 }
282 */
283
284 wxString m_name;
285 wxString m_userName;
290
297 static const char* ShowType( LAYER_T aType );
298
306 static LAYER_T ParseType( const char* aType );
307};
308
309
310// Helper class to handle high light nets
312{
313protected:
314 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
315 bool m_highLightOn; // highlight active
316
317 void Clear()
318 {
319 m_netCodes.clear();
320 m_highLightOn = false;
321 }
322
324 {
325 Clear();
326 }
327
328private:
329 friend class BOARD;
330};
331
337class BOARD;
338
348{
349 std::map<std::string, DRILL_SYMBOL_ASSIGNMENT> m_ByGroup;
350 std::map<KIID, std::vector<DRILL_SYMBOL_ENTRY>> m_ByItem;
351
357
363
364 uint64_t m_Generation = 0;
365 uint64_t m_Profile = 0;
366};
367
368
370{
371public:
372 virtual ~BOARD_LISTENER() { }
373 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
374 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
375 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
376 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
377 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
378 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
379 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
380 virtual void OnBoardSelectionChanged( BOARD& aBoard ) { }
381 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
382 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
383 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
384 std::vector<BOARD_ITEM*>& aRemovedItems,
385 std::vector<BOARD_ITEM*>& aChangedItems )
386 {
387 }
388};
389
393typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
394
398enum class BOARD_USE
399{
400 NORMAL, // A normal board
401 FPHOLDER // A board that holds a single footprint
402};
403
404
409{
410public:
411 static inline bool ClassOf( const EDA_ITEM* aItem )
412 {
413 return aItem && PCB_T == aItem->Type();
414 }
415
421 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
422
428 BOARD_USE GetBoardUse() const { return m_boardUse; }
429
430 void IncrementTimeStamp();
431
432 int GetTimeStamp() const { return m_timeStamp.load( std::memory_order_acquire ); }
433
439 bool IsFootprintHolder() const
440 {
442 }
443
444 PCB_LAYER_ID GetLayer() const override
445 {
446 wxFAIL_MSG( wxT( "BOARD::GetLayer() desn't have meaning. Don't call it." ) );
447 return UNDEFINED_LAYER;
448 }
449
450 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
451
452 const wxString &GetFileName() const { return m_fileName; }
453
459 wxString GetDesignRulesPath() const;
460
461 const TRACKS& Tracks() const { return m_tracks; }
462
463 const FOOTPRINTS& Footprints() const { return m_footprints; }
464
465 const DRAWINGS& Drawings() const { return m_drawings; }
466
467 const ZONES& Zones() const { return m_zones; }
468
474 wxString GetUniqueZoneName( const wxString& aBaseName, const ZONE* aExclude = nullptr ) const;
475
476 const GENERATORS& Generators() const { return m_generators; }
477
480 void UpdateBoardOutline();
481
487
488 const MARKERS& Markers() const { return m_markers; }
489
490 const PCB_POINTS& Points() const { return m_points; }
491
495
499 const BOARD_ITEM_SET GetItemSet() const;
500
509 const GROUPS& Groups() const { return m_groups; }
510
513 const CONSTRAINTS& Constraints() const { return m_constraints; }
514
515 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
516
517 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
518 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
519
520 // Variant system
521 wxString GetCurrentVariant() const { return m_currentVariant; }
522 void SetCurrentVariant( const wxString& aVariant );
523
524 const std::vector<wxString>& GetVariantNames() const { return m_variantNames; }
525 void SetVariantNames( const std::vector<wxString>& aNames ) { m_variantNames = aNames; }
526
527 bool HasVariant( const wxString& aVariantName ) const;
528 void AddVariant( const wxString& aVariantName );
529 void DeleteVariant( const wxString& aVariantName );
530 void RenameVariant( const wxString& aOldName, const wxString& aNewName );
531 void CopyVariant( const wxString& aOldName, const wxString& aNewName,
532 const wxString& aNewDescription = wxEmptyString );
533
534 wxString GetVariantDescription( const wxString& aVariantName ) const;
535 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
536
545 wxArrayString GetVariantNamesForUI() const;
546
547 void GetContextualTextVars( wxArrayString* aVars ) const;
548 bool ResolveTextVar( wxString* token, int aDepth ) const;
549
553
557
560
561 BOARD();
562 ~BOARD();
563
564 VECTOR2I GetPosition() const override;
565 void SetPosition( const VECTOR2I& aPos ) override;
566 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
567
568 bool IsEmpty() const;
569
570 void Move( const VECTOR2I& aMoveVector ) override;
571
572 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
573
574 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
576
586
588
589 void bumpDrillModelFor( const std::vector<BOARD_ITEM*>& aItems );
590
595 void noteDrillModelChange( BOARD_ITEM* aItem );
596
603 const LSET& DrillSymbolLayers() const { return m_drillSymbolLayers; }
604
606
618 std::shared_ptr<const DRILL_SYMBOL_CACHE> DrillSymbolCache() const;
619
624 std::vector<const PCB_DRILL_MAP*> DrillMapsOnLayer( PCB_LAYER_ID aLayer ) const;
625
630 BOX2I ExpandBoundingBoxForDrillSymbols( const BOX2I& aBoundingBox ) const;
631
632 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
633 const wxString& GetGenerator() const { return m_generator; }
634
636 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
637 bool aSkipConnectivity = false ) override;
638
640 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
641
650 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
654
655 bool HasItemsOnLayer( PCB_LAYER_ID aLayer );
656
665 bool RemoveAllItemsOnLayer( PCB_LAYER_ID aLayer );
666
671 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
672
677 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
678
683 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
684
690 void FixupEmbeddedData();
691
692 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
693
694 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
695 const std::vector<ZONE*>& aZones = {} );
696
705 {
706 return m_footprints.empty() ? nullptr : m_footprints.front();
707 }
708
712 void DeleteAllFootprints();
713
717 void DetachAllFootprints();
718
723 BOARD_ITEM* ResolveItem( const KIID& aID, bool aAllowNullptrReturn = false ) const;
724
728 void RebindItemUuid( BOARD_ITEM* aItem, const KIID& aNewId );
729
738
739 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
740
744 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
745 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
746
751 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
752
758 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
759
763 void DeleteMARKERs();
764
765 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
766
767 PROJECT* GetProject() const { return m_project; }
768
777 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
778
779 void ClearProject();
780
788 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
789
793 void RecordDRCExclusions();
794
799
805 void CompileRatsnest();
806
810 void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
811 bool aMatchPadPositions,
812 bool aDeleteExtraTexts = true,
813 bool aResetTextLayers = true,
814 bool aResetTextEffects = true,
815 bool aResetTextPositions = true,
816 bool aResetTextContent = true,
817 bool aResetFabricationAttrs = true,
818 bool aResetClearanceOverrides = true,
819 bool aReset3DModels = true,
820 bool aResetTransform = false,
821 bool* aUpdated = nullptr, bool* aShifted = nullptr );
822
826 void ResetNetHighLight();
827
831 const std::set<int>& GetHighLightNetCodes() const
832 {
833 return m_highLight.m_netCodes;
834 }
835
842 void SetHighLightNet( int aNetCode, bool aMulti = false );
843
847 bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
848
856 void HighLightON( bool aValue = true );
857
862 {
863 HighLightON( false );
864 }
865
869 int GetCopperLayerCount() const;
870 void SetCopperLayerCount( int aCount );
871
872 int GetUserDefinedLayerCount() const;
873 void SetUserDefinedLayerCount( int aCount );
874
880
881 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
882
883 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
884
890 const LSET& GetEnabledLayers() const;
891 LSET GetLayerSet() const override { return GetEnabledLayers(); }
892
898 void SetEnabledLayers( const LSET& aLayerMask );
899 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
900
907 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
908
916 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
917
923 const LSET& GetVisibleLayers() const;
924
931 void SetVisibleLayers( const LSET& aLayerMask );
932
933 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
934 // are not stored in the bitmap.
935
943
950 void SetVisibleElements( const GAL_SET& aMask );
951
957 void SetVisibleAlls();
958
966 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
967
975 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
976
984 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
985
990 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
991
999 void InvalidateClearanceCache( const KIID& aUuid );
1000
1007
1009
1010 const PAGE_INFO& GetPageSettings() const { return m_paper; }
1011 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
1012
1014 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
1015
1017 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
1018 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
1019
1020 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
1021
1023 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
1024
1029 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
1030
1051 bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool aInferOutlineIfNecessary,
1052 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
1053 bool aAllowUseArcsInPolygons = false, bool aIncludeNPTHAsOutlines = false );
1054
1064
1078 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
1079
1083 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
1084
1091 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
1092
1100 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
1101
1112 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
1113 {
1114 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
1115 return LayerName( aLayerId );
1116 }
1117
1125 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
1126
1130 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
1131
1135 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
1136
1143 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
1144
1152 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
1153
1158 unsigned GetNodesCount( int aNet = -1 ) const;
1159
1168 const std::vector<PAD*> GetPads() const;
1169
1171 {
1172 m_NetInfo.buildListOfNets();
1173 }
1174
1181 NETINFO_ITEM* FindNet( int aNetcode ) const;
1182
1189 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
1190
1200 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
1201
1205 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
1206
1208 {
1209 return m_NetInfo;
1210 }
1211
1213 {
1214 m_NetInfo.RemoveUnusedNets( aCommit );
1215 }
1216
1218 bool RenameNets( const std::map<wxString, wxString>& aNewNames, REPORTER& aReporter )
1219 {
1220 return m_NetInfo.RenameNets( aNewNames, aReporter );
1221 }
1222
1227 {
1228 return m_NetInfo.begin();
1229 }
1230
1235 {
1236 return m_NetInfo.end();
1237 }
1238
1242 unsigned GetNetCount() const
1243 {
1244 return m_NetInfo.GetNetCount();
1245 }
1246
1251
1256
1263 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false, bool aPhysicalLayersOnly = false ) const;
1264
1265 const BOX2I GetBoundingBox() const override
1266 {
1267 return ComputeBoundingBox( false, false );
1268 }
1269
1280 {
1281 return ComputeBoundingBox( true, true );
1282 }
1283
1284 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1285
1297 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1298 const std::vector<KICAD_T>& scanTypes ) override;
1299
1308 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1309
1316 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1317
1318 PAD* FindPadByUuid( const KIID& aUuid ) const;
1319
1320 void ReplaceNetChainTerminalPad( const wxString& aNetChain, const KIID& aPrev, const KIID& aNew );
1321
1325 void SetNetChainColor( const wxString& aChain, const KIGFX::COLOR4D& aColor )
1326 {
1327 if( aColor == KIGFX::COLOR4D::UNSPECIFIED )
1328 m_netChainColors.erase( aChain );
1329 else
1330 m_netChainColors[aChain] = aColor;
1331 }
1332
1333 KIGFX::COLOR4D GetNetChainColor( const wxString& aChain ) const
1334 {
1335 auto it = m_netChainColors.find( aChain );
1336 return it != m_netChainColors.end() ? it->second : KIGFX::COLOR4D::UNSPECIFIED;
1337 }
1338
1339 const std::map<wxString, KIGFX::COLOR4D>& GetNetChainColors() const
1340 {
1341 return m_netChainColors;
1342 }
1343
1347 std::set<wxString> GetNetClassAssignmentCandidates() const;
1348
1356 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1357
1367
1371 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1372
1376 void SynchronizeProperties();
1377
1382
1386 double Similarity( const BOARD_ITEM& aOther ) const override
1387 {
1388 return 1.0;
1389 }
1390
1391 bool operator==( const BOARD_ITEM& aOther ) const override;
1392
1393 wxString GetClass() const override
1394 {
1395 return wxT( "BOARD" );
1396 }
1397
1398#if defined(DEBUG)
1399 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1400#endif
1401
1402
1403 /*************************/
1404 /* Copper Areas handling */
1405 /*************************/
1406
1417
1424 ZONE* GetArea( int index ) const
1425 {
1426 if( (unsigned) index < m_zones.size() )
1427 return m_zones[index];
1428
1429 return nullptr;
1430 }
1431
1435 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1436
1440 int GetAreaCount() const
1441 {
1442 return static_cast<int>( m_zones.size() );
1443 }
1444
1445 /* Functions used in test, merge and cut outlines */
1446
1459 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1460 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1461
1469 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1470
1478 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1479 PAD* GetPad( const VECTOR2I& aPosition ) const
1480 {
1481 return GetPad( aPosition, LSET().set() );
1482 }
1483
1491 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1492
1507 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1508
1520 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1521
1529 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1530
1538 TRACKS TracksInNet( int aNetCode );
1539
1552 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1553 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1554
1560 int GetMaxClearanceValue() const;
1561
1567 void MapNets( BOARD* aDestBoard );
1568
1569 void SanitizeNetcodes();
1570
1579 void AddListener( BOARD_LISTENER* aListener );
1580
1585 void RemoveListener( BOARD_LISTENER* aListener );
1586
1590 void RemoveAllListeners();
1591
1596 void OnItemChanged( BOARD_ITEM* aItem );
1597
1602 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1603
1608
1613 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1614 std::vector<BOARD_ITEM*>& aRemovedItems,
1615 std::vector<BOARD_ITEM*>& aChangedItems );
1616
1620 void OnRatsnestChanged();
1621
1625 void OnZonesFilled( const std::vector<ZONE*>& aZones );
1626
1633 wxString GroupsSanityCheck( bool repair = false );
1634
1640 wxString GroupsSanityCheckInternal( bool repair );
1641
1642 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1643 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1644
1645 EMBEDDED_FILES* GetEmbeddedFiles() override;
1646 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1647
1649
1653 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1654
1658 void EmbedFonts() override;
1659
1664
1669
1671
1681 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
1682
1687 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
1688
1689 const std::unordered_map<KIID, BOARD_ITEM*>& GetItemByIdCache() const
1690 {
1691 return m_itemByIdCache;
1692 }
1693
1694 bool IsItemIndexedById( const BOARD_ITEM* aItem ) const
1695 {
1696 return m_cachedIdByItem.contains( aItem );
1697 }
1698
1706 BOARD_ITEM* GetCachedItemById( const KIID& aId ) const;
1707
1714 void CacheItemById( BOARD_ITEM* aItem ) const;
1715
1722 void UncacheItemById( const KIID& aId ) const;
1723
1725 {
1726 wxCHECK( aItem, /* void */ );
1727
1728 CacheItemById( aItem );
1729
1730 aItem->RunOnChildren(
1731 [this]( BOARD_ITEM* aChild )
1732 {
1733 CacheItemSubtreeById( aChild );
1734 },
1736 }
1737
1738 void CacheChildrenById( const BOARD_ITEM* aParent )
1739 {
1740 wxCHECK( aParent, /* void */ );
1741
1742 aParent->RunOnChildren(
1743 [this]( BOARD_ITEM* aChild )
1744 {
1745 CacheItemSubtreeById( aChild );
1746 },
1748 }
1749
1751 {
1752 wxCHECK( aItem, /* void */ );
1753
1754 // Pointer-keyed eviction: never remove an entry that belongs to a
1755 // different live item with the same UUID (e.g. a temporary copy).
1756 UncacheItemByPtr( aItem );
1757
1758 aItem->RunOnChildren(
1759 [this]( BOARD_ITEM* aChild )
1760 {
1761 UncacheItemSubtreeById( aChild );
1762 },
1764 }
1765
1766 void UncacheChildrenById( const BOARD_ITEM* aParent )
1767 {
1768 wxCHECK( aParent, /* void */ );
1769
1770 aParent->RunOnChildren(
1771 [this]( BOARD_ITEM* aChild )
1772 {
1773 UncacheItemSubtreeById( aChild );
1774 },
1776 }
1777
1784 void UncacheItemByPtr( const BOARD_ITEM* aItem );
1785
1786 BOARD_ITEM* CacheAndReturnItemById( const KIID& aId, BOARD_ITEM* aItem ) const;
1787
1788 void ClearItemByIdCache();
1789
1790 // --------- Item order comparators ---------
1791
1793 {
1794 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1795 };
1796
1798 {
1799 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1800 };
1801
1802public:
1812 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> GetFootprintCourtyardIndex();
1813
1814 // ------------ Run-time caches -------------
1815 mutable std::shared_mutex m_CachesMutex;
1816 // These predicate caches are written per item-pair from every DRC worker thread, so they
1817 // carry their own internal sharded locks and are NOT covered by m_CachesMutex.
1831 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1832 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1833 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1834 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1835 mutable std::optional<int> m_maxClearanceValue;
1836
1837 mutable std::unordered_map<const BOARD_ITEM*, wxString> m_ItemNetclassCache;
1838
1839 // Microvias that land on another microvia, for isStackedVia(). Whole-board relation, so it
1840 // is built in one pass rather than per via.
1841 mutable std::optional<std::set<const PCB_VIA*>> m_StackedMicroviaCache;
1842
1843 // Zone name lookup cache for DRC rule area functions like enclosedByArea/intersectsArea.
1844 // Maps zone names to vectors of matching zones to avoid O(n) zone iteration per lookup.
1845 mutable std::unordered_map<wxString, std::vector<ZONE*>> m_ZonesByNameCache;
1846
1847 // Deflated zone outline cache for DRC area checks. Caches the deflated outline for each zone
1848 // to avoid repeated expensive deflation operations during collidesWithArea calls.
1849 mutable std::unordered_map<const ZONE*, SHAPE_POLY_SET> m_DeflatedZoneOutlineCache;
1850
1851 // Spatial index of footprint courtyards, built lazily by GetFootprintCourtyardIndex().
1852 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> m_footprintCourtyardIndex;
1853
1854 // ------------ DRC caches -------------
1855 std::vector<ZONE*> m_DRCZones;
1856 std::vector<ZONE*> m_DRCCopperZones;
1857 std::map<PCB_LAYER_ID, std::vector<ZONE*>> m_DRCCopperZonesByLayer;
1860 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1861 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1862
1863private:
1864 // The default copy constructor & operator= are inadequate,
1865 // either write one or do not use it at all
1866 BOARD( const BOARD& aOther ) = delete;
1867
1868 BOARD& operator=( const BOARD& aOther ) = delete;
1869
1870 template <typename Func, typename... Args>
1871 void InvokeListeners( Func&& aFunc, Args&&... args )
1872 {
1873 for( auto&& l : m_listeners )
1874 ( l->*aFunc )( std::forward<Args>( args )... );
1875 }
1876
1877 // Refresh user layer opposites.
1878 void recalcOpposites();
1879
1881 std::vector<BOARD_ITEM*> collectOwnedItems() const;
1882
1883 friend class PCB_EDIT_FRAME;
1884
1885private:
1888
1891 std::atomic<int> m_timeStamp; // actually a modification counter
1892
1893 wxString m_fileName;
1894
1895 std::map<wxString, KIGFX::COLOR4D> m_netChainColors;
1896
1897 // These containers only have const accessors and must only be modified by Add()/Remove()
1908
1909 // Cache for fast access to items in the containers above by KIID, including children.
1910 // Mutable because it's a performance cache that can be populated during const lookups.
1911 // NOT protected by m_CachesMutex. Only safe for single-threaded access (UI, serialization).
1912 mutable std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1913 mutable std::unordered_map<const BOARD_ITEM*, KIID> m_cachedIdByItem;
1914
1915 std::map<int, LAYER> m_layers; // layer data
1916
1917 HIGH_LIGHT_INFO m_highLight; // current high light data
1918 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1919
1920 int m_fileFormatVersionAtLoad; // the version loaded from the file
1924
1929 std::vector<std::pair<VECTOR2I, int>> m_drillSymbolPlacements;
1930
1931 mutable std::shared_ptr<const DRILL_SYMBOL_CACHE> m_drillSymbolCache;
1932 mutable std::mutex m_drillSymbolCacheMutex;
1933 wxString m_generator; // the generator tag from the file
1934
1935 std::map<wxString, wxString> m_properties;
1936 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1937
1938 // Sentinel whose expiry signals to LOCAL_HISTORY that this board has been destroyed.
1939 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
1940
1942 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1944 PROJECT* m_project; // project this board is a part of
1946
1947 // Variant system
1948 wxString m_currentVariant; // Currently active variant (empty = default)
1949 std::vector<wxString> m_variantNames; // All variant names in the board
1950 std::map<wxString, wxString> m_variantDescriptions; // Descriptions for each variant
1951
1962 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1963
1968 bool m_legacyTeardrops = false;
1969
1970 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1971
1972 std::vector<BOARD_LISTENER*> m_listeners;
1973
1975
1976 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1977 // of all the parent's embedded data.
1979
1980 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1981 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1982
1983 // Reactive text-variable dependency adapter. Installed as a listener
1984 // during BOARD construction; destructor order ensures it outlives no
1985 // listener calls.
1986 std::unique_ptr<class BOARD_TEXT_VAR_ADAPTER> m_textVarAdapter;
1987
1988public:
1990};
1991
1992
1993#endif // CLASS_BOARD_H_
int index
BOARD_USE
Flags to specify how the board is being used.
Definition board.h:399
@ FPHOLDER
Definition board.h:401
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:241
@ LT_POWER
Definition board.h:244
@ LT_FRONT
Definition board.h:248
@ LT_MIXED
Definition board.h:245
@ LT_BACK
Definition board.h:249
@ LT_UNDEFINED
Definition board.h:242
@ LT_JUMPER
Definition board.h:246
@ LT_AUX
Definition board.h:247
@ LT_SIGNAL
Definition board.h:243
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition board.h:393
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
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:84
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:86
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
Definition board_item.h:264
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
Definition board.h:377
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition board.h:382
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:374
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:378
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:375
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:373
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition board.h:381
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:376
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition board.h:383
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:379
virtual ~BOARD_LISTENER()
Definition board.h:372
virtual void OnBoardSelectionChanged(BOARD &aBoard)
Definition board.h:380
Manage layers needed to make a physical board.
Bridges BOARD's listener stream into the generic TEXT_VAR_TRACKER.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
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:2828
ZONE * m_SolderMaskBridges
Definition board.h:1860
void ApplyNetChainNetclasses()
Expand the project's chain-to-netclass assignments into per-net pattern assignments,...
Definition board.cpp:3362
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:656
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:1288
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:3639
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition board.h:1014
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1861
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:1158
std::vector< const PCB_DRILL_MAP * > DrillMapsOnLayer(PCB_LAYER_ID aLayer) const
Every map on this layer.
Definition board.cpp:202
GENERATORS m_generators
Definition board.h:1905
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:3999
std::shared_ptr< void > m_historyLifetime
Definition board.h:1939
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1207
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition board.h:555
BOARD_TEXT_VAR_ADAPTER * GetTextVarAdapter() const
Definition board.h:1989
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition board.h:439
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition board.cpp:3489
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1821
int GetUserDefinedLayerCount() const
Definition board.cpp:1147
void recalcOpposites()
Definition board.cpp:1064
void CacheItemSubtreeById(BOARD_ITEM *aItem)
Definition board.h:1724
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:814
std::map< wxString, wxString > m_properties
Definition board.h:1935
bool RenameNets(const std::map< wxString, wxString > &aNewNames, REPORTER &aReporter)
Rename nets without changing net codes or connectivity.
Definition board.h:1218
void CacheItemById(BOARD_ITEM *aItem) const
Add an item to the item-by-id cache.
Definition board.cpp:2265
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsCourtyardResultCache
Definition board.h:1824
std::unordered_map< const BOARD_ITEM *, wxString > m_ItemNetclassCache
Definition board.h:1837
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:3825
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition board.h:1823
int m_fileFormatVersionAtLoad
Definition board.h:1920
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:3047
void UncacheItemById(const KIID &aId) const
Remove an item from the item-by-id cache.
Definition board.cpp:2308
void SetCurrentVariant(const wxString &aVariant)
Definition board.cpp:3152
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1856
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:1216
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition board.h:428
void SetVariantNames(const std::vector< wxString > &aNames)
Definition board.h:525
const std::vector< wxString > & GetVariantNames() const
Definition board.h:524
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1497
std::shared_ptr< const DRILL_SYMBOL_CACHE > m_drillSymbolCache
Definition board.h:1931
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:831
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaResultCache
Definition board.h:1829
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:3936
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition board.h:444
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition board.h:1968
TITLE_BLOCK m_titles
Definition board.h:1942
GAL_SET m_LegacyVisibleItems
Definition board.h:552
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition board.h:421
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition board.h:1424
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool aMatchPadPositions, bool aDeleteExtraTexts=true, bool aResetTextLayers=true, bool aResetTextEffects=true, bool aResetTextPositions=true, bool aResetTextContent=true, bool aResetFabricationAttrs=true, bool aResetClearanceOverrides=true, bool aReset3DModels=true, bool aResetTransform=false, bool *aUpdated=nullptr, bool *aShifted=nullptr)
Replace aExisting with aNew, preserving connectivity and metadata.
std::vector< wxString > m_variantNames
Definition board.h:1949
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1279
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1265
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1663
wxArrayString GetVariantNamesForUI() const
Return the variant names for UI display.
Definition board.cpp:3342
void BuildListOfNets()
Definition board.h:1170
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:1418
void SetNetChainColor(const wxString &aChain, const KIGFX::COLOR4D &aColor)
Per-net-chain colour override (empty COLOR4D::UNSPECIFIED = no override).
Definition board.h:1325
const GENERATORS & Generators() const
Definition board.h:476
void SetFileName(const wxString &aFileName)
Definition board.h:450
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition board.h:1112
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:3901
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition board.h:891
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:1250
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1887
uint64_t m_drillModelGeneration
Definition board.h:1921
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:3650
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:3118
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1890
void RefreshDrillSymbolLayers()
Definition board.cpp:234
void CopyVariant(const wxString &aOldName, const wxString &aNewName, const wxString &aNewDescription=wxEmptyString)
Definition board.cpp:3271
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:478
PAGE_INFO m_paper
Definition board.h:1941
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3993
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1820
FOOTPRINTS m_footprints
Definition board.h:1900
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:1962
friend class PCB_EDIT_FRAME
Definition board.h:1883
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1648
const PCB_POINTS & Points() const
Definition board.h:490
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:4247
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:3974
const PAGE_INFO & GetPageSettings() const
Definition board.h:1010
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition board.cpp:2018
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:518
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:989
const std::map< wxString, KIGFX::COLOR4D > & GetNetChainColors() const
Definition board.h:1339
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1244
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:4056
void CompileRatsnest()
Rebuild the entire board ratsnest.
Definition board.cpp:4039
HIGH_LIGHT_INFO m_highLight
Definition board.h:1917
std::map< wxString, wxString > m_variantDescriptions
Definition board.h:1950
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:908
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2980
EDA_UNITS m_userUnits
Definition board.h:1945
CONSTRAINTS m_constraints
Definition board.h:1903
void UpdateBoardOutline()
Definition board.cpp:4462
const ZONES & Zones() const
Definition board.h:467
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition board.cpp:1649
void ClearItemByIdCache()
Definition board.cpp:2397
void DeleteVariant(const wxString &aVariantName)
Definition board.cpp:3195
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1871
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1305
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1197
void SanitizeNetcodes()
Definition board.cpp:3954
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1318
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1978
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:3759
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:983
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition board.h:509
~BOARD()
Definition board.cpp:327
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Serialize board into HISTORY_FILE_DATA for non-blocking history commit.
Definition board.cpp:4510
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:364
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:1210
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:995
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition board.cpp:569
DRAWINGS m_drawings
Definition board.h:1899
uint64_t m_boardOutlineGeneration
Definition board.h:1922
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:4022
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:3455
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3402
EDA_UNITS GetUserUnits()
Definition board.h:1022
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:4047
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1943
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1818
const LSET & DrillSymbolLayers() const
Layers that currently have a drill map on them.
Definition board.h:603
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:954
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:3739
std::weak_ptr< void > GetHistoryLifetimeToken() const
Liveness token handed to LOCAL_HISTORY::RegisterSaver so a shared autosave timer skips this board's s...
Definition board.h:1687
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:686
const MARKERS & Markers() const
Definition board.h:488
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:704
uint64_t GetDrillModelGeneration() const
Definition board.h:587
void UncacheChildrenById(const BOARD_ITEM *aParent)
Definition board.h:1766
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1124
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:3887
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:820
std::unique_ptr< class BOARD_TEXT_VAR_ADAPTER > m_textVarAdapter
Definition board.h:1986
TITLE_BLOCK & GetTitleBlock()
Definition board.h:1016
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1425
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1325
ZONES m_zones
Definition board.h:1904
void InvalidateClearanceCache(const KIID &aUuid)
Invalidate the clearance cache for a specific item.
Definition board.cpp:1311
PAD * GetPad(const VECTOR2I &aPosition) const
Definition board.h:1479
PAD * FindPadByUuid(const KIID &aUuid) const
Definition board.cpp:3086
void OnBoardSelectionChanged()
Notify the board and its listeners that the editor selection has changed.
Definition board.cpp:4016
std::unordered_map< const BOARD_ITEM *, KIID > m_cachedIdByItem
Definition board.h:1913
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:916
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1918
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition board.h:566
void HighLightOFF()
Disable net highlight.
Definition board.h:861
NETINFO_LIST m_NetInfo
Definition board.h:1970
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition board.h:551
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition board.cpp:1233
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:1063
std::shared_ptr< const DRILL_SYMBOL_CACHE > DrillSymbolCache() const
Resolved drill symbols, by group and by owning item.
Definition board.cpp:260
bool HasVariant(const wxString &aVariantName) const
Definition board.cpp:3178
NETINFO_LIST::iterator EndNets() const
Definition board.h:1234
void AddVariant(const wxString &aVariantName)
Definition board.cpp:3184
int GetCopperLayerCount() const
Definition board.cpp:1131
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1972
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:1932
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:517
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutCache
Definition board.h:1822
void IncrementTimeStamp()
Definition board.cpp:446
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:2999
wxString GetUniqueZoneName(const wxString &aBaseName, const ZONE *aExclude=nullptr) const
Return a name based on aBaseName that is not used by any other zone or rule area on the board.
Definition board.cpp:1446
PCB_POINTS m_points
Definition board.h:1907
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1981
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:1212
const FOOTPRINTS & Footprints() const
Definition board.h:463
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1936
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:3843
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:1782
const BOARD_ITEM_SET GetItemSet()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
Definition board.cpp:4377
const TRACKS & Tracks() const
Definition board.h:461
int m_DRCMaxPhysicalClearance
Definition board.h:1859
const PCB_BOARD_OUTLINE * BoardOutline() const
Definition board.h:479
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition board.cpp:3074
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:1640
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:1011
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1831
BOARD_ITEM * GetCachedItemById(const KIID &aId) const
Return a cached item for aId if the entry is still self-consistent.
Definition board.cpp:2248
bool m_embedFonts
Definition board.h:1974
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:4095
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > m_footprintCourtyardIndex
Definition board.h:1852
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:4033
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:2551
wxString GetClass() const override
Return the class name.
Definition board.h:1393
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1980
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1819
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
Definition board.h:513
NETINFO_LIST::iterator BeginNets() const
Definition board.h:1226
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:3784
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:559
void SetCopperLayerCount(int aCount)
Definition board.cpp:1137
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1834
std::unordered_map< const ZONE *, SHAPE_POLY_SET > m_DeflatedZoneOutlineCache
Definition board.h:1849
wxString m_generator
Definition board.h:1933
std::vector< BOARD_ITEM * > collectOwnedItems() const
Get a simple vector of the board's pointers.
Definition board.cpp:4355
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsFCourtyardResultCache
Definition board.h:1825
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:886
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:374
PROJECT * m_project
Definition board.h:1944
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:3675
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1886
const wxString & GetFileName() const
Definition board.h:452
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:4394
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition board.cpp:595
int GetPadWithCastellatedAttrCount()
Definition board.cpp:4492
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutResultCache
Definition board.h:1828
wxString GetVariantDescription(const wxString &aVariantName) const
Definition board.cpp:3306
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:3062
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2704
bool IsHighLightNetON() const
Definition board.h:847
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition board.cpp:2506
SHARDED_CACHE< ITEM_FIELD_CACHE_KEY, wxString > m_ItemFieldCache
Definition board.h:1830
int GetFileFormatVersionAtLoad() const
Definition board.h:575
std::map< PCB_LAYER_ID, std::vector< ZONE * > > m_DRCCopperZonesByLayer
Definition board.h:1857
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1256
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1833
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:1014
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:1013
std::optional< std::set< const PCB_VIA * > > m_StackedMicroviaCache
Definition board.h:1841
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1893
const wxString & GetGenerator() const
Adds an item to the container.
Definition board.h:633
int GetAreaCount() const
Definition board.h:1440
BOX2I ExpandBoundingBoxForDrillSymbols(const BOX2I &aBoundingBox) const
Include every displaced copy of a hole-owned drill symbol in its view bounds.
Definition board.cpp:295
void DetachAllFootprints()
Remove all footprints without deleting.
Definition board.cpp:2089
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1643
std::map< int, LAYER > m_layers
Definition board.h:1915
void noteDrillModelChange(BOARD_ITEM *aItem)
Container-boundary notification, so an item that arrives or leaves without going through a commit sti...
Definition board.cpp:216
wxString GetCurrentVariant() const
Definition board.h:521
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition board.cpp:841
int GetOutlinesChainingEpsilon()
Definition board.h:1062
void BumpDrillModelGeneration()
Bumped whenever anything a drill chart or map reports on has moved.
Definition board.cpp:176
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:3624
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
Definition board.cpp:3964
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:1189
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsAreaResultCache
Definition board.h:1827
int m_DRCMaxClearance
Definition board.h:1858
void ClearProject()
Definition board.cpp:415
void ReplaceNetChainTerminalPad(const wxString &aNetChain, const KIID &aPrev, const KIID &aNew)
Definition board.cpp:3098
void UncacheItemByPtr(const BOARD_ITEM *aItem)
Remove every cache entry that still points to aItem.
Definition board.cpp:2371
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:899
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1832
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:1631
wxString m_currentVariant
Definition board.h:1948
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:1171
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:2077
PROJECT * GetProject() const
Definition board.h:767
bool IsEmpty() const
Definition board.cpp:802
int GetPadWithPressFitAttrCount()
Definition board.cpp:4474
bool LegacyTeardrops() const
Definition board.h:1642
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:2790
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:1017
KIGFX::COLOR4D GetNetChainColor(const wxString &aChain) const
Definition board.h:1333
wxString GetDesignRulesPath() const
Return the absolute path to the design rules file for this board.
Definition board.cpp:435
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition board.cpp:4081
void RenameVariant(const wxString &aOldName, const wxString &aNewName)
Definition board.cpp:3223
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1299
uint64_t GetBoardOutlineGeneration() const
Bumped by every UpdateBoardOutline(), so anything deriving geometry from the edge cuts can tell wheth...
Definition board.h:486
std::vector< ZONE * > m_DRCZones
Definition board.h:1855
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1183
void SetGenerator(const wxString &aGenerator)
Definition board.h:632
BOARD()
Definition board.cpp:95
void bumpDrillModelFor(const std::vector< BOARD_ITEM * > &aItems)
Definition board.cpp:314
std::vector< std::pair< VECTOR2I, int > > m_drillSymbolPlacements
Offset and symbol reach of every drill map, so a pad or track ViewBBox() does not walk the drawings l...
Definition board.h:1929
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:538
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition board.cpp:2631
void RebindItemUuid(BOARD_ITEM *aItem, const KIID &aNewId)
Rebind the UUID of an attached item and keep the item-by-id cache coherent.
Definition board.cpp:2407
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2433
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:3132
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition board.h:1912
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:3981
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1668
std::shared_mutex m_CachesMutex
Definition board.h:1815
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition board.cpp:2721
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > GetFootprintCourtyardIndex()
Return a spatial index of footprint courtyards, building it on first use.
Definition board.cpp:514
unsigned GetNetCount() const
Definition board.h:1242
std::atomic< int > m_timeStamp
Definition board.h:1891
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
Definition board.h:1689
std::mutex m_drillSymbolCacheMutex
Definition board.h:1932
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:3446
BOARD_ITEM * CacheAndReturnItemById(const KIID &aId, BOARD_ITEM *aItem) const
Definition board.cpp:2328
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:2040
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1668
std::unordered_map< wxString, std::vector< ZONE * > > m_ZonesByNameCache
Definition board.h:1845
GROUPS m_groups
Definition board.h:1902
PROJECT::ELEM ProjectElementType() override
Definition board.h:1670
MARKERS m_markers
Definition board.h:1898
bool IsItemIndexedById(const BOARD_ITEM *aItem) const
Definition board.h:1694
LSET m_drillSymbolLayers
Definition board.h:1923
std::optional< int > m_maxClearanceValue
Definition board.h:1835
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:4071
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1203
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:1018
void CacheChildrenById(const BOARD_ITEM *aParent)
Definition board.h:1738
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:3356
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1901
std::map< wxString, KIGFX::COLOR4D > m_netChainColors
Definition board.h:1895
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:2116
bool m_LegacyCopperEdgeClearanceLoaded
Definition board.h:556
int GetTimeStamp() const
Definition board.h:432
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:4008
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsBCourtyardResultCache
Definition board.h:1826
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:751
VECTOR2I GetPosition() const override
Definition board.cpp:808
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Definition board.cpp:3325
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition board.cpp:1357
static bool ClassOf(const EDA_ITEM *aItem)
Definition board.h:411
void SetUserUnits(EDA_UNITS aUnits)
Definition board.h:1023
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1223
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:3870
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1386
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1906
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:1153
const DRAWINGS & Drawings() const
Definition board.h:465
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition board.cpp:2012
void UncacheItemSubtreeById(const BOARD_ITEM *aItem)
Definition board.h:1750
void SetFileFormatVersionAtLoad(int aVersion)
Definition board.h:574
constexpr const Vec GetCenter() const
Definition box2.h:227
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:45
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:84
EMBEDDED_FILES()=default
Spatial index over footprint courtyard bounding boxes.
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:425
void Clear()
Definition board.h:317
friend class BOARD
Definition board.h:329
std::set< int > m_netCodes
Definition board.h:314
bool m_highLightOn
Definition board.h:315
Class OUTLINE_FONT implements outline font drawing.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:399
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:63
Definition kiid.h:46
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:50
Handle the data for a net.
Definition netinfo.h:50
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition netinfo.h:305
Container for NETINFO_ITEM elements, which are the nets.
Definition netinfo.h:231
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:61
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Turns on drill symbols at the holes, for one layer.
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:51
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:90
Container for project specific data.
Definition project.h:63
ELEM
The set of #_ELEMs that a PROJECT can hold.
Definition project.h:69
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
Represent a set of closed polygons.
A concurrent key/value cache split into independently locked shards.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:38
Handle a list of polygons defining a copper zone.
Definition zone.h:70
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
@ NO_RECURSE
Definition eda_item.h:52
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:44
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:28
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:224
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
STL namespace.
std::vector< ZONE * > ZONES
std::vector< PCB_MARKER * > MARKERS
std::deque< FOOTPRINT * > FOOTPRINTS
std::deque< PCB_TRACK * > TRACKS
std::deque< PCB_GROUP * > GROUPS
std::deque< PCB_CONSTRAINT * > CONSTRAINTS
std::deque< PCB_GENERATOR * > GENERATORS
std::deque< BOARD_ITEM * > DRAWINGS
std::deque< PCB_POINT * > PCB_POINTS
ENDPOINT_T
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:4185
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:4164
What moved, so a drill consumer can decide whether it cares.
Definition board.h:348
DRILL_CHART_TOTALS m_Totals
Counts for the ${DRILL_*} text variables.
Definition board.h:356
uint64_t m_Profile
Definition board.h:365
std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > m_ByItem
Definition board.h:350
uint64_t m_Generation
Definition board.h:364
BOX2I m_HoleExtent
Extent of every hole that carries a mark.
Definition board.h:362
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > m_ByGroup
Definition board.h:349
Data produced by a registered saver on the UI thread, consumed by either the background local-history...
A struct recording the isolated and single-pad islands within a zone.
Definition zone.h:57
std::size_t FieldHash
Definition board.h:153
bool operator==(const ITEM_FIELD_CACHE_KEY &other) const
Definition board.h:155
const BOARD_ITEM * A
Definition board.h:152
bool operator==(const ITEM_SELECTOR_LAYER_CACHE_KEY &other) const
Definition board.h:142
const BOARD_ITEM * A
Definition board.h:137
LAYERS_CHECKED(PCB_LAYER_ID aLayer)
Definition board.h:168
bool has_error
Definition board.h:174
LSET layers
Definition board.h:173
int m_opposite
Similar layer on opposite side of the board, if any.
Definition board.h:289
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition board.cpp:1043
void clear()
Definition board.h:263
LAYER_T m_type
The type of the layer.
Definition board.h:286
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition board.cpp:1027
LAYER()
Definition board.h:258
wxString m_name
The canonical name of the layer.
Definition board.h:284
wxString m_userName
The user defined name of the layer.
Definition board.h:285
bool m_visible
Definition board.h:287
int m_number
The layer ID.
Definition board.h:288
BOARD_ITEM * A
Definition board.h:112
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition board.h:115
PCB_LAYER_ID Layer
Definition board.h:113
BOARD_ITEM * A
Definition board.h:101
BOARD_ITEM * B
Definition board.h:102
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition board.h:104
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition board.h:127
BOARD_ITEM * B
Definition board.h:124
BOARD_ITEM * A
Definition board.h:123
PCB_LAYER_ID Layer
Definition board.h:125
std::size_t operator()(const ITEM_FIELD_CACHE_KEY &k) const
Definition board.h:227
std::size_t operator()(const ITEM_SELECTOR_LAYER_CACHE_KEY &k) const
Definition board.h:216
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition board.h:194
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition board.h:183
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition board.h:205
netlist clear()
@ PCB_T
Definition typeinfo.h:74
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:80
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:83
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:103
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:100
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:91
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition typeinfo.h:102
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.