parent
edf23c4c18
commit
7040b2178d
|
@ -1397,7 +1397,7 @@ private:
|
|||
void importPaths( Clipper2Lib::Paths64& paths,
|
||||
const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,
|
||||
const std::vector<SHAPE_ARC>& aArcBuffe );
|
||||
void importPolyPath( const std::unique_ptr<Clipper2Lib::PolyPath64>& aPolyPath,
|
||||
void importPolyPath( Clipper2Lib::PolyPath64* aPolyPath,
|
||||
const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,
|
||||
const std::vector<SHAPE_ARC>& aArcBuffer );
|
||||
|
||||
|
|
|
@ -1070,9 +1070,17 @@ void SHAPE_POLY_SET::inflate2( int aAmount, int aCircleSegCount, CORNER_STRATEGY
|
|||
|
||||
c.ArcTolerance( std::abs( aAmount ) * coeff );
|
||||
c.MiterLimit( miterLimit );
|
||||
c.MergeGroups( true );
|
||||
Paths64 solution = c.Execute( aAmount );
|
||||
|
||||
// We get paths back but we need the tree to assign the holes to the correct
|
||||
// outlines
|
||||
Clipper64 c2;
|
||||
PolyTree64 tree;
|
||||
c.Execute( aAmount, tree );
|
||||
c2.PreserveCollinear = false;
|
||||
c2.ReverseSolution = false;
|
||||
c2.AddSubject( solution );
|
||||
c2.Execute(ClipType::Union, FillRule::Positive, tree);
|
||||
|
||||
importTree( tree, zValues, arcBuffer );
|
||||
tree.Clear();
|
||||
|
@ -1112,7 +1120,7 @@ void SHAPE_POLY_SET::importTree( ClipperLib::PolyTree* tree,
|
|||
}
|
||||
|
||||
|
||||
void SHAPE_POLY_SET::importPolyPath( const std::unique_ptr<Clipper2Lib::PolyPath64>& aPolyPath,
|
||||
void SHAPE_POLY_SET::importPolyPath( Clipper2Lib::PolyPath64* aPolyPath,
|
||||
const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,
|
||||
const std::vector<SHAPE_ARC>& aArcBuffer )
|
||||
{
|
||||
|
@ -1122,11 +1130,11 @@ void SHAPE_POLY_SET::importPolyPath( const std::unique_ptr<Clipper2Lib::PolyPath
|
|||
paths.reserve( aPolyPath->Count() + 1 );
|
||||
paths.emplace_back( aPolyPath->Polygon(), aZValueBuffer, aArcBuffer );
|
||||
|
||||
for( const std::unique_ptr<Clipper2Lib::PolyPath64>& child : *aPolyPath )
|
||||
for( Clipper2Lib::PolyPath64* child : *aPolyPath )
|
||||
{
|
||||
paths.emplace_back( child->Polygon(), aZValueBuffer, aArcBuffer );
|
||||
|
||||
for( const std::unique_ptr<Clipper2Lib::PolyPath64>& grandchild : *child )
|
||||
for( Clipper2Lib::PolyPath64* grandchild : *child )
|
||||
importPolyPath( grandchild, aZValueBuffer, aArcBuffer );
|
||||
}
|
||||
|
||||
|
@ -1141,7 +1149,7 @@ void SHAPE_POLY_SET::importTree( Clipper2Lib::PolyTree64& tree,
|
|||
{
|
||||
m_polys.clear();
|
||||
|
||||
for( const std::unique_ptr<Clipper2Lib::PolyPath64>& n : tree )
|
||||
for( Clipper2Lib::PolyPath64* n : tree )
|
||||
importPolyPath( n, aZValueBuffer, aArcBuffer );
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Clipper2Lib
|
|||
public:
|
||||
explicit Clipper2Exception(const char* description) :
|
||||
m_descr(description) {}
|
||||
virtual const char* what() const throw() override { return m_descr.c_str(); }
|
||||
virtual const char* what() const throw() { return m_descr.c_str(); }
|
||||
private:
|
||||
std::string m_descr;
|
||||
};
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace Clipper2Lib {
|
|||
return result;
|
||||
}
|
||||
|
||||
inline Paths64 ClipRect(const Rect64& rect,
|
||||
inline Paths64 RectClip(const Rect64& rect,
|
||||
const Paths64& paths, bool convex_only = false)
|
||||
{
|
||||
if (rect.IsEmpty() || paths.empty()) return Paths64();
|
||||
|
@ -205,7 +205,7 @@ namespace Clipper2Lib {
|
|||
return rc.Execute(paths, convex_only);
|
||||
}
|
||||
|
||||
inline Paths64 ClipRect(const Rect64& rect,
|
||||
inline Paths64 RectClip(const Rect64& rect,
|
||||
const Path64& path, bool convex_only = false)
|
||||
{
|
||||
if (rect.IsEmpty() || path.empty()) return Paths64();
|
||||
|
@ -213,7 +213,7 @@ namespace Clipper2Lib {
|
|||
return rc.Execute(Paths64{ path }, convex_only);
|
||||
}
|
||||
|
||||
inline PathsD ClipRect(const RectD& rect,
|
||||
inline PathsD RectClip(const RectD& rect,
|
||||
const PathsD& paths, bool convex_only = false, int precision = 2)
|
||||
{
|
||||
if (rect.IsEmpty() || paths.empty()) return PathsD();
|
||||
|
@ -229,30 +229,30 @@ namespace Clipper2Lib {
|
|||
rc.Execute(pp, convex_only), 1 / scale, error_code);
|
||||
}
|
||||
|
||||
inline PathsD ClipRect(const RectD& rect,
|
||||
inline PathsD RectClip(const RectD& rect,
|
||||
const PathD& path, bool convex_only = false, int precision = 2)
|
||||
{
|
||||
return ClipRect(rect, PathsD{ path }, convex_only, precision);
|
||||
return RectClip(rect, PathsD{ path }, convex_only, precision);
|
||||
}
|
||||
|
||||
inline Paths64 ClipRectLines(const Rect64& rect, const Paths64& lines)
|
||||
inline Paths64 RectClipLines(const Rect64& rect, const Paths64& lines)
|
||||
{
|
||||
if (rect.IsEmpty() || lines.empty()) return Paths64();
|
||||
class RectClipLines rcl(rect);
|
||||
return rcl.Execute(lines);
|
||||
}
|
||||
|
||||
inline Paths64 ClipRectLines(const Rect64& rect, const Path64& line)
|
||||
inline Paths64 RectClipLines(const Rect64& rect, const Path64& line)
|
||||
{
|
||||
return ClipRectLines(rect, Paths64{ line });
|
||||
return RectClipLines(rect, Paths64{ line });
|
||||
}
|
||||
|
||||
inline PathsD ClipRectLines(const RectD& rect, const PathD& line, int precision = 2)
|
||||
inline PathsD RectClipLines(const RectD& rect, const PathD& line, int precision = 2)
|
||||
{
|
||||
return ClipRect(rect, PathsD{ line }, precision);
|
||||
return RectClip(rect, PathsD{ line }, precision);
|
||||
}
|
||||
|
||||
inline PathsD ClipRectLines(const RectD& rect, const PathsD& lines, int precision = 2)
|
||||
inline PathsD RectClipLines(const RectD& rect, const PathsD& lines, int precision = 2)
|
||||
{
|
||||
if (rect.IsEmpty() || lines.empty()) return PathsD();
|
||||
int error_code = 0;
|
||||
|
|
|
@ -36,8 +36,8 @@ private:
|
|||
bool is_reversed = false;
|
||||
JoinType join_type;
|
||||
EndType end_type;
|
||||
Group(const Paths64& paths, JoinType _join_type, EndType _end_type) :
|
||||
paths_in(paths), join_type(_join_type), end_type(_end_type) {}
|
||||
Group(const Paths64& paths, JoinType join_type, EndType end_type) :
|
||||
paths_in(paths), join_type(join_type), end_type(end_type) {}
|
||||
};
|
||||
|
||||
int error_code_ = 0;
|
||||
|
|
Loading…
Reference in New Issue