eeschema: Check connections on current unit

This is an expansion of dac12a6d9 that prevents junctions from being
added based on the position of alternate units in a component
This commit is contained in:
Seth Hillbrand 2020-04-03 08:40:59 -07:00
parent de66c65f3c
commit a546851d64
1 changed files with 24 additions and 0 deletions

View File

@ -1473,7 +1473,20 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
{ {
for( const auto& pin : m_pins ) for( const auto& pin : m_pins )
{
// Collect only pins attached to the current unit and convert.
// others are not associated to this component instance
int pin_unit = pin.get()->GetLibPin()->GetUnit();
int pin_convert = pin.get()->GetLibPin()->GetConvert();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
continue;
aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos ); aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos );
}
} }
@ -1737,6 +1750,17 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
for( const auto& pin : m_pins ) for( const auto& pin : m_pins )
{ {
// Collect only pins attached to the current unit and convert.
// others are not associated to this component instance
int pin_unit = pin.get()->GetLibPin()->GetUnit();
int pin_convert = pin.get()->GetLibPin()->GetConvert();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
continue;
if( pin->GetPosition() == new_pos ) if( pin->GetPosition() == new_pos )
return true; return true;
} }