本文整理汇总了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;
}
示例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;
}
示例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;
}