本文整理汇总了C++中PCB_SCREEN::GetZoom方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_SCREEN::GetZoom方法的具体用法?C++ PCB_SCREEN::GetZoom怎么用?C++ PCB_SCREEN::GetZoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_SCREEN
的用法示例。
在下文中一共展示了PCB_SCREEN::GetZoom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void EDGE_MODULE::Draw(WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int draw_mode)
/********************************************************************************/
/* Affichage d'un segment contour de module :
Entree : ox, oy = offset de trace
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
Les contours sont de differents type:
- Segment
- Cercles
- Arcs
*/
{
int ux0, uy0, dx, dy,rayon, StAngle, EndAngle;
int color , type_trace;
int zoom;
int typeaff;
PCB_SCREEN * screen;
WinEDA_BasePcbFrame * frame;
MODULE * Module = NULL;
if ( m_Parent && (m_Parent->m_StructType == TYPEMODULE) )
Module = (MODULE*) m_Parent;
GRSetDrawMode(DC, draw_mode);
color = g_DesignSettings.m_LayerColor[m_Layer];
if ( panel ) screen = (PCB_SCREEN *) panel->m_Parent->m_CurrentScreen;
else screen = ActiveScreen;
frame = screen->GetParentPcbFrame();
zoom = screen->GetZoom();
type_trace = m_Shape;
ux0 = m_Start.x - offset.x; uy0 = m_Start.y - offset.y;
dx = m_End.x - offset.x ;
dy = m_End.y - offset.y ;
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= CMP_N )
typeaff = frame->m_DisplayPcbTrackFill;
if( (m_Width /zoom) < L_MIN_DESSIN ) typeaff = FILAIRE;
switch (type_trace )
{
case S_SEGMENT:
if( typeaff == FILAIRE)
GRLine(&panel->m_ClipBox, DC, ux0, uy0, dx, dy, color);
else Affiche_1_Segment(panel, DC, ux0,uy0,dx,dy,m_Width,
typeaff,color);
break ;
case S_CIRCLE:
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
if( typeaff == FILAIRE)
{
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, color) ;
}
else
{
if(typeaff == FILLED )
{
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color);
}
else
{
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon + (m_Width/2), color) ;
GRCircle(&panel->m_ClipBox, DC, ux0, uy0, rayon - (m_Width/2), color) ;
}
}
break;
case S_ARC:
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
StAngle = (int)ArcTangente( dy-uy0, dx-ux0 );
EndAngle = StAngle + m_Angle;
if ( StAngle > EndAngle) EXCHG (StAngle, EndAngle);
if( typeaff == FILAIRE)
{
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color) ;
}
else if(typeaff == FILLED )
{
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon,
m_Width, color);
}
else
{
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon + (m_Width/2), color) ;
GRArc(&panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon - (m_Width/2), color) ;
}
break;
case S_POLYGON:
{
// We must compute true coordinates from m_PolyList
// which are relative to module position, orientation 0
//.........这里部分代码省略.........
示例2: 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 );
}
//.........这里部分代码省略.........