Use component library symbol when looking for a pin in the schematic.

For some reason, rather than using the LIB_PART object reference by an
SCH_COMPONENT to check if a pin was at a given position in the schematic,
a LIB_PART search was performed for every component in a schematic.  This
made absolutely no sense and was changed to use the LIB_PART referenced
by the SCH_COMPONENT object.  This should significantly speed up any
operations that call SCH_SCREEN functions, IsTerminalPoint(),
MarkConnections(), and IsJunctionNeeded().

Add function to SCH_COMPONENT to access PART_REF object.
This commit is contained in:
Wayne Stambaugh 2017-03-03 19:04:43 -05:00
parent 551b2b2312
commit 84835ed4e1
2 changed files with 3 additions and 4 deletions

View File

@ -164,6 +164,8 @@ public:
void SetLibId( const LIB_ID& aName, PART_LIBS* aLibs=NULL );
const LIB_ID& GetLibId() const { return m_lib_id; }
PART_REF& GetPartRef() { return m_part; }
/**
* Function Resolve
* [re-]assigns the current LIB_PART from aLibs which this component

View File

@ -550,9 +550,6 @@ void SCH_SCREEN::CheckComponentsToPartsLinks()
SCH_COMPONENT::ResolveAll( c, libs );
m_modification_sync = mod_hash; // note the last mod_hash
// guard against unneeded runs through this code path by printing trace
DBG(printf("%s: resync-ing %s\n", __func__, TO_UTF8( GetFileName() ) );)
}
}
}
@ -646,7 +643,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
{
pin = NULL;
LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetLibId() );
auto part = component->GetPartRef().lock();
if( !part )
continue;