本文整理汇总了C++中DRAWSEGMENT::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ DRAWSEGMENT::Draw方法的具体用法?C++ DRAWSEGMENT::Draw怎么用?C++ DRAWSEGMENT::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DRAWSEGMENT
的用法示例。
在下文中一共展示了DRAWSEGMENT::Draw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawSegment
/* Redraw segment during cursor movement
*/
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
auto frame = (PCB_EDIT_FRAME*) ( aPanel->GetParent() );
if( Segment == NULL )
return;
auto displ_opts = (PCB_DISPLAY_OPTIONS*) ( aPanel->GetDisplayOptions() );
bool tmp = displ_opts->m_DisplayDrawItemsFill;
displ_opts->m_DisplayDrawItemsFill = SKETCH;
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
if( frame->Settings().m_use45DegreeGraphicSegments && Segment->GetShape() == S_SEGMENT )
{
wxPoint pt;
pt = CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
Segment->GetStart() );
Segment->SetEnd( pt );
}
else // here the angle is arbitrary
{
Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
}
Segment->Draw( aPanel, aDC, GR_XOR );
displ_opts->m_DisplayDrawItemsFill = tmp;
}
示例2: DrawSegment
/* Redraw segment during cursor movement
*/
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems;
if( Segment == NULL )
return;
DisplayOpt.DisplayDrawItems = SKETCH;
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
if( g_Segments_45_Only && Segment->GetShape() == S_SEGMENT )
{
wxPoint pt;
CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
Segment->GetStart().x, Segment->GetStart().y,
&pt.x, &pt.y );
Segment->SetEnd( pt );
}
else // here the angle is arbitrary
{
Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
}
Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
}
示例3: OnOkClick
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
/*******************************************************************/
/* Copy values in text control to the item parameters
*/
{
m_parent->SaveCopyInUndoList( m_Item, UR_CHANGED );
wxString msg;
if( m_DC )
m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue();
m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_Center_StartYCtrl->GetValue();
m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndX_Radius_Ctrl->GetValue();
m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_EndY_Ctrl->GetValue();
m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_ThicknessCtrl->GetValue();
m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ));
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
if( m_Item->GetLayer() == EDGE_N )
m_brdSettings.m_EdgeSegmentWidth = thickness;
else
m_brdSettings.m_DrawSegmentWidth = thickness;
if( m_Item->GetShape() == S_ARC )
{
double angle;
m_Angle_Ctrl->GetValue().ToDouble( &angle );
NORMALIZE_ANGLE_360(angle);
m_Item->SetAngle( angle );
}
m_parent->OnModify();
if( m_DC )
m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
m_Item->DisplayInfo( m_parent );
m_parent->SetDesignSettings( m_brdSettings );
Close( true );
}
示例4: OnOkClick
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
{
if( !itemValuesOK() )
return;
m_parent->SaveCopyInUndoList( m_item, UR_CHANGED );
wxString msg;
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue();
m_item->SetStartX( ValueFromString( g_UserUnit, msg ) );
msg = m_Center_StartYCtrl->GetValue();
m_item->SetStartY( ValueFromString( g_UserUnit, msg ) );
msg = m_EndX_Radius_Ctrl->GetValue();
m_item->SetEndX( ValueFromString( g_UserUnit, msg ) );
msg = m_EndY_Ctrl->GetValue();
m_item->SetEndY( ValueFromString( g_UserUnit, msg ) );
msg = m_ThicknessCtrl->GetValue();
m_item->SetWidth( ValueFromString( g_UserUnit, msg ) );
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ValueFromString( g_UserUnit, msg );
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
if( m_item->GetLayer() == Edge_Cuts )
m_brdSettings.m_EdgeSegmentWidth = thickness;
else
m_brdSettings.m_DrawSegmentWidth = thickness;
if( m_item->GetShape() == S_ARC )
{
double angle;
m_Angle_Ctrl->GetValue().ToDouble( &angle );
NORMALIZE_ANGLE_360( angle );
m_item->SetAngle( angle );
}
m_parent->OnModify();
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
m_parent->SetMsgPanel( m_item );
m_parent->SetDesignSettings( m_brdSettings );
Close( true );
}
示例5: TransferDataFromWindow
bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
{
if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
return false;
m_parent->SaveCopyInUndoList( m_item, UR_CHANGED );
wxString msg;
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue();
m_item->SetStartX( ValueFromString( g_UserUnit, msg ) );
msg = m_Center_StartYCtrl->GetValue();
m_item->SetStartY( ValueFromString( g_UserUnit, msg ) );
msg = m_EndX_Radius_Ctrl->GetValue();
m_item->SetEndX( ValueFromString( g_UserUnit, msg ) );
msg = m_EndY_Ctrl->GetValue();
m_item->SetEndY( ValueFromString( g_UserUnit, msg ) );
msg = m_ThicknessCtrl->GetValue();
m_item->SetWidth( ValueFromString( g_UserUnit, msg ) );
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ValueFromString( g_UserUnit, msg );
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
if( m_item->GetLayer() == Edge_Cuts )
m_brdSettings.m_EdgeSegmentWidth = thickness;
else
m_brdSettings.m_DrawSegmentWidth = thickness;
if( m_item->GetShape() == S_ARC )
{
m_item->SetAngle( m_AngleValue * 10.0 );
}
m_parent->OnModify();
if( m_DC )
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
m_parent->SetMsgPanel( m_item );
m_parent->SetDesignSettings( m_brdSettings );
return true;
}
示例6: Abort_EditEdge
static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC )
{
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
if( Segment == NULL )
{
aPanel->SetMouseCapture( NULL, NULL );
return;
}
if( Segment->IsNew() )
{
aPanel->CallMouseCapture( DC, wxDefaultPosition, false );
Segment ->DeleteStructure();
Segment = NULL;
}
else
{
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
aPanel->GetParent()->SetCrossHairPosition( s_InitialPosition );
aPanel->CallMouseCapture( DC, wxDefaultPosition, true );
aPanel->GetParent()->SetCrossHairPosition( pos );
Segment->ClearFlags();
Segment->Draw( aPanel, DC, GR_OR );
}
#ifdef USE_WX_OVERLAY
aPanel->Refresh();
#endif
aPanel->SetMouseCapture( NULL, NULL );
( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
}
示例7: Move_Segment
/*
* Redraw segment during cursor movement.
*/
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
DRAWSEGMENT* segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
if( segment == NULL )
return;
if( aErase )
segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta;
delta = aPanel->GetParent()->GetCrossHairPosition() - s_LastPosition;
segment->Move( delta );
s_LastPosition = aPanel->GetParent()->GetCrossHairPosition();
segment->Draw( aPanel, aDC, GR_XOR );
}