specctra export zone 'cutout' support

This commit is contained in:
dickelbeck 2009-02-06 14:23:56 +00:00
parent d73e132455
commit 31aee8ef3e
3 changed files with 56 additions and 10 deletions

View File

@ -5,6 +5,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
added "cutout" from a ZONE_CONTAINER capability to the SPECCTRA export.
2009-Feb-6 Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-Feb-6 Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
@ -19,7 +24,7 @@ email address.
more refinements in user grid mode. more refinements in user grid mode.
new grid implementation does not used floats when user grid is selected to calculate coordinates. new grid implementation does not used floats when user grid is selected to calculate coordinates.
so it is unable to handle a metric grid. Todo: see what happened. so it is unable to handle a metric grid. Todo: see what happened.
++eeschema: ++eeschema:
Zoom factors in 1.5 progression, and limited to 15 values according to Wayne Stambaugh's changes. Zoom factors in 1.5 progression, and limited to 15 values according to Wayne Stambaugh's changes.
@ -37,6 +42,7 @@ email address.
automatically scrolling the drawing. automatically scrolling the drawing.
>>>>>>> .r1562
2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi> 2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:

View File

@ -1005,6 +1005,12 @@ public:
} }
} }
void AddWindow( WINDOW* aWindow )
{
aWindow->SetParent( this );
windows.push_back( aWindow );
}
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
const char* newline = "\n"; const char* newline = "\n";
@ -1047,9 +1053,11 @@ public:
for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i ) for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i )
i->Format( out, nestLevel+1 ); i->Format( out, nestLevel+1 );
}
out->Print( 0, ")\n" ); out->Print( nestLevel, ")\n" );
}
else
out->Print( 0, ")\n" );
} }
}; };
typedef boost::ptr_vector<KEEPOUT> KEEPOUTS; typedef boost::ptr_vector<KEEPOUT> KEEPOUTS;

View File

@ -1036,19 +1036,51 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
COPPER_PLANE* plane = new COPPER_PLANE( pcb->structure ); COPPER_PLANE* plane = new COPPER_PLANE( pcb->structure );
pcb->structure->planes.push_back( plane ); pcb->structure->planes.push_back( plane );
PATH* polygon = new PATH( plane, T_polygon ); PATH* mainPolygon = new PATH( plane, T_polygon );
plane->SetShape( polygon ); plane->SetShape( mainPolygon );
plane->name = CONV_TO_UTF8( item->m_Netname ); plane->name = CONV_TO_UTF8( item->m_Netname );
polygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
int count = item->m_Poly->corner.size(); int count = item->m_Poly->corner.size();
for( int j=0; j<count; ++j ) int ndx = 0; // used in 2 for() loops below
for( ; ndx<count; ++ndx )
{ {
wxPoint point( item->m_Poly->corner[j].x, wxPoint point( item->m_Poly->corner[ndx].x,
item->m_Poly->corner[j].y ); item->m_Poly->corner[ndx].y );
polygon->AppendPoint( mapPt(point) ); mainPolygon->AppendPoint( mapPt(point) );
// this was the end of the main polygon
if( item->m_Poly->corner[ndx].end_contour )
break;
}
WINDOW* window = 0;
PATH* cutout = 0;
// handle the cutouts
// http://www.freerouting.net/fen/viewtopic.php?f=6&t=19
for( ++ndx; ndx<count; ++ndx )
{
if( item->m_Poly->corner[ndx-1].end_contour )
{
window = new WINDOW( plane );
plane->AddWindow( window );
cutout = new PATH( window, T_path );
// cutout = new PATH( window, T_polygon );
window->SetShape( cutout );
cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
}
wxASSERT( window );
wxASSERT( cutout );
wxPoint point(item->m_Poly->corner[ndx].x,
item->m_Poly->corner[ndx].y );
cutout->AppendPoint( mapPt(point) );
} }
} }
} }