Loading common/gr_basic.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -869,8 +869,6 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points ) void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, int width, int Color, int BgColor ) int width, int Color, int BgColor ) { { int startx, starty; if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) return; return; Loading @@ -883,11 +881,15 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, } } else else { { startx = Points[n * 2 - 2]; int endx = Points[n * 2 - 2]; starty = Points[n * 2 - 1]; int endy = Points[n * 2 - 1]; GRSetBrush( DC, Color ); GRSetBrush( DC, Color ); DC->DrawLines( n, (wxPoint*) Points ); DC->DrawLines( n, (wxPoint*) Points ); // The last point is not drawn by DrawLine and DrawLines // Add it if the polygon is not closed if ( endx != Points[0] || endy != Points[1] ) DC->DrawPoint(endx, endy); } } } } Loading pcbnew/zones_convert_brd_items_to_polygons.cpp +24 −6 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,10 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng, static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32 static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32 * if g_Zone_Arc_Approximation == 1 * if g_Zone_Arc_Approximation == 1 */ */ double s_Correction; /* mult coeff used to enlarge rouded and oval pads * because the segment approximation for arcs and circles * create a smaler gap than a trur circle */ /** function AddClearanceAreasPolygonsToPolysList /** function AddClearanceAreasPolygonsToPolysList * Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearence) * to a filled copper area * to a filled copper area Loading @@ -60,6 +63,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) else else s_CircleToSegmentsCount = 16; s_CircleToSegmentsCount = 16; /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx. * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2) * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount ) */ s_Correction = 1.0 / cos(3.14159265 / s_CircleToSegmentsCount); /* Uses a kbool engine to add holes in the m_FilledPolysList polygon. /* Uses a kbool engine to add holes in the m_FilledPolysList polygon. * Because this function is called just after creating the m_FilledPolysList, * Because this function is called just after creating the m_FilledPolysList, * only one polygon is in list. * only one polygon is in list. Loading Loading @@ -89,13 +99,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) booleng->EndPolygonAdd(); booleng->EndPolygonAdd(); } } // Calculates the clearance value that meet DRC requirements int clearance = max( m_ZoneClearance,g_DesignSettings.m_TrackClearence); /* Add holes (i.e. tracks and pads areas as polygons outlines) /* Add holes (i.e. tracks and pads areas as polygons outlines) * in GroupB in Bool_Engine * in GroupB in Bool_Engine */ */ /* items ouside the zone bounding box are skipped */ /* items ouside the zone bounding box are skipped */ EDA_Rect item_boundingbox; EDA_Rect item_boundingbox; EDA_Rect zone_boundingbox = GetBoundingBox(); EDA_Rect zone_boundingbox = GetBoundingBox(); zone_boundingbox.Inflate(m_ZoneClearance, m_ZoneClearance); zone_boundingbox.Inflate(m_ZoneClearance, clearance); /* /* * First : Add pads * First : Add pads */ */ Loading @@ -110,7 +123,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) { { item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddPadWithClearancePolygon( booleng, *pad, m_ZoneClearance ); AddPadWithClearancePolygon( booleng, *pad, clearance ); continue; continue; } } Loading @@ -119,7 +132,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) case PAD_NOT_IN_ZONE: case PAD_NOT_IN_ZONE: item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddPadWithClearancePolygon( booleng, *pad, m_ZoneClearance ); AddPadWithClearancePolygon( booleng, *pad, clearance ); break; break; case THERMAL_PAD: case THERMAL_PAD: Loading Loading @@ -148,10 +161,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) continue; continue; item_boundingbox = track->GetBoundingBox(); item_boundingbox = track->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddTrackWithClearancePolygon( booleng, *track, m_ZoneClearance ); AddTrackWithClearancePolygon( booleng, *track, clearance ); } } // Draw graphic items (copper texts) and board edges // Draw graphic items (copper texts) and board edges // zone clearance is used here regardless of the g_DesignSettings.m_TrackClearence value for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) { { if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N ) if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N ) Loading Loading @@ -228,6 +242,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, switch( aPad.m_PadShape ) switch( aPad.m_PadShape ) { { case PAD_CIRCLE: case PAD_CIRCLE: dx = (int) (dx * s_Correction); for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) { { corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 ); Loading @@ -243,6 +258,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, angle = aPad.m_Orient; angle = aPad.m_Orient; if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles { { dy = (int) (dy * s_Correction); int angle_pg; // Polygon angle int angle_pg; // Polygon angle wxPoint shape_offset = wxPoint( 0, (dy - dx) ); wxPoint shape_offset = wxPoint( 0, (dy - dx) ); RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component Loading @@ -269,8 +285,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, break; break; } } else else //if( dy <= dx ) { { dx = (int) (dx * s_Correction); int angle_pg; // Polygon angle int angle_pg; // Polygon angle wxPoint shape_offset = wxPoint( (dy - dx), 0 ); wxPoint shape_offset = wxPoint( (dy - dx), 0 ); RotatePoint( &shape_offset, angle ); RotatePoint( &shape_offset, angle ); Loading Loading @@ -663,6 +680,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng, case TYPEVIA: case TYPEVIA: if( aBooleng->StartPolygonAdd( GROUP_B ) ) if( aBooleng->StartPolygonAdd( GROUP_B ) ) { { dx = (int) (dx * s_Correction); for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) { { corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 ); Loading Loading
common/gr_basic.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -869,8 +869,6 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points ) void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, int width, int Color, int BgColor ) int width, int Color, int BgColor ) { { int startx, starty; if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) return; return; Loading @@ -883,11 +881,15 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, } } else else { { startx = Points[n * 2 - 2]; int endx = Points[n * 2 - 2]; starty = Points[n * 2 - 1]; int endy = Points[n * 2 - 1]; GRSetBrush( DC, Color ); GRSetBrush( DC, Color ); DC->DrawLines( n, (wxPoint*) Points ); DC->DrawLines( n, (wxPoint*) Points ); // The last point is not drawn by DrawLine and DrawLines // Add it if the polygon is not closed if ( endx != Points[0] || endy != Points[1] ) DC->DrawPoint(endx, endy); } } } } Loading
pcbnew/zones_convert_brd_items_to_polygons.cpp +24 −6 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,10 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng, static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32 static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32 * if g_Zone_Arc_Approximation == 1 * if g_Zone_Arc_Approximation == 1 */ */ double s_Correction; /* mult coeff used to enlarge rouded and oval pads * because the segment approximation for arcs and circles * create a smaler gap than a trur circle */ /** function AddClearanceAreasPolygonsToPolysList /** function AddClearanceAreasPolygonsToPolysList * Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearence) * to a filled copper area * to a filled copper area Loading @@ -60,6 +63,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) else else s_CircleToSegmentsCount = 16; s_CircleToSegmentsCount = 16; /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx. * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2) * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount ) */ s_Correction = 1.0 / cos(3.14159265 / s_CircleToSegmentsCount); /* Uses a kbool engine to add holes in the m_FilledPolysList polygon. /* Uses a kbool engine to add holes in the m_FilledPolysList polygon. * Because this function is called just after creating the m_FilledPolysList, * Because this function is called just after creating the m_FilledPolysList, * only one polygon is in list. * only one polygon is in list. Loading Loading @@ -89,13 +99,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) booleng->EndPolygonAdd(); booleng->EndPolygonAdd(); } } // Calculates the clearance value that meet DRC requirements int clearance = max( m_ZoneClearance,g_DesignSettings.m_TrackClearence); /* Add holes (i.e. tracks and pads areas as polygons outlines) /* Add holes (i.e. tracks and pads areas as polygons outlines) * in GroupB in Bool_Engine * in GroupB in Bool_Engine */ */ /* items ouside the zone bounding box are skipped */ /* items ouside the zone bounding box are skipped */ EDA_Rect item_boundingbox; EDA_Rect item_boundingbox; EDA_Rect zone_boundingbox = GetBoundingBox(); EDA_Rect zone_boundingbox = GetBoundingBox(); zone_boundingbox.Inflate(m_ZoneClearance, m_ZoneClearance); zone_boundingbox.Inflate(m_ZoneClearance, clearance); /* /* * First : Add pads * First : Add pads */ */ Loading @@ -110,7 +123,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) { { item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddPadWithClearancePolygon( booleng, *pad, m_ZoneClearance ); AddPadWithClearancePolygon( booleng, *pad, clearance ); continue; continue; } } Loading @@ -119,7 +132,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) case PAD_NOT_IN_ZONE: case PAD_NOT_IN_ZONE: item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddPadWithClearancePolygon( booleng, *pad, m_ZoneClearance ); AddPadWithClearancePolygon( booleng, *pad, clearance ); break; break; case THERMAL_PAD: case THERMAL_PAD: Loading Loading @@ -148,10 +161,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) continue; continue; item_boundingbox = track->GetBoundingBox(); item_boundingbox = track->GetBoundingBox(); if ( item_boundingbox.Intersects( zone_boundingbox ) ) if ( item_boundingbox.Intersects( zone_boundingbox ) ) AddTrackWithClearancePolygon( booleng, *track, m_ZoneClearance ); AddTrackWithClearancePolygon( booleng, *track, clearance ); } } // Draw graphic items (copper texts) and board edges // Draw graphic items (copper texts) and board edges // zone clearance is used here regardless of the g_DesignSettings.m_TrackClearence value for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) { { if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N ) if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N ) Loading Loading @@ -228,6 +242,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, switch( aPad.m_PadShape ) switch( aPad.m_PadShape ) { { case PAD_CIRCLE: case PAD_CIRCLE: dx = (int) (dx * s_Correction); for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) { { corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 ); Loading @@ -243,6 +258,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, angle = aPad.m_Orient; angle = aPad.m_Orient; if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles if( dy > dx ) // Oval pad X/Y ratio for choosing translation axles { { dy = (int) (dy * s_Correction); int angle_pg; // Polygon angle int angle_pg; // Polygon angle wxPoint shape_offset = wxPoint( 0, (dy - dx) ); wxPoint shape_offset = wxPoint( 0, (dy - dx) ); RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component RotatePoint( &shape_offset, angle ); // Rotating shape offset vector with component Loading @@ -269,8 +285,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, break; break; } } else else //if( dy <= dx ) { { dx = (int) (dx * s_Correction); int angle_pg; // Polygon angle int angle_pg; // Polygon angle wxPoint shape_offset = wxPoint( (dy - dx), 0 ); wxPoint shape_offset = wxPoint( (dy - dx), 0 ); RotatePoint( &shape_offset, angle ); RotatePoint( &shape_offset, angle ); Loading Loading @@ -663,6 +680,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng, case TYPEVIA: case TYPEVIA: if( aBooleng->StartPolygonAdd( GROUP_B ) ) if( aBooleng->StartPolygonAdd( GROUP_B ) ) { { dx = (int) (dx * s_Correction); for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) for( ii = 0; ii < s_CircleToSegmentsCount; ii++ ) { { corner_position = wxPoint( dx, 0 ); corner_position = wxPoint( dx, 0 ); Loading