Commit 25545756 authored by jean-pierre charras's avatar jean-pierre charras

More work on CPOLYGONS_LIST class.

Pcbnew: fix minor bug about  plot line width.
parent cf86e18f
......@@ -88,7 +88,8 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
aCircleToSegmentsCount, aCorrectionFactor );
// Add outlines as thick segments in polygon buffer
for( unsigned ii = 0, jj = corners.size() - 1; ii < corners.size(); jj = ii, ii++ )
for( unsigned ii = 0, jj = corners.GetCornersCount() - 1;
ii < corners.GetCornersCount(); jj = ii, ii++ )
{
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
corners.GetPos( jj ),
......@@ -282,7 +283,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// bufferPolys contains polygons to merge. Many overlaps . Calculate merged polygons
if( bufferPolys.size() == 0 )
if( bufferPolys.GetCornersCount() == 0 )
continue;
KI_POLYGON_SET currLayerPolyset;
......@@ -294,7 +295,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// Add holes in polygon list
currLayerHoles.Append( allLayerHoles );
if( currLayerHoles.size() > 0 )
if( currLayerHoles.GetCornersCount() > 0 )
currLayerHoles.ExportTo( polysetHoles );
// Merge polygons, remove holes
......@@ -313,7 +314,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
thickness,
g_Parm_3D_Visu.m_BiuTo3Dunits );
if( bufferZonesPolys.size() )
if( bufferZonesPolys.GetCornersCount() )
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
thickness,
g_Parm_3D_Visu.m_BiuTo3Dunits );
......@@ -404,7 +405,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// bufferPolys contains polygons to merge. Many overlaps .
// Calculate merged polygons and remove pads and vias holes
if( bufferPolys.size() == 0 )
if( bufferPolys.GetCornersCount() == 0 )
continue;
KI_POLYGON_SET currLayerPolyset;
......
......@@ -96,11 +96,11 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
// Draw the vertical polygonal side
int startContour = 0;
for( unsigned ii = 0; ii < aPolysList.size(); ii++ )
for( unsigned ii = 0; ii < aPolysList.GetCornersCount(); ii++ )
{
unsigned jj = ii + 1;
if( aPolysList.IsEndContour( ii ) || jj >= aPolysList.size() )
if( aPolysList.IsEndContour( ii ) || jj >= aPolysList.GetCornersCount() )
{
jj = startContour;
startContour = ii + 1;
......@@ -170,7 +170,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
{
int startContour = 1;
for( unsigned ii = 0; ii < polylist.size(); ii++ )
for( unsigned ii = 0; ii < polylist.GetCornersCount(); ii++ )
{
if( startContour == 1 )
{
......
......@@ -59,10 +59,10 @@ void TransformCircleToPolygon( CPOLYGONS_LIST& aCornerBuffer,
RotatePoint( &corner_position.x, &corner_position.y, angle );
corner_position += aCenter;
CPolyPt polypoint( corner_position.x, corner_position.y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
}
......@@ -112,7 +112,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
// Finish arc:
......@@ -121,7 +121,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
// add left rounded end:
for( int ii = 0; ii < 1800; ii += delta )
......@@ -132,7 +132,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
// Finish arc:
......@@ -141,9 +141,9 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner += startp;
polypoint.x = corner.x;
polypoint.y = corner.y;
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
}
......@@ -229,13 +229,13 @@ void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
curr_point += aCentre;
polycorner.x = curr_point.x;
polycorner.y = curr_point.y;
aCornerBuffer.push_back( polycorner );
aCornerBuffer.Append( polycorner );
}
// Draw the last point of inner circle
polycorner.x = aCentre.x + inner_radius;
polycorner.y = aCentre.y;
aCornerBuffer.push_back( polycorner );
aCornerBuffer.Append( polycorner );
// Draw the outer circle of the ring
for( int ii = 0; ii < 3600; ii += delta )
......@@ -246,16 +246,16 @@ void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
curr_point += aCentre;
polycorner.x = curr_point.x;
polycorner.y = curr_point.y;
aCornerBuffer.push_back( polycorner );
aCornerBuffer.Append( polycorner );
}
// Draw the last point of outer circle
polycorner.x = aCentre.x + outer_radius;
polycorner.y = aCentre.y;
aCornerBuffer.push_back( polycorner );
aCornerBuffer.Append( polycorner );
// Close the polygon
polycorner.x = aCentre.x + inner_radius;
polycorner.end_contour = true;
aCornerBuffer.push_back( polycorner );
aCornerBuffer.Append( polycorner );
}
......@@ -137,7 +137,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
RotatePoint( &corner.x, &corner.y, GetOrientation() );
corner.x += GetPosition().x;
corner.y += GetPosition().y;
aCornerBuffer.push_back( corner );
aCornerBuffer.Append( corner );
}
aCornerBuffer.back().end_contour = true;
break;
......@@ -170,7 +170,7 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
int aCircleToSegmentsCount,
double aCorrectionFactor )
{
unsigned cornerscount = GetFilledPolysList().size();
unsigned cornerscount = GetFilledPolysList().GetCornersCount();
CPOLYGONS_LIST polygonslist;
if( cornerscount == 0 )
......@@ -239,7 +239,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
{
// Rotate polygon
RotatePoint( &corners[ii].x, &corners[ii].y, m_Pos.x, m_Pos.y, m_Orient );
aCornerBuffer.push_back( corners[ii] );
aCornerBuffer.Append( corners[ii] );
}
aCornerBuffer.back().end_contour = true;
......@@ -492,7 +492,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
// Rotate according to module orientation
corner_position += PadShapePos; // Shift origin to position
CPolyPt polypoint( corner_position.x, corner_position.y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
......@@ -505,7 +505,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint( &corner_position, angle );
corner_position += PadShapePos;
CPolyPt polypoint( corner_position.x, corner_position.y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
......@@ -518,7 +518,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint( &corner_position, angle );
corner_position += PadShapePos;
CPolyPt polypoint( corner_position.x, corner_position.y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
......@@ -531,10 +531,10 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint( &corner_position, angle );
corner_position += PadShapePos;
CPolyPt polypoint( corner_position.x, corner_position.y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
break;
}
}
......@@ -569,10 +569,10 @@ void D_PAD::BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
{
corners[ii] += PadShapePos; // Shift origin to position
CPolyPt polypoint( corners[ii].x, corners[ii].y );
aCornerBuffer.push_back( polypoint );
aCornerBuffer.Append( polypoint );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
break;
}
}
......@@ -768,10 +768,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner = corners_buffer[ii];
RotatePoint( &corner, th_angle + angle_pad ); // Rotate by segment angle and pad orientation
corner += PadShapePos;
aCornerBuffer.push_back( CPolyPt( corner.x, corner.y ) );
aCornerBuffer.Append( CPolyPt( corner.x, corner.y ) );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
th_angle += 900; // Note: th_angle in in 0.1 deg.
}
}
......@@ -872,7 +872,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
......@@ -897,7 +897,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
......@@ -970,10 +970,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle ); // Rotate according to module orientation
cpos += PadShapePos; // Shift origin to position
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
angle = AddAngles( angle, 1800 ); // this is calculate hole 3
}
......@@ -993,10 +993,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
aCornerBuffer.Append( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
angle = AddAngles( angle, 1800 );
}
......
......@@ -120,7 +120,8 @@ EDA_ITEM* ZONE_CONTAINER::Clone() const
bool ZONE_CONTAINER::UnFill()
{
bool change = ( m_FilledPolysList.size() > 0 ) || ( m_FillSegmList.size() > 0 );
bool change = ( m_FilledPolysList.GetCornersCount() > 0 ) ||
( m_FillSegmList.size() > 0 );
m_FilledPolysList.clear();
m_FillSegmList.clear();
......@@ -250,7 +251,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
if( DisplayOpt.DisplayZonesMode == 1 ) // Do not show filled areas
return;
if( m_FilledPolysList.size() == 0 ) // Nothing to draw
if( m_FilledPolysList.GetCornersCount() == 0 ) // Nothing to draw
return;
BOARD* brd = GetBoard();
......@@ -279,7 +280,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
CornersBuffer.clear();
// Draw all filled areas
int imax = m_FilledPolysList.size() - 1;
int imax = m_FilledPolysList.GetCornersCount() - 1;
for( int ic = 0; ic <= imax; ic++ )
{
......@@ -490,7 +491,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
wxPoint delta;
unsigned lim = m_Poly->m_CornersList.size();
unsigned lim = m_Poly->m_CornersList.GetCornersCount();
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
{
......@@ -513,7 +514,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
{
unsigned lim = m_Poly->m_CornersList.size();
unsigned lim = m_Poly->m_CornersList.GetCornersCount();
m_CornerSelection = -1; // Set to not found
......@@ -610,7 +611,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const
unsigned indexstart = 0, indexend;
bool inside = false;
for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ )
for( indexend = 0; indexend < m_FilledPolysList.GetCornersCount(); indexend++ )
{
if( m_FilledPolysList.IsEndContour( indexend ) ) // end of a filled sub-area found
{
......@@ -701,7 +702,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.size() );
msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );
if( m_FillMode )
......@@ -715,9 +716,9 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() );
aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) );
if( m_FilledPolysList.size() )
if( m_FilledPolysList.GetCornersCount() )
{
msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.size() );
msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) );
}
}
......@@ -728,7 +729,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void ZONE_CONTAINER::Move( const wxPoint& offset )
{
/* move outlines */
for( unsigned ii = 0; ii < m_Poly->m_CornersList.size(); ii++ )
for( unsigned ii = 0; ii < m_Poly->m_CornersList.GetCornersCount(); ii++ )
{
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
}
......@@ -736,7 +737,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
m_Poly->Hatch();
/* move filled areas: */
for( unsigned ic = 0; ic < m_FilledPolysList.size(); ic++ )
for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
{
m_FilledPolysList.SetX( ic, m_FilledPolysList.GetX( ic ) + offset.x );
m_FilledPolysList.SetY( ic, m_FilledPolysList.GetX( ic ) + offset.y );
......@@ -778,7 +779,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
{
wxPoint pos;
for( unsigned ic = 0; ic < m_Poly->m_CornersList.size(); ic++ )
for( unsigned ic = 0; ic < m_Poly->m_CornersList.GetCornersCount(); ic++ )
{
pos = m_Poly->m_CornersList.GetPos( ic );
RotatePoint( &pos, centre, angle );
......@@ -789,7 +790,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
m_Poly->Hatch();
/* rotate filled areas: */
for( unsigned ic = 0; ic < m_FilledPolysList.size(); ic++ )
for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
{
pos = m_FilledPolysList.GetPos( ic );
RotatePoint( &pos, centre, angle );
......@@ -814,7 +815,7 @@ void ZONE_CONTAINER::Flip( const wxPoint& aCentre )
void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
{
for( unsigned ic = 0; ic < m_Poly->m_CornersList.size(); ic++ )
for( unsigned ic = 0; ic < m_Poly->m_CornersList.GetCornersCount(); ic++ )
{
int py = m_Poly->m_CornersList.GetY( ic ) - mirror_ref.y;
NEGATE( py );
......@@ -824,7 +825,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
m_Poly->Hatch();
/* mirror filled areas: */
for( unsigned ic = 0; ic < m_FilledPolysList.size(); ic++ )
for( unsigned ic = 0; ic < m_FilledPolysList.GetCornersCount(); ic++ )
{
int py = m_FilledPolysList.GetY( ic ) - mirror_ref.y;
NEGATE( py );
......
......@@ -449,7 +449,7 @@ public:
int GetNumCorners( void ) const
{
return m_Poly->GetNumCorners();
return m_Poly->GetCornersCount();
}
void RemoveAllContours( void )
......
......@@ -1398,12 +1398,12 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
const CPOLYGONS_LIST& cv = aZone->Outline()->m_CornersList;
int newLine = 0;
if( cv.size() )
if( cv.GetCornersCount() )
{
m_out->Print( aNestLevel+1, "(polygon\n");
m_out->Print( aNestLevel+2, "(pts\n" );
for( unsigned it = 0; it < cv.size(); ++it )
for( unsigned it = 0; it < cv.GetCornersCount(); ++it )
{
if( newLine == 0 )
m_out->Print( aNestLevel+3, "(xy %s %s)",
......@@ -1429,7 +1429,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+2, ")\n" );
if( it+1 != cv.size() )
if( it+1 != cv.GetCornersCount() )
{
newLine = 0;
m_out->Print( aNestLevel+1, ")\n" );
......@@ -1446,12 +1446,12 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
const CPOLYGONS_LIST& fv = aZone->GetFilledPolysList();
newLine = 0;
if( fv.size() )
if( fv.GetCornersCount() )
{
m_out->Print( aNestLevel+1, "(filled_polygon\n" );
m_out->Print( aNestLevel+2, "(pts\n" );
for( unsigned it = 0; it < fv.size(); ++it )
for( unsigned it = 0; it < fv.GetCornersCount(); ++it )
{
if( newLine == 0 )
m_out->Print( aNestLevel+3, "(xy %s %s)",
......@@ -1477,7 +1477,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+2, ")\n" );
if( it+1 != fv.size() )
if( it+1 != fv.GetCornersCount() )
{
newLine = 0;
m_out->Print( aNestLevel+1, ")\n" );
......
......@@ -2360,7 +2360,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here
int cornerUtilityFlg = intParse( data );
polysList.push_back( CPolyPt( x, y, end_contour, cornerUtilityFlg ) );
polysList.Append( CPolyPt( x, y, end_contour, cornerUtilityFlg ) );
}
zc->AddFilledPolysList( polysList );
}
......@@ -3693,7 +3693,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
// Save the corner list
const CPOLYGONS_LIST& cv = me->Outline()->m_CornersList;
for( unsigned it = 0; it < cv.size(); ++it )
for( unsigned it = 0; it < cv.GetCornersCount(); ++it )
{
fprintf( m_fp, "ZCorner %s %d\n",
fmtBIUPair( cv.GetX( it ), cv.GetY( it ) ).c_str(),
......@@ -3702,11 +3702,11 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
// Save the PolysList
const CPOLYGONS_LIST& fv = me->GetFilledPolysList();
if( fv.size() )
if( fv.GetCornersCount() )
{
fprintf( m_fp, "$POLYSCORNERS\n" );
for( unsigned it = 0; it < fv.size(); ++it )
for( unsigned it = 0; it < fv.GetCornersCount(); ++it )
{
fprintf( m_fp, "%s %d %d\n",
fmtBIUPair( fv.GetX( it ), fv.GetY( it ) ).c_str(),
......
......@@ -665,7 +665,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ),
KiBitmap( fill_zone_xpm ) );
if( edge_zone->GetFilledPolysList().size() > 0 )
if( edge_zone->GetFilledPolysList().GetCornersCount() > 0 )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
_( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) );
......
......@@ -2614,11 +2614,11 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
pts.push_back( CPolyPt( parseXY() ) );
pts.Append( CPolyPt( parseXY() ) );
}
NeedRIGHT();
pts.back().end_contour = true;
pts.CloseLastContour();
}
break;
......@@ -2665,7 +2665,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
zone->Outline()->SetHatch( hatchStyle, hatchPitch, true );
}
if( pts.size() )
if( pts.GetCornersCount() )
zone->AddFilledPolysList( pts );
// Ensure keepout does not have a net (which have no sense for a keepout zone)
......
......@@ -2,7 +2,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -33,6 +33,7 @@
#define PLOT_LINEWIDTH_MIN (0.02*IU_PER_MM) // min value for default line thickness
#define PLOT_LINEWIDTH_MAX (2*IU_PER_MM) // max value for default line thickness
#define PLOT_LINEWIDTH_DEFAULT (0.15*IU_PER_MM) // def. value for default line thickness
#define HPGL_PEN_DIAMETER_MIN 0
#define HPGL_PEN_DIAMETER_MAX 100 // Unit = mil
#define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
......@@ -47,7 +48,7 @@
* Default line thickness in internal units used to draw or plot items using a
* default thickness line value (Frame references)
*/
int g_DrawDefaultLineThickness = (0.15*IU_PER_MM);
int g_DrawDefaultLineThickness = PLOT_LINEWIDTH_DEFAULT;
using namespace PCBPLOTPARAMS_T;
......@@ -132,8 +133,8 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
m_useGerberExtensions ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ),
m_excludeEdgeLayer ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_linewidth ),
m_lineWidth );
aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_linewidth ),
m_lineWidth / IU_PER_MM );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ),
m_plotFrameRef ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ),
......@@ -332,83 +333,89 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
aPcbPlotParams->m_layerSelection = atol( CurText() );
break;
case T_usegerberextensions:
aPcbPlotParams->m_useGerberExtensions = ParseBool();
aPcbPlotParams->m_useGerberExtensions = parseBool();
break;
case T_psa4output:
aPcbPlotParams->m_A4Output = ParseBool();
aPcbPlotParams->m_A4Output = parseBool();
break;
case T_excludeedgelayer:
aPcbPlotParams->m_excludeEdgeLayer = ParseBool();
aPcbPlotParams->m_excludeEdgeLayer = parseBool();
break;
case T_linewidth:
aPcbPlotParams->m_lineWidth = ParseInt( PLOT_LINEWIDTH_MIN,
PLOT_LINEWIDTH_MAX );
{
// Due to a bug, this (minor) parameter was saved in biu
// and now is saved in mm
// If the read value is outside bounds, force a default value
double tmp = parseDouble();
if( !aPcbPlotParams->SetLineWidth( KiROUND( tmp * IU_PER_MM ) ) )
aPcbPlotParams->SetLineWidth( PLOT_LINEWIDTH_DEFAULT );
}
break;
case T_plotframeref:
aPcbPlotParams->m_plotFrameRef = ParseBool();
aPcbPlotParams->m_plotFrameRef = parseBool();
break;
case T_viasonmask:
aPcbPlotParams->m_plotViaOnMaskLayer = ParseBool();
aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
break;
case T_mode:
aPcbPlotParams->m_mode = static_cast<EDA_DRAW_MODE_T>( ParseInt( 0, 2 ) );
aPcbPlotParams->m_mode = static_cast<EDA_DRAW_MODE_T>( parseInt( 0, 2 ) );
break;
case T_useauxorigin:
aPcbPlotParams->m_useAuxOrigin = ParseBool();
aPcbPlotParams->m_useAuxOrigin = parseBool();
break;
case T_hpglpennumber:
aPcbPlotParams->m_HPGLPenNum = ParseInt( HPGL_PEN_NUMBER_MIN,
aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN,
HPGL_PEN_NUMBER_MAX );
break;
case T_hpglpenspeed:
aPcbPlotParams->m_HPGLPenSpeed = ParseInt( HPGL_PEN_SPEED_MIN,
aPcbPlotParams->m_HPGLPenSpeed = parseInt( HPGL_PEN_SPEED_MIN,
HPGL_PEN_SPEED_MAX );
break;
case T_hpglpendiameter:
aPcbPlotParams->m_HPGLPenDiam = ParseInt( HPGL_PEN_DIAMETER_MIN,
aPcbPlotParams->m_HPGLPenDiam = parseInt( HPGL_PEN_DIAMETER_MIN,
HPGL_PEN_DIAMETER_MAX );
break;
case T_hpglpenoverlay:
aPcbPlotParams->m_HPGLPenOvr = ParseInt( HPGL_PEN_OVERLAP_MIN,
aPcbPlotParams->m_HPGLPenOvr = parseInt( HPGL_PEN_OVERLAP_MIN,
HPGL_PEN_OVERLAP_MAX );
break;
case T_pscolor:
NeedSYMBOL(); // This actually was never used...
break;
case T_psnegative:
aPcbPlotParams->m_negative = ParseBool();
aPcbPlotParams->m_negative = parseBool();
break;
case T_plotreference:
aPcbPlotParams->m_plotReference = ParseBool();
aPcbPlotParams->m_plotReference = parseBool();
break;
case T_plotvalue:
aPcbPlotParams->m_plotValue = ParseBool();
aPcbPlotParams->m_plotValue = parseBool();
break;
case T_plotothertext:
aPcbPlotParams->m_plotOtherText = ParseBool();
aPcbPlotParams->m_plotOtherText = parseBool();
break;
case T_plotinvisibletext:
aPcbPlotParams->m_plotInvisibleText = ParseBool();
aPcbPlotParams->m_plotInvisibleText = parseBool();
break;
case T_padsonsilk:
aPcbPlotParams->m_plotPadsOnSilkLayer= ParseBool();
aPcbPlotParams->m_plotPadsOnSilkLayer= parseBool();
break;
case T_subtractmaskfromsilk:
aPcbPlotParams->m_subtractMaskFromSilk = ParseBool();
aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
break;
case T_outputformat:
aPcbPlotParams->m_format = static_cast<PlotFormat>(
ParseInt( PLOT_FIRST_FORMAT, PLOT_LAST_FORMAT ) );
parseInt( PLOT_FIRST_FORMAT, PLOT_LAST_FORMAT ) );
break;
case T_mirror:
aPcbPlotParams->m_mirror = ParseBool();
aPcbPlotParams->m_mirror = parseBool();
break;
case T_drillshape:
aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
( ParseInt( 0, 2 ) );
( parseInt( 0, 2 ) );
break;
case T_scaleselection:
aPcbPlotParams->m_scaleSelection = ParseInt( 0, 4 );
aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
break;
case T_outputdirectory:
NeedSYMBOL();
......@@ -423,7 +430,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
}
bool PCB_PLOT_PARAMS_PARSER::ParseBool()
bool PCB_PLOT_PARAMS_PARSER::parseBool()
{
T token = NeedSYMBOL();
......@@ -434,7 +441,7 @@ bool PCB_PLOT_PARAMS_PARSER::ParseBool()
}
int PCB_PLOT_PARAMS_PARSER::ParseInt( int aMin, int aMax )
int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
{
T token = NextTok();
......@@ -450,3 +457,16 @@ int PCB_PLOT_PARAMS_PARSER::ParseInt( int aMin, int aMax )
return val;
}
double PCB_PLOT_PARAMS_PARSER::parseDouble()
{
T token = NextTok();
if( token != T_NUMBER )
Expecting( T_NUMBER );
double val = strtod( CurText(), NULL );
return val;
}
......@@ -46,16 +46,25 @@ public:
LINE_READER* GetReader() { return reader; };
void Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( PARSE_ERROR, IO_ERROR );
bool ParseBool();
private:
bool parseBool();
/**
* Function ParseInt
* Function parseInt
* parses an integer and constrains it between two values.
* @param aMin is the smallest return value.
* @param aMax is the largest return value.
* @return int - the parsed integer.
*/
int ParseInt( int aMin, int aMax );
int parseInt( int aMin, int aMax );
/**
* Function parseDouble
* parses a double
* @return double - the parsed double.
*/
double parseDouble();
};
......
......@@ -509,7 +509,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
{
const CPOLYGONS_LIST& polysList = aZone->GetFilledPolysList();
unsigned imax = polysList.size();
unsigned imax = polysList.GetCornersCount();
if( imax == 0 ) // Nothing to draw
return;
......
......@@ -1502,7 +1502,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
int count = item->Outline()->m_CornersList.size();
int count = item->Outline()->m_CornersList.GetCornersCount();
int ndx = 0; // used in 2 for() loops below
for( ; ndx<count; ++ndx )
{
......@@ -1579,7 +1579,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
int count = item->Outline()->m_CornersList.size();
int count = item->Outline()->m_CornersList.GetCornersCount();
int ndx = 0; // used in 2 for() loops below
for( ; ndx<count; ++ndx )
{
......
......@@ -157,7 +157,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments()
// Read all filled areas in m_FilledPolysList
m_FillSegmList.clear();
istart = 0;
int end_list = m_FilledPolysList.size()-1;
int end_list = m_FilledPolysList.GetCornersCount()-1;
for( int ic = 0; ic <= end_list; ic++ )
{
......
......@@ -358,7 +358,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
{
OnModify();
if( aZone->Outline()->GetNumCorners() <= 3 )
if( aZone->Outline()->GetCornersCount() <= 3 )
{
m_canvas->RefreshDrawingRect( aZone->GetBoundingBox() );
......
......@@ -414,7 +414,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// cornerBufferPolysToSubstract contains polygons to substract.
// polyset_zone_solid_areas contains the main filled area
// Calculate now actual solid areas
if( cornerBufferPolysToSubstract.size() > 0 )
if( cornerBufferPolysToSubstract.GetCornersCount() > 0 )
{
KI_POLYGON_SET polyset_holes;
cornerBufferPolysToSubstract.ExportTo( polyset_holes );
......@@ -440,7 +440,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
s_Correction, s_thermalRot );
// remove copper areas corresponding to not connected stubs
if( cornerBufferPolysToSubstract.size() )
if( cornerBufferPolysToSubstract.GetCornersCount() )
{
KI_POLYGON_SET polyset_holes;
cornerBufferPolysToSubstract.ExportTo( polyset_holes );
......
......@@ -68,7 +68,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
KI_POLYGON_SET polyset_zone_solid_areas;
std::vector<KI_POLY_POINT> cornerslist;
unsigned ic = 0;
unsigned corners_count = zoneOutines.size();
unsigned corners_count = zoneOutines.GetCornersCount();
while( ic < corners_count )
{
cornerslist.clear();
......@@ -104,10 +104,10 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
corner.x = point.x();
corner.y = point.y();
corner.end_contour = false;
aCornerBuffer.push_back( corner );
aCornerBuffer.Append( corner );
}
aCornerBuffer.back().end_contour = true;
aCornerBuffer.CloseLastContour();
}
}
......@@ -284,8 +284,8 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
CPolyPt corner;
corner.x = cpos.x;
corner.y = cpos.y;
corner.end_contour = ( ic < (corners_buffer.size() - 1) ) ? 0 : 1;
aCornerBuffer.push_back( corner );
corner.end_contour = ( ic < (corners_buffer.size() - 1) ) ? false : true;
aCornerBuffer.Append( corner );
}
}
}
......
......@@ -40,7 +40,7 @@
void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb )
{
if( m_FilledPolysList.size() == 0 )
if( m_FilledPolysList.GetCornersCount() == 0 )
return;
// Build a list of points connected to the net:
......@@ -79,7 +79,7 @@ void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb )
unsigned indexstart = 0, indexend;
bool connected = false;
for( indexend = 0; indexend < m_FilledPolysList.size(); indexend++ )
for( indexend = 0; indexend < m_FilledPolysList.GetCornersCount(); indexend++ )
{
if( m_FilledPolysList[indexend].end_contour ) // end of a filled sub-area found
{
......
......@@ -51,7 +51,8 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
bool sort_areas( const ZONE_CONTAINER* ref, const ZONE_CONTAINER* tst )
{
if( ref->GetNet() == tst->GetNet() )
return ref->GetFilledPolysList().size() < tst->GetFilledPolysList().size();
return ref->GetFilledPolysList().GetCornersCount() <
tst->GetFilledPolysList().GetCornersCount();
else
return ref->GetNet() < tst->GetNet();
}
......@@ -94,7 +95,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
continue;
if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNet() ) )
continue;
if( curr_zone->GetFilledPolysList().size() == 0 )
if( curr_zone->GetFilledPolysList().GetCornersCount() == 0 )
continue;
zones_candidates.push_back(curr_zone);
}
......@@ -144,7 +145,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
// test if a candidate is inside a filled area of this zone
unsigned indexstart = 0, indexend;
const CPOLYGONS_LIST& polysList = curr_zone->GetFilledPolysList();
for( indexend = 0; indexend < polysList.size(); indexend++ )
for( indexend = 0; indexend < polysList.GetCornersCount(); indexend++ )
{
// end of a filled sub-area found
if( polysList.IsEndContour( indexend ) )
......
......@@ -257,7 +257,7 @@ bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area
// If a contour is inside an other contour, no segments intersects, but the zones
// can be combined if a corner is inside an outline (only one corner is enought)
for( int ic2 = 0; ic2 < poly2->GetNumCorners(); ic2++ )
for( int ic2 = 0; ic2 < poly2->GetCornersCount(); ic2++ )
{
int x = poly2->GetX( ic2 );
int y = poly2->GetY( ic2 );
......@@ -268,7 +268,7 @@ bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area
}
}
for( int ic1 = 0; ic1 < poly1->GetNumCorners(); ic1++ )
for( int ic1 = 0; ic1 < poly1->GetCornersCount(); ic1++ )
{
int x = poly1->GetX( ic1 );
int y = poly1->GetY( ic1 );
......@@ -414,7 +414,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
zone2zoneClearance = 1;
// test for some corners of Area_Ref inside area_to_test
for( int ic = 0; ic < refSmoothedPoly->GetNumCorners(); ic++ )
for( int ic = 0; ic < refSmoothedPoly->GetCornersCount(); ic++ )
{
int x = refSmoothedPoly->GetX( ic );
int y = refSmoothedPoly->GetY( ic );
......@@ -438,7 +438,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
}
// test for some corners of area_to_test inside Area_Ref
for( int ic2 = 0; ic2 < testSmoothedPoly->GetNumCorners(); ic2++ )
for( int ic2 = 0; ic2 < testSmoothedPoly->GetCornersCount(); ic2++ )
{
int x = testSmoothedPoly->GetX( ic2 );
int y = testSmoothedPoly->GetY( ic2 );
......
......@@ -42,7 +42,7 @@ CPolyLine::~CPolyLine()
int removed = 0;
unsigned startcountour = 0;
for( unsigned icnt = 1; icnt < m_CornersList.size(); icnt ++ )
for( unsigned icnt = 1; icnt < m_CornersList.GetCornersCount(); icnt ++ )
{
unsigned last = icnt-1;
if( m_CornersList[icnt].end_contour )
......@@ -84,7 +84,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
ClipperLib::Polygon raw_polygon;
ClipperLib::Polygons normalized_polygons;
unsigned corners_count = m_CornersList.size();
unsigned corners_count = m_CornersList.GetCornersCount();
KI_POLYGON_SET polysholes;
KI_POLYGON_WITH_HOLES mainpoly;
......@@ -216,7 +216,7 @@ void CPolyLine::Start( LAYER_NUM layer, int x, int y, int hatch )
CPolyPt poly_pt( x, y );
poly_pt.end_contour = false;
m_CornersList.push_back( poly_pt );
m_CornersList.Append( poly_pt );
}
......@@ -229,7 +229,7 @@ void CPolyLine::AppendCorner( int x, int y )
poly_pt.end_contour = false;
// add entries for new corner
m_CornersList.push_back( poly_pt );
m_CornersList.Append( poly_pt );
}
// move corner of polyline
......@@ -535,16 +535,16 @@ void CPolyLine::InsertCorner( int ic, int x, int y )
{
UnHatch();
if( (unsigned) (ic) >= m_CornersList.size() )
if( (unsigned) (ic) >= m_CornersList.GetCornersCount() )
{
m_CornersList.push_back( CPolyPt( x, y ) );
m_CornersList.Append( CPolyPt( x, y ) );
}
else
{
m_CornersList.InsertCorner(ic, CPolyPt( x, y ) );
}
if( (unsigned) (ic + 1) < m_CornersList.size() )
if( (unsigned) (ic + 1) < m_CornersList.GetCornersCount() )
{
if( m_CornersList[ic].end_contour )
{
......@@ -585,7 +585,7 @@ CRect CPolyLine::GetCornerBounds()
r.left = r.bottom = INT_MAX;
r.right = r.top = INT_MIN;
for( unsigned i = 0; i<m_CornersList.size(); i++ )
for( unsigned i = 0; i< m_CornersList.GetCornersCount(); i++ )
{
r.left = std::min( r.left, m_CornersList[i].x );
r.right = std::max( r.right, m_CornersList[i].x );
......@@ -618,26 +618,18 @@ CRect CPolyLine::GetCornerBounds( int icont )
}
int CPolyLine::GetNumCorners() const
{
return m_CornersList.size();
}
int CPolyLine::GetContoursCount()
{
int ncont = 0;
if( !m_CornersList.size() )
if( !m_CornersList.GetCornersCount() )
return 0;
for( unsigned ic = 0; ic < m_CornersList.size(); ic++ )
for( unsigned ic = 0; ic < m_CornersList.GetCornersCount(); ic++ )
if( m_CornersList[ic].end_contour )
ncont++;
if( !m_CornersList[m_CornersList.size() - 1].end_contour )
if( !m_CornersList[m_CornersList.GetCornersCount() - 1].end_contour )
ncont++;
return ncont;
......@@ -665,7 +657,7 @@ int CPolyLine::GetContourStart( int icont )
int ncont = 0;
for( unsigned i = 0; i<m_CornersList.size(); i++ )
for( unsigned i = 0; i<m_CornersList.GetCornersCount(); i++ )
{
if( m_CornersList[i].end_contour )
{
......@@ -687,11 +679,11 @@ int CPolyLine::GetContourEnd( int icont )
return 0;
if( icont == GetContoursCount() - 1 )
return m_CornersList.size() - 1;
return m_CornersList.GetCornersCount() - 1;
int ncont = 0;
for( unsigned i = 0; i<m_CornersList.size(); i++ )
for( unsigned i = 0; i<m_CornersList.GetCornersCount(); i++ )
{
if( m_CornersList[i].end_contour )
{
......@@ -715,10 +707,10 @@ int CPolyLine::GetContourSize( int icont )
int CPolyLine::GetClosed()
{
if( m_CornersList.size() == 0 )
if( m_CornersList.GetCornersCount() == 0 )
return 0;
else
return m_CornersList[m_CornersList.size() - 1].end_contour;
return m_CornersList[m_CornersList.GetCornersCount() - 1].end_contour;
}
......@@ -747,7 +739,7 @@ void CPolyLine::Hatch()
int min_y = m_CornersList[0].y;
int max_y = m_CornersList[0].y;
for( unsigned ic = 1; ic < m_CornersList.size(); ic++ )
for( unsigned ic = 1; ic < m_CornersList.GetCornersCount(); ic++ )
{
if( m_CornersList[ic].x < min_x )
min_x = m_CornersList[ic].x;
......@@ -798,7 +790,7 @@ void CPolyLine::Hatch()
min_a += offset;
// now calculate and draw hatch lines
int nc = m_CornersList.size();
int nc = m_CornersList.GetCornersCount();
// loop through hatch lines
#define MAXPTS 200 // Usually we store only few values per one hatch line
......@@ -824,7 +816,8 @@ void CPolyLine::Hatch()
double x, y, x2, y2;
int ok;
if( m_CornersList[ic].end_contour || ( ic == (int) (m_CornersList.size() - 1) ) )
if( m_CornersList[ic].end_contour ||
( ic == (int) (m_CornersList.GetCornersCount() - 1) ) )
{
ok = FindLineSegmentIntersection( a, slope,
m_CornersList[ic].x, m_CornersList[ic].y,
......@@ -977,7 +970,7 @@ void CPolyLine::MoveOrigin( int x_off, int y_off )
{
UnHatch();
for( int ic = 0; ic < GetNumCorners(); ic++ )
for( int ic = 0; ic < GetCornersCount(); ic++ )
{
SetX( ic, GetX( ic ) + x_off );
SetY( ic, GetY( ic ) + y_off );
......@@ -1284,7 +1277,7 @@ void CPOLYGONS_LIST::ImportFrom( KI_POLYGON_SET& aPolygons )
void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWithHoles,
CPOLYGONS_LIST& aOnePolyList )
{
unsigned corners_count = aPolysListWithHoles.size();
unsigned corners_count = aPolysListWithHoles.GetCornersCount();
int polycount = 0;
for( unsigned ii = 0; ii < corners_count; ii++ )
......@@ -1305,7 +1298,7 @@ void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWith
KI_POLYGON_SET mainpoly;
KI_POLYGON poly_tmp;
std::vector<KI_POLY_POINT> cornerslist;
corners_count = aPolysListWithHoles.size();
corners_count = aPolysListWithHoles.GetCornersCount();
unsigned ic = 0;
// enter main outline
......
......@@ -118,8 +118,6 @@ public:
// vector <> methods
void reserve( int aSize ) { m_cornersList.reserve( aSize ); }
void clear() { m_cornersList.clear(); }
unsigned size() const { return m_cornersList.size(); }
void push_back( const CPolyPt& aItem ) { m_cornersList.push_back( aItem ); }
CPolyPt& back() { return m_cornersList.back(); }
unsigned GetCornersCount() const { return m_cornersList.size(); }
......@@ -311,7 +309,11 @@ public:
// access functions
void SetLayer( LAYER_NUM aLayer ) { m_layer = aLayer; }
LAYER_NUM GetLayer() const { return m_layer; }
int GetNumCorners() const;
int GetCornersCount() const
{
return m_CornersList.GetCornersCount();
}
int GetClosed();
int GetContoursCount();
int GetContour( int ic );
......
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