CvPcb: count unique pin numbers when filtering by pin count. (fixes:1300719)
This commit is contained in:
parent
a988d7a2f1
commit
16c2c398e9
|
@ -102,10 +102,14 @@ void FOOTPRINT_INFO::load()
|
||||||
std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
|
std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
|
||||||
|
|
||||||
if( m.get() == NULL ) // Should happen only with malformed/broken libraries
|
if( m.get() == NULL ) // Should happen only with malformed/broken libraries
|
||||||
|
{
|
||||||
m_pad_count = 0;
|
m_pad_count = 0;
|
||||||
|
m_unique_pad_count = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
|
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
|
||||||
|
m_unique_pad_count = m->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
|
||||||
m_keywords = m->GetKeywords();
|
m_keywords = m->GetKeywords();
|
||||||
m_doc = m->GetDescription();
|
m_doc = m->GetDescription();
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( (aFilterType & BY_PIN_COUNT) && aComponent
|
if( (aFilterType & BY_PIN_COUNT) && aComponent
|
||||||
&& aComponent->GetNetCount() != aList.GetItem( ii ).GetPadCount() )
|
&& aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ),
|
msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ),
|
||||||
|
|
|
@ -68,7 +68,8 @@ public:
|
||||||
m_nickname( aNickname ),
|
m_nickname( aNickname ),
|
||||||
m_fpname( aFootprintName ),
|
m_fpname( aFootprintName ),
|
||||||
m_num( 0 ),
|
m_num( 0 ),
|
||||||
m_pad_count( 0 )
|
m_pad_count( 0 ),
|
||||||
|
m_unique_pad_count( 0 )
|
||||||
{
|
{
|
||||||
#if !USE_FPI_LAZY
|
#if !USE_FPI_LAZY
|
||||||
load();
|
load();
|
||||||
|
@ -93,6 +94,12 @@ public:
|
||||||
return m_pad_count;
|
return m_pad_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned GetUniquePadCount()
|
||||||
|
{
|
||||||
|
ensure_loaded();
|
||||||
|
return m_unique_pad_count;
|
||||||
|
}
|
||||||
|
|
||||||
int GetOrderNum()
|
int GetOrderNum()
|
||||||
{
|
{
|
||||||
ensure_loaded();
|
ensure_loaded();
|
||||||
|
@ -129,6 +136,7 @@ private:
|
||||||
wxString m_fpname; ///< Module name.
|
wxString m_fpname; ///< Module name.
|
||||||
int m_num; ///< Order number in the display list.
|
int m_num; ///< Order number in the display list.
|
||||||
int m_pad_count; ///< Number of pads
|
int m_pad_count; ///< Number of pads
|
||||||
|
int m_unique_pad_count; ///< Number of unique pads
|
||||||
wxString m_doc; ///< Footprint description.
|
wxString m_doc; ///< Footprint description.
|
||||||
wxString m_keywords; ///< Footprint keywords.
|
wxString m_keywords; ///< Footprint keywords.
|
||||||
};
|
};
|
||||||
|
|
|
@ -717,6 +717,30 @@ unsigned MODULE::GetPadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
|
||||||
|
{
|
||||||
|
std::set<int> usedNumbers;
|
||||||
|
|
||||||
|
// Create a set of used pad numbers
|
||||||
|
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
|
||||||
|
{
|
||||||
|
if( !aIncludeNPTH )
|
||||||
|
{
|
||||||
|
//remove NPTH
|
||||||
|
if( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int padNumber = getTrailingInt( pad->GetPadName() );
|
||||||
|
usedNumbers.insert( padNumber );
|
||||||
|
}
|
||||||
|
|
||||||
|
return usedNumbers.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MODULE::Add3DModel( S3D_MASTER* a3DModel )
|
void MODULE::Add3DModel( S3D_MASTER* a3DModel )
|
||||||
{
|
{
|
||||||
a3DModel->SetParent( this );
|
a3DModel->SetParent( this );
|
||||||
|
|
|
@ -487,7 +487,7 @@ public:
|
||||||
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
|
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetPadCount
|
* GetUniPadCount
|
||||||
* returns the number of pads.
|
* returns the number of pads.
|
||||||
*
|
*
|
||||||
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
||||||
|
@ -496,6 +496,16 @@ public:
|
||||||
*/
|
*/
|
||||||
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
|
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetUniquePadCount
|
||||||
|
* returns the number of unique pads.
|
||||||
|
*
|
||||||
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
||||||
|
* non-plated through holes when false.
|
||||||
|
* @return the number of unique pads according to \a aIncludeNPTH.
|
||||||
|
*/
|
||||||
|
unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetNextPadName
|
* Function GetNextPadName
|
||||||
* returns the next available pad name in the module
|
* returns the next available pad name in the module
|
||||||
|
|
Loading…
Reference in New Issue