当前位置: 首页>>代码示例>>C++>>正文


C++ GAL::SetGridOrigin方法代码示例

本文整理汇总了C++中kigfx::GAL::SetGridOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ GAL::SetGridOrigin方法的具体用法?C++ GAL::SetGridOrigin怎么用?C++ GAL::SetGridOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kigfx::GAL的用法示例。


在下文中一共展示了GAL::SetGridOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UseGalCanvas

void EDA_DRAW_FRAME::UseGalCanvas()
{
    KIGFX::GAL* gal = GetGalCanvas()->GetGAL();

    // Set up grid settings
    gal->SetGridVisibility( IsGridVisible() );
    gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
    gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );

    // Transfer EDA_DRAW_PANEL settings
    KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
    viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
    viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
    viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );

    m_canvas->SetEvtHandlerEnabled( false );
    GetGalCanvas()->SetEvtHandlerEnabled( true );

    GetGalCanvas()->StartDrawing();

    // Switch panes
    // JEY TODO: drop down to a single pane....
    m_auimgr.GetPane( "DrawFrame" ).Show( false );
    m_auimgr.GetPane( "DrawFrameGal" ).Show( true );
    m_auimgr.Update();

    // Reset current tool on switch();
    SetNoToolSelected();
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:29,代码来源:eda_draw_frame.cpp

示例2: UseGalCanvas

void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
{
    KIGFX::VIEW* view = GetGalCanvas()->GetView();
    KIGFX::GAL* gal = GetGalCanvas()->GetGAL();

    double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();

    // Display the same view after canvas switching
    if( aEnable )
    {
        BASE_SCREEN* screen = GetScreen();

        // Switch to GAL rendering
        if( !IsGalCanvasActive() )
        {
            // Set up viewport
            double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
            view->SetScale( zoom );
            view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
        }

        // Set up grid settings
        gal->SetGridVisibility( IsGridVisible() );
        gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) );
        gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
    }
    else
    {
        // Switch to standard rendering
        if( IsGalCanvasActive() )
        {
            // Change view settings only if GAL was active previously
            double zoom = 1.0 / ( zoomFactor * view->GetScale() );
            m_canvas->SetZoom( zoom );

            VECTOR2D center = view->GetCenter();
            RedrawScreen( wxPoint( center.x, center.y ), false );
        }
    }

    m_canvas->SetEvtHandlerEnabled( !aEnable );
    GetGalCanvas()->SetEvtHandlerEnabled( aEnable );

    // Switch panes
    m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
    m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
    m_auimgr.Update();

    // Reset current tool on switch();
    SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );

    m_galCanvasActive = aEnable;
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:53,代码来源:draw_frame.cpp

示例3: UseGalCanvas

void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
{
    KIGFX::VIEW* view = GetGalCanvas()->GetView();
    KIGFX::GAL* gal = GetGalCanvas()->GetGAL();

    // Display the same view after canvas switching
    if( aEnable )
    {
        // Switch to GAL renderer from legacy
        if( !m_galCanvasActive )
        {
            // Set up viewport
            double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
            double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
            view->SetScale( zoom );
            view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
        }

        // Set up grid settings
        gal->SetGridVisibility( IsGridVisible() );
        gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
        gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );

        // Transfer EDA_DRAW_PANEL settings
        GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
        GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
        GetGalCanvas()->GetViewControls()->EnableAutoPan( m_canvas->GetEnableAutoPan() );
    }
    else if( m_galCanvasActive )
    {
        // Switch to legacy renderer from GAL
        double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
        // TODO replace it with EDA_DRAW_PANEL_GAL::GetLegacyZoom
        m_canvas->SetZoom( 1.0 / ( zoomFactor * view->GetScale() ) );
        VECTOR2D center = view->GetCenter();
        AdjustScrollBars( wxPoint( center.x, center.y ) );
    }

    m_canvas->SetEvtHandlerEnabled( !aEnable );
    GetGalCanvas()->SetEvtHandlerEnabled( aEnable );

    // Switch panes
    m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
    m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
    m_auimgr.Update();

    // Reset current tool on switch();
    SetNoToolSelected();

    m_galCanvasActive = aEnable;
}
开发者ID:cpavlina,项目名称:kicad,代码行数:51,代码来源:draw_frame.cpp


注:本文中的kigfx::GAL::SetGridOrigin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。