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>
25#include <functional>
28#include <core/mirror.h>
32#include <embedded_files.h>
33#include <convert_shape_list_to_polygon.h> // for OUTLINE_ERROR_HANDLER
35#include <hash.h>
36#include <layer_ids.h>
37#include <lset.h>
38#include <netinfo.h>
39#include <pcb_item_containers.h>
40#include <pcb_plot_params.h>
41#include <title_block.h>
42#include <zone_settings.h>
43#include <shared_mutex>
44#include <sharded_cache.h>
45#include <unordered_set>
46#include <project.h>
47#include <list>
48
52class BOARD_COMMIT;
54class DRC_RTREE;
55class PCB_BASE_FRAME;
56class PCB_EDIT_FRAME;
59class BOARD;
60class FOOTPRINT;
62class ZONE;
63class PCB_TRACK;
64class PCB_VIA;
65class PAD;
66class PCB_DRILL_MAP;
67class PCB_GROUP;
68class PCB_GENERATOR;
69class PCB_MARKER;
70class MSG_PANEL_ITEM;
71class NETLIST;
72class REPORTER;
74class COMPONENT;
75class PROJECT;
78
79namespace KIGFX
80{
81class RENDER_SETTINGS;
82};
83
84
85namespace KIFONT
86{
87 class OUTLINE_FONT;
88}
89
90struct ISOLATED_ISLANDS;
91
92// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
93// It is the max dist between 2 end points to see them connected
94#define DEFAULT_CHAINING_EPSILON_MM 0.01
95
96// Forward declare endpoint from class_track.h
97enum ENDPOINT_T : int;
98
99
101{
104
105 bool operator==(const PTR_PTR_CACHE_KEY& other) const
106 {
107 return A == other.A && B == other.B;
108 }
109};
110
112{
115
116 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
117 {
118 return A == other.A && Layer == other.Layer;
119 }
120};
121
123{
127
128 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
129 {
130 return A == other.A && B == other.B && Layer == other.Layer;
131 }
132};
133
134// Caches the whole-predicate result of a footprint-selector query (e.g. intersectsCourtyard)
135// for one item, so a rule set that repeats the same condition does not re-scan every footprint.
137{
138 const BOARD_ITEM* A;
139 wxString Selector; // the selector argument string, compared verbatim
141 int Constraint; // some predicates (intersectsArea) branch on the constraint
142
143 bool operator==( const ITEM_SELECTOR_LAYER_CACHE_KEY& other ) const
144 {
145 return A == other.A && Selector == other.Selector && Layer == other.Layer
146 && Constraint == other.Constraint;
147 }
148};
149
150// Caches getField('x') text per (item, field name)
152{
153 const BOARD_ITEM* A;
154 std::size_t FieldHash;
155
156 bool operator==( const ITEM_FIELD_CACHE_KEY& other ) const
157 {
158 return A == other.A && FieldHash == other.FieldHash;
159 }
160};
161
163{
165 layers(),
166 has_error( false )
167 {}
168
170 layers( { aLayer } ),
171 has_error( false )
172 {}
173
176};
177
178
179namespace std
180{
181 template <>
182 struct hash<PTR_PTR_CACHE_KEY>
183 {
184 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
185 {
186 std::size_t seed = 0xa82de1c0;
187 hash_combine( seed, k.A, k.B );
188 return seed;
189 }
190 };
191
192 template <>
194 {
195 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
196 {
197 std::size_t seed = 0xa82de1c0;
198 hash_combine( seed, k.A, k.Layer );
199 return seed;
200 }
201 };
202
203 template <>
205 {
206 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
207 {
208 std::size_t seed = 0xa82de1c0;
209 hash_combine( seed, k.A, k.B, k.Layer );
210 return seed;
211 }
212 };
213
214 template <>
216 {
217 std::size_t operator()( const ITEM_SELECTOR_LAYER_CACHE_KEY& k ) const
218 {
219 std::size_t seed = 0xa82de1c0;
220 hash_combine( seed, k.A, k.Selector, k.Layer, k.Constraint );
221 return seed;
222 }
223 };
224
225 template <>
227 {
228 std::size_t operator()( const ITEM_FIELD_CACHE_KEY& k ) const
229 {
230 std::size_t seed = 0xa82de1c0;
231 hash_combine( seed, k.A, k.FieldHash );
232 return seed;
233 }
234 };
235}
236
237
252
253
257struct LAYER
258{
260 {
261 clear();
262 }
263
264 void clear()
265 {
267 m_visible = true;
268 m_number = 0;
269 m_name.clear();
270 m_userName.clear();
272 }
273
274 /*
275 LAYER( const wxString& aName = wxEmptyString,
276 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
277 m_name( aName ),
278 m_type( aType ),
279 m_visible( aVisible ),
280 m_number( aNumber )
281 {
282 }
283 */
284
285 wxString m_name;
286 wxString m_userName;
291
298 static const char* ShowType( LAYER_T aType );
299
307 static LAYER_T ParseType( const char* aType );
308};
309
310
311// Helper class to handle high light nets
313{
314protected:
315 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
316 bool m_highLightOn; // highlight active
317
318 void Clear()
319 {
320 m_netCodes.clear();
321 m_highLightOn = false;
322 }
323
325 {
326 Clear();
327 }
328
329private:
330 friend class BOARD;
331};
332
338class BOARD;
339
349{
350 std::map<std::string, DRILL_SYMBOL_ASSIGNMENT> m_ByGroup;
351 std::map<KIID, std::vector<DRILL_SYMBOL_ENTRY>> m_ByItem;
352
358
364
365 uint64_t m_Generation = 0;
366 uint64_t m_Profile = 0;
367};
368
369
371{
372public:
373 virtual ~BOARD_LISTENER() { }
374 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
375 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
376 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
377 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
378 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
379 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
380 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
381 virtual void OnBoardSelectionChanged( BOARD& aBoard ) { }
382 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
383 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
384 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
385 std::vector<BOARD_ITEM*>& aRemovedItems,
386 std::vector<BOARD_ITEM*>& aChangedItems )
387 {
388 }
389};
390
394typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
395
399enum class BOARD_USE
400{
401 NORMAL, // A normal board
402 FPHOLDER // A board that holds a single footprint
403};
404
405
410{
411public:
412 static inline bool ClassOf( const EDA_ITEM* aItem )
413 {
414 return aItem && PCB_T == aItem->Type();
415 }
416
422 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
423
429 BOARD_USE GetBoardUse() const { return m_boardUse; }
430
431 void IncrementTimeStamp();
432
433 int GetTimeStamp() const { return m_timeStamp.load( std::memory_order_acquire ); }
434
440 bool IsFootprintHolder() const
441 {
443 }
444
445 PCB_LAYER_ID GetLayer() const override
446 {
447 wxFAIL_MSG( wxT( "BOARD::GetLayer() desn't have meaning. Don't call it." ) );
448 return UNDEFINED_LAYER;
449 }
450
451 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
452
453 const wxString &GetFileName() const { return m_fileName; }
454
460 wxString GetDesignRulesPath() const;
461
462 const TRACKS& Tracks() const { return m_tracks; }
463
464 const FOOTPRINTS& Footprints() const { return m_footprints; }
465
466 const DRAWINGS& Drawings() const { return m_drawings; }
467
468 const ZONES& Zones() const { return m_zones; }
469
475 wxString GetUniqueZoneName( const wxString& aBaseName, const ZONE* aExclude = nullptr ) const;
476
481 static wxString MakeUniqueZoneName( const wxString& aBaseName,
482 const std::function<bool( const wxString& )>& aInUse );
483
484 const GENERATORS& Generators() const { return m_generators; }
485
488 void UpdateBoardOutline();
489
495
496 const MARKERS& Markers() const { return m_markers; }
497
498 const PCB_POINTS& Points() const { return m_points; }
499
503
507 const BOARD_ITEM_SET GetItemSet() const;
508
517 const GROUPS& Groups() const { return m_groups; }
518
521 const CONSTRAINTS& Constraints() const { return m_constraints; }
522
523 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
524
525 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
526 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
527
528 // Variant system
529 wxString GetCurrentVariant() const { return m_currentVariant; }
530 void SetCurrentVariant( const wxString& aVariant );
531
532 const std::vector<wxString>& GetVariantNames() const { return m_variantNames; }
533 void SetVariantNames( const std::vector<wxString>& aNames ) { m_variantNames = aNames; }
534
535 bool HasVariant( const wxString& aVariantName ) const;
536 void AddVariant( const wxString& aVariantName );
537 void DeleteVariant( const wxString& aVariantName );
538 void RenameVariant( const wxString& aOldName, const wxString& aNewName );
539 void CopyVariant( const wxString& aOldName, const wxString& aNewName,
540 const wxString& aNewDescription = wxEmptyString );
541
542 wxString GetVariantDescription( const wxString& aVariantName ) const;
543 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
544
553 wxArrayString GetVariantNamesForUI() const;
554
555 void GetContextualTextVars( wxArrayString* aVars ) const;
556 bool ResolveTextVar( wxString* token, int aDepth ) const;
557 bool ResolveTextVar( wxString* token, const wxString& aVariantName, int aDepth ) const;
558
562
566
569
570 BOARD();
571 ~BOARD();
572
573 VECTOR2I GetPosition() const override;
574 void SetPosition( const VECTOR2I& aPos ) override;
575 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
576
577 bool IsEmpty() const;
578
579 void Move( const VECTOR2I& aMoveVector ) override;
580
581 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
582
583 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
585
595
597
598 void bumpDrillModelFor( const std::vector<BOARD_ITEM*>& aItems );
599
604 void noteDrillModelChange( BOARD_ITEM* aItem );
605
612 const LSET& DrillSymbolLayers() const { return m_drillSymbolLayers; }
613
615
627 std::shared_ptr<const DRILL_SYMBOL_CACHE> DrillSymbolCache() const;
628
633 std::vector<const PCB_DRILL_MAP*> DrillMapsOnLayer( PCB_LAYER_ID aLayer ) const;
634
639 BOX2I ExpandBoundingBoxForDrillSymbols( const BOX2I& aBoundingBox ) const;
640
641 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
642 const wxString& GetGenerator() const { return m_generator; }
643
644 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
645 bool aSkipConnectivity = false ) override;
646
648 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
649
658 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
662
663 bool HasItemsOnLayer( PCB_LAYER_ID aLayer );
664
673 bool RemoveAllItemsOnLayer( PCB_LAYER_ID aLayer );
674
679 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
680
685 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
686
691 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
692
698 void FixupEmbeddedData();
699
700 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
701
702 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
703 const std::vector<ZONE*>& aZones = {} );
704
713 {
714 return m_footprints.empty() ? nullptr : m_footprints.front();
715 }
716
720 void DeleteAllFootprints();
721
725 void DetachAllFootprints();
726
731 BOARD_ITEM* ResolveItem( const KIID& aID, bool aAllowNullptrReturn = false ) const;
732
736 void RebindItemUuid( BOARD_ITEM* aItem, const KIID& aNewId );
737
746
747 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
748
752 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
753 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
754
759 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
760
766 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
767
771 void DeleteMARKERs();
772
773 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
774
775 PROJECT* GetProject() const { return m_project; }
776
785 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
786
787 void ClearProject();
788
796 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
797
801 void RecordDRCExclusions();
802
807
813 void CompileRatsnest();
814
818 void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
819 bool aMatchPadPositions,
820 bool aDeleteExtraTexts = true,
821 bool aResetTextLayers = true,
822 bool aResetTextEffects = true,
823 bool aResetTextPositions = true,
824 bool aResetTextContent = true,
825 bool aResetFabricationAttrs = true,
826 bool aResetClearanceOverrides = true,
827 bool aReset3DModels = true,
828 bool aResetTransform = false,
829 bool* aUpdated = nullptr, bool* aShifted = nullptr );
830
834 void ResetNetHighLight();
835
839 const std::set<int>& GetHighLightNetCodes() const
840 {
841 return m_highLight.m_netCodes;
842 }
843
850 void SetHighLightNet( int aNetCode, bool aMulti = false );
851
855 bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
856
864 void HighLightON( bool aValue = true );
865
870 {
871 HighLightON( false );
872 }
873
877 int GetCopperLayerCount() const;
878 void SetCopperLayerCount( int aCount );
879
880 int GetUserDefinedLayerCount() const;
881 void SetUserDefinedLayerCount( int aCount );
882
888
889 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
890
891 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
892
898 const LSET& GetEnabledLayers() const;
899 LSET GetLayerSet() const override { return GetEnabledLayers(); }
900
906 void SetEnabledLayers( const LSET& aLayerMask );
907 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
908
915 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
916
924 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
925
931 const LSET& GetVisibleLayers() const;
932
939 void SetVisibleLayers( const LSET& aLayerMask );
940
941 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
942 // are not stored in the bitmap.
943
951
958 void SetVisibleElements( const GAL_SET& aMask );
959
965 void SetVisibleAlls();
966
974 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
975
983 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
984
992 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
993
998 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
999
1007 void InvalidateClearanceCache( const KIID& aUuid );
1008
1015
1017
1018 const PAGE_INFO& GetPageSettings() const { return m_paper; }
1019 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
1020
1022 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
1023
1025 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
1026 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
1027
1028 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
1029
1031 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
1032
1037 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
1038
1059 bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool aInferOutlineIfNecessary,
1060 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
1061 bool aAllowUseArcsInPolygons = false, bool aIncludeNPTHAsOutlines = false );
1062
1072
1086 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
1087
1091 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
1092
1099 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
1100
1108 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
1109
1120 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
1121 {
1122 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
1123 return LayerName( aLayerId );
1124 }
1125
1133 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
1134
1138 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
1139
1143 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
1144
1151 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
1152
1160 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
1161
1166 unsigned GetNodesCount( int aNet = -1 ) const;
1167
1176 const std::vector<PAD*> GetPads() const;
1177
1179 {
1180 m_NetInfo.buildListOfNets();
1181 }
1182
1189 NETINFO_ITEM* FindNet( int aNetcode ) const;
1190
1197 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
1198
1208 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
1209
1213 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
1214
1216 {
1217 return m_NetInfo;
1218 }
1219
1221 {
1222 m_NetInfo.RemoveUnusedNets( aCommit );
1223 }
1224
1226 bool RenameNets( const std::map<wxString, wxString>& aNewNames, REPORTER& aReporter )
1227 {
1228 return m_NetInfo.RenameNets( aNewNames, aReporter );
1229 }
1230
1235 {
1236 return m_NetInfo.begin();
1237 }
1238
1243 {
1244 return m_NetInfo.end();
1245 }
1246
1250 unsigned GetNetCount() const
1251 {
1252 return m_NetInfo.GetNetCount();
1253 }
1254
1259
1264
1272 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false, bool aPhysicalLayersOnly = false ) const;
1273
1274 const BOX2I GetBoundingBox() const override
1275 {
1276 return ComputeBoundingBox( false, false );
1277 }
1278
1289 {
1290 return ComputeBoundingBox( true, true );
1291 }
1292
1293 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1294
1306 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1307 const std::vector<KICAD_T>& scanTypes ) override;
1308
1317 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1318
1325 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1326
1327 PAD* FindPadByUuid( const KIID& aUuid ) const;
1328
1329 void ReplaceNetChainTerminalPad( const wxString& aNetChain, const KIID& aPrev, const KIID& aNew );
1330
1334 void SetNetChainColor( const wxString& aChain, const KIGFX::COLOR4D& aColor )
1335 {
1336 if( aColor == KIGFX::COLOR4D::UNSPECIFIED )
1337 m_netChainColors.erase( aChain );
1338 else
1339 m_netChainColors[aChain] = aColor;
1340 }
1341
1342 KIGFX::COLOR4D GetNetChainColor( const wxString& aChain ) const
1343 {
1344 auto it = m_netChainColors.find( aChain );
1345 return it != m_netChainColors.end() ? it->second : KIGFX::COLOR4D::UNSPECIFIED;
1346 }
1347
1348 const std::map<wxString, KIGFX::COLOR4D>& GetNetChainColors() const
1349 {
1350 return m_netChainColors;
1351 }
1352
1356 std::set<wxString> GetNetClassAssignmentCandidates() const;
1357
1365 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1366
1376
1380 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1381
1385 void SynchronizeProperties();
1386
1391
1395 double Similarity( const BOARD_ITEM& aOther ) const override
1396 {
1397 return 1.0;
1398 }
1399
1400 bool operator==( const BOARD_ITEM& aOther ) const override;
1401
1402 wxString GetClass() const override
1403 {
1404 return wxT( "BOARD" );
1405 }
1406
1407#if defined(DEBUG)
1408 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1409#endif
1410
1411
1412 /*************************/
1413 /* Copper Areas handling */
1414 /*************************/
1415
1426
1433 ZONE* GetArea( int index ) const
1434 {
1435 if( (unsigned) index < m_zones.size() )
1436 return m_zones[index];
1437
1438 return nullptr;
1439 }
1440
1444 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1445
1449 int GetAreaCount() const
1450 {
1451 return static_cast<int>( m_zones.size() );
1452 }
1453
1454 /* Functions used in test, merge and cut outlines */
1455
1468 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1469 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1470
1478 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1479
1487 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1488 PAD* GetPad( const VECTOR2I& aPosition ) const
1489 {
1490 return GetPad( aPosition, LSET().set() );
1491 }
1492
1500 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1501
1516 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1517
1529 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1530
1538 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1539
1547 TRACKS TracksInNet( int aNetCode );
1548
1561 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1562 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1563
1569 int GetMaxClearanceValue() const;
1570
1576 void MapNets( BOARD* aDestBoard );
1577
1578 void SanitizeNetcodes();
1579
1588 void AddListener( BOARD_LISTENER* aListener );
1589
1594 void RemoveListener( BOARD_LISTENER* aListener );
1595
1599 void RemoveAllListeners();
1600
1605 void OnItemChanged( BOARD_ITEM* aItem );
1606
1611 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1612
1617
1622 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1623 std::vector<BOARD_ITEM*>& aRemovedItems,
1624 std::vector<BOARD_ITEM*>& aChangedItems );
1625
1629 void OnRatsnestChanged();
1630
1634 void OnZonesFilled( const std::vector<ZONE*>& aZones );
1635
1642 wxString GroupsSanityCheck( bool repair = false );
1643
1649 wxString GroupsSanityCheckInternal( bool repair );
1650
1651 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1652 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1653
1654 EMBEDDED_FILES* GetEmbeddedFiles() override;
1655 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1656
1658
1662 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1663
1667 void EmbedFonts() override;
1668
1673
1678
1680
1690 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
1691
1696 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
1697
1698 const std::unordered_map<KIID, BOARD_ITEM*>& GetItemByIdCache() const
1699 {
1700 return m_itemByIdCache;
1701 }
1702
1703 bool IsItemIndexedById( const BOARD_ITEM* aItem ) const
1704 {
1705 return m_cachedIdByItem.contains( aItem );
1706 }
1707
1715 BOARD_ITEM* GetCachedItemById( const KIID& aId ) const;
1716
1723 void CacheItemById( BOARD_ITEM* aItem ) const;
1724
1731 void UncacheItemById( const KIID& aId ) const;
1732
1734 {
1735 wxCHECK( aItem, /* void */ );
1736
1737 CacheItemById( aItem );
1738
1739 aItem->RunOnChildren(
1740 [this]( BOARD_ITEM* aChild )
1741 {
1742 CacheItemSubtreeById( aChild );
1743 },
1745 }
1746
1747 void CacheChildrenById( const BOARD_ITEM* aParent )
1748 {
1749 wxCHECK( aParent, /* void */ );
1750
1751 aParent->RunOnChildren(
1752 [this]( BOARD_ITEM* aChild )
1753 {
1754 CacheItemSubtreeById( aChild );
1755 },
1757 }
1758
1760 {
1761 wxCHECK( aItem, /* void */ );
1762
1763 // Pointer-keyed eviction: never remove an entry that belongs to a
1764 // different live item with the same UUID (e.g. a temporary copy).
1765 UncacheItemByPtr( aItem );
1766
1767 aItem->RunOnChildren(
1768 [this]( BOARD_ITEM* aChild )
1769 {
1770 UncacheItemSubtreeById( aChild );
1771 },
1773 }
1774
1775 void UncacheChildrenById( const BOARD_ITEM* aParent )
1776 {
1777 wxCHECK( aParent, /* void */ );
1778
1779 aParent->RunOnChildren(
1780 [this]( BOARD_ITEM* aChild )
1781 {
1782 UncacheItemSubtreeById( aChild );
1783 },
1785 }
1786
1793 void UncacheItemByPtr( const BOARD_ITEM* aItem );
1794
1795 BOARD_ITEM* CacheAndReturnItemById( const KIID& aId, BOARD_ITEM* aItem ) const;
1796
1797 void ClearItemByIdCache();
1798
1799 // --------- Item order comparators ---------
1800
1802 {
1803 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1804 };
1805
1807 {
1808 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1809 };
1810
1811public:
1821 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> GetFootprintCourtyardIndex();
1822
1823 // ------------ Run-time caches -------------
1824 mutable std::shared_mutex m_CachesMutex;
1825 // These predicate caches are written per item-pair from every DRC worker thread, so they
1826 // carry their own internal sharded locks and are NOT covered by m_CachesMutex.
1840 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1841 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1842 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1843 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1844 mutable std::optional<int> m_maxClearanceValue;
1845
1846 // Microvias that land on another microvia, for isStackedVia(). Whole-board relation, so it
1847 // is built in one pass rather than per via.
1848 mutable std::optional<std::set<const PCB_VIA*>> m_StackedMicroviaCache;
1849
1850 // Zone name lookup cache for DRC rule area functions like enclosedByArea/intersectsArea.
1851 // Maps zone names to vectors of matching zones to avoid O(n) zone iteration per lookup.
1852 mutable std::unordered_map<wxString, std::vector<ZONE*>> m_ZonesByNameCache;
1853
1854 // Deflated zone outline cache for DRC area checks. Caches the deflated outline for each zone
1855 // to avoid repeated expensive deflation operations during collidesWithArea calls.
1856 mutable std::unordered_map<const ZONE*, SHAPE_POLY_SET> m_DeflatedZoneOutlineCache;
1857
1858 // Spatial index of footprint courtyards, built lazily by GetFootprintCourtyardIndex().
1859 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> m_footprintCourtyardIndex;
1860
1861 // ------------ DRC caches -------------
1862 std::vector<ZONE*> m_DRCZones;
1863 std::vector<ZONE*> m_DRCCopperZones;
1864 std::map<PCB_LAYER_ID, std::vector<ZONE*>> m_DRCCopperZonesByLayer;
1867 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1868 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1869
1875 {
1876 auto it = m_CopperZoneRTreeCache.find( aZone );
1877
1878 return it != m_CopperZoneRTreeCache.end() ? it->second.get() : nullptr;
1879 }
1880
1881private:
1882 // The default copy constructor & operator= are inadequate,
1883 // either write one or do not use it at all
1884 BOARD( const BOARD& aOther ) = delete;
1885
1886 BOARD& operator=( const BOARD& aOther ) = delete;
1887
1888 template <typename Func, typename... Args>
1889 void InvokeListeners( Func&& aFunc, Args&&... args )
1890 {
1891 for( auto&& l : m_listeners )
1892 ( l->*aFunc )( std::forward<Args>( args )... );
1893 }
1894
1895 // Refresh user layer opposites.
1896 void recalcOpposites();
1897
1899 std::vector<BOARD_ITEM*> collectOwnedItems() const;
1900
1901 friend class PCB_EDIT_FRAME;
1902
1903private:
1906
1909 std::atomic<int> m_timeStamp; // actually a modification counter
1910
1911 wxString m_fileName;
1912
1913 std::map<wxString, KIGFX::COLOR4D> m_netChainColors;
1914
1915 // These containers only have const accessors and must only be modified by Add()/Remove()
1926
1927 // Cache for fast access to items in the containers above by KIID, including children.
1928 // Mutable because it's a performance cache that can be populated during const lookups.
1929 // NOT protected by m_CachesMutex. Only safe for single-threaded access (UI, serialization).
1930 mutable std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1931 mutable std::unordered_map<const BOARD_ITEM*, KIID> m_cachedIdByItem;
1932
1933 std::map<int, LAYER> m_layers; // layer data
1934
1935 HIGH_LIGHT_INFO m_highLight; // current high light data
1936 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1937
1938 int m_fileFormatVersionAtLoad; // the version loaded from the file
1942
1947 std::vector<std::pair<VECTOR2I, int>> m_drillSymbolPlacements;
1948
1949 mutable std::shared_ptr<const DRILL_SYMBOL_CACHE> m_drillSymbolCache;
1950 mutable std::mutex m_drillSymbolCacheMutex;
1951 wxString m_generator; // the generator tag from the file
1952
1953 std::map<wxString, wxString> m_properties;
1954 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1955
1956 // Sentinel whose expiry signals to LOCAL_HISTORY that this board has been destroyed.
1957 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
1958
1960 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1962 PROJECT* m_project; // project this board is a part of
1964
1965 // Variant system
1966 wxString m_currentVariant; // Currently active variant (empty = default)
1967 std::vector<wxString> m_variantNames; // All variant names in the board
1968 std::map<wxString, wxString> m_variantDescriptions; // Descriptions for each variant
1969
1980 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1981
1986 bool m_legacyTeardrops = false;
1987
1988 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1989
1990 std::vector<BOARD_LISTENER*> m_listeners;
1991
1993
1994 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1995 // of all the parent's embedded data.
1997
1998 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1999 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
2000
2001 // Reactive text-variable dependency adapter. Installed as a listener
2002 // during BOARD construction; destructor order ensures it outlives no
2003 // listener calls.
2004 std::unique_ptr<class BOARD_TEXT_VAR_ADAPTER> m_textVarAdapter;
2005
2006public:
2008};
2009
2010
2011#endif // CLASS_BOARD_H_
int index
BOARD_USE
Flags to specify how the board is being used.
Definition board.h:400
@ FPHOLDER
Definition board.h:402
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:242
@ LT_POWER
Definition board.h:245
@ LT_FRONT
Definition board.h:249
@ LT_MIXED
Definition board.h:246
@ LT_BACK
Definition board.h:250
@ LT_UNDEFINED
Definition board.h:243
@ LT_JUMPER
Definition board.h:247
@ LT_AUX
Definition board.h:248
@ LT_SIGNAL
Definition board.h:244
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition board.h:394
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
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:378
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition board.h:383
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:375
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:379
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:376
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:374
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition board.h:382
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:377
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition board.h:384
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:380
virtual ~BOARD_LISTENER()
Definition board.h:373
virtual void OnBoardSelectionChanged(BOARD &aBoard)
Definition board.h:381
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:410
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:2849
ZONE * m_SolderMaskBridges
Definition board.h:1867
void ApplyNetChainNetclasses()
Expand the project's chain-to-netclass assignments into per-net pattern assignments,...
Definition board.cpp:3383
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:657
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:1290
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:3660
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition board.h:1022
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1868
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:1165
std::vector< const PCB_DRILL_MAP * > DrillMapsOnLayer(PCB_LAYER_ID aLayer) const
Every map on this layer.
Definition board.cpp:205
GENERATORS m_generators
Definition board.h:1923
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:4020
std::shared_ptr< void > m_historyLifetime
Definition board.h:1957
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1215
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition board.h:564
BOARD_TEXT_VAR_ADAPTER * GetTextVarAdapter() const
Definition board.h:2007
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition board.h:440
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition board.cpp:3510
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1830
int GetUserDefinedLayerCount() const
Definition board.cpp:1154
void recalcOpposites()
Definition board.cpp:1071
void CacheItemSubtreeById(BOARD_ITEM *aItem)
Definition board.h:1733
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:821
std::map< wxString, wxString > m_properties
Definition board.h:1953
bool RenameNets(const std::map< wxString, wxString > &aNewNames, REPORTER &aReporter)
Rename nets without changing net codes or connectivity.
Definition board.h:1226
void CacheItemById(BOARD_ITEM *aItem) const
Add an item to the item-by-id cache.
Definition board.cpp:2292
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsCourtyardResultCache
Definition board.h:1833
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:3846
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition board.h:1832
int m_fileFormatVersionAtLoad
Definition board.h:1938
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:3068
void UncacheItemById(const KIID &aId) const
Remove an item from the item-by-id cache.
Definition board.cpp:2335
void SetCurrentVariant(const wxString &aVariant)
Definition board.cpp:3173
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1863
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:1218
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition board.h:429
void SetVariantNames(const std::vector< wxString > &aNames)
Definition board.h:533
const std::vector< wxString > & GetVariantNames() const
Definition board.h:532
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1524
std::shared_ptr< const DRILL_SYMBOL_CACHE > m_drillSymbolCache
Definition board.h:1949
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:839
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaResultCache
Definition board.h:1838
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:3957
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition board.h:445
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition board.h:1986
TITLE_BLOCK m_titles
Definition board.h:1960
GAL_SET m_LegacyVisibleItems
Definition board.h:561
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition board.h:422
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition board.h:1433
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:1967
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1288
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1274
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1672
wxArrayString GetVariantNamesForUI() const
Return the variant names for UI display.
Definition board.cpp:3363
void BuildListOfNets()
Definition board.h:1178
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:1442
void SetNetChainColor(const wxString &aChain, const KIGFX::COLOR4D &aColor)
Per-net-chain colour override (empty COLOR4D::UNSPECIFIED = no override).
Definition board.h:1334
const GENERATORS & Generators() const
Definition board.h:484
void SetFileName(const wxString &aFileName)
Definition board.h:451
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition board.h:1120
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:3922
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition board.h:899
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:1252
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1905
uint64_t m_drillModelGeneration
Definition board.h:1939
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:3671
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:3139
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1908
void RefreshDrillSymbolLayers()
Definition board.cpp:237
void CopyVariant(const wxString &aOldName, const wxString &aNewName, const wxString &aNewDescription=wxEmptyString)
Definition board.cpp:3292
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:486
PAGE_INFO m_paper
Definition board.h:1959
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:4014
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1829
FOOTPRINTS m_footprints
Definition board.h:1918
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:1980
friend class PCB_EDIT_FRAME
Definition board.h:1901
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1657
const PCB_POINTS & Points() const
Definition board.h:498
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:4268
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:3995
const PAGE_INFO & GetPageSettings() const
Definition board.h:1018
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition board.cpp:2045
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:526
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:996
const std::map< wxString, KIGFX::COLOR4D > & GetNetChainColors() const
Definition board.h:1348
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1246
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:4077
void CompileRatsnest()
Rebuild the entire board ratsnest.
Definition board.cpp:4060
HIGH_LIGHT_INFO m_highLight
Definition board.h:1935
std::map< wxString, wxString > m_variantDescriptions
Definition board.h:1968
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:915
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:3001
EDA_UNITS m_userUnits
Definition board.h:1963
CONSTRAINTS m_constraints
Definition board.h:1921
void UpdateBoardOutline()
Definition board.cpp:4483
const ZONES & Zones() const
Definition board.h:468
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition board.cpp:1676
void ClearItemByIdCache()
Definition board.cpp:2418
void DeleteVariant(const wxString &aVariantName)
Definition board.cpp:3216
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1889
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1307
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1199
void SanitizeNetcodes()
Definition board.cpp:3975
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1323
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1996
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:3780
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:990
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition board.h:517
~BOARD()
Definition board.cpp:330
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:4531
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:367
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:1212
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:1002
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition board.cpp:570
DRAWINGS m_drawings
Definition board.h:1917
uint64_t m_boardOutlineGeneration
Definition board.h:1940
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:4043
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:3476
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3423
EDA_UNITS GetUserUnits()
Definition board.h:1030
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:4068
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1961
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1827
const LSET & DrillSymbolLayers() const
Layers that currently have a drill map on them.
Definition board.h:612
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:961
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:3760
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:1696
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:687
const MARKERS & Markers() const
Definition board.h:496
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:712
uint64_t GetDrillModelGeneration() const
Definition board.h:596
void UncacheChildrenById(const BOARD_ITEM *aParent)
Definition board.h:1775
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1131
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:3908
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:827
std::unique_ptr< class BOARD_TEXT_VAR_ADAPTER > m_textVarAdapter
Definition board.h:2004
TITLE_BLOCK & GetTitleBlock()
Definition board.h:1024
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1449
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1330
ZONES m_zones
Definition board.h:1922
void InvalidateClearanceCache(const KIID &aUuid)
Invalidate the clearance cache for a specific item.
Definition board.cpp:1316
PAD * GetPad(const VECTOR2I &aPosition) const
Definition board.h:1488
PAD * FindPadByUuid(const KIID &aUuid) const
Definition board.cpp:3107
void OnBoardSelectionChanged()
Notify the board and its listeners that the editor selection has changed.
Definition board.cpp:4037
std::unordered_map< const BOARD_ITEM *, KIID > m_cachedIdByItem
Definition board.h:1931
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:923
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1936
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition board.h:575
void HighLightOFF()
Disable net highlight.
Definition board.h:869
NETINFO_LIST m_NetInfo
Definition board.h:1988
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition board.h:560
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition board.cpp:1235
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:1071
std::shared_ptr< const DRILL_SYMBOL_CACHE > DrillSymbolCache() const
Resolved drill symbols, by group and by owning item.
Definition board.cpp:263
bool HasVariant(const wxString &aVariantName) const
Definition board.cpp:3199
NETINFO_LIST::iterator EndNets() const
Definition board.h:1242
void AddVariant(const wxString &aVariantName)
Definition board.cpp:3205
int GetCopperLayerCount() const
Definition board.cpp:1138
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1990
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:1959
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:525
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutCache
Definition board.h:1831
void IncrementTimeStamp()
Definition board.cpp:449
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:3020
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:1470
PCB_POINTS m_points
Definition board.h:1925
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1999
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:1220
const FOOTPRINTS & Footprints() const
Definition board.h:464
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1954
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:3864
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:1809
const BOARD_ITEM_SET GetItemSet()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
Definition board.cpp:4398
const TRACKS & Tracks() const
Definition board.h:462
int m_DRCMaxPhysicalClearance
Definition board.h:1866
const PCB_BOARD_OUTLINE * BoardOutline() const
Definition board.h:487
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition board.cpp:3095
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:1667
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:1019
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1840
BOARD_ITEM * GetCachedItemById(const KIID &aId) const
Return a cached item for aId if the entry is still self-consistent.
Definition board.cpp:2275
bool m_embedFonts
Definition board.h:1992
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:4116
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > m_footprintCourtyardIndex
Definition board.h:1859
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:4054
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:2572
wxString GetClass() const override
Return the class name.
Definition board.h:1402
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1998
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1828
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
Definition board.h:521
NETINFO_LIST::iterator BeginNets() const
Definition board.h:1234
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:3805
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:568
void SetCopperLayerCount(int aCount)
Definition board.cpp:1144
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1843
std::unordered_map< const ZONE *, SHAPE_POLY_SET > m_DeflatedZoneOutlineCache
Definition board.h:1856
wxString m_generator
Definition board.h:1951
std::vector< BOARD_ITEM * > collectOwnedItems() const
Get a simple vector of the board's pointers.
Definition board.cpp:4376
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsFCourtyardResultCache
Definition board.h:1834
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:893
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:377
PROJECT * m_project
Definition board.h:1962
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:3696
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1913
const wxString & GetFileName() const
Definition board.h:453
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:4415
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition board.cpp:596
int GetPadWithCastellatedAttrCount()
Definition board.cpp:4513
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutResultCache
Definition board.h:1837
wxString GetVariantDescription(const wxString &aVariantName) const
Definition board.cpp:3327
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:3083
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2725
bool IsHighLightNetON() const
Definition board.h:855
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition board.cpp:2527
SHARDED_CACHE< ITEM_FIELD_CACHE_KEY, wxString > m_ItemFieldCache
Definition board.h:1839
int GetFileFormatVersionAtLoad() const
Definition board.h:584
std::map< PCB_LAYER_ID, std::vector< ZONE * > > m_DRCCopperZonesByLayer
Definition board.h:1864
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1258
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1842
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:1021
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:1021
std::optional< std::set< const PCB_VIA * > > m_StackedMicroviaCache
Definition board.h:1848
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1911
const wxString & GetGenerator() const
Definition board.h:642
int GetAreaCount() const
Definition board.h:1449
BOX2I ExpandBoundingBoxForDrillSymbols(const BOX2I &aBoundingBox) const
Include every displaced copy of a hole-owned drill symbol in its view bounds.
Definition board.cpp:298
void DetachAllFootprints()
Remove all footprints without deleting.
Definition board.cpp:2116
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1652
std::map< int, LAYER > m_layers
Definition board.h:1933
void noteDrillModelChange(BOARD_ITEM *aItem)
Container-boundary notification, so an item that arrives or leaves without going through a commit sti...
Definition board.cpp:219
wxString GetCurrentVariant() const
Definition board.h:529
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition board.cpp:848
int GetOutlinesChainingEpsilon()
Definition board.h:1070
void BumpDrillModelGeneration()
Bumped whenever anything a drill chart or map reports on has moved.
Definition board.cpp:179
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:3645
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
Definition board.cpp:3985
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:1191
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsAreaResultCache
Definition board.h:1836
int m_DRCMaxClearance
Definition board.h:1865
void ClearProject()
Definition board.cpp:418
void ReplaceNetChainTerminalPad(const wxString &aNetChain, const KIID &aPrev, const KIID &aNew)
Definition board.cpp:3119
void UncacheItemByPtr(const BOARD_ITEM *aItem)
Remove every cache entry that still points to aItem.
Definition board.cpp:2398
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:907
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1841
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:1658
wxString m_currentVariant
Definition board.h:1966
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:1178
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:2104
PROJECT * GetProject() const
Definition board.h:775
bool IsEmpty() const
Definition board.cpp:809
int GetPadWithPressFitAttrCount()
Definition board.cpp:4495
bool LegacyTeardrops() const
Definition board.h:1651
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:2811
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:1025
KIGFX::COLOR4D GetNetChainColor(const wxString &aChain) const
Definition board.h:1342
wxString GetDesignRulesPath() const
Return the absolute path to the design rules file for this board.
Definition board.cpp:438
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition board.cpp:4102
void RenameVariant(const wxString &aOldName, const wxString &aNewName)
Definition board.cpp:3244
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1301
uint64_t GetBoardOutlineGeneration() const
Bumped by every UpdateBoardOutline(), so anything deriving geometry from the edge cuts can tell wheth...
Definition board.h:494
std::vector< ZONE * > m_DRCZones
Definition board.h:1862
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1185
void SetGenerator(const wxString &aGenerator)
Definition board.h:641
BOARD()
Definition board.cpp:98
void bumpDrillModelFor(const std::vector< BOARD_ITEM * > &aItems)
Definition board.cpp:317
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:1947
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition board.cpp:539
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition board.cpp:2652
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:2428
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2454
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:3153
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition board.h:1930
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:4002
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1677
std::shared_mutex m_CachesMutex
Definition board.h:1824
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition board.cpp:2742
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > GetFootprintCourtyardIndex()
Return a spatial index of footprint courtyards, building it on first use.
Definition board.cpp:515
unsigned GetNetCount() const
Definition board.h:1250
static wxString MakeUniqueZoneName(const wxString &aBaseName, const std::function< bool(const wxString &)> &aInUse)
Return a name based on aBaseName for which aInUse returns false, adding or incrementing a _<number> s...
Definition board.cpp:1487
std::atomic< int > m_timeStamp
Definition board.h:1909
const std::unordered_map< KIID, BOARD_ITEM * > & GetItemByIdCache() const
Definition board.h:1698
std::mutex m_drillSymbolCacheMutex
Definition board.h:1950
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:3467
BOARD_ITEM * CacheAndReturnItemById(const KIID &aId, BOARD_ITEM *aItem) const
Definition board.cpp:2355
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:2067
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1695
std::unordered_map< wxString, std::vector< ZONE * > > m_ZonesByNameCache
Definition board.h:1852
GROUPS m_groups
Definition board.h:1920
PROJECT::ELEM ProjectElementType() override
Definition board.h:1679
MARKERS m_markers
Definition board.h:1916
bool IsItemIndexedById(const BOARD_ITEM *aItem) const
Definition board.h:1703
LSET m_drillSymbolLayers
Definition board.h:1941
std::optional< int > m_maxClearanceValue
Definition board.h:1844
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:4092
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1205
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:1026
void CacheChildrenById(const BOARD_ITEM *aParent)
Definition board.h:1747
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:3377
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1919
std::map< wxString, KIGFX::COLOR4D > m_netChainColors
Definition board.h:1913
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:2143
bool m_LegacyCopperEdgeClearanceLoaded
Definition board.h:565
int GetTimeStamp() const
Definition board.h:433
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:4029
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsBCourtyardResultCache
Definition board.h:1835
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:759
VECTOR2I GetPosition() const override
Definition board.cpp:815
DRC_RTREE * GetCopperZoneRTree(ZONE *aZone) const
Look up a zone's filled-copper R-tree.
Definition board.h:1874
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Definition board.cpp:3346
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition board.cpp:1362
static bool ClassOf(const EDA_ITEM *aItem)
Definition board.h:412
void SetUserUnits(EDA_UNITS aUnits)
Definition board.h:1031
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1225
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:3891
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1395
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1924
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:1160
const DRAWINGS & Drawings() const
Definition board.h:466
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition board.cpp:2039
void UncacheItemSubtreeById(const BOARD_ITEM *aItem)
Definition board.h:1759
void SetFileFormatVersionAtLoad(int aVersion)
Definition board.h:583
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:46
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:318
friend class BOARD
Definition board.h:330
std::set< int > m_netCodes
Definition board.h:315
bool m_highLightOn
Definition board.h:316
Implement 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:400
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:306
Container for NETINFO_ITEM elements, which are the nets.
Definition netinfo.h:232
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 _ELEM objects 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:4206
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:4185
What moved, so a drill consumer can decide whether it cares.
Definition board.h:349
DRILL_CHART_TOTALS m_Totals
Counts for the ${DRILL_*} text variables.
Definition board.h:357
uint64_t m_Profile
Definition board.h:366
std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > m_ByItem
Definition board.h:351
uint64_t m_Generation
Definition board.h:365
BOX2I m_HoleExtent
Extent of every hole that carries a mark.
Definition board.h:363
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > m_ByGroup
Definition board.h:350
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:154
bool operator==(const ITEM_FIELD_CACHE_KEY &other) const
Definition board.h:156
const BOARD_ITEM * A
Definition board.h:153
bool operator==(const ITEM_SELECTOR_LAYER_CACHE_KEY &other) const
Definition board.h:143
const BOARD_ITEM * A
Definition board.h:138
LAYERS_CHECKED(PCB_LAYER_ID aLayer)
Definition board.h:169
bool has_error
Definition board.h:175
LSET layers
Definition board.h:174
int m_opposite
Similar layer on opposite side of the board, if any.
Definition board.h:290
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition board.cpp:1050
void clear()
Definition board.h:264
LAYER_T m_type
The type of the layer.
Definition board.h:287
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition board.cpp:1034
LAYER()
Definition board.h:259
wxString m_name
The canonical name of the layer.
Definition board.h:285
wxString m_userName
The user defined name of the layer.
Definition board.h:286
bool m_visible
Definition board.h:288
int m_number
The layer ID.
Definition board.h:289
BOARD_ITEM * A
Definition board.h:113
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition board.h:116
PCB_LAYER_ID Layer
Definition board.h:114
BOARD_ITEM * A
Definition board.h:102
BOARD_ITEM * B
Definition board.h:103
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition board.h:105
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition board.h:128
BOARD_ITEM * B
Definition board.h:125
BOARD_ITEM * A
Definition board.h:124
PCB_LAYER_ID Layer
Definition board.h:126
std::size_t operator()(const ITEM_FIELD_CACHE_KEY &k) const
Definition board.h:228
std::size_t operator()(const ITEM_SELECTOR_LAYER_CACHE_KEY &k) const
Definition board.h:217
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition board.h:195
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition board.h:184
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition board.h:206
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:708
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.