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


C++ PCB_BASE_EDIT_FRAME::GetRotationAngle方法代码示例

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


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

示例1: Rotate

int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
{
    const SELECTION& selection = m_selectionTool->GetSelection();
    PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();

    // Shall the selection be cleared at the end?
    bool unselect = selection.Empty();

    if( !hoverSelection() || m_selectionTool->CheckLock() == SELECTION_LOCKED )
        return 0;

    wxPoint rotatePoint = getModificationPoint( selection );

    for( unsigned int i = 0; i < selection.items.GetCount(); ++i )
    {
        BOARD_ITEM* item = selection.Item<BOARD_ITEM>( i );
        m_commit->Modify( item );
        item->Rotate( rotatePoint, editFrame->GetRotationAngle() );
    }

    if( !m_dragging )
        m_commit->Push( _( "Rotate" ) );

    if( unselect )
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

    // TODO selectionModified
    m_toolMgr->RunAction( COMMON_ACTIONS::editModifiedSelection, true );

    return 0;
}
开发者ID:nikgul,项目名称:kicad-source-mirror,代码行数:31,代码来源:edit_tool.cpp

示例2: GetEventRotationAngle

int TOOL_EVT_UTILS::GetEventRotationAngle( const PCB_BASE_EDIT_FRAME& aFrame,
                                           const TOOL_EVENT& aEvt )
{
    wxASSERT_MSG( IsRotateToolEvt( aEvt ), "Expected rotation event" );

    const int rotAngle = aFrame.GetRotationAngle();
    const int angleMultiplier = aEvt.Parameter<intptr_t>();

    return rotAngle * angleMultiplier;
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:10,代码来源:tool_event_utils.cpp

示例3: Rotate

int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
{
    const SELECTION& selection = m_selectionTool->GetSelection();
    PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();

    // Shall the selection be cleared at the end?
    bool unselect = selection.Empty();

    if( !makeSelection( selection ) || m_selectionTool->CheckLock() )
    {
        setTransitions();

        return 0;
    }

    wxPoint rotatePoint = getModificationPoint( selection );

    if( !m_dragging )   // If it is being dragged, then it is already saved with UR_CHANGED flag
    {
        editFrame->OnModify();
        editFrame->SaveCopyInUndoList( selection.items, UR_ROTATED, rotatePoint );
    }

    for( unsigned int i = 0; i < selection.items.GetCount(); ++i )
    {
        BOARD_ITEM* item = selection.Item<BOARD_ITEM>( i );

        item->Rotate( rotatePoint, editFrame->GetRotationAngle() );

        if( !m_dragging )
            item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
    }

    updateRatsnest( m_dragging );

    // Update dragging offset (distance between cursor and the first dragged item)
    m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() -
                                         rotatePoint;

    if( m_dragging )
        selection.group->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
    else
        getModel<BOARD>()->GetRatsnest()->Recalculate();

    if( unselect )
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

    m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate, true );
    setTransitions();

    return 0;
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:52,代码来源:edit_tool.cpp


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