本文整理汇总了C++中PART_LIB::FindPart方法的典型用法代码示例。如果您正苦于以下问题:C++ PART_LIB::FindPart方法的具体用法?C++ PART_LIB::FindPart怎么用?C++ PART_LIB::FindPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PART_LIB
的用法示例。
在下文中一共展示了PART_LIB::FindPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BestZoom
double LIB_VIEW_FRAME::BestZoom()
{
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
*/
LIB_PART* part = NULL;
double bestzoom = 16.0; // default value for bestzoom
PART_LIB* lib = Prj().SchLibs()->FindLibrary( m_libraryName );
if( lib )
part = lib->FindPart( m_entryName );
if( !part )
{
SetScrollCenterPosition( wxPoint( 0, 0 ) );
return bestzoom;
}
wxSize size = m_canvas->GetClientSize();
EDA_RECT boundingBox = part->GetBoundingBox( m_unit, m_convert );
// Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8;
double zx =(double) boundingBox.GetWidth() /
( margin_scale_factor * (double)size.x );
double zy = (double) boundingBox.GetHeight() /
( margin_scale_factor * (double)size.y);
// Calculates the best zoom
bestzoom = std::max( zx, zy );
// keep it >= minimal existing zoom (can happen for very small components
// like small power symbols
if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0];
SetScrollCenterPosition( boundingBox.Centre() );
return bestzoom;
}