コード例 #1
0
// Redraw the BOARD items but not cursors, axis or grid
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset )
{
    /* The order of drawing is flexible on some systems and not on others.  For
     * OSes which use OR to draw, the order is not important except for the
     * effect of the highlight and its relationship to markers. See comment
     * below.
     * This order independence comes from the fact that a binary OR operation is
     * commutative in nature.
     * However on the OSX, the OR operation is not used, and so this sequence
     * below is chosen to give MODULEs the highest visible priority.
     */

    /* Draw all tracks and zones.  As long as dark colors are used for the
     * tracks,  Then the OR draw mode should show tracks underneath other
     * tracks.  But a white track will cover any other color since it has
     * more bits to OR in.
     */
    for( TRACK* track = m_Track; track; track = track->Next() )
    {
        if( track->IsMoving() )
            continue;

        track->Draw( aPanel, DC, aDrawMode );
    }

    // Draw areas (i.e. zones)
    for( int ii = 0; ii < GetAreaCount(); ii++ )
    {
        ZONE_CONTAINER* zone = GetArea( ii );

        // Areas must be drawn here only if not moved or dragged,
        // because these areas are drawn by ManageCursor() in a specific manner
        if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
        {
            zone->Draw( aPanel, DC, aDrawMode );
            zone->DrawFilledArea( aPanel, DC, aDrawMode );
        }
    }

    // Draw the graphic items
    for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
    {
        if( item->IsMoving() )
            continue;

        switch( item->Type() )
        {
        case PCB_DIMENSION_T:
        case PCB_TEXT_T:
        case PCB_TARGET_T:
        case PCB_LINE_T:
            item->Draw( aPanel, DC, aDrawMode );
            break;

        default:
            break;
        }
    }

    LSET all_cu = LSET::AllCuMask();

    for( MODULE* module = m_Modules; module; module = module->Next() )
    {
        bool    display = true;
        LSET    layerMask = all_cu;

        if( module->IsMoving() )
            continue;

        if( !IsElementVisible( LAYER_MOD_FR ) )
        {
            if( module->GetLayer() == F_Cu )
                display = false;

            layerMask.set( F_Cu, false );
        }

        if( !IsElementVisible( LAYER_MOD_BK ) )
        {
            if( module->GetLayer() == B_Cu )
                display = false;

            layerMask.set( B_Cu, false );
        }

        if( display )
            module->Draw( aPanel, DC, aDrawMode );
        else
            Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
    }

    // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
    for( unsigned i = 0; i < m_markers.size(); ++i )
    {
        m_markers[i]->Draw( aPanel, DC, aDrawMode );
    }
}
コード例 #2
0
void WinEDA_PcbFrame::Trace_Pcb(wxDC * DC, int mode)
/****************************************************/
/* Trace l'ensemble des elements du PCB sur l'ecran actif*/
{
MARQUEUR * Marqueur;
MODULE * Module;
EDA_BaseStruct * PtStruct;

	if ( ! m_Pcb ) return;

	Module = (MODULE*) m_Pcb->m_Modules;
	for ( ; Module != NULL; Module = (MODULE *) Module->Pnext )
		{
		bool display = TRUE, MaskLay = ALL_CU_LAYERS;
		if( Module->m_Flags & IS_MOVED ) continue ;

		if( ! DisplayOpt.Show_Modules_Cmp )
			{
			if(Module->m_Layer == CMP_N) display = FALSE;
			MaskLay &= ~CMP_LAYER;
			}
		if( ! DisplayOpt.Show_Modules_Cu )
			{
			if(Module->m_Layer == CUIVRE_N) display = FALSE;
			MaskLay &= ~CUIVRE_LAYER;
			}

		if ( display ) Module->Draw(DrawPanel, DC, wxPoint(0,0), mode);
		else  Trace_Pads_Only(DrawPanel, DC, Module, 0, 0, MaskLay, mode);
		}

	/* Trace des elements particuliers de Drawings Pcb */

	PtStruct = m_Pcb->m_Drawings;
	for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
		{
		if ( PtStruct->m_Flags & IS_MOVED ) continue;

		switch(PtStruct->m_StructType)
			{
			case TYPECOTATION:
				((COTATION*) PtStruct)->Draw(DrawPanel, DC, wxPoint(0,0), mode);
				break;

			case TYPETEXTE:
				((TEXTE_PCB*) PtStruct)->Draw(DrawPanel, DC, wxPoint(0,0), mode );
				break;

			case TYPEMIRE:
				((MIREPCB*) PtStruct)->Draw(DrawPanel, DC, wxPoint(0,0), mode);
				break;

			case TYPEMARQUEUR:	 /* Trace des marqueurs */
				Marqueur = ( MARQUEUR*) PtStruct;
				Marqueur->Draw(DrawPanel, DC, mode);
				break;

			default: break;
			}
		}

	Trace_Pistes(DrawPanel, m_Pcb, DC, mode);
	if ( g_HightLigt_Status ) DrawHightLight(DC, g_HightLigth_NetCode) ;

	EDGE_ZONE * segment = m_Pcb->m_CurrentLimitZone;
	for( ; segment != NULL; segment = (EDGE_ZONE *) segment->Pback)
		{
		if ( segment->m_Flags & IS_MOVED ) continue;
		Trace_DrawSegmentPcb(DrawPanel, DC, segment, mode);
		}

	Trace_PcbEdges(DC, mode);
	DrawGeneralRatsnest(DC);

	m_CurrentScreen->ClrRefreshReq();
}