当前位置: 首页>>代码示例>>C++>>正文


C++ DRAWSEGMENT::Draw方法代码示例

本文整理汇总了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;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:33,代码来源:editedge.cpp

示例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;
}
开发者ID:michaellis,项目名称:kicad-source-mirror,代码行数:32,代码来源:editedge.cpp

示例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 );
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例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 );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:56,代码来源:dialog_graphic_item_properties.cpp

示例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;
}
开发者ID:asutp,项目名称:kicad-source-mirror,代码行数:53,代码来源:dialog_graphic_item_properties.cpp

示例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 );
}
开发者ID:michaellis,项目名称:kicad-source-mirror,代码行数:33,代码来源:editedge.cpp

示例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 );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:23,代码来源:editedge.cpp


注:本文中的DRAWSEGMENT::Draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。