本文整理汇总了C++中DIMENSION::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ DIMENSION::Draw方法的具体用法?C++ DIMENSION::Draw怎么用?C++ DIMENSION::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIMENSION
的用法示例。
在下文中一共展示了DIMENSION::Draw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOKClick
void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{
if( m_DC ) // Delete old text.
{
CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
}
m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED);
if( m_Name->GetValue() != wxEmptyString )
{
CurrentDimension->SetText( m_Name->GetValue() );
}
wxString msg;
// Get new size value:
msg = m_TxtSizeXCtrl->GetValue();
CurrentDimension->Text().SetWidth( ReturnValueFromString( g_UserUnit, msg ) );
msg = m_TxtSizeYCtrl->GetValue();
CurrentDimension->Text().SetHeight( ReturnValueFromString( g_UserUnit, msg ) );
// Get new position value:
// It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue();
wxPoint pos;
pos.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_textCtrlPosY->GetValue();
pos.y = ReturnValueFromString( g_UserUnit, msg );
CurrentDimension->Text().SetTextPosition( pos );
// Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue();
int width = ReturnValueFromString( g_UserUnit, msg );
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->Text().GetSize() );
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. It will be clamped") );
width = maxthickness;
}
CurrentDimension->SetWidth( width );
CurrentDimension->Text().SetThickness( width );
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( m_SelLayerBox->GetLayerSelection() );
if( m_DC ) // Display new text
{
CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
}
m_Parent->OnModify();
EndModal( 1 );
}
示例2: AbortMoveDimensionText
/*
* Abort current text edit progress.
*
* If a text is selected, its initial coord are regenerated
*/
void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
DIMENSION* dimension = (DIMENSION*) aPanel->GetScreen()->GetCurItem();
( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
aPanel->SetMouseCapture( NULL, NULL );
if( dimension == NULL ) // Should not occur
return;
dimension->Draw( aPanel, aDC, GR_XOR );
dimension->Text().SetTextPosition( initialTextPosition );
dimension->ClearFlags();
dimension->Draw( aPanel, aDC, GR_OR );
}
示例3: MoveDimensionText
/* Move dimension text following the cursor. */
static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
DIMENSION* dimension = (DIMENSION*) aPanel->GetScreen()->GetCurItem();
if( dimension == NULL )
return;
if( aErase )
dimension->Draw( aPanel, aDC, GR_XOR );
dimension->Text().SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
dimension->Draw( aPanel, aDC, GR_XOR );
}
示例4: 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
{
wxPoint delta;
int dx, dy;
double angle, depl;
delta = Dimension->m_featureLineDO - Dimension->m_featureLineGO;
/* Calculating the direction of travel perpendicular to the selected axis. */
angle = atan2( delta.y, delta.x ) + (M_PI / 2);
delta = pos - Dimension->m_featureLineDO;
depl = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
dx = KiROUND( depl * cos( angle ) );
dy = KiROUND( depl * sin( angle ) );
Dimension->m_crossBarO.x = Dimension->m_featureLineGO.x + dx;
Dimension->m_crossBarO.y = Dimension->m_featureLineGO.y + dy;
Dimension->m_crossBarF.x = Dimension->m_featureLineDO.x + dx;
Dimension->m_crossBarF.y = Dimension->m_featureLineDO.y + dy;
Dimension->AdjustDimensionDetails( );
}
Dimension->Draw( aPanel, aDC, GR_XOR );
}
示例5: AbortBuildDimension
static void AbortBuildDimension( EDA_DRAW_PANEL* Panel, wxDC* aDC )
{
DIMENSION* Dimension = (DIMENSION*) Panel->GetScreen()->GetCurItem();
if( Dimension )
{
if( Dimension->IsNew() )
{
Dimension->Draw( Panel, aDC, GR_XOR );
Dimension->DeleteStructure();
}
else
{
Dimension->Draw( Panel, aDC, GR_OR );
}
}
status_dimension = 0;
((PCB_EDIT_FRAME*)Panel->GetParent())->SetCurItem( NULL );
}
示例6: OnOKClick
void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{
LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );
if( !m_Parent->GetBoard()->IsLayerEnabled( newlayer ) )
{
wxMessageBox( _( "The layer currently selected is not enabled for this board\n"
"You cannot use it" ) );
return;
}
#ifndef USE_WX_OVERLAY
if( m_DC ) // Delete old text.
{
CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
}
#endif
m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED);
if( m_Name->GetValue() != wxEmptyString )
{
CurrentDimension->SetText( m_Name->GetValue() );
}
wxString msg;
// Get new size value:
msg = m_TxtSizeXCtrl->GetValue();
CurrentDimension->Text().SetWidth( ValueFromString( g_UserUnit, msg ) );
msg = m_TxtSizeYCtrl->GetValue();
CurrentDimension->Text().SetHeight( ValueFromString( g_UserUnit, msg ) );
// Get new position value:
// It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue();
wxPoint pos;
pos.x = ValueFromString( g_UserUnit, msg );
msg = m_textCtrlPosY->GetValue();
pos.y = ValueFromString( g_UserUnit, msg );
CurrentDimension->Text().SetTextPosition( pos );
// Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue();
int width = ValueFromString( g_UserUnit, msg );
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->Text().GetSize() );
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. "
"It will be clamped" ) );
width = maxthickness;
}
CurrentDimension->SetWidth( width );
CurrentDimension->Text().SetThickness( width );
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( newlayer );
#ifndef USE_WX_OVERLAY
if( m_DC ) // Display new text
{
CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
}
#else
m_Parent->Refresh();
#endif
m_Parent->OnModify();
EndModal( 1 );
}
示例7: OnOKClick
void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{
BOARD_COMMIT commit( m_parent );
PCB_LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );
if( !m_parent->GetBoard()->IsLayerEnabled( newlayer ) )
{
wxMessageBox( _( "The layer currently selected is not enabled for this board\n"
"You cannot use it" ) );
return;
}
#ifndef USE_WX_OVERLAY
if( m_DC ) // Delete old text.
{
m_currentDimension->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
}
#endif
commit.Modify( m_currentDimension );
if( m_Name->GetValue() != wxEmptyString )
{
m_currentDimension->SetText( m_Name->GetValue() );
}
wxString msg;
// Get new size value:
msg = m_TxtSizeXCtrl->GetValue();
m_currentDimension->Text().SetTextWidth( ValueFromString( g_UserUnit, msg ) );
msg = m_TxtSizeYCtrl->GetValue();
m_currentDimension->Text().SetTextHeight( ValueFromString( g_UserUnit, msg ) );
// Get new position value:
// It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue();
wxPoint pos;
pos.x = ValueFromString( g_UserUnit, msg );
msg = m_textCtrlPosY->GetValue();
pos.y = ValueFromString( g_UserUnit, msg );
m_currentDimension->Text().SetTextPos( pos );
// Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue();
int width = ValueFromString( g_UserUnit, msg );
int maxthickness = Clamp_Text_PenSize( width, m_currentDimension->Text().GetTextSize() );
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. "
"It will be clamped" ) );
width = maxthickness;
}
m_currentDimension->SetWidth( width );
m_currentDimension->Text().SetThickness( width );
m_currentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
m_currentDimension->SetLayer( newlayer );
#ifndef USE_WX_OVERLAY
if( m_DC ) // Display new text
{
m_currentDimension->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
}
#else
m_parent->Refresh();
#endif
commit.Push( _( "Modifed dimensions properties" ) );
event.Skip(); // ends returning wxID_OK (default behavior)
}