SHAPE_POLY_SET: add FullPointCount(), mainly for statistics and debug.
This commit is contained in:
parent
c9d858eaf5
commit
29c3601061
|
@ -649,6 +649,10 @@ public:
|
|||
///< Return the number of vertices in a given outline/hole
|
||||
int VertexCount( int aOutline = -1, int aHole = -1 ) const;
|
||||
|
||||
///< Return the number of points in the shape poly set.
|
||||
///< mainly for reports
|
||||
int FullPointCount() const;
|
||||
|
||||
///< Returns the number of holes in a given outline
|
||||
int HoleCount( int aOutline ) const
|
||||
{
|
||||
|
|
|
@ -319,6 +319,27 @@ int SHAPE_POLY_SET::VertexCount( int aOutline, int aHole ) const
|
|||
}
|
||||
|
||||
|
||||
int SHAPE_POLY_SET::FullPointCount() const
|
||||
{
|
||||
int full_count = 0;
|
||||
|
||||
if( m_polys.size() == 0 ) // Empty poly set
|
||||
return full_count;
|
||||
|
||||
for( int ii = 0; ii < OutlineCount(); ii++ )
|
||||
{
|
||||
// the first polygon in m_polys[ii] is the main contour,
|
||||
// only others are holes:
|
||||
for( int idx = 0; idx <= HoleCount( ii ); idx++ )
|
||||
{
|
||||
full_count += m_polys[ii][idx].PointCount();
|
||||
}
|
||||
}
|
||||
|
||||
return full_count;
|
||||
}
|
||||
|
||||
|
||||
SHAPE_POLY_SET SHAPE_POLY_SET::Subset( int aFirstPolygon, int aLastPolygon )
|
||||
{
|
||||
assert( aFirstPolygon >= 0 && aLastPolygon <= OutlineCount() );
|
||||
|
|
Loading…
Reference in New Issue