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#pragma once
22
23#include <atomic>
24#include <functional>
26#include <board_item_index.h>
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;
79
80namespace KIGFX
81{
82class RENDER_SETTINGS;
83};
84
85
86namespace KIFONT
87{
88 class OUTLINE_FONT;
89}
90
91struct ISOLATED_ISLANDS;
92
93// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
94// It is the max dist between 2 end points to see them connected
95#define DEFAULT_CHAINING_EPSILON_MM 0.01
96
97// Forward declare endpoint from class_track.h
98enum ENDPOINT_T : int;
99
100
102{
105
106 bool operator==(const PTR_PTR_CACHE_KEY& other) const
107 {
108 return A == other.A && B == other.B;
109 }
110};
111
113{
116
117 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
118 {
119 return A == other.A && Layer == other.Layer;
120 }
121};
122
124{
128
129 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
130 {
131 return A == other.A && B == other.B && Layer == other.Layer;
132 }
133};
134
135// Caches the whole-predicate result of a footprint-selector query (e.g. intersectsCourtyard)
136// for one item, so a rule set that repeats the same condition does not re-scan every footprint.
138{
139 const BOARD_ITEM* A;
140 wxString Selector; // the selector argument string, compared verbatim
142 int Constraint; // some predicates (intersectsArea) branch on the constraint
143
144 bool operator==( const ITEM_SELECTOR_LAYER_CACHE_KEY& other ) const
145 {
146 return A == other.A && Selector == other.Selector && Layer == other.Layer
147 && Constraint == other.Constraint;
148 }
149};
150
151// Caches getField('x') text per (item, field name)
153{
154 const BOARD_ITEM* A;
155 std::size_t FieldHash;
156
157 bool operator==( const ITEM_FIELD_CACHE_KEY& other ) const
158 {
159 return A == other.A && FieldHash == other.FieldHash;
160 }
161};
162
164{
166 layers(),
167 has_error( false )
168 {}
169
171 layers( { aLayer } ),
172 has_error( false )
173 {}
174
177};
178
179
180namespace std
181{
182 template <>
183 struct hash<PTR_PTR_CACHE_KEY>
184 {
185 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
186 {
187 std::size_t seed = 0xa82de1c0;
188 hash_combine( seed, k.A, k.B );
189 return seed;
190 }
191 };
192
193 template <>
195 {
196 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
197 {
198 std::size_t seed = 0xa82de1c0;
199 hash_combine( seed, k.A, k.Layer );
200 return seed;
201 }
202 };
203
204 template <>
206 {
207 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
208 {
209 std::size_t seed = 0xa82de1c0;
210 hash_combine( seed, k.A, k.B, k.Layer );
211 return seed;
212 }
213 };
214
215 template <>
217 {
218 std::size_t operator()( const ITEM_SELECTOR_LAYER_CACHE_KEY& k ) const
219 {
220 std::size_t seed = 0xa82de1c0;
221 hash_combine( seed, k.A, k.Selector, k.Layer, k.Constraint );
222 return seed;
223 }
224 };
225
226 template <>
228 {
229 std::size_t operator()( const ITEM_FIELD_CACHE_KEY& k ) const
230 {
231 std::size_t seed = 0xa82de1c0;
232 hash_combine( seed, k.A, k.FieldHash );
233 return seed;
234 }
235 };
236}
237
238
253
254
258struct LAYER
259{
261 {
262 clear();
263 }
264
265 void clear()
266 {
268 m_visible = true;
269 m_number = 0;
270 m_name.clear();
271 m_userName.clear();
273 }
274
275 /*
276 LAYER( const wxString& aName = wxEmptyString,
277 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
278 m_name( aName ),
279 m_type( aType ),
280 m_visible( aVisible ),
281 m_number( aNumber )
282 {
283 }
284 */
285
286 wxString m_name;
287 wxString m_userName;
292
299 static const char* ShowType( LAYER_T aType );
300
308 static LAYER_T ParseType( const char* aType );
309};
310
311
312// Helper class to handle high light nets
314{
315protected:
316 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
317 bool m_highLightOn; // highlight active
318
319 void Clear()
320 {
321 m_netCodes.clear();
322 m_highLightOn = false;
323 }
324
326 {
327 Clear();
328 }
329
330private:
331 friend class BOARD;
332};
333
339class BOARD;
340
350{
351 std::map<std::string, DRILL_SYMBOL_ASSIGNMENT> m_ByGroup;
352 std::map<KIID, std::vector<DRILL_SYMBOL_ENTRY>> m_ByItem;
353
359
365
366 uint64_t m_Generation = 0;
367 uint64_t m_Profile = 0;
368};
369
370
372{
373public:
374 virtual ~BOARD_LISTENER() { }
375 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
376 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
377 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
378 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
379 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
380 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
381 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems ) { }
382 virtual void OnBoardSelectionChanged( BOARD& aBoard ) { }
383 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
384 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
385 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
386 std::vector<BOARD_ITEM*>& aRemovedItems,
387 std::vector<BOARD_ITEM*>& aChangedItems )
388 {
389 }
390};
391
395typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
396
400enum class BOARD_USE
401{
402 NORMAL, // A normal board
403 FPHOLDER // A board that holds a single footprint
404};
405
406
411{
412public:
413 static inline bool ClassOf( const EDA_ITEM* aItem )
414 {
415 return aItem && PCB_T == aItem->Type();
416 }
417
423 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
424
430 BOARD_USE GetBoardUse() const { return m_boardUse; }
431
432 void IncrementTimeStamp();
433
434 int GetTimeStamp() const { return m_timeStamp.load( std::memory_order_acquire ); }
435
441 bool IsFootprintHolder() const
442 {
444 }
445
446 PCB_LAYER_ID GetLayer() const override
447 {
448 wxFAIL_MSG( wxT( "BOARD::GetLayer() desn't have meaning. Don't call it." ) );
449 return UNDEFINED_LAYER;
450 }
451
452 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
453
454 const wxString &GetFileName() const { return m_fileName; }
455
461 wxString GetDesignRulesPath() const;
462
463 const TRACKS& Tracks() const { return m_tracks; }
464
465 const FOOTPRINTS& Footprints() const { return m_footprints; }
466
467 const DRAWINGS& Drawings() const { return m_drawings; }
468
469 const ZONES& Zones() const { return m_zones; }
470
476 wxString GetUniqueZoneName( const wxString& aBaseName, const ZONE* aExclude = nullptr ) const;
477
482 static wxString MakeUniqueZoneName( const wxString& aBaseName,
483 const std::function<bool( const wxString& )>& aInUse );
484
485 const GENERATORS& Generators() const { return m_generators; }
486
489 void UpdateBoardOutline();
490
496
497 const MARKERS& Markers() const { return m_markers; }
498
499 const PCB_POINTS& Points() const { return m_points; }
500
504
508 const BOARD_ITEM_SET GetItemSet() const;
509
518 const GROUPS& Groups() const { return m_groups; }
519
522 const CONSTRAINTS& Constraints() const { return m_constraints; }
523
524 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
525
526 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
527 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
528
529 // Variant system
530 wxString GetCurrentVariant() const { return m_currentVariant; }
531 void SetCurrentVariant( const wxString& aVariant );
532
533 const std::vector<wxString>& GetVariantNames() const { return m_variantNames; }
534 void SetVariantNames( const std::vector<wxString>& aNames ) { m_variantNames = aNames; }
535
536 bool HasVariant( const wxString& aVariantName ) const;
537 void AddVariant( const wxString& aVariantName );
538 void DeleteVariant( const wxString& aVariantName );
539 void RenameVariant( const wxString& aOldName, const wxString& aNewName );
540 void CopyVariant( const wxString& aOldName, const wxString& aNewName,
541 const wxString& aNewDescription = wxEmptyString );
542
543 wxString GetVariantDescription( const wxString& aVariantName ) const;
544 void SetVariantDescription( const wxString& aVariantName, const wxString& aDescription );
545
554 wxArrayString GetVariantNamesForUI() const;
555
556 void GetContextualTextVars( wxArrayString* aVars ) const;
557 bool ResolveTextVar( wxString* token, int aDepth ) const;
558 bool ResolveTextVar( wxString* token, const wxString& aVariantName, int aDepth ) const;
559
563
567
570
571 BOARD();
572 ~BOARD();
573
574 VECTOR2I GetPosition() const override;
575 void SetPosition( const VECTOR2I& aPos ) override;
576 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
577
578 bool IsEmpty() const;
579
580 void Move( const VECTOR2I& aMoveVector ) override;
581
582 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
583
584 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
586
596
598
599 void bumpDrillModelFor( const std::vector<BOARD_ITEM*>& aItems );
600
605 void noteDrillModelChange( BOARD_ITEM* aItem );
606
613 const LSET& DrillSymbolLayers() const { return m_drillSymbolLayers; }
614
616
628 std::shared_ptr<const DRILL_SYMBOL_CACHE> DrillSymbolCache() const;
629
634 std::vector<const PCB_DRILL_MAP*> DrillMapsOnLayer( PCB_LAYER_ID aLayer ) const;
635
640 BOX2I ExpandBoundingBoxForDrillSymbols( const BOX2I& aBoundingBox ) const;
641
642 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
643 const wxString& GetGenerator() const { return m_generator; }
644
645 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
646 bool aSkipConnectivity = false ) override;
647
649 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
650
659 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
663
664 bool HasItemsOnLayer( PCB_LAYER_ID aLayer );
665
674 bool RemoveAllItemsOnLayer( PCB_LAYER_ID aLayer );
675
680 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
681
686 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
687
692 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
693
699 void FixupEmbeddedData();
700
701 void RunOnNestedEmbeddedFiles( const std::function<void( EMBEDDED_FILES* )>& aFunction ) override;
702
703 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
704 const std::vector<ZONE*>& aZones = {} );
705
714 {
715 return m_footprints.empty() ? nullptr : m_footprints.front();
716 }
717
721 void DeleteAllFootprints();
722
726 void DetachAllFootprints();
727
732 BOARD_ITEM* ResolveItem( const KIID& aID, bool aAllowNullptrReturn = false ) const;
733
737 void RebindItemUuid( BOARD_ITEM& aItem, const KIID& aNewId ) { m_itemIndex.Rebind( aItem, aNewId ); }
738
747
751 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
752 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
753
758 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
759
765 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
766
770 void DeleteMARKERs();
771
772 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
773
774 PROJECT* GetProject() const { return m_project; }
775
784 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
785
786 void ClearProject();
787
795 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
796
800 void RecordDRCExclusions();
801
806
812 void CompileRatsnest();
813
817 void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
818 FLIP_DIRECTION aFlipDirection,
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
999
1000 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
1001
1009 void InvalidateClearanceCache( const KIID& aUuid );
1010
1017
1019
1020 const PAGE_INFO& GetPageSettings() const { return m_paper; }
1021 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
1022
1024 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
1025
1027 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
1028 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
1029
1030 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
1031
1033 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
1034
1039 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
1040
1061 bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool aInferOutlineIfNecessary,
1062 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
1063 bool aAllowUseArcsInPolygons = false, bool aIncludeNPTHAsOutlines = false );
1064
1074
1088 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
1089
1093 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
1094
1101 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
1102
1110 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
1111
1122 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
1123 {
1124 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
1125 return LayerName( aLayerId );
1126 }
1127
1135 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
1136
1140 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
1141
1145 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
1146
1153 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
1154
1162 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
1163
1168 unsigned GetNodesCount( int aNet = -1 ) const;
1169
1178 const std::vector<PAD*> GetPads() const;
1179
1181 {
1182 m_NetInfo.buildListOfNets();
1183 }
1184
1191 NETINFO_ITEM* FindNet( int aNetcode ) const;
1192
1199 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
1200
1210 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
1211
1215 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
1216
1218 {
1219 return m_NetInfo;
1220 }
1221
1223 {
1224 m_NetInfo.RemoveUnusedNets( aCommit );
1225 }
1226
1228 bool RenameNets( const std::map<wxString, wxString>& aNewNames, REPORTER& aReporter )
1229 {
1230 return m_NetInfo.RenameNets( aNewNames, aReporter );
1231 }
1232
1237 {
1238 return m_NetInfo.begin();
1239 }
1240
1245 {
1246 return m_NetInfo.end();
1247 }
1248
1252 unsigned GetNetCount() const
1253 {
1254 return m_NetInfo.GetNetCount();
1255 }
1256
1261
1266
1274 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false, bool aPhysicalLayersOnly = false ) const;
1275
1276 const BOX2I GetBoundingBox() const override
1277 {
1278 return ComputeBoundingBox( false, false );
1279 }
1280
1291 {
1292 return ComputeBoundingBox( true, true );
1293 }
1294
1295 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1296
1308 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1309 const std::vector<KICAD_T>& scanTypes ) override;
1310
1319 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1320
1327 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1328
1329 PAD* FindPadByUuid( const KIID& aUuid ) const;
1330
1331 void ReplaceNetChainTerminalPad( const wxString& aNetChain, const KIID& aPrev, const KIID& aNew );
1332
1336 void SetNetChainColor( const wxString& aChain, const KIGFX::COLOR4D& aColor )
1337 {
1338 if( aColor == KIGFX::COLOR4D::UNSPECIFIED )
1339 m_netChainColors.erase( aChain );
1340 else
1341 m_netChainColors[aChain] = aColor;
1342 }
1343
1344 KIGFX::COLOR4D GetNetChainColor( const wxString& aChain ) const
1345 {
1346 auto it = m_netChainColors.find( aChain );
1347 return it != m_netChainColors.end() ? it->second : KIGFX::COLOR4D::UNSPECIFIED;
1348 }
1349
1350 const std::map<wxString, KIGFX::COLOR4D>& GetNetChainColors() const
1351 {
1352 return m_netChainColors;
1353 }
1354
1356 {
1357 m_netChainColors.clear();
1358 }
1359
1363 std::set<wxString> GetNetClassAssignmentCandidates() const;
1364
1372 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1373
1383
1387 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1388
1392 void SynchronizeProperties();
1393
1398
1402 double Similarity( const BOARD_ITEM& aOther ) const override
1403 {
1404 return 1.0;
1405 }
1406
1407 bool operator==( const BOARD_ITEM& aOther ) const override;
1408
1409 wxString GetClass() const override
1410 {
1411 return wxT( "BOARD" );
1412 }
1413
1414#if defined(DEBUG)
1415 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1416#endif
1417
1418
1419 /*************************/
1420 /* Copper Areas handling */
1421 /*************************/
1422
1433
1440 ZONE* GetArea( int index ) const
1441 {
1442 if( (unsigned) index < m_zones.size() )
1443 return m_zones[index];
1444
1445 return nullptr;
1446 }
1447
1451 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1452
1456 int GetAreaCount() const
1457 {
1458 return static_cast<int>( m_zones.size() );
1459 }
1460
1461 /* Functions used in test, merge and cut outlines */
1462
1475 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1476 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1477
1485 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1486
1494 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1495 PAD* GetPad( const VECTOR2I& aPosition ) const
1496 {
1497 return GetPad( aPosition, LSET().set() );
1498 }
1499
1507 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1508
1523 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1524
1536 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1537
1545 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1546
1554 TRACKS TracksInNet( int aNetCode );
1555
1568 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1569 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1570
1576 int GetMaxClearanceValue() const;
1577
1583 void MapNets( BOARD* aDestBoard );
1584
1585 void SanitizeNetcodes();
1586
1595 void AddListener( BOARD_LISTENER* aListener );
1596
1601 void RemoveListener( BOARD_LISTENER* aListener );
1602
1606 void RemoveAllListeners();
1607
1612 void OnItemChanged( BOARD_ITEM* aItem );
1613
1618 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1619
1624
1629 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1630 std::vector<BOARD_ITEM*>& aRemovedItems,
1631 std::vector<BOARD_ITEM*>& aChangedItems );
1632
1636 void OnRatsnestChanged();
1637
1641 void OnZonesFilled( const std::vector<ZONE*>& aZones );
1642
1649 wxString GroupsSanityCheck( bool repair = false );
1650
1656 wxString GroupsSanityCheckInternal( bool repair );
1657
1658 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1659 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1660
1661 EMBEDDED_FILES* GetEmbeddedFiles() override;
1662 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1663
1665
1669 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1670
1674 void EmbedFonts() override;
1675
1680
1685
1687
1697 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
1698
1703 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
1704
1705 // --------- Items-by-index facades ---------
1706
1713 bool IsItemIndexedById( const BOARD_ITEM* aItem ) const { return m_itemIndex.IsIndexed( aItem ); }
1714
1719 bool IsItemIndexedById( const KIID& aId ) const { return m_itemIndex.IsIndexed( aId ); }
1720
1727 void CacheItemById( BOARD_ITEM& aItem ) const { m_itemIndex.BindItem( aItem ); }
1728
1729 void CacheItemSubtreeById( BOARD_ITEM& aItem ) { m_itemIndex.BindSubtree( aItem ); }
1730
1731 void CacheChildrenById( const BOARD_ITEM& aParent ) { m_itemIndex.BindChildren( aParent ); }
1732
1735 void UncacheItemSubtreeById( const BOARD_ITEM& aItem ) { m_itemIndex.UnbindSubtree( aItem ); }
1736
1737 void UncacheChildrenById( const BOARD_ITEM& aParent ) { m_itemIndex.UnbindChildren( aParent ); }
1738
1740
1741 // --------- Item order comparators ---------
1742
1744 {
1745 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1746 };
1747
1749 {
1750 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1751 };
1752
1754
1755public:
1765 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> GetFootprintCourtyardIndex();
1766
1767 // ------------ Run-time caches -------------
1768 mutable std::shared_mutex m_CachesMutex;
1769 // These predicate caches are written per item-pair from every DRC worker thread, so they
1770 // carry their own internal sharded locks and are NOT covered by m_CachesMutex.
1784 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1785 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1786 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1787 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1788 mutable std::optional<int> m_maxClearanceValue;
1789
1790 // Microvias that land on another microvia, for isStackedVia(). Whole-board relation, so it
1791 // is built in one pass rather than per via.
1792 mutable std::optional<std::set<const PCB_VIA*>> m_StackedMicroviaCache;
1793
1794 // Zone name lookup cache for DRC rule area functions like enclosedByArea/intersectsArea.
1795 // Maps zone names to vectors of matching zones to avoid O(n) zone iteration per lookup.
1796 mutable std::unordered_map<wxString, std::vector<ZONE*>> m_ZonesByNameCache;
1797
1798 // Deflated zone outline cache for DRC area checks. Caches the deflated outline for each zone
1799 // to avoid repeated expensive deflation operations during collidesWithArea calls.
1800 mutable std::unordered_map<const ZONE*, SHAPE_POLY_SET> m_DeflatedZoneOutlineCache;
1801
1802 // Spatial index of footprint courtyards, built lazily by GetFootprintCourtyardIndex().
1803 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> m_footprintCourtyardIndex;
1804
1805 // ------------ DRC caches -------------
1806 std::vector<ZONE*> m_DRCZones;
1807 std::vector<ZONE*> m_DRCCopperZones;
1808 std::map<PCB_LAYER_ID, std::vector<ZONE*>> m_DRCCopperZonesByLayer;
1811 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1812 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1813
1819 {
1820 auto it = m_CopperZoneRTreeCache.find( aZone );
1821
1822 return it != m_CopperZoneRTreeCache.end() ? it->second.get() : nullptr;
1823 }
1824
1825private:
1826 // The default copy constructor & operator= are inadequate,
1827 // either write one or do not use it at all
1828 BOARD( const BOARD& aOther ) = delete;
1829
1830 BOARD& operator=( const BOARD& aOther ) = delete;
1831
1832 template <typename Func, typename... Args>
1833 void InvokeListeners( Func&& aFunc, Args&&... args )
1834 {
1835 for( auto&& l : m_listeners )
1836 ( l->*aFunc )( std::forward<Args>( args )... );
1837 }
1838
1839 // Refresh user layer opposites.
1840 void recalcOpposites();
1841
1843 std::vector<BOARD_ITEM*> collectOwnedItems() const;
1844
1845 friend class PCB_EDIT_FRAME;
1846
1847private:
1850
1853 std::atomic<int> m_timeStamp; // actually a modification counter
1854
1855 wxString m_fileName;
1856
1857 std::map<wxString, KIGFX::COLOR4D> m_netChainColors;
1858
1859 // These containers only have const accessors and must only be modified by Add()/Remove()
1870
1871 // Identity index for the containers above, including their children. Mutable because
1872 // const lookups populate it, and NOT covered by m_CachesMutex: only safe for
1873 // single-threaded access (UI, serialization). BOARD_ITEM_INDEX owns the rules.
1875
1876 std::map<int, LAYER> m_layers; // layer data
1877
1878 HIGH_LIGHT_INFO m_highLight; // current high light data
1879 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1880
1881 int m_fileFormatVersionAtLoad; // the version loaded from the file
1885
1890 std::vector<std::pair<VECTOR2I, int>> m_drillSymbolPlacements;
1891
1892 mutable std::shared_ptr<const DRILL_SYMBOL_CACHE> m_drillSymbolCache;
1893 mutable std::mutex m_drillSymbolCacheMutex;
1894
1895 wxString m_generator; // the generator tag from the file
1896 std::map<wxString, wxString> m_properties;
1897 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1898
1899 // Sentinel whose expiry signals to LOCAL_HISTORY that this board has been destroyed.
1900 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
1901
1903 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1905 PROJECT* m_project; // project this board is a part of
1907
1908 // Variant system
1909 wxString m_currentVariant; // Currently active variant (empty = default)
1910 std::vector<wxString> m_variantNames; // All variant names in the board
1911 std::map<wxString, wxString> m_variantDescriptions; // Descriptions for each variant
1912
1923 std::shared_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1924
1929 bool m_legacyTeardrops = false;
1930
1931 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1932
1933 std::vector<BOARD_LISTENER*> m_listeners;
1934
1936
1937 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1938 // of all the parent's embedded data.
1940
1941 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1942 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1943
1944 // Reactive text-variable dependency adapter. Installed as a listener during BOARD construction;
1945 // destructor order ensures it outlives no listener calls.
1946 std::unique_ptr<BOARD_TEXT_VAR_ADAPTER> m_textVarAdapter;
1947};
int index
BOARD_USE
Flags to specify how the board is being used.
Definition board.h:401
@ FPHOLDER
Definition board.h:403
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:243
@ LT_POWER
Definition board.h:246
@ LT_FRONT
Definition board.h:250
@ LT_MIXED
Definition board.h:247
@ LT_BACK
Definition board.h:251
@ LT_UNDEFINED
Definition board.h:244
@ LT_JUMPER
Definition board.h:248
@ LT_AUX
Definition board.h:249
@ LT_SIGNAL
Definition board.h:245
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition board.h:395
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:85
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:87
friend class BOARD_ITEM_INDEX
Definition board_item.h:610
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
Definition board.h:379
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition board.h:384
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:376
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:380
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:377
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition board.h:375
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition board.h:383
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:378
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition board.h:385
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
Definition board.h:381
virtual ~BOARD_LISTENER()
Definition board.h:374
virtual void OnBoardSelectionChanged(BOARD &aBoard)
Definition board.h:382
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:411
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:2645
ZONE * m_SolderMaskBridges
Definition board.h:1811
void ApplyNetChainNetclasses()
Expand the project's chain-to-netclass assignments into per-net pattern assignments,...
Definition board.cpp:3181
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:650
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:1279
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:3459
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition board.h:1024
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1812
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:1154
std::vector< const PCB_DRILL_MAP * > DrillMapsOnLayer(PCB_LAYER_ID aLayer) const
Every map on this layer.
Definition board.cpp:207
GENERATORS m_generators
Definition board.h:1867
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:3836
std::shared_ptr< void > m_historyLifetime
Definition board.h:1900
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1217
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition board.h:565
BOARD_TEXT_VAR_ADAPTER * GetTextVarAdapter() const
Definition board.h:1753
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition board.h:441
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition board.cpp:3309
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1774
void CacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1731
int GetUserDefinedLayerCount() const
Definition board.cpp:1143
void recalcOpposites()
Definition board.cpp:1060
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:810
std::map< wxString, wxString > m_properties
Definition board.h:1896
bool RenameNets(const std::map< wxString, wxString > &aNewNames, REPORTER &aReporter)
Rename nets without changing net codes or connectivity.
Definition board.h:1228
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsCourtyardResultCache
Definition board.h:1777
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:3662
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition board.h:1776
int m_fileFormatVersionAtLoad
Definition board.h:1881
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:2864
void SetCurrentVariant(const wxString &aVariant)
Definition board.cpp:2969
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1807
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:1207
void CacheItemById(BOARD_ITEM &aItem) const
Add an item to the item-by-id cache.
Definition board.h:1727
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition board.h:430
void SetVariantNames(const std::vector< wxString > &aNames)
Definition board.h:534
const std::vector< wxString > & GetVariantNames() const
Definition board.h:533
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1520
std::shared_ptr< const DRILL_SYMBOL_CACHE > m_drillSymbolCache
Definition board.h:1892
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:839
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaResultCache
Definition board.h:1782
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:3773
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition board.h:446
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition board.h:1929
TITLE_BLOCK m_titles
Definition board.h:1903
GAL_SET m_LegacyVisibleItems
Definition board.h:562
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition board.h:423
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition board.h:1440
std::vector< wxString > m_variantNames
Definition board.h:1910
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1290
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1276
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1679
wxArrayString GetVariantNamesForUI() const
Return the variant names for UI display.
Definition board.cpp:3161
void BuildListOfNets()
Definition board.h:1180
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:1437
void SetNetChainColor(const wxString &aChain, const KIGFX::COLOR4D &aColor)
Per-net-chain colour override (empty COLOR4D::UNSPECIFIED = no override).
Definition board.h:1336
const GENERATORS & Generators() const
Definition board.h:485
void SetFileName(const wxString &aFileName)
Definition board.h:452
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition board.h:1122
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:3738
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:1241
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1849
uint64_t m_drillModelGeneration
Definition board.h:1882
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:3470
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:2935
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1852
void RefreshDrillSymbolLayers()
Definition board.cpp:239
void CopyVariant(const wxString &aOldName, const wxString &aNewName, const wxString &aNewDescription=wxEmptyString)
Definition board.cpp:3090
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:487
PAGE_INFO m_paper
Definition board.h:1902
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3830
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1773
FOOTPRINTS m_footprints
Definition board.h:1862
friend class PCB_EDIT_FRAME
Definition board.h:1845
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1664
const PCB_POINTS & Points() const
Definition board.h:499
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:4084
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:3811
const PAGE_INFO & GetPageSettings() const
Definition board.h:1020
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition board.cpp:2044
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:527
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:985
const std::map< wxString, KIGFX::COLOR4D > & GetNetChainColors() const
Definition board.h:1350
std::shared_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:1923
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1235
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3893
void CompileRatsnest()
Rebuild the entire board ratsnest.
Definition board.cpp:3876
HIGH_LIGHT_INFO m_highLight
Definition board.h:1878
std::map< wxString, wxString > m_variantDescriptions
Definition board.h:1911
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:904
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2797
EDA_UNITS m_userUnits
Definition board.h:1906
CONSTRAINTS m_constraints
Definition board.h:1865
void UpdateBoardOutline()
Definition board.cpp:4299
const ZONES & Zones() const
Definition board.h:469
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition board.cpp:1672
void ClearItemByIdCache()
Definition board.h:1739
void DeleteVariant(const wxString &aVariantName)
Definition board.cpp:3014
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1833
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1302
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1188
void SanitizeNetcodes()
Definition board.cpp:3791
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1318
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1939
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:3579
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:979
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition board.h:518
~BOARD()
Definition board.cpp:332
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:4347
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:369
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:1201
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:991
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition board.cpp:569
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.h:737
DRAWINGS m_drawings
Definition board.h:1861
uint64_t m_boardOutlineGeneration
Definition board.h:1883
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:3859
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:3275
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3221
EDA_UNITS GetUserUnits()
Definition board.h:1032
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3884
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1904
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1771
const LSET & DrillSymbolLayers() const
Layers that currently have a drill map on them.
Definition board.h:613
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:950
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:3559
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:1703
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:680
const MARKERS & Markers() const
Definition board.h:497
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:713
uint64_t GetDrillModelGeneration() const
Definition board.h:597
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1120
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:3724
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:816
TITLE_BLOCK & GetTitleBlock()
Definition board.h:1026
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1444
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1325
ZONES m_zones
Definition board.h:1866
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:1495
PAD * FindPadByUuid(const KIID &aUuid) const
Definition board.cpp:2903
void OnBoardSelectionChanged()
Notify the board and its listeners that the editor selection has changed.
Definition board.cpp:3853
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:912
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1879
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition board.h:576
void HighLightOFF()
Disable net highlight.
Definition board.h:869
NETINFO_LIST m_NetInfo
Definition board.h:1931
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition board.h:561
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition board.cpp:1224
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:1073
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, FLIP_DIRECTION aFlipDirection, 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::shared_ptr< const DRILL_SYMBOL_CACHE > DrillSymbolCache() const
Resolved drill symbols, by group and by owning item.
Definition board.cpp:265
bool HasVariant(const wxString &aVariantName) const
Definition board.cpp:2995
NETINFO_LIST::iterator EndNets() const
Definition board.h:1244
void AddVariant(const wxString &aVariantName)
Definition board.cpp:3001
int GetCopperLayerCount() const
Definition board.cpp:1127
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1933
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:1958
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:526
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutCache
Definition board.h:1775
void IncrementTimeStamp()
Definition board.cpp:448
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:2816
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:1465
PCB_POINTS m_points
Definition board.h:1869
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1942
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:1222
const FOOTPRINTS & Footprints() const
Definition board.h:465
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1897
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:3680
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:1805
const BOARD_ITEM_SET GetItemSet()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
Definition board.cpp:4214
const TRACKS & Tracks() const
Definition board.h:463
int m_DRCMaxPhysicalClearance
Definition board.h:1810
const PCB_BOARD_OUTLINE * BoardOutline() const
Definition board.h:488
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition board.cpp:2891
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:1663
BOARD_ITEM_INDEX m_itemIndex
Definition board.h:1874
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:1021
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1784
bool m_embedFonts
Definition board.h:1935
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:3932
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > m_footprintCourtyardIndex
Definition board.h:1803
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:3870
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:2368
wxString GetClass() const override
Return the class name.
Definition board.h:1409
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1941
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1772
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
Definition board.h:522
NETINFO_LIST::iterator BeginNets() const
Definition board.h:1236
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:3604
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:569
void SetCopperLayerCount(int aCount)
Definition board.cpp:1133
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1787
std::unordered_map< const ZONE *, SHAPE_POLY_SET > m_DeflatedZoneOutlineCache
Definition board.h:1800
wxString m_generator
Definition board.h:1895
std::vector< BOARD_ITEM * > collectOwnedItems() const
Get a simple vector of the board's pointers.
Definition board.cpp:4192
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsFCourtyardResultCache
Definition board.h:1778
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:882
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:379
PROJECT * m_project
Definition board.h:1905
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:3495
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1912
const wxString & GetFileName() const
Definition board.h:454
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:4231
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:4329
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutResultCache
Definition board.h:1781
wxString GetVariantDescription(const wxString &aVariantName) const
Definition board.cpp:3125
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:2879
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2521
bool IsHighLightNetON() const
Definition board.h:855
bool IsItemIndexedById(const KIID &aId) const
Return true if an index entry for aId exists.
Definition board.h:1719
SHARDED_CACHE< ITEM_FIELD_CACHE_KEY, wxString > m_ItemFieldCache
Definition board.h:1783
int GetFileFormatVersionAtLoad() const
Definition board.h:585
std::map< PCB_LAYER_ID, std::vector< ZONE * > > m_DRCCopperZonesByLayer
Definition board.h:1808
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1247
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1786
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:1010
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:1023
void ClearNetChainColors()
Definition board.h:1355
std::optional< std::set< const PCB_VIA * > > m_StackedMicroviaCache
Definition board.h:1792
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1855
const wxString & GetGenerator() const
Definition board.h:643
int GetAreaCount() const
Definition board.h:1456
BOX2I ExpandBoundingBoxForDrillSymbols(const BOX2I &aBoundingBox) const
Include every displaced copy of a hole-owned drill symbol in its view bounds.
Definition board.cpp:300
void DetachAllFootprints()
Remove all footprints without deleting.
Definition board.cpp:2115
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1659
std::map< int, LAYER > m_layers
Definition board.h:1876
void noteDrillModelChange(BOARD_ITEM *aItem)
Container-boundary notification, so an item that arrives or leaves without going through a commit sti...
Definition board.cpp:221
wxString GetCurrentVariant() const
Definition board.h:530
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition board.cpp:837
int GetOutlinesChainingEpsilon()
Definition board.h:1072
void BumpDrillModelGeneration()
Bumped whenever anything a drill chart or map reports on has moved.
Definition board.cpp:181
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:3444
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
Definition board.cpp:3801
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:1180
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsAreaResultCache
Definition board.h:1780
int m_DRCMaxClearance
Definition board.h:1809
void ClearProject()
Definition board.cpp:420
void ReplaceNetChainTerminalPad(const wxString &aNetChain, const KIID &aPrev, const KIID &aNew)
Definition board.cpp:2915
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:907
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1785
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:1654
wxString m_currentVariant
Definition board.h:1909
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:1167
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:2103
PROJECT * GetProject() const
Definition board.h:774
bool IsEmpty() const
Definition board.cpp:798
int GetPadWithPressFitAttrCount()
Definition board.cpp:4311
bool LegacyTeardrops() const
Definition board.h:1658
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:2607
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:1027
KIGFX::COLOR4D GetNetChainColor(const wxString &aChain) const
Definition board.h:1344
wxString GetDesignRulesPath() const
Return the absolute path to the design rules file for this board.
Definition board.cpp:437
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition board.cpp:3918
void RenameVariant(const wxString &aOldName, const wxString &aNewName)
Definition board.cpp:3042
uint64_t GetBoardOutlineGeneration() const
Bumped by every UpdateBoardOutline(), so anything deriving geometry from the edge cuts can tell wheth...
Definition board.h:495
std::vector< ZONE * > m_DRCZones
Definition board.h:1806
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1174
void SetGenerator(const wxString &aGenerator)
Definition board.h:642
BOARD()
Definition board.cpp:99
void bumpDrillModelFor(const std::vector< BOARD_ITEM * > &aItems)
Definition board.cpp:319
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:1890
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:2448
void UncacheItemSubtreeById(const BOARD_ITEM &aItem)
Uncache an item and its children.
Definition board.h:1735
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2292
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2949
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:3818
std::unique_ptr< BOARD_TEXT_VAR_ADAPTER > m_textVarAdapter
Definition board.h:1946
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1684
std::shared_mutex m_CachesMutex
Definition board.h:1768
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition board.cpp:2538
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:1252
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:1483
std::atomic< int > m_timeStamp
Definition board.h:1853
std::mutex m_drillSymbolCacheMutex
Definition board.h:1893
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:3265
void UncacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1737
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:2066
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1691
std::unordered_map< wxString, std::vector< ZONE * > > m_ZonesByNameCache
Definition board.h:1796
GROUPS m_groups
Definition board.h:1864
PROJECT::ELEM ProjectElementType() override
Definition board.h:1686
MARKERS m_markers
Definition board.h:1860
bool IsItemIndexedById(const BOARD_ITEM *aItem) const
Return true if aItem is currently indexed.
Definition board.h:1713
LSET m_drillSymbolLayers
Definition board.h:1884
std::optional< int > m_maxClearanceValue
Definition board.h:1788
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3908
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1194
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:1028
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:3175
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1863
std::map< wxString, KIGFX::COLOR4D > m_netChainColors
Definition board.h:1857
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:2142
bool m_LegacyCopperEdgeClearanceLoaded
Definition board.h:566
int GetTimeStamp() const
Definition board.h:434
BOARD_DESIGN_SETTINGS & GetDesignSettings()
Definition board.cpp:1290
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:3845
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsBCourtyardResultCache
Definition board.h:1779
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition board.h:758
VECTOR2I GetPosition() const override
Definition board.cpp:804
DRC_RTREE * GetCopperZoneRTree(ZONE *aZone) const
Look up a zone's filled-copper R-tree.
Definition board.h:1818
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Definition board.cpp:3144
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:413
void SetUserUnits(EDA_UNITS aUnits)
Definition board.h:1033
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1214
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:3707
void CacheItemSubtreeById(BOARD_ITEM &aItem)
Definition board.h:1729
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1402
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1868
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:1149
const DRAWINGS & Drawings() const
Definition board.h:467
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition board.cpp:2038
void SetFileFormatVersionAtLoad(int aVersion)
Definition board.h:584
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:431
void Clear()
Definition board.h:319
friend class BOARD
Definition board.h:331
std::set< int > m_netCodes
Definition board.h:316
bool m_highLightOn
Definition board.h:317
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:68
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
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
FLIP_DIRECTION
Definition mirror.h:23
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:4022
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:4001
What moved, so a drill consumer can decide whether it cares.
Definition board.h:350
DRILL_CHART_TOTALS m_Totals
Counts for the ${DRILL_*} text variables.
Definition board.h:358
uint64_t m_Profile
Definition board.h:367
std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > m_ByItem
Definition board.h:352
uint64_t m_Generation
Definition board.h:366
BOX2I m_HoleExtent
Extent of every hole that carries a mark.
Definition board.h:364
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > m_ByGroup
Definition board.h:351
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:155
bool operator==(const ITEM_FIELD_CACHE_KEY &other) const
Definition board.h:157
const BOARD_ITEM * A
Definition board.h:154
bool operator==(const ITEM_SELECTOR_LAYER_CACHE_KEY &other) const
Definition board.h:144
const BOARD_ITEM * A
Definition board.h:139
LAYERS_CHECKED(PCB_LAYER_ID aLayer)
Definition board.h:170
bool has_error
Definition board.h:176
LSET layers
Definition board.h:175
int m_opposite
Similar layer on opposite side of the board, if any.
Definition board.h:291
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition board.cpp:1039
void clear()
Definition board.h:265
LAYER_T m_type
The type of the layer.
Definition board.h:288
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition board.cpp:1023
LAYER()
Definition board.h:260
wxString m_name
The canonical name of the layer.
Definition board.h:286
wxString m_userName
The user defined name of the layer.
Definition board.h:287
bool m_visible
Definition board.h:289
int m_number
The layer ID.
Definition board.h:290
BOARD_ITEM * A
Definition board.h:114
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition board.h:117
PCB_LAYER_ID Layer
Definition board.h:115
BOARD_ITEM * A
Definition board.h:103
BOARD_ITEM * B
Definition board.h:104
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition board.h:106
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition board.h:129
BOARD_ITEM * B
Definition board.h:126
BOARD_ITEM * A
Definition board.h:125
PCB_LAYER_ID Layer
Definition board.h:127
std::size_t operator()(const ITEM_FIELD_CACHE_KEY &k) const
Definition board.h:229
std::size_t operator()(const ITEM_SELECTOR_LAYER_CACHE_KEY &k) const
Definition board.h:218
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition board.h:196
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition board.h:185
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition board.h:207
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.