Fix and rename CONNECTIVITY_DATA::GetConnectedItems(aItem, aAnchor, aTypes[] ) to GetConnectedItemsAtAnchor
- Fix the function so it actually returns the connected items (previously it was returning aItem every time) - Make the function const - Rename the function so that it is not confused with the other function of the same name - Add doxygen comments for the function
This commit is contained in:
parent
bdc89df333
commit
498c4121b3
|
@ -613,25 +613,30 @@ bool CONNECTIVITY_DATA::TestTrackEndpointDangling( TRACK* aTrack, wxPoint* aPos
|
|||
}
|
||||
|
||||
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
|
||||
const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] )
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItemsAtAnchor(
|
||||
const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, const KICAD_T aTypes[] ) const
|
||||
{
|
||||
auto& entry = m_connAlgo->ItemEntry( aItem );
|
||||
std::vector<BOARD_CONNECTED_ITEM* > rv;
|
||||
|
||||
for( auto cnItem : entry.GetItems() )
|
||||
{
|
||||
for( auto anchor : cnItem->Anchors() )
|
||||
for( auto connected : cnItem->ConnectedItems() )
|
||||
{
|
||||
if( anchor->Pos() == aAnchor )
|
||||
for( auto anchor : connected->Anchors() )
|
||||
{
|
||||
for( int i = 0; aTypes[i] > 0; i++ )
|
||||
if( anchor->Pos() == aAnchor )
|
||||
{
|
||||
if( cnItem->Valid() && cnItem->Parent()->Type() == aTypes[i] )
|
||||
for( int i = 0; aTypes[i] > 0; i++ )
|
||||
{
|
||||
rv.push_back( cnItem->Parent() );
|
||||
break;
|
||||
if( connected->Valid() && connected->Parent()->Type() == aTypes[i] )
|
||||
{
|
||||
rv.push_back( connected->Parent() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,17 @@ public:
|
|||
|
||||
void GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem, std::set<PAD*>* pads ) const;
|
||||
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] );
|
||||
/**
|
||||
* Function GetConnectedItemsAtAnchor()
|
||||
* Returns a list of items connected to a source item aItem at position aAnchor
|
||||
* @param aItem is the reference item to find other connected items.
|
||||
* @param aAnchor is the position to find connected items on.
|
||||
* @param aTypes allows one to filter by item types.
|
||||
* @return
|
||||
*/
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> GetConnectedItemsAtAnchor( const BOARD_CONNECTED_ITEM* aItem,
|
||||
const VECTOR2I& aAnchor,
|
||||
const KICAD_T aTypes[] ) const;
|
||||
|
||||
void GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges ) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue