mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Implement BOARD::RunOnDescendants
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19397
This commit is contained in:
parent
a4ac22f2d6
commit
2dec1dd598
@ -521,6 +521,45 @@ void BOARD::Move( const VECTOR2I& aMoveVector ) // overload
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BOARD::RunOnDescendants( const std::function<void ( BOARD_ITEM* )>& aFunction,
|
||||||
|
int aDepth ) const
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for( PCB_TRACK* track : m_tracks )
|
||||||
|
aFunction( track );
|
||||||
|
|
||||||
|
for( ZONE* zone : m_zones )
|
||||||
|
aFunction( zone );
|
||||||
|
|
||||||
|
for( PCB_MARKER* marker : m_markers )
|
||||||
|
aFunction( marker );
|
||||||
|
|
||||||
|
for( FOOTPRINT* footprint : m_footprints )
|
||||||
|
{
|
||||||
|
aFunction( footprint );
|
||||||
|
footprint->RunOnDescendants( aFunction, aDepth + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( PCB_GROUP* group : m_groups )
|
||||||
|
{
|
||||||
|
aFunction( group );
|
||||||
|
group->RunOnDescendants( aFunction, aDepth + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( BOARD_ITEM* drawing : m_drawings )
|
||||||
|
{
|
||||||
|
aFunction( drawing );
|
||||||
|
drawing->RunOnDescendants( aFunction, aDepth + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( std::bad_function_call& )
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( wxT( "Error running FOOTPRINT::RunOnDescendants" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TRACKS BOARD::TracksInNet( int aNetCode )
|
TRACKS BOARD::TracksInNet( int aNetCode )
|
||||||
{
|
{
|
||||||
TRACKS ret;
|
TRACKS ret;
|
||||||
|
@ -390,6 +390,9 @@ public:
|
|||||||
|
|
||||||
void Move( const VECTOR2I& aMoveVector ) override;
|
void Move( const VECTOR2I& aMoveVector ) override;
|
||||||
|
|
||||||
|
void RunOnDescendants( const std::function<void ( BOARD_ITEM* )>& aFunction,
|
||||||
|
int aDepth = 0 ) const override;
|
||||||
|
|
||||||
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
|
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
|
||||||
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
|
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user