|
|
@ -1087,53 +1087,66 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) |
|
|
|
else |
|
|
|
keepout_type = T_keepout; |
|
|
|
|
|
|
|
KEEPOUT* keepout = new KEEPOUT( pcb->structure, keepout_type ); |
|
|
|
pcb->structure->keepouts.push_back( keepout ); |
|
|
|
// Now, build keepout polygon on each copper layer where the item
|
|
|
|
// keepout is living (keepout zones can live on many copper layers)
|
|
|
|
const int copperCount = aBoard->GetCopperLayerCount(); |
|
|
|
|
|
|
|
PATH* mainPolygon = new PATH( keepout, T_polygon ); |
|
|
|
keepout->SetShape( mainPolygon ); |
|
|
|
for( int layer = 0; layer < copperCount; layer++ ) |
|
|
|
{ |
|
|
|
if( layer == copperCount-1) |
|
|
|
layer = B_Cu; |
|
|
|
|
|
|
|
mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; |
|
|
|
if( !item->IsOnLayer( PCB_LAYER_ID( layer ) ) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
// Handle the main outlines
|
|
|
|
SHAPE_POLY_SET::ITERATOR iterator; |
|
|
|
for( iterator = item->IterateWithHoles(); iterator; iterator++ ) |
|
|
|
{ |
|
|
|
wxPoint point( iterator->x, iterator->y ); |
|
|
|
mainPolygon->AppendPoint( mapPt(point) ); |
|
|
|
KEEPOUT* keepout = new KEEPOUT( pcb->structure, keepout_type ); |
|
|
|
pcb->structure->keepouts.push_back( keepout ); |
|
|
|
|
|
|
|
// this was the end of the main polygon
|
|
|
|
if( iterator.IsEndContour() ) |
|
|
|
break; |
|
|
|
} |
|
|
|
PATH* mainPolygon = new PATH( keepout, T_polygon ); |
|
|
|
keepout->SetShape( mainPolygon ); |
|
|
|
|
|
|
|
WINDOW* window = 0; |
|
|
|
PATH* cutout = 0; |
|
|
|
mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ layer ] ]; |
|
|
|
|
|
|
|
bool isStartContour = true; |
|
|
|
// Handle the main outlines
|
|
|
|
SHAPE_POLY_SET::ITERATOR iterator; |
|
|
|
for( iterator = item->IterateWithHoles(); iterator; iterator++ ) |
|
|
|
{ |
|
|
|
wxPoint point( iterator->x, iterator->y ); |
|
|
|
mainPolygon->AppendPoint( mapPt(point) ); |
|
|
|
|
|
|
|
// handle the cutouts
|
|
|
|
for( iterator++; iterator; iterator++ ) |
|
|
|
{ |
|
|
|
if( isStartContour ) |
|
|
|
// this was the end of the main polygon
|
|
|
|
if( iterator.IsEndContour() ) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
WINDOW* window = 0; |
|
|
|
PATH* cutout = 0; |
|
|
|
|
|
|
|
bool isStartContour = true; |
|
|
|
|
|
|
|
// handle the cutouts
|
|
|
|
for( iterator++; iterator; iterator++ ) |
|
|
|
{ |
|
|
|
window = new WINDOW( keepout ); |
|
|
|
keepout->AddWindow( window ); |
|
|
|
if( isStartContour ) |
|
|
|
{ |
|
|
|
window = new WINDOW( keepout ); |
|
|
|
keepout->AddWindow( window ); |
|
|
|
|
|
|
|
cutout = new PATH( window, T_polygon ); |
|
|
|
cutout = new PATH( window, T_polygon ); |
|
|
|
|
|
|
|
window->SetShape( cutout ); |
|
|
|
window->SetShape( cutout ); |
|
|
|
|
|
|
|
cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; |
|
|
|
} |
|
|
|
cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; |
|
|
|
} |
|
|
|
|
|
|
|
isStartContour = iterator.IsEndContour(); |
|
|
|
isStartContour = iterator.IsEndContour(); |
|
|
|
|
|
|
|
wxASSERT( window ); |
|
|
|
wxASSERT( cutout ); |
|
|
|
wxASSERT( window ); |
|
|
|
wxASSERT( cutout ); |
|
|
|
|
|
|
|
wxPoint point(iterator->x, iterator->y ); |
|
|
|
cutout->AppendPoint( mapPt(point) ); |
|
|
|
wxPoint point(iterator->x, iterator->y ); |
|
|
|
cutout->AppendPoint( mapPt(point) ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|