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
804 std::vector<PCB_MARKER*> ReloadDRCExclusions( std::vector<PCB_MARKER*>& aStale );
805
809 void RecordDRCExclusions();
810
815
821 void CompileRatsnest();
822
826 void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
827 FLIP_DIRECTION aFlipDirection,
828 bool aMatchPadPositions,
829 bool aDeleteExtraTexts = true,
830 bool aResetTextLayers = true,
831 bool aResetTextEffects = true,
832 bool aResetTextPositions = true,
833 bool aResetTextContent = true,
834 bool aResetFabricationAttrs = true,
835 bool aResetClearanceOverrides = true,
836 bool aReset3DModels = true,
837 bool aResetTransform = false,
838 bool* aUpdated = nullptr, bool* aShifted = nullptr );
839
843 void ResetNetHighLight();
844
848 const std::set<int>& GetHighLightNetCodes() const
849 {
850 return m_highLight.m_netCodes;
851 }
852
859 void SetHighLightNet( int aNetCode, bool aMulti = false );
860
864 bool IsHighLightNetON() const { return m_highLight.m_highLightOn; }
865
873 void HighLightON( bool aValue = true );
874
879 {
880 HighLightON( false );
881 }
882
886 int GetCopperLayerCount() const;
887 void SetCopperLayerCount( int aCount );
888
889 int GetUserDefinedLayerCount() const;
890 void SetUserDefinedLayerCount( int aCount );
891
897
898 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
899
900 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
901
907 const LSET& GetEnabledLayers() const;
908 LSET GetLayerSet() const override { return GetEnabledLayers(); }
909
915 void SetEnabledLayers( const LSET& aLayerMask );
916 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
917
924 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
925
933 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
934
940 const LSET& GetVisibleLayers() const;
941
948 void SetVisibleLayers( const LSET& aLayerMask );
949
950 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
951 // are not stored in the bitmap.
952
960
967 void SetVisibleElements( const GAL_SET& aMask );
968
974 void SetVisibleAlls();
975
983 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
984
992 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
993
1001 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
1002
1008
1009 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
1010
1018 void InvalidateClearanceCache( const KIID& aUuid );
1019
1026
1028
1029 const PAGE_INFO& GetPageSettings() const { return m_paper; }
1030 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
1031
1033 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
1034
1036 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
1037 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
1038
1039 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
1040
1042 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
1043
1048 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
1049
1070 bool GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, bool aInferOutlineIfNecessary,
1071 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
1072 bool aAllowUseArcsInPolygons = false, bool aIncludeNPTHAsOutlines = false );
1073
1083
1097 KIGFX::RENDER_SETTINGS* aRenderSettings = nullptr ) const;
1098
1102 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
1103
1110 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
1111
1119 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
1120
1131 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
1132 {
1133 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
1134 return LayerName( aLayerId );
1135 }
1136
1144 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
1145
1149 bool IsFrontLayer( PCB_LAYER_ID aLayer ) const;
1150
1154 bool IsBackLayer( PCB_LAYER_ID aLayer ) const;
1155
1162 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
1163
1171 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
1172
1177 unsigned GetNodesCount( int aNet = -1 ) const;
1178
1187 const std::vector<PAD*> GetPads() const;
1188
1190 {
1191 m_NetInfo.buildListOfNets();
1192 }
1193
1200 NETINFO_ITEM* FindNet( int aNetcode ) const;
1201
1208 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
1209
1222 NETINFO_ITEM* FindOrAddNet( const wxString& aNetName, int aNetCode = -1, ADD_MODE aMode = ADD_MODE::INSERT,
1223 bool aSkipConnectivity = false );
1224
1234 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
1235
1239 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
1240
1242 {
1243 return m_NetInfo;
1244 }
1245
1247 {
1248 m_NetInfo.RemoveUnusedNets( aCommit );
1249 }
1250
1252 bool RenameNets( const std::map<wxString, wxString>& aNewNames, REPORTER& aReporter )
1253 {
1254 return m_NetInfo.RenameNets( aNewNames, aReporter );
1255 }
1256
1261 {
1262 return m_NetInfo.begin();
1263 }
1264
1269 {
1270 return m_NetInfo.end();
1271 }
1272
1276 unsigned GetNetCount() const
1277 {
1278 return m_NetInfo.GetNetCount();
1279 }
1280
1285
1290
1298 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false, bool aPhysicalLayersOnly = false ) const;
1299
1300 const BOX2I GetBoundingBox() const override
1301 {
1302 return ComputeBoundingBox( false, false );
1303 }
1304
1315 {
1316 return ComputeBoundingBox( true, true );
1317 }
1318
1319 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
1320
1332 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
1333 const std::vector<KICAD_T>& scanTypes ) override;
1334
1343 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
1344
1351 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
1352
1353 PAD* FindPadByUuid( const KIID& aUuid ) const;
1354
1355 void ReplaceNetChainTerminalPad( const wxString& aNetChain, const KIID& aPrev, const KIID& aNew );
1356
1360 void SetNetChainColor( const wxString& aChain, const KIGFX::COLOR4D& aColor )
1361 {
1362 if( aColor == KIGFX::COLOR4D::UNSPECIFIED )
1363 m_netChainColors.erase( aChain );
1364 else
1365 m_netChainColors[aChain] = aColor;
1366 }
1367
1368 KIGFX::COLOR4D GetNetChainColor( const wxString& aChain ) const
1369 {
1370 auto it = m_netChainColors.find( aChain );
1371 return it != m_netChainColors.end() ? it->second : KIGFX::COLOR4D::UNSPECIFIED;
1372 }
1373
1374 const std::map<wxString, KIGFX::COLOR4D>& GetNetChainColors() const
1375 {
1376 return m_netChainColors;
1377 }
1378
1380 {
1381 m_netChainColors.clear();
1382 }
1383
1387 std::set<wxString> GetNetClassAssignmentCandidates() const;
1388
1396 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1397
1407
1411 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1412
1416 void SynchronizeProperties();
1417
1422
1426 double Similarity( const BOARD_ITEM& aOther ) const override
1427 {
1428 return 1.0;
1429 }
1430
1431 bool operator==( const BOARD_ITEM& aOther ) const override;
1432
1433 wxString GetClass() const override
1434 {
1435 return wxT( "BOARD" );
1436 }
1437
1438#if defined(DEBUG)
1439 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1440#endif
1441
1442
1443 /*************************/
1444 /* Copper Areas handling */
1445 /*************************/
1446
1457
1464 ZONE* GetArea( int index ) const
1465 {
1466 if( (unsigned) index < m_zones.size() )
1467 return m_zones[index];
1468
1469 return nullptr;
1470 }
1471
1475 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1476
1480 int GetAreaCount() const
1481 {
1482 return static_cast<int>( m_zones.size() );
1483 }
1484
1485 /* Functions used in test, merge and cut outlines */
1486
1499 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1500 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1501
1509 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1510
1518 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1519 PAD* GetPad( const VECTOR2I& aPosition ) const
1520 {
1521 return GetPad( aPosition, LSET().set() );
1522 }
1523
1531 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1532
1547 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1548
1560 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1561
1569 std::tuple<int, double, double, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1570
1578 TRACKS TracksInNet( int aNetCode );
1579
1592 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1593 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1594
1600 int GetMaxClearanceValue() const;
1601
1607 void MapNets( BOARD* aDestBoard );
1608
1609 void SanitizeNetcodes();
1610
1619 void AddListener( BOARD_LISTENER* aListener );
1620
1625 void RemoveListener( BOARD_LISTENER* aListener );
1626
1630 void RemoveAllListeners();
1631
1636 void OnItemChanged( BOARD_ITEM* aItem );
1637
1642 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1643
1648
1653 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1654 std::vector<BOARD_ITEM*>& aRemovedItems,
1655 std::vector<BOARD_ITEM*>& aChangedItems );
1656
1660 void OnRatsnestChanged();
1661
1665 void OnZonesFilled( const std::vector<ZONE*>& aZones );
1666
1673 wxString GroupsSanityCheck( bool repair = false );
1674
1680 wxString GroupsSanityCheckInternal( bool repair );
1681
1682 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1683 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1684
1685 EMBEDDED_FILES* GetEmbeddedFiles() override;
1686 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1687
1689
1693 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1694
1698 void EmbedFonts() override;
1699
1704
1709
1711
1721 void SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData );
1722
1727 std::weak_ptr<void> GetHistoryLifetimeToken() const { return m_historyLifetime; }
1728
1729 // --------- Items-by-index facades ---------
1730
1737 bool IsItemIndexedById( const BOARD_ITEM* aItem ) const { return m_itemIndex.IsIndexed( aItem ); }
1738
1743 bool IsItemIndexedById( const KIID& aId ) const { return m_itemIndex.IsIndexed( aId ); }
1744
1751 void CacheItemById( BOARD_ITEM& aItem ) const { m_itemIndex.BindItem( aItem ); }
1752
1753 void CacheItemSubtreeById( BOARD_ITEM& aItem ) { m_itemIndex.BindSubtree( aItem ); }
1754
1755 void CacheChildrenById( const BOARD_ITEM& aParent ) { m_itemIndex.BindChildren( aParent ); }
1756
1759 void UncacheItemSubtreeById( const BOARD_ITEM& aItem ) { m_itemIndex.UnbindSubtree( aItem ); }
1760
1761 void UncacheChildrenById( const BOARD_ITEM& aParent ) { m_itemIndex.UnbindChildren( aParent ); }
1762
1764
1765 // --------- Item order comparators ---------
1766
1768 {
1769 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1770 };
1771
1773 {
1774 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1775 };
1776
1778
1779public:
1789 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> GetFootprintCourtyardIndex();
1790
1791 // ------------ Run-time caches -------------
1792 mutable std::shared_mutex m_CachesMutex;
1793 // These predicate caches are written per item-pair from every DRC worker thread, so they
1794 // carry their own internal sharded locks and are NOT covered by m_CachesMutex.
1808 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1809 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1810 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1811 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1812 mutable std::optional<int> m_maxClearanceValue;
1813
1814 // Microvias that land on another microvia, for isStackedVia(). Whole-board relation, so it
1815 // is built in one pass rather than per via.
1816 mutable std::optional<std::set<const PCB_VIA*>> m_StackedMicroviaCache;
1817
1818 // Zone name lookup cache for DRC rule area functions like enclosedByArea/intersectsArea.
1819 // Maps zone names to vectors of matching zones to avoid O(n) zone iteration per lookup.
1820 mutable std::unordered_map<wxString, std::vector<ZONE*>> m_ZonesByNameCache;
1821
1822 // Deflated zone outline cache for DRC area checks. Caches the deflated outline for each zone
1823 // to avoid repeated expensive deflation operations during collidesWithArea calls.
1824 mutable std::unordered_map<const ZONE*, SHAPE_POLY_SET> m_DeflatedZoneOutlineCache;
1825
1826 // Spatial index of footprint courtyards, built lazily by GetFootprintCourtyardIndex().
1827 std::shared_ptr<const FOOTPRINT_COURTYARD_INDEX> m_footprintCourtyardIndex;
1828
1829 // ------------ DRC caches -------------
1830 std::vector<ZONE*> m_DRCZones;
1831 std::vector<ZONE*> m_DRCCopperZones;
1832 std::map<PCB_LAYER_ID, std::vector<ZONE*>> m_DRCCopperZonesByLayer;
1835 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1836 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1837
1843 {
1844 auto it = m_CopperZoneRTreeCache.find( aZone );
1845
1846 return it != m_CopperZoneRTreeCache.end() ? it->second.get() : nullptr;
1847 }
1848
1849private:
1850 // The default copy constructor & operator= are inadequate,
1851 // either write one or do not use it at all
1852 BOARD( const BOARD& aOther ) = delete;
1853
1854 BOARD& operator=( const BOARD& aOther ) = delete;
1855
1856 template <typename Func, typename... Args>
1857 void InvokeListeners( Func&& aFunc, Args&&... args )
1858 {
1859 for( auto&& l : m_listeners )
1860 ( l->*aFunc )( std::forward<Args>( args )... );
1861 }
1862
1863 // Refresh user layer opposites.
1864 void recalcOpposites();
1865
1867 std::vector<BOARD_ITEM*> collectOwnedItems() const;
1868
1869 friend class PCB_EDIT_FRAME;
1870
1871private:
1874
1877 std::atomic<int> m_timeStamp; // actually a modification counter
1878
1879 wxString m_fileName;
1880
1881 std::map<wxString, KIGFX::COLOR4D> m_netChainColors;
1882
1883 // These containers only have const accessors and must only be modified by Add()/Remove()
1894
1895 // Identity index for the containers above, including their children. Mutable because
1896 // const lookups populate it, and NOT covered by m_CachesMutex: only safe for
1897 // single-threaded access (UI, serialization). BOARD_ITEM_INDEX owns the rules.
1899
1900 std::map<int, LAYER> m_layers; // layer data
1901
1902 HIGH_LIGHT_INFO m_highLight; // current high light data
1903 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1904
1905 int m_fileFormatVersionAtLoad; // the version loaded from the file
1909
1914 std::vector<std::pair<VECTOR2I, int>> m_drillSymbolPlacements;
1915
1916 mutable std::shared_ptr<const DRILL_SYMBOL_CACHE> m_drillSymbolCache;
1917 mutable std::mutex m_drillSymbolCacheMutex;
1918
1919 wxString m_generator; // the generator tag from the file
1920 std::map<wxString, wxString> m_properties;
1921 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1922
1923 // Sentinel whose expiry signals to LOCAL_HISTORY that this board has been destroyed.
1924 std::shared_ptr<void> m_historyLifetime = std::make_shared<char>();
1925
1927 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1929 PROJECT* m_project; // project this board is a part of
1931
1932 // Variant system
1933 wxString m_currentVariant; // Currently active variant (empty = default)
1934 std::vector<wxString> m_variantNames; // All variant names in the board
1935 std::map<wxString, wxString> m_variantDescriptions; // Descriptions for each variant
1936
1947 std::shared_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1948
1953 bool m_legacyTeardrops = false;
1954
1955 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1956
1957 std::vector<BOARD_LISTENER*> m_listeners;
1958
1960
1961 // Used for dummy boards, such as a footprint holder, where we don't want to make a copy
1962 // of all the parent's embedded data.
1964
1965 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1966 std::unique_ptr<LENGTH_DELAY_CALCULATION> m_lengthDelayCalc;
1967
1968 // Reactive text-variable dependency adapter. Installed as a listener during BOARD construction;
1969 // destructor order ensures it outlives no listener calls.
1970 std::unique_ptr<BOARD_TEXT_VAR_ADAPTER> m_textVarAdapter;
1971};
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:917
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:99
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:101
friend class BOARD_ITEM_INDEX
Definition board_item.h:635
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:2680
ZONE * m_SolderMaskBridges
Definition board.h:1835
void ApplyNetChainNetclasses()
Expand the project's chain-to-netclass assignments into per-net pattern assignments,...
Definition board.cpp:3228
void GetContextualTextVars(wxArrayString *aVars) const
Definition board.cpp:678
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:1307
BOARD_STACKUP GetStackupOrDefault() const
Definition board.cpp:3506
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition board.h:1033
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition board.h:1836
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition board.cpp:1182
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:1891
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:3883
std::shared_ptr< void > m_historyLifetime
Definition board.h:1924
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1241
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:1777
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:3356
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition board.h:1798
void CacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1755
int GetUserDefinedLayerCount() const
Definition board.cpp:1171
void recalcOpposites()
Definition board.cpp:1088
void SetPosition(const VECTOR2I &aPos) override
Definition board.cpp:838
std::map< wxString, wxString > m_properties
Definition board.h:1920
bool RenameNets(const std::map< wxString, wxString > &aNewNames, REPORTER &aReporter)
Rename nets without changing net codes or connectivity.
Definition board.h:1252
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsCourtyardResultCache
Definition board.h:1801
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition board.cpp:3709
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition board.h:1800
int m_fileFormatVersionAtLoad
Definition board.h:1905
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition board.cpp:2911
void SetCurrentVariant(const wxString &aVariant)
Definition board.cpp:3016
std::vector< ZONE * > m_DRCCopperZones
Definition board.h:1831
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:1235
void CacheItemById(BOARD_ITEM &aItem) const
Add an item to the item-by-id cache.
Definition board.h:1751
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:1548
std::shared_ptr< const DRILL_SYMBOL_CACHE > m_drillSymbolCache
Definition board.h:1916
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:848
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaResultCache
Definition board.h:1806
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:3820
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:1953
TITLE_BLOCK m_titles
Definition board.h:1927
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
NETINFO_ITEM * FindOrAddNet(const wxString &aNetName, int aNetCode=-1, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false)
Return the net with the given name, adding it to the board if there is none.
Definition board.cpp:2852
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition board.h:1464
std::vector< wxString > m_variantNames
Definition board.h:1934
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition board.h:1314
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition board.h:1300
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition board.h:1703
wxArrayString GetVariantNamesForUI() const
Return the variant names for UI display.
Definition board.cpp:3208
void BuildListOfNets()
Definition board.h:1189
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:1465
void SetNetChainColor(const wxString &aChain, const KIGFX::COLOR4D &aColor)
Per-net-chain colour override (empty COLOR4D::UNSPECIFIED = no override).
Definition board.h:1360
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:1131
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition board.cpp:3785
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition board.h:908
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition board.cpp:1269
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition board.h:1873
uint64_t m_drillModelGeneration
Definition board.h:1906
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:3517
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition board.cpp:2982
BOARD_USE m_boardUse
What is this board being used for.
Definition board.h:1876
void RefreshDrillSymbolLayers()
Definition board.cpp:239
void CopyVariant(const wxString &aOldName, const wxString &aNewName, const wxString &aNewDescription=wxEmptyString)
Definition board.cpp:3137
PCB_BOARD_OUTLINE * BoardOutline()
Definition board.h:487
PAGE_INFO m_paper
Definition board.h:1926
void RemoveAllListeners()
Remove all listeners.
Definition board.cpp:3877
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition board.h:1797
FOOTPRINTS m_footprints
Definition board.h:1886
friend class PCB_EDIT_FRAME
Definition board.h:1869
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
Definition board.h:1688
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:4131
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:3858
const PAGE_INFO & GetPageSettings() const
Definition board.h:1029
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition board.cpp:2078
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition board.h:527
std::vector< PCB_MARKER * > ReloadDRCExclusions(std::vector< PCB_MARKER * > &aStale)
Resolve exclusions again after the project file was reread.
Definition board.cpp:653
bool IsBackLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1013
const std::map< wxString, KIGFX::COLOR4D > & GetNetChainColors() const
Definition board.h:1374
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:1947
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition board.cpp:1263
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3940
void CompileRatsnest()
Rebuild the entire board ratsnest.
Definition board.cpp:3923
HIGH_LIGHT_INFO m_highLight
Definition board.h:1902
std::map< wxString, wxString > m_variantDescriptions
Definition board.h:1935
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition board.cpp:932
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2833
EDA_UNITS m_userUnits
Definition board.h:1930
CONSTRAINTS m_constraints
Definition board.h:1889
void UpdateBoardOutline()
Definition board.cpp:4347
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:1704
void ClearItemByIdCache()
Definition board.h:1763
void DeleteVariant(const wxString &aVariantName)
Definition board.cpp:3061
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition board.h:1857
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1330
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1216
void SanitizeNetcodes()
Definition board.cpp:3838
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
Definition board.cpp:1346
EMBEDDED_FILES * m_embeddedFilesDelegate
Definition board.h:1963
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:3626
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1007
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:4395
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:1229
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition board.cpp:1019
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:1885
uint64_t m_boardOutlineGeneration
Definition board.h:1907
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:3906
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition board.cpp:3322
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition board.cpp:3268
EDA_UNITS GetUserUnits()
Definition board.h:1041
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3931
PCB_PLOT_PARAMS m_plotOptions
Definition board.h:1928
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition board.h:1795
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:978
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition board.cpp:3606
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:1727
bool ResolveTextVar(wxString *token, int aDepth) const
Definition board.cpp:708
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:1148
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition board.cpp:3771
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition board.cpp:844
TITLE_BLOCK & GetTitleBlock()
Definition board.h:1035
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition board.cpp:1472
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition board.cpp:1353
ZONES m_zones
Definition board.h:1890
void InvalidateClearanceCache(const KIID &aUuid)
Invalidate the clearance cache for a specific item.
Definition board.cpp:1339
PAD * GetPad(const VECTOR2I &aPosition) const
Definition board.h:1519
PAD * FindPadByUuid(const KIID &aUuid) const
Definition board.cpp:2950
void OnBoardSelectionChanged()
Notify the board and its listeners that the editor selection has changed.
Definition board.cpp:3900
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition board.cpp:940
HIGH_LIGHT_INFO m_highLightPrevious
Definition board.h:1903
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:878
NETINFO_LIST m_NetInfo
Definition board.h:1955
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:1252
void SetOutlinesChainingEpsilon(int aValue)
Definition board.h:1082
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:3042
NETINFO_LIST::iterator EndNets() const
Definition board.h:1268
void AddVariant(const wxString &aVariantName)
Definition board.cpp:3048
int GetCopperLayerCount() const
Definition board.cpp:1155
std::vector< BOARD_LISTENER * > m_listeners
Definition board.h:1957
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:1992
const std::map< wxString, wxString > & GetProperties() const
Definition board.h:526
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutCache
Definition board.h:1799
void IncrementTimeStamp()
Definition board.cpp:448
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition board.cpp:2863
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:1493
PCB_POINTS m_points
Definition board.h:1893
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
Definition board.h:1966
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition board.h:1246
const FOOTPRINTS & Footprints() const
Definition board.h:465
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition board.h:1921
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition board.cpp:3727
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:1838
const BOARD_ITEM_SET GetItemSet()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
Definition board.cpp:4262
const TRACKS & Tracks() const
Definition board.h:463
int m_DRCMaxPhysicalClearance
Definition board.h:1834
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:2938
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:1695
BOARD_ITEM_INDEX m_itemIndex
Definition board.h:1898
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition board.h:1030
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition board.h:1808
bool m_embedFonts
Definition board.h:1959
wxString GroupsSanityCheckInternal(bool repair)
Definition board.cpp:3979
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > m_footprintCourtyardIndex
Definition board.h:1827
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition board.cpp:3917
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition board.cpp:2402
wxString GetClass() const override
Return the class name.
Definition board.h:1433
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition board.h:1965
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition board.h:1796
const CONSTRAINTS & Constraints() const
Geometric constraints (#2329) owned by this board.
Definition board.h:522
NETINFO_LIST::iterator BeginNets() const
Definition board.h:1260
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:3651
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition board.h:569
void SetCopperLayerCount(int aCount)
Definition board.cpp:1161
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition board.h:1811
std::unordered_map< const ZONE *, SHAPE_POLY_SET > m_DeflatedZoneOutlineCache
Definition board.h:1824
wxString m_generator
Definition board.h:1919
std::vector< BOARD_ITEM * > collectOwnedItems() const
Get a simple vector of the board's pointers.
Definition board.cpp:4240
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsFCourtyardResultCache
Definition board.h:1802
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition board.cpp:910
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:379
PROJECT * m_project
Definition board.h:1929
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:3542
bool HasItemsOnLayer(PCB_LAYER_ID aLayer)
Definition board.cpp:1946
const wxString & GetFileName() const
Definition board.h:454
bool operator==(const BOARD_ITEM &aOther) const override
Definition board.cpp:4279
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:4377
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutResultCache
Definition board.h:1805
wxString GetVariantDescription(const wxString &aVariantName) const
Definition board.cpp:3172
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition board.cpp:2926
unsigned GetNodesCount(int aNet=-1) const
Definition board.cpp:2555
bool IsHighLightNetON() const
Definition board.h:864
bool IsItemIndexedById(const KIID &aId) const
Return true if an index entry for aId exists.
Definition board.h:1743
SHARDED_CACHE< ITEM_FIELD_CACHE_KEY, wxString > m_ItemFieldCache
Definition board.h:1807
int GetFileFormatVersionAtLoad() const
Definition board.h:585
std::map< PCB_LAYER_ID, std::vector< ZONE * > > m_DRCCopperZonesByLayer
Definition board.h:1832
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition board.cpp:1275
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition board.h:1810
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition board.cpp:1038
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition board.h:1032
void ClearNetChainColors()
Definition board.h:1379
std::optional< std::set< const PCB_VIA * > > m_StackedMicroviaCache
Definition board.h:1816
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition board.h:1879
const wxString & GetGenerator() const
Definition board.h:643
int GetAreaCount() const
Definition board.h:1480
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:2149
void SetLegacyTeardrops(bool aFlag)
Definition board.h:1683
std::map< int, LAYER > m_layers
Definition board.h:1900
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:865
int GetOutlinesChainingEpsilon()
Definition board.h:1081
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:3491
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
Definition board.cpp:3848
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:1208
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsAreaResultCache
Definition board.h:1804
int m_DRCMaxClearance
Definition board.h:1833
void ClearProject()
Definition board.cpp:420
void ReplaceNetChainTerminalPad(const wxString &aNetChain, const KIID &aPrev, const KIID &aNew)
Definition board.cpp:2962
void SetLayerSet(const LSET &aLayerMask) override
Definition board.h:916
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition board.h:1809
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:1686
wxString m_currentVariant
Definition board.h:1933
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition board.cpp:1195
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:2137
PROJECT * GetProject() const
Definition board.h:774
bool IsEmpty() const
Definition board.cpp:826
int GetPadWithPressFitAttrCount()
Definition board.cpp:4359
bool LegacyTeardrops() const
Definition board.h:1682
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:2642
const TITLE_BLOCK & GetTitleBlock() const
Definition board.h:1036
KIGFX::COLOR4D GetNetChainColor(const wxString &aChain) const
Definition board.h:1368
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:3965
void RenameVariant(const wxString &aOldName, const wxString &aNewName)
Definition board.cpp:3089
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:1830
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1202
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:1914
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:2482
void UncacheItemSubtreeById(const BOARD_ITEM &aItem)
Uncache an item and its children.
Definition board.h:1759
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
Definition board.cpp:2326
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2996
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition board.cpp:3865
std::unique_ptr< BOARD_TEXT_VAR_ADAPTER > m_textVarAdapter
Definition board.h:1970
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition board.h:1708
std::shared_mutex m_CachesMutex
Definition board.h:1792
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition board.cpp:2572
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:1276
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:1511
std::atomic< int > m_timeStamp
Definition board.h:1877
std::mutex m_drillSymbolCacheMutex
Definition board.h:1917
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition board.cpp:3312
void UncacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1761
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition board.cpp:2100
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition board.cpp:1723
std::unordered_map< wxString, std::vector< ZONE * > > m_ZonesByNameCache
Definition board.h:1820
GROUPS m_groups
Definition board.h:1888
PROJECT::ELEM ProjectElementType() override
Definition board.h:1710
MARKERS m_markers
Definition board.h:1884
bool IsItemIndexedById(const BOARD_ITEM *aItem) const
Return true if aItem is currently indexed.
Definition board.h:1737
LSET m_drillSymbolLayers
Definition board.h:1908
std::optional< int > m_maxClearanceValue
Definition board.h:1812
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3955
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1222
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition board.h:1037
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition board.cpp:3222
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition board.h:1887
std::map< wxString, KIGFX::COLOR4D > m_netChainColors
Definition board.h:1881
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
Definition board.cpp:2176
bool m_LegacyCopperEdgeClearanceLoaded
Definition board.h:566
int GetTimeStamp() const
Definition board.h:434
BOARD_DESIGN_SETTINGS & GetDesignSettings()
Definition board.cpp:1318
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:3892
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsBCourtyardResultCache
Definition board.h:1803
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:832
DRC_RTREE * GetCopperZoneRTree(ZONE *aZone) const
Look up a zone's filled-copper R-tree.
Definition board.h:1842
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Definition board.cpp:3191
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition board.cpp:1385
static bool ClassOf(const EDA_ITEM *aItem)
Definition board.h:413
void SetUserUnits(EDA_UNITS aUnits)
Definition board.h:1042
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1242
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition board.cpp:3754
void CacheItemSubtreeById(BOARD_ITEM &aItem)
Definition board.h:1753
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition board.h:1426
PCB_BOARD_OUTLINE * m_boardOutline
Definition board.h:1892
void SetUserDefinedLayerCount(int aCount)
Definition board.cpp:1177
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:2072
void SetFileFormatVersionAtLoad(int aVersion)
Definition board.h:584
constexpr const Vec GetCenter() const
Definition box2.h:233
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:434
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:45
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:26
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:4069
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition board.cpp:4048
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:1067
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:1051
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
m_board BuildConnectivity()
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.