本文整理汇总了C++中PCB_SCREEN::SetScalingFactor方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_SCREEN::SetScalingFactor方法的具体用法?C++ PCB_SCREEN::SetScalingFactor怎么用?C++ PCB_SCREEN::SetScalingFactor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_SCREEN
的用法示例。
在下文中一共展示了PCB_SCREEN::SetScalingFactor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawPage
/*
* This is the real print function: print the active screen
*/
void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
int tmpzoom;
wxPoint tmp_startvisu;
wxPoint old_org;
wxPoint DrawOffset; // Offset de trace
double userscale;
double DrawZoom = 1;
wxDC* dc = GetDC();
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
bool printMirror = m_PrintParams.m_PrintMirror;
wxBusyCursor dummy;
// Save old draw scale and draw offset
tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
// Change draw scale and offset to draw the whole page
screen->SetScalingFactor( DrawZoom );
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
wxSize pageSizeIU = pcbframe->GetPageSizeIU(); // internal units
EDA_RECT bbbox = pcbframe->GetBoard()->ComputeBoundingBox();
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved:
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) )
{
bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
}
// Compute the PCB size in internal units
userscale = m_PrintParams.m_PrintScale;
if( userscale == 0 ) // fit in page
{
// Margin = 0.4 inch
#if defined(KICAD_NANOMETRE)
int extra_margin = int( 0.4 * 25400 ); // nanometers
#else
int extra_margin = int( 0.4 * 1000 ); // deci-mils
#endif
pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;
userscale = 0.99;
}
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
{
DrawOffset += bbbox.Centre();
}
if( m_PrintParams.m_PageSetupData )
{
wxSize pagesize;
pagesize.x = int( pageSizeIU.x / userscale );
pagesize.y = int( pageSizeIU.y / userscale );
FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
}
// Compute Accurate scale 1
if( userscale == 1.0 )
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper();
int w, h;
GetPPIPrinter( &w, &h );
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
double accurate_Yscale = ( (double) ( DrawZoom * h ) ) / (double) PCB_INTERNAL_UNIT;
if( IsPreview() ) // Scale must take in account the DC size in Preview
{
// Get the size of the DC in pixels
wxSize PlotAreaSize;
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
GetPageSizePixels( &w, &h );
accurate_Xscale *= PlotAreaSize.x;
accurate_Xscale /= (double) w;
accurate_Yscale *= PlotAreaSize.y;
accurate_Yscale /= (double) h;
}
accurate_Xscale *= m_PrintParams.m_XScaleAdjust;
accurate_Yscale *= m_PrintParams.m_YScaleAdjust;
// Fine scale adjust
dc->SetUserScale( accurate_Xscale, accurate_Yscale );
}
//.........这里部分代码省略.........