KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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, jaen-pierre.charras@gipsa-lab.inpg.com
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef CLASS_BOARD_H_
26#define CLASS_BOARD_H_
27
31#include <embedded_files.h>
32#include <common.h> // Needed for stl hash extensions
33#include <convert_shape_list_to_polygon.h> // for OUTLINE_ERROR_HANDLER
34#include <hash.h>
35#include <layer_ids.h>
36#include <length_calculation.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 <tools/pcb_selection.h>
43#include <shared_mutex>
44#include <project.h>
45#include <list>
46
49class BOARD_COMMIT;
50class DRC_RTREE;
51class PCB_BASE_FRAME;
52class PCB_EDIT_FRAME;
54class BOARD;
55class FOOTPRINT;
56class ZONE;
57class PCB_TRACK;
58class PAD;
59class PCB_GROUP;
60class PCB_GENERATOR;
61class PCB_MARKER;
62class MSG_PANEL_ITEM;
63class NETLIST;
64class REPORTER;
65class SHAPE_POLY_SET;
67class COMPONENT;
68class PROJECT;
70namespace KIFONT
71{
72 class OUTLINE_FONT;
73}
74
75struct ISOLATED_ISLANDS;
76
77// The default value for m_outlinesChainingEpsilon to convert a board outlines to polygons
78// It is the max dist between 2 end points to see them connected
79#define DEFAULT_CHAINING_EPSILON_MM 0.01
80
81// Forward declare endpoint from class_track.h
82enum ENDPOINT_T : int;
83
84
86{
89
90 bool operator==(const PTR_PTR_CACHE_KEY& other) const
91 {
92 return A == other.A && B == other.B;
93 }
94};
95
97{
100
101 bool operator==(const PTR_LAYER_CACHE_KEY& other) const
102 {
103 return A == other.A && Layer == other.Layer;
104 }
105};
106
108{
112
113 bool operator==(const PTR_PTR_LAYER_CACHE_KEY& other) const
114 {
115 return A == other.A && B == other.B && Layer == other.Layer;
116 }
117};
118
119namespace std
120{
121 template <>
122 struct hash<PTR_PTR_CACHE_KEY>
123 {
124 std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
125 {
126 std::size_t seed = 0xa82de1c0;
127 hash_combine( seed, k.A, k.B );
128 return seed;
129 }
130 };
131
132 template <>
134 {
135 std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
136 {
137 std::size_t seed = 0xa82de1c0;
138 hash_combine( seed, k.A, k.Layer );
139 return seed;
140 }
141 };
142
143 template <>
145 {
146 std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
147 {
148 std::size_t seed = 0xa82de1c0;
149 hash_combine( seed, k.A, k.B, k.Layer );
150 return seed;
151 }
152 };
153}
154
155
160{
168 LT_BACK
170
171
175struct LAYER
176{
178 {
179 clear();
180 }
181
182 void clear()
183 {
185 m_visible = true;
186 m_number = 0;
187 m_name.clear();
188 m_userName.clear();
190 }
191
192 /*
193 LAYER( const wxString& aName = wxEmptyString,
194 LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
195 m_name( aName ),
196 m_type( aType ),
197 m_visible( aVisible ),
198 m_number( aNumber )
199 {
200 }
201 */
202
203 wxString m_name;
204 wxString m_userName;
209
216 static const char* ShowType( LAYER_T aType );
217
225 static LAYER_T ParseType( const char* aType );
226};
227
228
229// Helper class to handle high light nets
231{
232protected:
233 std::set<int> m_netCodes; // net(s) selected for highlight (-1 when no net selected )
234 bool m_highLightOn; // highlight active
235
236 void Clear()
237 {
238 m_netCodes.clear();
239 m_highLightOn = false;
240 }
241
243 {
244 Clear();
245 }
246
247private:
248 friend class BOARD;
249};
250
256class BOARD;
257
259{
260public:
261 virtual ~BOARD_LISTENER() { }
262 virtual void OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
263 virtual void OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
264 virtual void OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
265 virtual void OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
266 virtual void OnBoardNetSettingsChanged( BOARD& aBoard ) { }
267 virtual void OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem ) { }
268 virtual void OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItem ) { }
269 virtual void OnBoardHighlightNetChanged( BOARD& aBoard ) { }
270 virtual void OnBoardRatsnestChanged( BOARD& aBoard ) { }
271 virtual void OnBoardCompositeUpdate( BOARD& aBoard, std::vector<BOARD_ITEM*>& aAddedItems,
272 std::vector<BOARD_ITEM*>& aRemovedItems,
273 std::vector<BOARD_ITEM*>& aChangedItems )
274 {
275 }
276};
277
281typedef std::set<BOARD_ITEM*, CompareByUuid> BOARD_ITEM_SET;
282
286enum class BOARD_USE
287{
288 NORMAL, // A normal board
289 FPHOLDER // A board that holds a single footprint
290};
291
292
297{
298public:
299 static inline bool ClassOf( const EDA_ITEM* aItem )
300 {
301 return aItem && PCB_T == aItem->Type();
302 }
303
309 void SetBoardUse( BOARD_USE aUse ) { m_boardUse = aUse; }
310
316 BOARD_USE GetBoardUse() const { return m_boardUse; }
317
318 void IncrementTimeStamp();
319
320 int GetTimeStamp() const { return m_timeStamp; }
321
327 bool IsFootprintHolder() const
328 {
329 return m_boardUse == BOARD_USE::FPHOLDER;
330 }
331
332 void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
333
334 const wxString &GetFileName() const { return m_fileName; }
335
336 const TRACKS& Tracks() const { return m_tracks; }
337
338 const FOOTPRINTS& Footprints() const { return m_footprints; }
339
340 const DRAWINGS& Drawings() const { return m_drawings; }
341
342 const ZONES& Zones() const { return m_zones; }
343
344 const GENERATORS& Generators() const { return m_generators; }
345
346 const MARKERS& Markers() const { return m_markers; }
347
348 // SWIG requires non-const accessors for some reason to make the custom iterators in board.i
349 // work. It would be good to remove this if we can figure out how to fix that.
350#ifdef SWIG
351 DRAWINGS& Drawings() { return m_drawings; }
352 TRACKS& Tracks() { return m_tracks; }
353#endif
354
356
365 const GROUPS& Groups() const { return m_groups; }
366
367 const std::vector<BOARD_CONNECTED_ITEM*> AllConnectedItems();
368
369 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
370 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
371
372 void GetContextualTextVars( wxArrayString* aVars ) const;
373 bool ResolveTextVar( wxString* token, int aDepth ) const;
374
378
382
385
386 BOARD();
387 ~BOARD();
388
389 VECTOR2I GetPosition() const override;
390 void SetPosition( const VECTOR2I& aPos ) override;
391 const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
392
393 bool IsEmpty() const
394 {
395 return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
396 }
397
398 void Move( const VECTOR2I& aMoveVector ) override;
399
400 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
401
402 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
404
405 void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
406 const wxString& GetGenerator() const { return m_generator; }
407
409 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
410 bool aSkipConnectivity = false ) override;
411
413 void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
414
423 void RemoveAll( std::initializer_list<KICAD_T> aTypes = { PCB_NETINFO_T, PCB_MARKER_T,
427
432 void BulkRemoveStaleTeardrops( BOARD_COMMIT& aCommit );
433
438 void FinalizeBulkAdd( std::vector<BOARD_ITEM*>& aNewItems );
439
444 void FinalizeBulkRemove( std::vector<BOARD_ITEM*>& aRemovedItems );
445
451 void FixupEmbeddedData();
452
453 void CacheTriangulation( PROGRESS_REPORTER* aReporter = nullptr,
454 const std::vector<ZONE*>& aZones = {} );
455
464 {
465 return m_footprints.empty() ? nullptr : m_footprints.front();
466 }
467
471 void DeleteAllFootprints();
472
476 void DetachAllFootprints();
477
481 BOARD_ITEM* GetItem( const KIID& aID ) const;
482
483 void FillItemMap( std::map<KIID, EDA_ITEM*>& aMap );
484
488 wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
489 wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
490
495 std::shared_ptr<CONNECTIVITY_DATA> GetConnectivity() const { return m_connectivity; }
496
502 bool BuildConnectivity( PROGRESS_REPORTER* aReporter = nullptr );
503
507 void DeleteMARKERs();
508
509 void DeleteMARKERs( bool aWarningsAndErrors, bool aExclusions );
510
511 PROJECT* GetProject() const { return m_project; }
512
521 void SetProject( PROJECT* aProject, bool aReferenceOnly = false );
522
523 void ClearProject();
524
532 std::vector<PCB_MARKER*> ResolveDRCExclusions( bool aCreateMarkers );
533
537 void RecordDRCExclusions();
538
543
547 void ResetNetHighLight();
548
552 const std::set<int>& GetHighLightNetCodes() const
553 {
554 return m_highLight.m_netCodes;
555 }
556
563 void SetHighLightNet( int aNetCode, bool aMulti = false );
564
569
577 void HighLightON( bool aValue = true );
578
583 {
584 HighLightON( false );
585 }
586
590 int GetCopperLayerCount() const;
591 void SetCopperLayerCount( int aCount );
592
593 int GetUserDefinedLayerCount() const;
594 void SetUserDefinedLayerCount( int aCount );
595
601
602 PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayer ) const;
603
604 int LayerDepth( PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer ) const;
605
611 LSET GetEnabledLayers() const;
612 LSET GetLayerSet() const override { return GetEnabledLayers(); }
613
619 void SetEnabledLayers( const LSET& aLayerMask );
620 void SetLayerSet( const LSET& aLayerMask ) override { SetEnabledLayers( aLayerMask ); }
621
628 bool IsLayerEnabled( PCB_LAYER_ID aLayer ) const;
629
637 bool IsLayerVisible( PCB_LAYER_ID aLayer ) const;
638
644 LSET GetVisibleLayers() const;
645
652 void SetVisibleLayers( const LSET& aLayerMask );
653
654 // these 2 functions are not tidy at this time, since there are PCB_LAYER_IDs that
655 // are not stored in the bitmap.
656
664
671 void SetVisibleElements( const GAL_SET& aMask );
672
678 void SetVisibleAlls();
679
687 bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
688
696 void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
697
705 bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
706
711 void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
712
714
715 const PAGE_INFO& GetPageSettings() const { return m_paper; }
716 void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
717
719 void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
720
722 const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
723 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
724
725 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
726
728 void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
729
734 void UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView );
735
754 OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr,
755 bool aAllowUseArcsInPolygons = false,
756 bool aIncludeNPTHAsOutlines = false );
757
767
778 void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const;
779
783 PCB_LAYER_ID GetLayerID( const wxString& aLayerName ) const;
784
791 const wxString GetLayerName( PCB_LAYER_ID aLayer ) const;
792
800 bool SetLayerName( PCB_LAYER_ID aLayer, const wxString& aLayerName );
801
812 static wxString GetStandardLayerName( PCB_LAYER_ID aLayerId )
813 {
814 // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
815 return LayerName( aLayerId );
816 }
817
825 bool SetLayerDescr( PCB_LAYER_ID aIndex, const LAYER& aLayer );
826
833 LAYER_T GetLayerType( PCB_LAYER_ID aLayer ) const;
834
842 bool SetLayerType( PCB_LAYER_ID aLayer, LAYER_T aLayerType );
843
848 unsigned GetNodesCount( int aNet = -1 ) const;
849
858 const std::vector<PAD*> GetPads() const;
859
861 {
863 }
864
871 NETINFO_ITEM* FindNet( int aNetcode ) const;
872
879 NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
880
890 int MatchDpSuffix( const wxString& aNetName, wxString& aComplementNet );
891
895 NETINFO_ITEM* DpCoupledNet( const NETINFO_ITEM* aNet );
896
898 {
899 return m_NetInfo;
900 }
901
903 {
904 m_NetInfo.RemoveUnusedNets( aCommit );
905 }
906
907#ifndef SWIG
912 {
913 return m_NetInfo.begin();
914 }
915
920 {
921 return m_NetInfo.end();
922 }
923#endif
924
928 unsigned GetNetCount() const
929 {
930 return m_NetInfo.GetNetCount();
931 }
932
939 BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
940
941 const BOX2I GetBoundingBox() const override
942 {
943 return ComputeBoundingBox( false );
944 }
945
956 {
957 return ComputeBoundingBox( true );
958 }
959
960 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
961
973 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
974 const std::vector<KICAD_T>& scanTypes ) override;
975
984 FOOTPRINT* FindFootprintByReference( const wxString& aReference ) const;
985
992 FOOTPRINT* FindFootprintByPath( const KIID_PATH& aPath ) const;
993
997 std::set<wxString> GetNetClassAssignmentCandidates() const;
998
1006 void SynchronizeNetsAndNetClasses( bool aResetTrackAndViaSizes );
1007
1011 bool SynchronizeComponentClasses( const std::unordered_set<wxString>& aNewSheetPaths ) const;
1012
1016 void SynchronizeProperties();
1017
1021 double Similarity( const BOARD_ITEM& aOther ) const override
1022 {
1023 return 1.0;
1024 }
1025
1026 bool operator==( const BOARD_ITEM& aOther ) const override;
1027
1028 wxString GetClass() const override
1029 {
1030 return wxT( "BOARD" );
1031 }
1032
1033#if defined(DEBUG)
1034 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1035#endif
1036
1037
1038 /*************************/
1039 /* Copper Areas handling */
1040 /*************************/
1041
1052
1059 ZONE* GetArea( int index ) const
1060 {
1061 if( (unsigned) index < m_zones.size() )
1062 return m_zones[index];
1063
1064 return nullptr;
1065 }
1066
1070 std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
1071
1075 int GetAreaCount() const
1076 {
1077 return static_cast<int>( m_zones.size() );
1078 }
1079
1080 /* Functions used in test, merge and cut outlines */
1081
1094 ZONE* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
1095 VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
1096
1104 bool TestZoneIntersection( ZONE* aZone1, ZONE* aZone2 );
1105
1113 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1114 PAD* GetPad( const VECTOR2I& aPosition ) const
1115 {
1116 return GetPad( aPosition, LSET().set() );
1117 }
1118
1126 PAD* GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
1127
1137 PAD* GetPadFast( const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1138
1153 PAD* GetPad( std::vector<PAD*>& aPadList, const VECTOR2I& aPosition, const LSET& aLayerMask ) const;
1154
1166 void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
1167
1175 std::tuple<int, double, double> GetTrackLength( const PCB_TRACK& aTrack ) const;
1176
1184 TRACKS TracksInNet( int aNetCode );
1185
1198 FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
1199 bool aVisibleOnly, bool aIgnoreLocked = false ) const;
1200
1206 int GetMaxClearanceValue() const;
1207
1213 void MapNets( BOARD* aDestBoard );
1214
1215 void SanitizeNetcodes();
1216
1225 void AddListener( BOARD_LISTENER* aListener );
1226
1231 void RemoveListener( BOARD_LISTENER* aListener );
1232
1236 void RemoveAllListeners();
1237
1242 void OnItemChanged( BOARD_ITEM* aItem );
1243
1248 void OnItemsChanged( std::vector<BOARD_ITEM*>& aItems );
1249
1254 void OnItemsCompositeUpdate( std::vector<BOARD_ITEM*>& aAddedItems,
1255 std::vector<BOARD_ITEM*>& aRemovedItems,
1256 std::vector<BOARD_ITEM*>& aChangedItems );
1257
1261 void OnRatsnestChanged();
1262
1269 wxString GroupsSanityCheck( bool repair = false );
1270
1276 wxString GroupsSanityCheckInternal( bool repair );
1277
1279 {
1280 bool create : 1;
1281 bool ungroup : 1;
1282 bool removeItems : 1;
1283 };
1284
1290 GroupLegalOpsField GroupLegalOps( const PCB_SELECTION& selection ) const;
1291
1292 bool LegacyTeardrops() const { return m_legacyTeardrops; }
1293 void SetLegacyTeardrops( bool aFlag ) { m_legacyTeardrops = aFlag; }
1294
1295 EMBEDDED_FILES* GetEmbeddedFiles() override;
1296 const EMBEDDED_FILES* GetEmbeddedFiles() const;
1297
1301 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1302
1306 void EmbedFonts() override;
1307
1312
1317
1319
1320 // --------- Item order comparators ---------
1321
1323 {
1324 bool operator() ( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1325 };
1326
1328 {
1329 bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
1330 };
1331
1332public:
1333 // ------------ Run-time caches -------------
1334 mutable std::shared_mutex m_CachesMutex;
1335 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsCourtyardCache;
1336 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsFCourtyardCache;
1337 std::unordered_map<PTR_PTR_CACHE_KEY, bool> m_IntersectsBCourtyardCache;
1338 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_IntersectsAreaCache;
1339 std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, bool> m_EnclosedByAreaCache;
1340 std::unordered_map< wxString, LSET > m_LayerExpressionCache;
1341 std::unordered_map<ZONE*, std::unique_ptr<DRC_RTREE>> m_CopperZoneRTreeCache;
1342 std::shared_ptr<DRC_RTREE> m_CopperItemRTreeCache;
1343 mutable std::unordered_map<const ZONE*, BOX2I> m_ZoneBBoxCache;
1344 mutable std::optional<int> m_maxClearanceValue;
1345
1346 // ------------ DRC caches -------------
1347 std::vector<ZONE*> m_DRCZones;
1348 std::vector<ZONE*> m_DRCCopperZones;
1351 ZONE* m_SolderMaskBridges; // A container to build bridges on solder mask layers
1352 std::map<ZONE*, std::map<PCB_LAYER_ID, ISOLATED_ISLANDS>> m_ZoneIsolatedIslandsMap;
1353
1354private:
1355 // The default copy constructor & operator= are inadequate,
1356 // either write one or do not use it at all
1357 BOARD( const BOARD& aOther ) = delete;
1358
1359 BOARD& operator=( const BOARD& aOther ) = delete;
1360
1361 template <typename Func, typename... Args>
1362 void InvokeListeners( Func&& aFunc, Args&&... args )
1363 {
1364 for( auto&& l : m_listeners )
1365 ( l->*aFunc )( std::forward<Args>( args )... );
1366 }
1367
1368 // Refresh user layer opposites.
1369 void recalcOpposites();
1370
1371 friend class PCB_EDIT_FRAME;
1372
1373private:
1376
1379 int m_timeStamp; // actually a modification counter
1380
1381 wxString m_fileName;
1382
1383 // These containers only have const accessors and must only be modified by Add()/Remove()
1384 MARKERS m_markers;
1385 DRAWINGS m_drawings;
1386 FOOTPRINTS m_footprints;
1388 GROUPS m_groups;
1390 GENERATORS m_generators;
1391
1392 // Cache for fast access to items in the containers above by KIID, including children
1393 std::unordered_map<KIID, BOARD_ITEM*> m_itemByIdCache;
1394
1395 std::map<int, LAYER> m_layers; // layer data
1396
1397 HIGH_LIGHT_INFO m_highLight; // current high light data
1398 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
1399
1400 int m_fileFormatVersionAtLoad; // the version loaded from the file
1401 wxString m_generator; // the generator tag from the file
1402
1403 std::map<wxString, wxString> m_properties;
1404 std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
1405
1407 TITLE_BLOCK m_titles; // text in lower right of screen and plots
1409 PROJECT* m_project; // project this board is a part of
1411
1422 std::unique_ptr<BOARD_DESIGN_SETTINGS> m_designSettings;
1423
1428 bool m_legacyTeardrops = false;
1429
1430 NETINFO_LIST m_NetInfo; // net info list (name, design constraints...
1431
1432 std::vector<BOARD_LISTENER*> m_listeners;
1433
1435
1436 std::unique_ptr<COMPONENT_CLASS_MANAGER> m_componentClassManager;
1437
1438 std::unique_ptr<LENGTH_CALCULATION> m_lengthCalc;
1439};
1440
1441
1442#endif // CLASS_BOARD_H_
BOARD_USE
Flags to specify how the board is being used.
Definition: board.h:287
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition: board.h:160
@ LT_POWER
Definition: board.h:163
@ LT_FRONT
Definition: board.h:167
@ LT_MIXED
Definition: board.h:164
@ LT_BACK
Definition: board.h:168
@ LT_UNDEFINED
Definition: board.h:161
@ LT_JUMPER
Definition: board.h:165
@ LT_AUX
Definition: board.h:166
@ LT_SIGNAL
Definition: board.h:162
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition: board.h:281
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Container for design settings for a BOARD object.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:78
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:146
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
Definition: board.h:266
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:263
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
Definition: board.h:270
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:268
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:267
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:264
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:262
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:269
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Definition: board.h:271
virtual ~BOARD_LISTENER()
Definition: board.h:261
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:265
Manage layers needed to make a physical board.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
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:1862
ZONE * m_SolderMaskBridges
Definition: board.h:1351
void GetContextualTextVars(wxArrayString *aVars) const
Definition: board.cpp:408
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:934
BOARD_STACKUP GetStackupOrDefault() const
Definition: board.cpp:2388
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
Definition: board.h:719
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition: board.h:1339
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
Definition: board.h:1352
PCB_LAYER_ID GetCopperLayerStackMaxId() const
Definition: board.cpp:804
GENERATORS m_generators
Definition: board.h:1390
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
Definition: board.cpp:2531
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:2736
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:897
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:380
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition: board.h:327
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:2219
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:829
int GetUserDefinedLayerCount() const
Definition: board.cpp:793
void recalcOpposites()
Definition: board.cpp:713
void SetPosition(const VECTOR2I &aPos) override
Definition: board.cpp:497
std::map< wxString, wxString > m_properties
Definition: board.h:1403
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: board.cpp:2584
int m_fileFormatVersionAtLoad
Definition: board.h:1400
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
Definition: board.cpp:2082
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:843
std::vector< ZONE * > m_DRCCopperZones
Definition: board.h:1348
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:861
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:316
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:1060
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:552
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:2682
bool m_legacyTeardrops
Teardrops in 7.0 were applied as a post-processing step (rather than from pad and via properties).
Definition: board.h:1428
TITLE_BLOCK m_titles
Definition: board.h:1407
GAL_SET m_LegacyVisibleItems
Definition: board.h:377
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:309
ZONE * GetArea(int index) const
Return the Zone at a given index.
Definition: board.h:1059
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:955
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:941
void BuildListOfNets()
Definition: board.h:860
const GENERATORS & Generators() const
Definition: board.h:344
void SetFileName(const wxString &aFileName)
Definition: board.h:332
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:812
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:2656
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: board.h:612
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:895
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
Definition: board.h:1375
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
Definition: board.cpp:2121
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1378
PAGE_INFO m_paper
Definition: board.h:1406
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2730
FOOTPRINTS m_footprints
Definition: board.h:1386
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
Definition: board.h:1422
std::unique_ptr< LENGTH_CALCULATION > m_lengthCalc
Definition: board.h:1438
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:2711
const PAGE_INFO & GetPageSettings() const
Definition: board.h:715
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
Definition: board.cpp:1413
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: board.h:370
BOARD(const BOARD &aOther)=delete
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:889
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2772
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1397
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
Definition: board.cpp:586
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:2011
EDA_UNITS m_userUnits
Definition: board.h:1410
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:1501
const ZONES & Zones() const
Definition: board.h:342
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
Definition: board.cpp:1196
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1362
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition: board.cpp:952
void SanitizeNetcodes()
Definition: board.cpp:2701
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:2506
const GROUPS & Groups() const
The groups must maintain the following invariants.
Definition: board.h:365
~BOARD()
Definition: board.cpp:139
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:185
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:855
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
Definition: board.cpp:652
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
Definition: board.cpp:328
DRAWINGS m_drawings
Definition: board.h:1385
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:2748
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
Definition: board.cpp:2185
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:2144
EDA_UNITS GetUserUnits()
Definition: board.h:727
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2763
PCB_PLOT_PARAMS m_plotOptions
Definition: board.h:1408
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:632
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
Definition: board.cpp:2486
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition: board.cpp:2967
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:434
const MARKERS & Markers() const
Definition: board.h:346
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:463
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition: board.cpp:774
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
Definition: board.cpp:2642
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: board.cpp:503
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:721
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1763
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
Definition: board.cpp:1040
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
Definition: board.cpp:958
ZONES m_zones
Definition: board.h:1389
PAD * GetPad(const VECTOR2I &aPosition) const
Definition: board.h:1114
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
Definition: board.cpp:594
HIGH_LIGHT_INFO m_highLightPrevious
Definition: board.h:1398
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: board.h:391
void HighLightOFF()
Disable net highlight.
Definition: board.h:582
NETINFO_LIST m_NetInfo
Definition: board.h:1430
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition: board.h:376
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:878
void SetOutlinesChainingEpsilon(int aValue)
Definition: board.h:766
NETINFO_LIST::iterator EndNets() const
Definition: board.h:919
GroupLegalOpsField GroupLegalOps(const PCB_SELECTION &selection) const
Check which selection tool group operations are legal given the selection.
Definition: board.cpp:2877
int GetCopperLayerCount() const
Definition: board.cpp:781
int m_timeStamp
Definition: board.h:1379
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1432
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:369
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition: board.h:1335
void IncrementTimeStamp()
Definition: board.cpp:253
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
Definition: board.cpp:2032
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition: board.h:1336
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition: board.h:902
const FOOTPRINTS & Footprints() const
Definition: board.h:338
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1404
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
Definition: board.cpp:2602
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:1326
const BOARD_ITEM_SET GetItemSet()
Definition: board.cpp:3068
const TRACKS & Tracks() const
Definition: board.h:336
int m_DRCMaxPhysicalClearance
Definition: board.h:1350
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
Definition: board.cpp:2109
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:1190
void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: board.h:716
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition: board.h:1340
bool m_embedFonts
Definition: board.h:1434
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2808
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
Definition: board.cpp:2757
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
Definition: board.cpp:1644
wxString GetClass() const override
Return the class name.
Definition: board.h:1028
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
Definition: board.h:1436
NETINFO_LIST::iterator BeginNets() const
Definition: board.h:911
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:384
void SetCopperLayerCount(int aCount)
Definition: board.cpp:787
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition: board.h:1343
wxString m_generator
Definition: board.h:1401
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition: board.h:1337
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
Definition: board.cpp:564
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:195
PROJECT * m_project
Definition: board.h:1409
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:2422
const wxString & GetFileName() const
Definition: board.h:334
bool operator==(const BOARD_ITEM &aOther) const override
Definition: board.cpp:3083
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
Definition: board.cpp:345
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:2097
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:1746
bool IsHighLightNetON() const
Definition: board.h:568
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Definition: board.cpp:1605
int GetFileFormatVersionAtLoad() const
Definition: board.h:403
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:901
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
Definition: board.h:1342
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
Definition: board.cpp:671
const PCB_PLOT_PARAMS & GetPlotOptions() const
Definition: board.h:718
BOARD & operator=(const BOARD &aOther)=delete
wxString m_fileName
Definition: board.h:1381
const wxString & GetGenerator() const
Adds an item to the container.
Definition: board.h:406
int GetAreaCount() const
Definition: board.h:1075
void DetachAllFootprints()
Remove all footprints without deleting.
Definition: board.cpp:1489
void SetLegacyTeardrops(bool aFlag)
Definition: board.h:1293
std::map< int, LAYER > m_layers
Definition: board.h:1395
PAD * GetPadFast(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Return pad found at aPosition on aLayerMask using the fast search method.
Definition: board.cpp:2246
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: board.cpp:525
int GetOutlinesChainingEpsilon()
Definition: board.h:765
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:2373
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:835
int m_DRCMaxClearance
Definition: board.h:1349
void ClearProject()
Definition: board.cpp:233
void SetLayerSet(const LSET &aLayerMask) override
Definition: board.h:620
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition: board.h:1341
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:1184
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
Definition: board.cpp:817
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1477
PROJECT * GetProject() const
Definition: board.h:511
bool IsEmpty() const
Definition: board.h:393
bool LegacyTeardrops() const
Definition: board.h:1292
std::tuple< int, 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:2399
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:1824
const TITLE_BLOCK & GetTitleBlock() const
Definition: board.h:722
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
Definition: board.cpp:2795
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:946
std::vector< ZONE * > m_DRCZones
Definition: board.h:1347
void SetGenerator(const wxString &aGenerator)
Definition: board.h:405
BOARD()
Definition: board.cpp:76
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:297
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
Definition: board.cpp:1698
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition: board.cpp:2135
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
Definition: board.h:1393
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
Definition: board.cpp:2718
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
Definition: board.h:1316
std::shared_mutex m_CachesMutex
Definition: board.h:1334
unsigned GetNetCount() const
Definition: board.h:928
LENGTH_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
Definition: board.h:1311
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
Definition: board.cpp:2174
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:1439
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:1213
GROUPS m_groups
Definition: board.h:1388
PROJECT::ELEM ProjectElementType() override
Definition: board.h:1318
MARKERS m_markers
Definition: board.h:1384
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
Definition: board.h:1338
std::optional< int > m_maxClearanceValue
Definition: board.h:1344
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2785
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:849
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: board.h:723
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
TRACKS m_tracks
Definition: board.h:1387
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:381
int GetTimeStamp() const
Definition: board.h:320
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:2742
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:495
VECTOR2I GetPosition() const override
Definition: board.cpp:491
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition: board.cpp:990
static bool ClassOf(const EDA_ITEM *aItem)
Definition: board.h:299
void SetUserUnits(EDA_UNITS aUnits)
Definition: board.h:728
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:868
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
Definition: board.cpp:2630
double Similarity(const BOARD_ITEM &aOther) const override
Return the Similarity.
Definition: board.h:1021
void SetUserDefinedLayerCount(int aCount)
Definition: board.cpp:799
const DRAWINGS & Drawings() const
Definition: board.h:340
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: board.cpp:1407
void SetFileFormatVersionAtLoad(int aVersion)
Definition: board.h:402
constexpr const Vec GetCenter() const
Definition: box2.h:230
A class to manage Component Classes in a board context.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
Implement an R-tree for fast spatial and layer indexing of connectable items.
Definition: drc_rtree.h:48
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:95
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:107
Helper for storing and iterating over GAL_LAYER_IDs.
Definition: layer_ids.h:392
void Clear()
Definition: board.h:236
HIGH_LIGHT_INFO()
Definition: board.h:242
std::set< int > m_netCodes
Definition: board.h:233
bool m_highLightOn
Definition: board.h:234
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
Definition: kiid.h:49
Class which calculates lengths (and associated routing statistics) in a BOARD context.
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Handle the data for a net.
Definition: netinfo.h:56
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:407
Container for NETINFO_ITEM elements, which are the nets.
Definition: netinfo.h:346
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
iterator begin() const
Definition: netinfo.h:452
unsigned GetNetCount() const
Definition: netinfo.h:369
iterator end() const
Definition: netinfo.h:457
void buildListOfNets()
Rebuild the list of NETINFO_ITEMs.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:255
Definition: pad.h:54
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:59
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:52
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:96
Container for project specific data.
Definition: project.h:64
ELEM
The set of #_ELEMs that a PROJECT can hold.
Definition: project.h:70
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:73
Represent a set of closed polygons.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
Handle a list of polygons defining a copper zone.
Definition: zone.h:74
The common library.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
RECURSE_MODE
Definition: eda_item.h:49
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:88
EDA_UNITS
Definition: eda_units.h:46
static constexpr void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
Definition: hash.h:32
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition: layer_id.cpp:31
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:228
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
STL namespace.
std::vector< ZONE * > ZONES
Definition: pcb_io_eagle.h:47
ENDPOINT_T
Definition: pcb_track.h:59
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: board.cpp:2927
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: board.cpp:2906
A struct recording the isolated and single-pad islands within a zone.
Definition: zone.h:61
Container to hold information pertinent to a layer of a BOARD.
Definition: board.h:176
int m_opposite
Similar layer on opposite side of the board, if any.
Definition: board.h:208
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
Definition: board.cpp:700
void clear()
Definition: board.h:182
LAYER_T m_type
The type of the layer.
Definition: board.h:205
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Definition: board.cpp:684
LAYER()
Definition: board.h:177
wxString m_name
The canonical name of the layer.
Definition: board.h:203
wxString m_userName
The user defined name of the layer.
Definition: board.h:204
bool m_visible
Definition: board.h:206
int m_number
The layer ID.
Definition: board.h:207
BOARD_ITEM * A
Definition: board.h:98
bool operator==(const PTR_LAYER_CACHE_KEY &other) const
Definition: board.h:101
PCB_LAYER_ID Layer
Definition: board.h:99
BOARD_ITEM * A
Definition: board.h:87
BOARD_ITEM * B
Definition: board.h:88
bool operator==(const PTR_PTR_CACHE_KEY &other) const
Definition: board.h:90
bool operator==(const PTR_PTR_LAYER_CACHE_KEY &other) const
Definition: board.h:113
BOARD_ITEM * B
Definition: board.h:110
BOARD_ITEM * A
Definition: board.h:109
PCB_LAYER_ID Layer
Definition: board.h:111
std::size_t operator()(const PTR_LAYER_CACHE_KEY &k) const
Definition: board.h:135
std::size_t operator()(const PTR_PTR_CACHE_KEY &k) const
Definition: board.h:124
std::size_t operator()(const PTR_PTR_LAYER_CACHE_KEY &k) const
Definition: board.h:146
@ PCB_T
Definition: typeinfo.h:82
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition: typeinfo.h:91
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:99
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:109
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:59