• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GRLine函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GRLine函数的典型用法代码示例。如果您正苦于以下问题:C++ GRLine函数的具体用法?C++ GRLine怎么用?C++ GRLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GRLine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GRSetDrawMode

void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
    GRSetDrawMode( DC, GR_COPY );

    if( GetParent()->IsGridVisible() )
        DrawGrid( DC );

    // Draw axis
    if( GetParent()->GetShowAxis() )
    {
        COLOR4D axis_color = COLOR4D( BLUE );
        wxSize  pageSize = GetParent()->GetPageSizeIU();

        // Draw the Y axis
        GRLine( &m_ClipBox, DC, 0, -pageSize.y, 0, pageSize.y, 0, axis_color );

        // Draw the X axis
        GRLine( &m_ClipBox, DC, -pageSize.x, 0, pageSize.x, 0, 0, axis_color );
    }

    if( GetParent()->GetShowOriginAxis() )
        DrawAuxiliaryAxis( DC, GR_COPY );

    if( GetParent()->GetShowGridAxis() )
        DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() );
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:26,代码来源:eda_draw_panel.cpp


示例2: GRSetDrawMode

void BASE_SCREEN::Trace_Curseur(WinEDA_DrawPanel * panel, wxDC * DC)
/*******************************************************************/
/*
 Trace Le curseur sur la zone PCB , se deplacant sur la grille
*/
{
int color = WHITE;
	
	GRSetDrawMode(DC, GR_XOR);
	if( g_CursorShape == 1 )	/* Trace d'un reticule */
		{
		int dx = panel->m_ClipBox.GetWidth() * GetZoom();
		int dy = panel->m_ClipBox.GetHeight() * GetZoom();
		GRLine(&panel->m_ClipBox, DC, m_Curseur.x - dx, m_Curseur.y,
							m_Curseur.x + dx, m_Curseur.y, color); // axe Y
		GRLine(&panel->m_ClipBox, DC, m_Curseur.x, m_Curseur.y - dx,
				m_Curseur.x, m_Curseur.y + dy, color);  // axe X
		}

	else
		{
		int len = CURSOR_SIZE * GetZoom();
		GRLine(&panel->m_ClipBox, DC, m_Curseur.x - len, m_Curseur.y,
				m_Curseur.x + len, m_Curseur.y, color);
		GRLine(&panel->m_ClipBox, DC, m_Curseur.x, m_Curseur.y - len,
				m_Curseur.x, m_Curseur.y + len, color);
		}
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:28,代码来源:base_screen.cpp


示例3: GetParent

void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin )
{
    if( !GetParent()->GetShowGridAxis() || ( !aGridOrigin.x && !aGridOrigin.y ) )
        return;

    COLOR4D color = GetParent()->GetGridColor();

    GRSetDrawMode( aDC, aDrawMode );

#if DRAW_AXIS_AS_LINES
    wxSize      pageSize = GetParent()->GetPageSizeIU();
    // Draw the Y axis
    GRLine( &m_ClipBox, aDC, aGridOrigin.x, -pageSize.y,
            aGridOrigin.x, pageSize.y, 0, color );

    // Draw the X axis
    GRLine( &m_ClipBox, aDC, -pageSize.x, aGridOrigin.y,
            pageSize.x, aGridOrigin.y, 0, color );
#else
    int radius = aDC->DeviceToLogicalXRel( AXIS_SIZE_IN_PIXELS );
    int linewidth = aDC->DeviceToLogicalXRel( 1 );

    GRSetColorPen( aDC, GetParent()->GetGridColor(), linewidth );

    GRLine( &m_ClipBox, aDC, aGridOrigin.x-radius, aGridOrigin.y-radius,
            aGridOrigin.x+radius, aGridOrigin.y+radius, 0, color );

    // Draw the X shape
    GRLine( &m_ClipBox, aDC, aGridOrigin.x+radius, aGridOrigin.y-radius,
            aGridOrigin.x-radius, aGridOrigin.y+radius, 0, color );

    GRCircle( &m_ClipBox, aDC, aGridOrigin, radius, linewidth, color );
#endif
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:34,代码来源:eda_draw_panel.cpp


示例4: GetParent

void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
{
    if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
        return;

    wxPoint cursor = GetParent()->GetCrossHairPosition();

    GRSetDrawMode( aDC, GR_XOR );

    if( GetParent()->m_cursorShape != 0 )    // Draws full screen crosshair.
    {
        wxSize  clientSize = GetClientSize();

        // Y axis
        wxPoint lineStart( cursor.x, aDC->DeviceToLogicalY( 0 ) );
        wxPoint lineEnd(   cursor.x, aDC->DeviceToLogicalY( clientSize.y ) );

        GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );

        // X axis
        lineStart = wxPoint( aDC->DeviceToLogicalX( 0 ), cursor.y );
        lineEnd   = wxPoint( aDC->DeviceToLogicalX( clientSize.x ), cursor.y );

        GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );
    }
    else
    {
        int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );

        GRLine( &m_ClipBox, aDC, cursor.x - len, cursor.y,
                cursor.x + len, cursor.y, 0, aColor );
        GRLine( &m_ClipBox, aDC, cursor.x, cursor.y - len,
                cursor.x, cursor.y + len, 0, aColor );
    }
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:35,代码来源:draw_panel.cpp


示例5: GetBoard

/* Draw PCB_TARGET object: 2 segments + 1 circle
 * The circle radius is half the radius of the target
 * 2 lines have length the diameter of the target
 */
void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
                       const wxPoint& offset )
{
    int radius, ox, oy, width;
    int dx1, dx2, dy1, dy2;

    ox = m_Pos.x + offset.x;
    oy = m_Pos.y + offset.y;

    BOARD * brd =  GetBoard( );

    if( brd->IsLayerVisible( m_Layer ) == false )
        return;

    auto frame = static_cast<PCB_EDIT_FRAME*> ( panel->GetParent() );
    auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer );

    GRSetDrawMode( DC, mode_color );
    auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
    bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
    width   = m_Width;

    radius = m_Size / 3;

    if( GetShape() )   // shape X
        radius = m_Size / 2;

    if( filled )
        GRCircle( panel->GetClipBox(), DC, ox, oy, radius, width, gcolor );
    else
    {
        GRCircle( panel->GetClipBox(), DC, ox, oy, radius + (width / 2), gcolor );
        GRCircle( panel->GetClipBox(), DC, ox, oy, radius - (width / 2), gcolor );
    }


    radius = m_Size / 2;
    dx1   = radius;
    dy1   = 0;
    dx2   = 0;
    dy2   = radius;

    if( GetShape() )   // shape X
    {
        dx1 = dy1 = radius;
        dx2 = dx1;
        dy2 = -dy1;
    }

    if( filled )
    {
        GRLine( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
        GRLine( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
    }
    else
    {
        GRCSegm( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor );
    }
}
开发者ID:cpavlina,项目名称:kicad,代码行数:64,代码来源:class_pcb_target.cpp


示例6: GRSetDrawMode

void WinEDA_BasePcbFrame::trace_ratsnest_pad(wxDC * DC)
/*******************************************************/
/*
 affiche le "chevelu" d'un pad lors des trace de segments de piste
*/
{
int * pt_coord;
int ii;
int refX, refY;

	if((m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0) return;
	if( nb_local_chevelu == 0 ) return;
	if ( local_liste_chevelu == NULL ) return;

	pt_coord = (int*) local_liste_chevelu;
	refX = *pt_coord; pt_coord++;
	refY = *pt_coord; pt_coord++;

	GRSetDrawMode(DC, GR_XOR);
	for( ii = 0; ii < nb_local_chevelu; ii++)
		{
		if ( ii >= g_MaxLinksShowed ) break;
		GRLine(&DrawPanel->m_ClipBox, DC, refX, refY, *pt_coord, *(pt_coord+1), YELLOW);
		pt_coord += 2;
		}
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:26,代码来源:ratsnest.cpp


示例7: GetLayerColor

void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
                          GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
    COLOR4D color;
    EDA_RECT* clipbox = aPanel->GetClipBox();

    if( aColor != COLOR4D::UNSPECIFIED )
        color = aColor;
    else
        color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );

    GRSetDrawMode( aDC, aDrawMode );

    GRLine( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
            m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );


    // Draw pin targets if part is being dragged
    bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured();

    if( m_isDanglingStart || dragging )
    {
        GRCircle( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
                TARGET_BUSENTRY_RADIUS, 0, color );
    }

    if( m_isDanglingEnd || dragging )
    {
        GRCircle( clipbox, aDC, m_End().x + aOffset.x, m_End().y + aOffset.y,
                TARGET_BUSENTRY_RADIUS, 0, color );
    }
}
开发者ID:cpavlina,项目名称:kicad,代码行数:32,代码来源:sch_bus_entry.cpp


示例8: GetBoard

void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
                    const wxPoint& aOffset )
{
    DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();

    if( displ_opts->m_DisplayZonesMode != 0 )
        return;

    BOARD * brd = GetBoard( );
    EDA_COLOR_T color = brd->GetLayerColor(m_Layer);

    if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
        return;

#ifdef USE_WX_OVERLAY
    // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay
    if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))
      return;
#endif

    if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
    {
        LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;

        if( !IsOnLayer( curr_layer ) )
            ColorTurnToDarkDarkGray( &color );
    }

    if( aDrawMode & GR_HIGHLIGHT )
        ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );

    ColorApplyHighlightFlag( &color );

    SetAlpha( &color, 150 );

    GRSetDrawMode( aDC, aDrawMode );

    int l_trace = m_Width / 2;

    if( aDC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH )
    {
        GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, 0, color );
        return;
    }

    if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
    {
        GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
    }
    else
    {
        GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
                     m_Start.y + aOffset.y,
                     m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
    }

    // No clearance or netnames for zones
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:58,代码来源:class_track.cpp


示例9: GetBoard

void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
                    const wxPoint& aOffset )
{
    auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );

    if( displ_opts->m_DisplayZonesMode != 0 )
        return;

    BOARD* brd = GetBoard();

    auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );
    auto color = frame->Settings().Colors().GetLayerColor( m_Layer );

    if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
        return;

#ifdef USE_WX_OVERLAY
    // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay
    if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))
      return;
#endif

    if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
    {
        PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;

        if( !IsOnLayer( curr_layer ) )
            color = COLOR4D( DARKDARKGRAY );
    }

    if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
        color.SetToLegacyHighlightColor();

    color.a = 0.588;

    GRSetDrawMode( aDC, aDrawMode );

    // Draw track as line if width <= 1pixel:
    if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
    {
        GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
        return;
    }

    if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
    {
        GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
    }
    else
    {
        GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
                     m_Start.y + aOffset.y,
                     m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
    }

    // No clearance or netnames for zones
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:57,代码来源:class_track.cpp


示例10: GetWidth

void DrawBlockStruct::Draw(WinEDA_DrawPanel * panel, wxDC * DC)
/**************************************************************/
{
    int w = GetWidth()/panel->GetZoom();
    int h = GetHeight()/panel->GetZoom();
    if (  w == 0 || h == 0 )
        GRLine(&panel->m_ClipBox, DC, GetX(), GetY(),
               GetRight(), GetBottom(), m_Color);
    else
        GRRect(&panel->m_ClipBox, DC,  GetX(), GetY(),
               GetRight(), GetBottom(), m_Color);
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:12,代码来源:block_commande.cpp


示例11: GRSetDrawMode

/**
 * Function Draw
 * Draws a line (a ratsnest) from the starting pad to the ending pad
 */
void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
                          wxDC*           DC,
                          GR_DRAWMODE     aDrawMode,
                          const wxPoint&  aOffset )
{
    GRSetDrawMode( DC, aDrawMode );

    EDA_COLOR_T color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);

    GRLine( panel->GetClipBox(), DC,
            m_PadStart->GetPosition() - aOffset,
            m_PadEnd->GetPosition() - aOffset, 0, color );
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:17,代码来源:class_netinfo_item.cpp


示例12: GetBoard

void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
                      const wxPoint& offset )
{
    EDA_COLOR_T gcolor;
    BOARD*      brd = GetBoard();

    if( brd->IsLayerVisible( m_Layer ) == false )
        return;

    m_Text.Draw( panel, DC, mode_color, offset );

    gcolor = brd->GetLayerColor( m_Layer );

    GRSetDrawMode( DC, mode_color );
    DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
    bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED;
    int width   = m_Width;

    if( filled )
    {
        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
                m_crossBarF + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset,
                m_featureLineGF + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_featureLineDO + offset,
                m_featureLineDF + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
                m_arrowD1F + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_crossBarF + offset,
                m_arrowD2F + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
                m_arrowG1F + offset, width, gcolor );
        GRLine( panel->GetClipBox(), DC, m_crossBarO + offset,
                m_arrowG2F + offset, width, gcolor );
    }
    else
    {
        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
                 m_crossBarF + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset,
                 m_featureLineGF + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_featureLineDO + offset,
                 m_featureLineDF + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
                 m_arrowD1F + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_crossBarF + offset,
                 m_arrowD2F + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
                 m_arrowG1F + offset, width, gcolor );
        GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset,
                 m_arrowG2F + offset, width, gcolor );
    }
}
开发者ID:RocFan,项目名称:kicad-source-mirror,代码行数:53,代码来源:class_dimension.cpp


示例13: GetDefaultLineThickness

void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
                           GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
    int pX, pY;
    int delta = m_size.x / 2;
    int width = GetDefaultLineThickness();

    pX = m_pos.x + aOffset.x;
    pY = m_pos.y + aOffset.y;

    COLOR4D color;

    if( aColor != COLOR4D::UNSPECIFIED )
        color = aColor;
    else
        color = GetLayerColor( LAYER_NOCONNECT );

    GRSetDrawMode( aDC, aDrawMode );

    GRLine( aPanel->GetClipBox(), aDC, pX - delta, pY - delta, pX + delta, pY + delta,
            width, color );
    GRLine( aPanel->GetClipBox(), aDC, pX + delta, pY - delta, pX - delta, pY + delta,
            width, color );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:24,代码来源:sch_no_connect.cpp


示例14: GetParent

/* Draws a line from the TEXTE_MODULE origin to parent MODULE origin.
*/
void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
                                  wxDC*           aDC,
                                  GR_DRAWMODE     aDrawMode,
                                  const wxPoint&  aOffset )
{
    MODULE* parent = (MODULE*) GetParent();

    if( !parent )
        return;

    GRSetDrawMode( aDC, GR_XOR );
    GRLine( aPanel->GetClipBox(), aDC,
            parent->GetPosition(), GetTextPosition() + aOffset,
            0, UMBILICAL_COLOR);
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:17,代码来源:class_text_mod.cpp


示例15: ReturnLayerColor

void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
                          GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
    EDA_COLOR_T color;

    if( aColor >= 0 )
        color = aColor;
    else
        color = ReturnLayerColor( m_Layer );

    GRSetDrawMode( aDC, aDrawMode );

    GRLine( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
            m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:15,代码来源:sch_bus_entry.cpp


示例16: GetWidth

void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
                           GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{

    int w = GetWidth();
    int h = GetHeight();

    GRSetDrawMode( aDC, aDrawMode );

    if(  w == 0 || h == 0 )
        GRLine( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,
                GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
    else
        GRRect( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,
                GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:16,代码来源:block_commande.cpp


示例17: GRSetDrawMode

void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC )
{
    if( aDC == NULL )
        return;

    if( s_TargetsLocations.size() == 0 )
        return;

    GRSetDrawMode( aDC, GR_XOR );

    for( int ii = 0; ii < (int) s_TargetsLocations.size(); ii++ )
    {
        if( ii >= g_MaxLinksShowed )
            break;

        GRLine( m_canvas->GetClipBox(), aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW );
    }
}
开发者ID:jerkey,项目名称:kicad,代码行数:18,代码来源:ratsnest.cpp


示例18: dc

void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
{
    wxPaintDC    dc( m_panelShowPad );
    PAD_DRAWINFO drawInfo;

    EDA_COLOR_T color = BLACK;

    if( m_dummyPad->GetLayerSet()[F_Cu] )
    {
        color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );
    }

    if( m_dummyPad->GetLayerSet()[B_Cu] )
    {
        color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
    }

    // What could happen: the pad color is *actually* black, or no
    // copper was selected
    if( color == BLACK )
        color = LIGHTGRAY;

    drawInfo.m_Color     = color;
    drawInfo.m_HoleColor = DARKGRAY;
    drawInfo.m_Offset    = m_dummyPad->GetPosition();
    drawInfo.m_Display_padnum  = true;
    drawInfo.m_Display_netname = true;

    if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
        drawInfo.m_ShowNotPlatedHole = true;

    // Shows the local pad clearance
    drawInfo.m_PadClearance = m_dummyPad->GetLocalClearance();

    wxSize dc_size = dc.GetSize();
    dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );

    // Calculate a suitable scale to fit the available draw area
    int dim = m_dummyPad->GetSize().x + std::abs( m_dummyPad->GetDelta().y);

    if( m_dummyPad->GetLocalClearance() > 0 )
        dim += m_dummyPad->GetLocalClearance() * 2;

    double scale = (double) dc_size.x / dim;

    dim = m_dummyPad->GetSize().y + std::abs( m_dummyPad->GetDelta().x);
    if( m_dummyPad->GetLocalClearance() > 0 )
        dim += m_dummyPad->GetLocalClearance() * 2;

    double altscale = (double) dc_size.y / dim;
    scale = std::min( scale, altscale );

    // Give a margin
    scale *= 0.7;
    dc.SetUserScale( scale, scale );

    GRResetPenAndBrush( &dc );
    m_dummyPad->DrawShape( NULL, &dc, drawInfo );

    // Draw X and Y axis.
    // this is particularly useful to show the reference position of pads
    // with offset and no hole
    GRLine( NULL, &dc, -dim, 0, dim, 0, 0, BLUE );   // X axis
    GRLine( NULL, &dc, 0, -dim, 0, dim, 0, BLUE );   // Y axis

    event.Skip();
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:67,代码来源:dialog_pad_properties.cpp


示例19: GetPenSizeForBold

void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
                      const wxPoint& offset, GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
    int            orient;
    EDA_COLOR_T    color;
    wxPoint        textpos;
    SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
    int            LineWidth = m_Thickness;

    if( LineWidth == 0 )   // Use default values for pen size
    {
        if( m_Bold  )
            LineWidth = GetPenSizeForBold( m_Size.x );
        else
            LineWidth = GetDefaultLineThickness();
    }


    // Clip pen size for small texts:
    LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );

    if( ((m_Attributs & TEXT_NO_VISIBLE) && !m_forceVisible) || IsVoid() )
        return;

    GRSetDrawMode( DC, DrawMode );

    // Calculate the text orientation according to the component orientation.
    orient = m_Orient;

    if( parentComponent->GetTransform().y1 )  // Rotate component 90 degrees.
    {
        if( orient == TEXT_ORIENT_HORIZ )
            orient = TEXT_ORIENT_VERT;
        else
            orient = TEXT_ORIENT_HORIZ;
    }

    /* Calculate the text justification, according to the component
     * orientation/mirror this is a bit complicated due to cumulative
     * calculations:
     * - numerous cases (mirrored or not, rotation)
     * - the DrawGraphicText function recalculate also H and H justifications
     *      according to the text orientation.
     * - When a component is mirrored, the text is not mirrored and
     *   justifications are complicated to calculate
     * so the more easily way is to use no justifications ( Centered text )
     * and use GetBoundaryBox to know the text coordinate considered as centered
     */
    EDA_RECT boundaryBox = GetBoundingBox();
    textpos = boundaryBox.Centre();

    if( m_forceVisible )
    {
        color = DARKGRAY;
    }
    else
    {
        if( m_id == REFERENCE )
            color = ReturnLayerColor( LAYER_REFERENCEPART );
        else if( m_id == VALUE )
            color = ReturnLayerColor( LAYER_VALUEPART );
        else
            color = ReturnLayerColor( LAYER_FIELDS );
    }

    DrawGraphicText( panel, DC, textpos, color, GetText(), orient, m_Size,
                     GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
                     LineWidth, m_Italic, m_Bold );

    /* Enable this to draw the bounding box around the text field to validate
     * the bounding box calculations.
     */
#if 0

    // Draw boundary box:
    GRRect( panel->GetClipBox(), DC, boundaryBox, 0, BROWN );

    // Draw the text anchor point

    /* Calculate the text position, according to the component
     * orientation/mirror */
    textpos  = m_Pos - parentComponent->GetPosition();
    textpos  = parentComponent->GetScreenCoord( textpos );
    textpos += parentComponent->GetPosition();
    const int len = 10;
    GRLine( panel->GetClipBox(), DC,
            textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE );
    GRLine( panel->GetClipBox(), DC,
            textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );
#endif
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:91,代码来源:sch_field.cpp


示例20: SymbolDisplayDraw

static void SymbolDisplayDraw(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
{
int DrawMode = g_XorMode;
int * ptpoly;
int dx, dy;
BASE_SCREEN * Screen = panel->m_Parent->m_CurrentScreen;
int mx = Screen->m_Curseur.x,
	my = Screen->m_Curseur.y;

	GRSetDrawMode(DC, DrawMode);

	if( erase )
		{ 
		if( StateDrawArc == 1 )
			{
			int Color = ReturnLayerColor(LAYER_DEVICE);
			GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color);
			}
		else
			{
			DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0,
						CurrentDrawItem, CurrentUnit, DrawMode);
			if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE)
				{
				int Color = ReturnLayerColor(LAYER_DEVICE);
				GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY,
						((LibDrawArc*)CurrentDrawItem)->m_Pos.x,
						- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,
						Color);
				GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY,
						((LibDrawArc*)CurrentDrawItem)->m_Pos.x,
						- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,
						Color);
				}
			}
		}

	switch ( CurrentDrawItem->m_StructType )
		{
		case COMPONENT_ARC_DRAW_TYPE:
			if( StateDrawArc == 1)
				{
				ArcEndX = mx; ArcEndY = - my;
				}

			if( StateDrawArc == 2)
				{
				ComputeArc((LibDrawArc*)CurrentDrawItem, Screen->m_Curseur);
				}
			((LibDrawArc*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;
			break;

		case COMPONENT_CIRCLE_DRAW_TYPE:
			dx = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.x - mx;
			dy = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.y + my;
			((LibDrawCircle*)CurrentDrawItem)->m_Rayon = (int)sqrt( (dx*dx) + (dy*dy) );
			((LibDrawCircle*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;
			break;

		case COMPONENT_RECT_DRAW_TYPE:
			((LibDrawSquare*)CurrentDrawItem)->m_End.x = mx;
			((LibDrawSquare*)CurrentDrawItem)->m_End.y = - my;
			((LibDrawSquare*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;
			break;

		case COMPONENT_POLYLINE_DRAW_TYPE:
			ptpoly = ((LibDrawPolyline*)CurrentDrawItem)->PolyList;
			ptpoly += 2 * (((LibDrawPolyline*)CurrentDrawItem)->n - 1);
			ptpoly[0] = mx;
			ptpoly[1] = - my;
			((LibDrawPolyline*)CurrentDrawItem)->m_Fill = FlSymbol_Fill;
			break;

		case COMPONENT_LINE_DRAW_TYPE:
			((LibDrawSegment*)CurrentDrawItem)->m_End.x = mx;
			((LibDrawSegment*)CurrentDrawItem)->m_End.y = - my;
			break;

		case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:	/* Traite par des routines specifiques */
			break;
		}

	if( StateDrawArc == 1 )
		{
		int Color = ReturnLayerColor(LAYER_DEVICE);
		GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color);
		}
	else
		{
		DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0,
						CurrentDrawItem, CurrentUnit, DrawMode);
		if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE)
			{
			int Color = ReturnLayerColor(LAYER_DEVICE);
			GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY,
					((LibDrawArc*)CurrentDrawItem)->m_Pos.x,
					- ((LibDrawArc*)CurrentDrawItem)->m_Pos.y,
					Color);
			GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY,
					((LibDrawArc*)CurrentDrawItem)->m_Pos.x,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,代码来源:symbdraw.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GRN_API_RETURN函数代码示例发布时间:2022-05-30
下一篇:
C++ GRL_DEBUG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap