LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent, bool aEndPointOnly ) const { SCH_ITEM* item; SCH_COMPONENT* component = NULL; LIB_PIN* pin = NULL; for( item = m_drawList.begin(); item; item = item->Next() ) { if( item->Type() != SCH_COMPONENT_T ) continue; component = (SCH_COMPONENT*) item; if( aEndPointOnly ) { pin = NULL; LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetPartName() ); if( !part ) continue; for( pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) ) { // Skip items not used for this part. if( component->GetUnit() && pin->GetUnit() && ( pin->GetUnit() != component->GetUnit() ) ) continue; if( component->GetConvert() && pin->GetConvert() && ( pin->GetConvert() != component->GetConvert() ) ) continue; if(component->GetPinPhysicalPosition( pin ) == aPosition ) break; } if( pin ) break; } else { pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T ); if( pin ) break; } } if( pin && aComponent ) *aComponent = component; return pin; }
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent, bool aEndPointOnly ) const { SCH_ITEM* item; SCH_COMPONENT* component = NULL; LIB_PIN* pin = NULL; for( item = m_drawList.begin(); item != NULL; item = item->Next() ) { if( item->Type() != SCH_COMPONENT_T ) continue; component = (SCH_COMPONENT*) item; if( aEndPointOnly ) { pin = NULL; LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() ); if( entry == NULL ) continue; for( pin = entry->GetNextPin(); pin != NULL; pin = entry->GetNextPin( pin ) ) { // Skip items not used for this part. if( component->GetUnit() && pin->GetUnit() && ( pin->GetUnit() != component->GetUnit() ) ) continue; if( component->GetConvert() && pin->GetConvert() && ( pin->GetConvert() != component->GetConvert() ) ) continue; if(component->GetPinPhysicalPosition( pin ) == aPosition ) break; } if( pin ) break; } else { pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T ); if( pin ) break; } } if( pin && aComponent ) *aComponent = component; return pin; }