예제 #1
0
/* DEBUG Function: displays the routing matrix */
void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
{
    int dcell0;
    EDA_COLOR_T color;

    int maxi = 600 / RoutingMatrix.m_Ncols;
    maxi = ( maxi * 3 ) / 4;

    if( !maxi )
        maxi = 1;

    GRSetDrawMode( DC, GR_COPY );

    for( int col = 0; col < RoutingMatrix.m_Ncols; col++ )
    {
        for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
        {
            color  = BLACK;
            dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );

            if( dcell0 & HOLE )
                color = GREEN;

#if 0
            int dcell1 = 0;

            if( RoutingMatrix.m_RoutingLayersCount )
                dcell1 = GetCell( row, col, TOP );

            if( dcell1 & HOLE )
                color = RED;

            dcell0 |= dcell1;
#endif
            if( !color && ( dcell0 & VIA_IMPOSSIBLE ) )
                color = BLUE;

            if( dcell0 & CELL_is_EDGE )
                color = YELLOW;
            else if( dcell0 & CELL_is_ZONE )
                color = YELLOW;

            #define DRAW_OFFSET_X -20
            #define DRAW_OFFSET_Y 20
//            if( color )
            {
                for( int i = 0; i < maxi; i++ )
                    for( int j = 0; j < maxi; j++ )
                        GRPutPixel( panel->GetClipBox(), DC,
                                    ( col * maxi ) + i + DRAW_OFFSET_X,
                                    ( row * maxi ) + j + DRAW_OFFSET_Y, color );

            }
        }
    }
}
void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC )
{
    int         ii, jj;
    EDA_COLOR_T color;
    int         ox, oy;
    MATRIX_CELL top_state, bottom_state;

    GRSetDrawMode( DC, GR_COPY );

    for( ii = 0; ii < RoutingMatrix.m_Nrows; ii++ )
    {
        oy = RoutingMatrix.m_BrdBox.GetY() + ( ii * RoutingMatrix.m_GridRouting );

        for( jj = 0; jj < RoutingMatrix.m_Ncols; jj++ )
        {
            ox      = RoutingMatrix.m_BrdBox.GetX() + (jj * RoutingMatrix.m_GridRouting);
            color   = BLACK;

            top_state       = RoutingMatrix.GetCell( ii, jj, TOP );
            bottom_state    = RoutingMatrix.GetCell( ii, jj, BOTTOM );

            if( top_state & CELL_is_ZONE )
                color = BLUE;

            // obstacles
            if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
                color = WHITE;
            else if( top_state & ( HOLE | CELL_is_MODULE ) )
                color = LIGHTRED;
            else if( bottom_state & (HOLE | CELL_is_MODULE) )
                color = LIGHTGREEN;
            else    // Display the filling and keep out regions.
            {
                if( RoutingMatrix.GetDist( ii, jj, TOP )
                    || RoutingMatrix.GetDist( ii, jj, BOTTOM ) )
                    color = DARKGRAY;
            }

            GRPutPixel( NULL, DC, ox, oy, color );
        }
    }
}
예제 #3
0
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC)
/***********************************************/
/* Trace les axes X et Y et la grille
	La grille n'est affichee que si elle peut etre facilement visible
	La grille passe toujours par le centre de l'ecran
*/
{
int Color = BLUE;
BASE_SCREEN * screen = GetScreen();
int ii,jj ,xg , yg , color;
wxSize pas_grille_affichee;
bool drawgrid = FALSE;
int zoom = GetZoom();
wxSize size;
wxPoint org;
double pasx, pasy;

	color = screen->m_GridColor;
	GRSetDrawMode(DC, GR_COPY);

	/* le pas d'affichage doit etre assez grand pour avoir une grille visible */
	drawgrid = m_Parent->m_Draw_Grid;
	pas_grille_affichee = screen->GetGrid();

	ii = pas_grille_affichee.x / zoom;
	if (ii  < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; }
	if( ii < 5 ) drawgrid = FALSE;	// grille trop petite
	ii = pas_grille_affichee.y / zoom;
	if (ii  < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; }
	if( ii < 5 ) drawgrid = FALSE;	// grille trop petite

	GetViewStart(&org.x, &org.y);
	GetScrollPixelsPerUnit(&ii, &jj);
	org.x *= ii; org.y *= jj;
	screen->m_StartVisu = org;

	org.x *= zoom; org.y *= zoom;
	org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y;

	size = GetClientSize();
	size.x *= zoom; size.y *= zoom;
	pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits;
	pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits;
	if ( screen->m_UserGridUnit != INCHES )
	{
		pasx /= 25.4; pasy /= 25.4;
	}

	if( drawgrid)
	{
		m_Parent->PutOnGrid(&org) ;

		GRSetColorPen(DC, color );
		for ( ii = 0 ; ; ii++ )
		{
			xg = screen->m_UserGridIsON ? (int)( (ii * pasx) + 0.5)
				:ii * pas_grille_affichee.x;
			int xpos = org.x + xg;
			for ( jj = 0 ; ; jj++ )
			{
				yg = screen->m_UserGridIsON ? (int)( (jj * pasy) + 0.5)
					: jj * pas_grille_affichee.y;
				GRPutPixel(&m_ClipBox, DC, xpos, org.y + yg, color);
				if ( yg > size.y ) break;
			}
			if ( xg > size.x ) break;
		}
	}

	/* trace des axes principaux */
	if (  m_Parent->m_Draw_Axes )
	{
		/* Trace de l'axe vertical */
		GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
				0, screen->ReturnPageSize().y, Color );

		/* Trace de l'axe horizontal */
		GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
				screen->ReturnPageSize().x, 0, Color );
	}

	/* trace des axes auxiliaires */
	if ( m_Parent->m_Draw_Auxiliary_Axe)
	{
		m_Draw_Auxiliary_Axe(DC, FALSE);
	}
}