Pcbnew: fix segfault in eagle plugin when importing zone keepout areas.

This commit is contained in:
Jon Neal 2015-11-15 08:29:48 -05:00 committed by Wayne Stambaugh
parent c3b51b0d07
commit 19075e3434
1 changed files with 12 additions and 12 deletions

View File

@ -797,7 +797,7 @@ struct EPOLYGON
HATCH, HATCH,
CUTOUT, CUTOUT,
}; };
opt_int pour; int pour = EPOLYGON::SOLID;
opt_double isolate; opt_double isolate;
opt_bool orphans; opt_bool orphans;
opt_bool thermals; opt_bool thermals;
@ -836,8 +836,6 @@ EPOLYGON::EPOLYGON( CPTREE& aPolygon )
pour = EPOLYGON::HATCH; pour = EPOLYGON::HATCH;
else if( !s->compare( "cutout" ) ) else if( !s->compare( "cutout" ) )
pour = EPOLYGON::CUTOUT; pour = EPOLYGON::CUTOUT;
else
pour = EPOLYGON::SOLID;
} }
orphans = parseOptionalBool( attribs, "orphans" ); orphans = parseOptionalBool( attribs, "orphans" );
@ -2434,7 +2432,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
(void) breakhere; (void) breakhere;
} }
#endif #endif
// (contactref | polygon | wire | via)* // (contactref | polygon | wire | via)*
for( CITER it = net->second.begin(); it != net->second.end(); ++it ) for( CITER it = net->second.begin(); it != net->second.end(); ++it )
{ {
@ -2567,8 +2564,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
zone->SetLayer( layer ); zone->SetLayer( layer );
zone->SetNetCode( netCode ); zone->SetNetCode( netCode );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;
bool first = true; bool first = true;
for( CITER vi = it->second.begin(); vi != it->second.end(); ++vi ) for( CITER vi = it->second.begin(); vi != it->second.end(); ++vi )
{ {
@ -2581,7 +2576,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
if( first ) if( first )
{ {
zone->Outline()->Start( layer, kicad_x( v.x ), kicad_y( v.y ), zone->Outline()->Start( layer, kicad_x( v.x ), kicad_y( v.y ),
outline_hatch ); CPolyLine::NO_HATCH);
first = false; first = false;
} }
else else
@ -2590,14 +2585,19 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
zone->Outline()->CloseLastContour(); zone->Outline()->CloseLastContour();
// If pour is set the zone should be hatched, // If the pour is a cutout it needs to be set to a keepout
// set the hatch size from the spacing variable. if( p.pour == EPOLYGON::CUTOUT )
if( p.pour )
{ {
zone->Outline()->SetHatch( outline_hatch, zone->SetIsKeepout( true );
zone->SetDoNotAllowCopperPour( true );
zone->Outline()->SetHatchStyle( CPolyLine::NO_HATCH );
}
// if spacing is set the zone should be hatched
if( p.spacing )
zone->Outline()->SetHatch( CPolyLine::DIAGONAL_EDGE,
*p.spacing, *p.spacing,
true ); true );
}
// clearances, etc. // clearances, etc.
zone->SetArcSegmentCount( 32 ); // @todo: should be a constructor default? zone->SetArcSegmentCount( 32 ); // @todo: should be a constructor default?