De-scope ClipperLib namespace

This commit is contained in:
Seth Hillbrand 2020-11-18 15:39:14 -08:00 committed by Jon Evans
parent 6c224156f5
commit 8521deb38d
1 changed files with 15 additions and 15 deletions

View File

@ -54,7 +54,6 @@
#include <geometry/shape_segment.h>
#include <geometry/shape_circle.h>
using namespace ClipperLib;
SHAPE_POLY_SET::SHAPE_POLY_SET() :
SHAPE( SH_POLY_SET )
@ -500,25 +499,25 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET
void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET& aShape,
const SHAPE_POLY_SET& aOtherShape, POLYGON_MODE aFastMode )
{
Clipper c;
ClipperLib::Clipper c;
c.StrictlySimple( aFastMode == PM_STRICTLY_SIMPLE );
for( const POLYGON& poly : aShape.m_polys )
{
for( size_t i = 0 ; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptSubject, true );
c.AddPath( poly[i].convertToClipper( i == 0 ), ClipperLib::ptSubject, true );
}
for( const POLYGON& poly : aOtherShape.m_polys )
{
for( size_t i = 0; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptClip, true );
c.AddPath( poly[i].convertToClipper( i == 0 ), ClipperLib::ptClip, true );
}
PolyTree solution;
ClipperLib::PolyTree solution;
c.Execute( aType, solution, pftNonZero, pftNonZero );
c.Execute( aType, solution, ClipperLib::pftNonZero, ClipperLib::pftNonZero );
importTree( &solution );
}
@ -526,40 +525,40 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctUnion, b, aFastMode );
booleanOp( ClipperLib::ctUnion, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctDifference, b, aFastMode );
booleanOp( ClipperLib::ctDifference, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& b, POLYGON_MODE aFastMode )
{
booleanOp( ctIntersection, b, aFastMode );
booleanOp( ClipperLib::ctIntersection, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanAdd( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode )
{
booleanOp( ctUnion, a, b, aFastMode );
booleanOp( ClipperLib::ctUnion, a, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanSubtract( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode )
{
booleanOp( ctDifference, a, b, aFastMode );
booleanOp( ClipperLib::ctDifference, a, b, aFastMode );
}
void SHAPE_POLY_SET::BooleanIntersection( const SHAPE_POLY_SET& a, const SHAPE_POLY_SET& b,
POLYGON_MODE aFastMode )
{
booleanOp( ctIntersection, a, b, aFastMode );
booleanOp( ClipperLib::ctIntersection, a, b, aFastMode );
}
@ -574,6 +573,7 @@ void SHAPE_POLY_SET::InflateWithLinkedHoles( int aFactor, int aCircleSegmentsCou
void SHAPE_POLY_SET::Inflate( int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy )
{
using namespace ClipperLib;
// A static table to avoid repetitive calculations of the coefficient
// 1.0 - cos( M_PI / aCircleSegCount )
// aCircleSegCount is most of time <= 64 and usually 8, 12, 16, 32
@ -656,11 +656,11 @@ void SHAPE_POLY_SET::Inflate( int aAmount, int aCircleSegCount, CORNER_STRATEGY
}
void SHAPE_POLY_SET::importTree( PolyTree* tree )
void SHAPE_POLY_SET::importTree( ClipperLib::PolyTree* tree )
{
m_polys.clear();
for( PolyNode* n = tree->GetFirst(); n; n = n->GetNext() )
for( ClipperLib::PolyNode* n = tree->GetFirst(); n; n = n->GetNext() )
{
if( !n->IsHole() )
{
@ -1087,7 +1087,7 @@ void SHAPE_POLY_SET::Simplify( POLYGON_MODE aFastMode )
{
SHAPE_POLY_SET empty;
booleanOp( ctUnion, empty, aFastMode );
booleanOp( ClipperLib::ctUnion, empty, aFastMode );
}