pcbnew: Fix multiple issues with BOARD_CONNECTED_ITEM
Modules are not members of BOARD_CONNECTED_ITEM, so we cannot use this as a proxy for membership in the connectivity or ratsnest calculations. Fixes https://gitlab.com/kicad/code/kicad/issues/5140
This commit is contained in:
parent
00547b7aac
commit
0fd1214dea
|
@ -39,11 +39,6 @@
|
|||
|
||||
bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* citem = dyn_cast<BOARD_CONNECTED_ITEM*>( aItem );
|
||||
|
||||
if( !citem )
|
||||
return false;
|
||||
|
||||
markItemNetAsDirty( aItem );
|
||||
|
||||
switch( aItem->Type() )
|
||||
|
@ -51,35 +46,35 @@ bool CN_CONNECTIVITY_ALGO::Remove( BOARD_ITEM* aItem )
|
|||
case PCB_MODULE_T:
|
||||
for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() )
|
||||
{
|
||||
m_itemMap[pad].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( pad );
|
||||
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( pad ) ].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( pad ) );
|
||||
}
|
||||
|
||||
m_itemList.SetDirty( true );
|
||||
break;
|
||||
|
||||
case PCB_PAD_T:
|
||||
m_itemMap[citem].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( citem );
|
||||
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
|
||||
m_itemList.SetDirty( true );
|
||||
break;
|
||||
|
||||
case PCB_TRACE_T:
|
||||
m_itemMap[citem].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( citem );
|
||||
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
|
||||
m_itemList.SetDirty( true );
|
||||
break;
|
||||
|
||||
case PCB_VIA_T:
|
||||
m_itemMap[citem].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( citem );
|
||||
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
|
||||
m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
|
||||
m_itemList.SetDirty( true );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
{
|
||||
m_itemMap[citem].MarkItemsAsInvalid();
|
||||
m_itemMap.erase ( citem );
|
||||
m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
|
||||
m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
|
||||
m_itemList.SetDirty( true );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -666,11 +666,6 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
|
|||
|
||||
for( auto item : aItems )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* conn_item = dyn_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||
|
||||
if( !conn_item )
|
||||
continue;
|
||||
|
||||
if( item->Type() == PCB_MODULE_T )
|
||||
{
|
||||
auto component = static_cast<MODULE*>( item );
|
||||
|
@ -681,8 +676,9 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
|
|||
item_set.insert( pad );
|
||||
}
|
||||
}
|
||||
else
|
||||
else if( auto conn_item = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
||||
{
|
||||
item_set.insert( conn_item );
|
||||
nets.insert( conn_item->GetNetCode() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1272,13 +1272,7 @@ void PCB_EDITOR_CONTROL::calculateSelectionRatsnest()
|
|||
|
||||
for( auto item : selection )
|
||||
{
|
||||
auto board_item = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||
|
||||
if( board_item->Type() != PCB_MODULE_T && board_item->GetLocalRatsnestVisible() )
|
||||
{
|
||||
items.push_back( board_item );
|
||||
}
|
||||
else if( board_item->Type() == PCB_MODULE_T )
|
||||
if( item->Type() == PCB_MODULE_T )
|
||||
{
|
||||
for( auto pad : static_cast<MODULE*>( item )->Pads() )
|
||||
{
|
||||
|
@ -1286,6 +1280,11 @@ void PCB_EDITOR_CONTROL::calculateSelectionRatsnest()
|
|||
items.push_back( pad );
|
||||
}
|
||||
}
|
||||
else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
||||
{
|
||||
if( boardItem->GetLocalRatsnestVisible() )
|
||||
items.push_back( boardItem );
|
||||
}
|
||||
}
|
||||
|
||||
connectivity->ComputeDynamicRatsnest( items );
|
||||
|
|
Loading…
Reference in New Issue