本文整理汇总了C++中DIMENSION::GetAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ DIMENSION::GetAngle方法的具体用法?C++ DIMENSION::GetAngle怎么用?C++ DIMENSION::GetAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIMENSION
的用法示例。
在下文中一共展示了DIMENSION::GetAngle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildDimension
static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
if( Dimension == NULL )
return;
// Erase previous dimension.
if( aErase )
{
Dimension->Draw( aPanel, aDC, GR_XOR );
}
Dimension->SetLayer( screen->m_Active_Layer );
if( status_dimension == 1 )
{
Dimension->m_featureLineDO = pos;
Dimension->m_crossBarF = Dimension->m_featureLineDO;
Dimension->AdjustDimensionDetails( );
}
else
{
/* Calculating the direction of travel perpendicular to the selected axis. */
double angle = Dimension->GetAngle() + (M_PI / 2);
wxPoint delta = pos - Dimension->m_featureLineDO;
double depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
Dimension->SetHeight( depl );
}
Dimension->Draw( aPanel, aDC, GR_XOR );
}
示例2: DrawDimension
//.........这里部分代码省略.........
// Init the new item attributes
dimension = new DIMENSION( m_board );
dimension->SetLayer( layer );
dimension->SetOrigin( wxPoint( cursorPos.x, cursorPos.y ) );
dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
dimension->Text().SetSize( m_board->GetDesignSettings().m_PcbTextSize );
width = m_board->GetDesignSettings().m_PcbTextWidth;
maxThickness = Clamp_Text_PenSize( width, dimension->Text().GetSize() );
if( width > maxThickness )
width = maxThickness;
dimension->Text().SetThickness( width );
dimension->SetWidth( width );
dimension->AdjustDimensionDetails();
preview.Add( dimension );
m_controls->SetAutoPan( true );
m_controls->CaptureCursor( true );
}
}
break;
case SET_END:
dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
// Dimensions that have origin and end in the same spot are not valid
if( dimension->GetOrigin() == dimension->GetEnd() )
--step;
break;
case SET_HEIGHT:
{
if( wxPoint( cursorPos.x, cursorPos.y ) != dimension->GetPosition() )
{
assert( dimension->GetOrigin() != dimension->GetEnd() );
assert( dimension->GetWidth() > 0 );
m_view->Add( dimension );
m_board->Add( dimension );
dimension->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( dimension, UR_NEW );
preview.Remove( dimension );
}
}
break;
}
if( ++step == FINISHED )
{
step = SET_ORIGIN;
m_controls->SetAutoPan( false );
m_controls->CaptureCursor( false );
}
}
else if( evt->IsMotion() )
{
switch( step )
{
case SET_END:
dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
break;
case SET_HEIGHT:
{
// Calculating the direction of travel perpendicular to the selected axis
double angle = dimension->GetAngle() + ( M_PI / 2 );
wxPoint pos( cursorPos.x, cursorPos.y );
wxPoint delta( pos - dimension->m_featureLineDO );
double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
dimension->SetHeight( height );
}
break;
}
// Show a preview of the item
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
if( step != SET_ORIGIN )
delete dimension;
m_controls->ShowCursor( false );
m_controls->SetSnapping( false );
m_controls->SetAutoPan( false );
m_controls->CaptureCursor( false );
m_view->Remove( &preview );
m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
return 0;
}