本文整理汇总了C++中BOX2I::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BOX2I::GetSize方法的具体用法?C++ BOX2I::GetSize怎么用?C++ BOX2I::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOX2I
的用法示例。
在下文中一共展示了BOX2I::GetSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZoomFitScreen
int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
KIGFX::GAL* gal = m_frame->GetGalCanvas()->GetGAL();
BOARD* board = getModel<BOARD>();
board->ComputeBoundingBox();
BOX2I boardBBox = board->ViewBBox();
VECTOR2I screenSize = gal->GetScreenPixelSize();
if( boardBBox.GetSize().x == 0 || boardBBox.GetSize().y == 0 )
{
// Empty view
view->SetCenter( view->ToWorld( VECTOR2D( screenSize.x / 2, screenSize.y / 2 ) ) );
view->SetScale( 17.0 );
}
else
{
// Autozoom to board
double iuPerX = screenSize.x ? boardBBox.GetWidth() / screenSize.x : 1.0;
double iuPerY = screenSize.y ? boardBBox.GetHeight() / screenSize.y : 1.0;
double bestZoom = std::max( iuPerX, iuPerY );
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
double zoom = 1.0 / ( zoomFactor * bestZoom );
view->SetCenter( boardBBox.Centre() );
view->SetScale( zoom );
}
return 0;
}
示例2: redraw
void DIALOG_PAD_PROPERTIES::redraw()
{
if( m_parent->IsGalCanvasActive() )
{
m_dummyPad->ViewUpdate();
BOX2I bbox = m_dummyPad->ViewBBox();
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{
// gives a size to the full drawable area
BOX2I drawbox;
drawbox.Move( m_dummyPad->GetPosition() );
drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
m_panelShowPadGal->GetView()->SetBoundary( drawbox );
// Autozoom
m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
// Add a margin
m_panelShowPadGal->GetView()->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
m_panelShowPadGal->Refresh();
}
}
else
{
m_panelShowPad->Refresh();
}
}
示例3: ZoomFitScreen
int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
EDA_DRAW_PANEL_GAL* galCanvas = m_frame->GetGalCanvas();
BOARD* board = getModel<BOARD>();
board->ComputeBoundingBox();
BOX2I boardBBox = board->ViewBBox();
VECTOR2D scrollbarSize = VECTOR2D( galCanvas->GetSize() - galCanvas->GetClientSize() );
VECTOR2D screenSize = view->ToWorld( galCanvas->GetClientSize(), false );
if( boardBBox.GetWidth() == 0 || boardBBox.GetHeight() == 0 )
{
// Empty view
view->SetScale( 17.0 ); // works fine for the standard worksheet frame
view->SetCenter( screenSize / 2.0 );
}
else
{
VECTOR2D vsize = boardBBox.GetSize();
double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
fabs( vsize.y / screenSize.y ) );
view->SetScale( scale );
view->SetCenter( boardBBox.Centre() );
}
// Take scrollbars into account
VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
return 0;
}
示例4: ConvexHull
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& aConvex, int aClearance )
{
// this defines the horizontal and vertical lines in the hull octagon
BOX2I box = aConvex.BBox( aClearance + HULL_MARGIN );
box.Normalize();
SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),
VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ) );
SEG rightline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ),
VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ) );
SEG bottomline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ),
box.GetOrigin() );
SEG leftline = SEG( box.GetOrigin(), VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ) );
const SHAPE_LINE_CHAIN& vertices = aConvex.Vertices();
// top right diagonal
VECTOR2I corner = box.GetOrigin() + box.GetSize();
SEG toprightline = SEG( corner,
corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
MoveDiagonal( toprightline, vertices, aClearance );
// bottom right diagonal
corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
corner );
MoveDiagonal( bottomrightline, vertices, aClearance );
// bottom left diagonal
corner = box.GetOrigin();
SEG bottomleftline = SEG( corner,
corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
MoveDiagonal( bottomleftline, vertices, aClearance );
// top left diagonal
corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
corner );
MoveDiagonal( topleftline, vertices, aClearance );
SHAPE_LINE_CHAIN octagon;
octagon.SetClosed( true );
octagon.Append( *leftline.IntersectLines( bottomleftline ) );
octagon.Append( *bottomline.IntersectLines( bottomleftline ) );
octagon.Append( *bottomline.IntersectLines( bottomrightline ) );
octagon.Append( *rightline.IntersectLines( bottomrightline ) );
octagon.Append( *rightline.IntersectLines( toprightline ) );
octagon.Append( *topline.IntersectLines( toprightline ) );
octagon.Append( *topline.IntersectLines( topleftline ) );
octagon.Append( *leftline.IntersectLines( topleftline ) );
return octagon;
}
示例5: AddBox
void AddBox( BOX2I aB, int aColor )
{
SHAPE_LINE_CHAIN l;
VECTOR2I o = aB.GetOrigin();
VECTOR2I s = aB.GetSize();
l.Append( o );
l.Append( o.x + s.x, o.y );
l.Append( o.x + s.x, o.y + s.y );
l.Append( o.x, o.y + s.y );
l.Append( o );
AddLine( l, aColor, 10000 );
}
示例6: redraw
void DIALOG_PAD_PROPERTIES::redraw()
{
if( m_parent->IsGalCanvasActive() )
{
m_dummyPad->ViewUpdate();
BOX2I bbox = m_dummyPad->ViewBBox();
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{
// Autozoom
m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
// Add a margin
m_panelShowPadGal->GetView()->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
m_panelShowPadGal->Refresh();
}
}
else
{
m_panelShowPad->Refresh();
}
}
示例7: DrawDebugBox
void DrawDebugBox( BOX2I aB, int aColor )
{
SHAPE_LINE_CHAIN l;
VECTOR2I o = aB.GetOrigin();
VECTOR2I s = aB.GetSize();
l.Append( o );
l.Append( o.x + s.x, o.y );
l.Append( o.x + s.x, o.y + s.y );
l.Append( o.x, o.y + s.y );
l.Append( o );
ROUTER::GetInstance()->DisplayDebugLine( l, aColor, 10000 );
}