More work on a better support of polygons in Kicad (code cleaning).

This commit is contained in:
jean-pierre charras
2012-07-25 20:46:25 +02:00
parent ef5f1b9e6b
commit 99b90d2fa3
16 changed files with 745 additions and 669 deletions
+7 -34
View File
@@ -89,39 +89,12 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
break;
}
m_smoothedPoly->MakeKboolPoly( -1, -1, NULL, true );
int count = 0;
while( m_smoothedPoly->GetKboolEngine()->StartPolygonGet() )
{
CPolyPt corner( 0, 0, false );
while( m_smoothedPoly->GetKboolEngine()->PolygonHasMorePoints() )
{
corner.x = (int) m_smoothedPoly->GetKboolEngine()->GetPolygonXPoint();
corner.y = (int) m_smoothedPoly->GetKboolEngine()->GetPolygonYPoint();
corner.end_contour = false;
if( aCornerBuffer )
aCornerBuffer->push_back( corner );
else
m_FilledPolysList.push_back( corner );
count++;
}
corner.end_contour = true;
if( aCornerBuffer )
{
aCornerBuffer->pop_back();
aCornerBuffer->push_back( corner );
}
else
{
m_FilledPolysList.pop_back();
m_FilledPolysList.push_back( corner );
}
m_smoothedPoly->GetKboolEngine()->EndPolygonGet();
}
m_smoothedPoly->FreeKboolEngine();
if( aCornerBuffer )
ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList,
*aCornerBuffer );
else
ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList,
m_FilledPolysList );
/* For copper layers, we now must add holes in the Polygon list.
* holes are pads and tracks with their clearance area
*/
@@ -134,7 +107,7 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
Fill_Zone_Areas_With_Segments( );
}
return count;
return 1;
}
// Sort function to build filled zones