本文整理汇总了C++中D_PAD::Flip方法的典型用法代码示例。如果您正苦于以下问题:C++ D_PAD::Flip方法的具体用法?C++ D_PAD::Flip怎么用?C++ D_PAD::Flip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D_PAD
的用法示例。
在下文中一共展示了D_PAD::Flip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Flip
void MODULE::Flip( const wxPoint& aCentre )
{
// Move module to its final position:
wxPoint finalPos = m_Pos;
finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position
SetPosition( finalPos );
// Flip layer
SetLayer( FlipLayer( GetLayer() ) );
// Reverse mirror orientation.
NEGATE( m_Orient );
NORMALIZE_ANGLE_POS( m_Orient );
// Mirror pads to other side of board about the x axis, i.e. vertically.
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
pad->Flip( m_Pos );
// Mirror reference.
m_Reference->FlipWithModule( m_Pos.y );
// Mirror value.
m_Value->FlipWithModule( m_Pos.y );
// Reverse mirror module graphics and texts.
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
( (EDGE_MODULE*) item )->Flip( m_Pos );
break;
case PCB_MODULE_TEXT_T:
static_cast<TEXTE_MODULE*>( item )->FlipWithModule( m_Pos.y );
break;
default:
wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
break;
}
}
CalculateBoundingBox();
}
示例2: PlacePad
int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
assert( m_board->m_Modules );
D_PAD* pad = new D_PAD( m_board->m_Modules );
m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
VECTOR2I cursorPos = m_controls->GetCursorPosition();
pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
// Add a VIEW_GROUP that serves as a preview for the new item
KIGFX::VIEW_GROUP preview( m_view );
preview.Add( pad );
m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
m_controls->ShowCursor( true );
m_controls->SetSnapping( true );
Activate();
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
cursorPos = m_controls->GetCursorPosition();
if( evt->IsMotion() )
{
pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
m_view->Update( &preview );
}
else if( evt->Category() == TC_COMMAND )
{
if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
{
pad->Rotate( pad->GetPosition(), m_frame->GetRotationAngle() );
m_view->Update( &preview );
}
else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
{
pad->Flip( pad->GetPosition() );
m_view->Update( &preview );
}
else if( evt->IsCancel() || evt->IsActivate() )
{
preview.Clear();
delete pad;
break;
}
}
else if( evt->IsClick( BUT_LEFT ) )
{
BOARD_COMMIT commit( m_frame );
commit.Add( pad );
m_board->m_Status_Pcb = 0; // I have no clue why, but it is done in the legacy view
// Take the next available pad number
pad->IncrementPadName( true, true );
// Handle the view aspect
preview.Remove( pad );
commit.Push( _( "Add a pad" ) );
// Start placing next pad
pad = new D_PAD( m_board->m_Modules );
m_frame->Import_Pad_Settings( pad, false );
pad->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
preview.Add( pad );
}
}
m_controls->ShowCursor( false );
m_controls->SetSnapping( false );
m_controls->SetAutoPan( false );
m_view->Remove( &preview );
m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
return 0;
}
示例3: Flip
void MODULE::Flip( const wxPoint& aCentre )
{
TEXTE_MODULE* text;
// Move module to its final position:
wxPoint finalPos = m_Pos;
finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position
SetPosition( finalPos );
// Flip layer
SetLayer( FlipLayer( GetLayer() ) );
// Reverse mirror orientation.
NEGATE( m_Orient );
NORMALIZE_ANGLE_POS( m_Orient );
// Mirror pads to other side of board about the x axis, i.e. vertically.
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
pad->Flip( m_Pos );
// Mirror reference.
text = m_Reference;
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE(text->m_Pos0.y);
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
// Mirror value.
text = m_Value;
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
// Reverse mirror module graphics and texts.
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint s = em->GetStart();
s.y -= m_Pos.y;
s.y = -s.y;
s.y += m_Pos.y;
em->SetStart( s );
wxPoint e = em->GetEnd();
e.y -= m_Pos.y;
e.y = -e.y;
e.y += m_Pos.y;
em->SetEnd( e );
NEGATE( em->m_Start0.y );
NEGATE( em->m_End0.y );
if( em->GetShape() == S_ARC )
{
em->SetAngle( -em->GetAngle() );
}
em->SetLayer( FlipLayer( em->GetLayer() ) );
}
break;
case PCB_MODULE_TEXT_T:
text = (TEXTE_MODULE*) item;
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
break;
default:
wxMessageBox( wxT( "MODULE::Flip() error: Unknown Draw Type" ) );
break;
}
}
CalculateBoundingBox();
}