Commit 4c920f52 authored by charras's avatar charras

finishing worl on trapezoidal pads in zones

parent df3939f8
...@@ -151,7 +151,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -151,7 +151,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
CopyPolygonsFromBoolengineToFilledPolysList( booleng ); CopyPolygonsFromBoolengineToFilledPolysList( booleng );
delete booleng; delete booleng;
if ( m_FilledPolysList.size() == 0 ) if( m_FilledPolysList.size() == 0 )
return; return;
/* Second, Add the main (corrected) polygon (i.e. the filled area using only one outline) /* Second, Add the main (corrected) polygon (i.e. the filled area using only one outline)
...@@ -202,7 +202,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -202,7 +202,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue; continue;
} }
if( (m_PadOption == PAD_NOT_IN_ZONE) || (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID ) if( (m_PadOption == PAD_NOT_IN_ZONE)
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
// PAD_TRAPEZOID shapes are *never* in zones becuase they are used in microwave apps
// and the shae *must not* be changed by thermal pads or others
{ {
item_boundingbox = pad->GetBoundingBox(); item_boundingbox = pad->GetBoundingBox();
if( item_boundingbox.Intersects( zone_boundingbox ) ) if( item_boundingbox.Intersects( zone_boundingbox ) )
...@@ -210,7 +213,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -210,7 +213,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
AddPadWithClearancePolygon( booleng, *pad, clearance ); AddPadWithClearancePolygon( booleng, *pad, clearance );
have_poly_to_substract = true; have_poly_to_substract = true;
} }
} }
} }
} }
...@@ -287,7 +289,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -287,7 +289,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
} }
/* calculates copper areas */ /* calculates copper areas */
if ( have_poly_to_substract ) if( have_poly_to_substract )
{ {
booleng->Do_Operation( BOOL_A_SUB_B ); booleng->Do_Operation( BOOL_A_SUB_B );
...@@ -353,7 +355,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -353,7 +355,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// Remove insulated islands: // Remove insulated islands:
if( GetNet() > 0 ) if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb ); Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
} }
// Now we remove all unused thermal stubs. // Now we remove all unused thermal stubs.
...@@ -432,7 +433,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -432,7 +433,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// polygons are rectangles with width of copper bridge value // polygons are rectangles with width of copper bridge value
// contour line width has to be taken into calculation to avoid "thermal stub bleed" // contour line width has to be taken into calculation to avoid "thermal stub bleed"
const int iDTRC = ( m_ThermalReliefCopperBridgeValue - m_ZoneMinThickness ) / 2; const int iDTRC =
( m_ThermalReliefCopperBridgeValue - m_ZoneMinThickness ) / 2;
switch( i ) switch( i )
{ {
...@@ -485,19 +487,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -485,19 +487,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
} }
/* compute copper areas */ /* compute copper areas */
if ( have_poly_to_substract ) if( have_poly_to_substract )
{ {
booleng->Do_Operation( BOOL_A_SUB_B ); booleng->Do_Operation( BOOL_A_SUB_B );
/* put these areas in m_FilledPolysList */ /* put these areas in m_FilledPolysList */
m_FilledPolysList.clear(); m_FilledPolysList.clear();
CopyPolygonsFromBoolengineToFilledPolysList( booleng ); CopyPolygonsFromBoolengineToFilledPolysList( booleng );
// Remove insulated islands, if any: // Remove insulated islands, if any:
if( GetNet() > 0 ) if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb ); Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
} }
delete booleng; delete booleng;
//#endif //#endif
} }
...@@ -519,6 +523,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -519,6 +523,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
int delta = 3600 / s_CircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / s_CircleToSegmentsCount; // rot angle in 0.1 degree
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */ * the pad position is NOT the shape position */
wxSize psize = aPad.m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads
* trapezoidal pads are considered as rect pad shape having they boudary box size
*/
switch( aPad.m_PadShape ) switch( aPad.m_PadShape )
{ {
...@@ -601,11 +608,11 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -601,11 +608,11 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
break; break;
} }
default:
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
default: /* @todo: the others shapes must be calculated: see trapezoidal shape psize.x += ABS(aPad.m_DeltaSize.y);
* but before this is made, the rect shape is used insteed. psize.y += ABS(aPad.m_DeltaSize.x);
* A polygon *must* be created because we have started a polygon in kbool engine // fall through
*/
case PAD_RECT: // Easy implementation for rectangular cutouts with rounded corners // Easy implementation for rectangular cutouts with rounded corners case PAD_RECT: // Easy implementation for rectangular cutouts with rounded corners // Easy implementation for rectangular cutouts with rounded corners
angle = aPad.m_Orient; angle = aPad.m_Orient;
int rounding_radius = (int) ( aClearanceValue * s_Correction ); // Corner rounding radius int rounding_radius = (int) ( aClearanceValue * s_Correction ); // Corner rounding radius
...@@ -617,7 +624,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -617,7 +624,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) ); // Start at half increment offset RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) ); // Start at half increment offset
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset corner_position -= psize / 2; // Rounding vector + Pad corner offset
RotatePoint( &corner_position, angle ); // Rotate according to module orientation RotatePoint( &corner_position, angle ); // Rotate according to module orientation
corner_position += PadShapePos; // Shift origin to position corner_position += PadShapePos; // Shift origin to position
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
...@@ -629,7 +636,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -629,7 +636,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) ); RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( aPad.m_Size.x / 2, -aPad.m_Size.y / 2 ); corner_position -= wxPoint( psize.x / 2, -psize.y / 2 );
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
...@@ -641,7 +648,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -641,7 +648,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) ); RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position += aPad.m_Size / 2; corner_position += psize / 2;
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
...@@ -653,7 +660,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -653,7 +660,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) ); RotatePoint( &corner_position, (1800 / s_CircleToSegmentsCount) );
angle_pg = i * delta; angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( -aPad.m_Size.x / 2, aPad.m_Size.y / 2 ); corner_position -= wxPoint( -psize.x / 2, psize.y / 2 );
RotatePoint( &corner_position, angle ); RotatePoint( &corner_position, angle );
corner_position += PadShapePos; corner_position += PadShapePos;
aBooleng->AddPoint( corner_position.x, corner_position.y ); aBooleng->AddPoint( corner_position.x, corner_position.y );
...@@ -703,7 +710,8 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -703,7 +710,8 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
* *
* Note 2: * Note 2:
* Trapezoidal pads are not considered here because they are very special case * Trapezoidal pads are not considered here because they are very special case
* and are used in microwave applications and they do not have a therma relief that change the shape * and are used in microwave applications and they *DO NOT* have a thermal relief that change the shape
* by creating stubs and destroy their properties.
*/ */
void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
D_PAD& aPad, D_PAD& aPad,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment