clipper.hpp | clipper.hpp | |||
---|---|---|---|---|
/************************************************************************** ***** | /************************************************************************** ***** | |||
* * | * * | |||
* Author : Angus Johnson * | * Author : Angus Johnson * | |||
* Version : 5.1.4 | * Version : 5.1.5 | |||
* | * | |||
* Date : 24 March 2013 | * Date : 4 May 2013 | |||
* | * | |||
* Website : http://www.angusj.com * | * Website : http://www.angusj.com * | |||
* Copyright : Angus Johnson 2010-2013 * | * Copyright : Angus Johnson 2010-2013 * | |||
* * | * * | |||
* License: * | * License: * | |||
* Use, modification & distribution is subject to Boost Software License Ver 1. * | * Use, modification & distribution is subject to Boost Software License Ver 1. * | |||
* http://www.boost.org/LICENSE_1_0.txt * | * http://www.boost.org/LICENSE_1_0.txt * | |||
* * | * * | |||
* Attributions: * | * Attributions: * | |||
* The code in this library is an extension of Bala Vatti's clipping algorit hm: * | * The code in this library is an extension of Bala Vatti's clipping algorit hm: * | |||
* "A generic solution to polygon clipping" * | * "A generic solution to polygon clipping" * | |||
skipping to change at line 249 | skipping to change at line 249 | |||
Polygons &solution, | Polygons &solution, | |||
PolyFillType subjFillType = pftEvenOdd, | PolyFillType subjFillType = pftEvenOdd, | |||
PolyFillType clipFillType = pftEvenOdd); | PolyFillType clipFillType = pftEvenOdd); | |||
bool Execute(ClipType clipType, | bool Execute(ClipType clipType, | |||
PolyTree &polytree, | PolyTree &polytree, | |||
PolyFillType subjFillType = pftEvenOdd, | PolyFillType subjFillType = pftEvenOdd, | |||
PolyFillType clipFillType = pftEvenOdd); | PolyFillType clipFillType = pftEvenOdd); | |||
void Clear(); | void Clear(); | |||
bool ReverseSolution() {return m_ReverseOutput;}; | bool ReverseSolution() {return m_ReverseOutput;}; | |||
void ReverseSolution(bool value) {m_ReverseOutput = value;}; | void ReverseSolution(bool value) {m_ReverseOutput = value;}; | |||
bool ForceSimple() {return m_ForceSimple;}; | ||||
void ForceSimple(bool value) {m_ForceSimple = value;}; | ||||
protected: | protected: | |||
void Reset(); | void Reset(); | |||
virtual bool ExecuteInternal(); | virtual bool ExecuteInternal(); | |||
private: | private: | |||
PolyOutList m_PolyOuts; | PolyOutList m_PolyOuts; | |||
JoinList m_Joins; | JoinList m_Joins; | |||
HorzJoinList m_HorizJoins; | HorzJoinList m_HorizJoins; | |||
ClipType m_ClipType; | ClipType m_ClipType; | |||
Scanbeam *m_Scanbeam; | Scanbeam *m_Scanbeam; | |||
TEdge *m_ActiveEdges; | TEdge *m_ActiveEdges; | |||
TEdge *m_SortedEdges; | TEdge *m_SortedEdges; | |||
IntersectNode *m_IntersectNodes; | IntersectNode *m_IntersectNodes; | |||
bool m_ExecuteLocked; | bool m_ExecuteLocked; | |||
PolyFillType m_ClipFillType; | PolyFillType m_ClipFillType; | |||
PolyFillType m_SubjFillType; | PolyFillType m_SubjFillType; | |||
bool m_ReverseOutput; | bool m_ReverseOutput; | |||
bool m_UsingPolyTree; | bool m_UsingPolyTree; | |||
bool m_ForceSimple; | ||||
void DisposeScanbeamList(); | void DisposeScanbeamList(); | |||
void SetWindingCount(TEdge& edge); | void SetWindingCount(TEdge& edge); | |||
bool IsEvenOddFillType(const TEdge& edge) const; | bool IsEvenOddFillType(const TEdge& edge) const; | |||
bool IsEvenOddAltFillType(const TEdge& edge) const; | bool IsEvenOddAltFillType(const TEdge& edge) const; | |||
void InsertScanbeam(const long64 Y); | void InsertScanbeam(const long64 Y); | |||
long64 PopScanbeam(); | long64 PopScanbeam(); | |||
void InsertLocalMinimaIntoAEL(const long64 botY); | void InsertLocalMinimaIntoAEL(const long64 botY); | |||
void InsertEdgeIntoAEL(TEdge *edge); | void InsertEdgeIntoAEL(TEdge *edge); | |||
void AddEdgeToSEL(TEdge *edge); | void AddEdgeToSEL(TEdge *edge); | |||
void CopyAELToSEL(); | void CopyAELToSEL(); | |||
skipping to change at line 288 | skipping to change at line 291 | |||
void UpdateEdgeIntoAEL(TEdge *&e); | void UpdateEdgeIntoAEL(TEdge *&e); | |||
void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); | void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); | |||
bool IsContributing(const TEdge& edge) const; | bool IsContributing(const TEdge& edge) const; | |||
bool IsTopHorz(const long64 XPos); | bool IsTopHorz(const long64 XPos); | |||
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); | void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); | |||
void DoMaxima(TEdge *e, long64 topY); | void DoMaxima(TEdge *e, long64 topY); | |||
void ProcessHorizontals(); | void ProcessHorizontals(); | |||
void ProcessHorizontal(TEdge *horzEdge); | void ProcessHorizontal(TEdge *horzEdge); | |||
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
OutRec* GetOutRec(int idx); | ||||
void AppendPolygon(TEdge *e1, TEdge *e2); | void AppendPolygon(TEdge *e1, TEdge *e2); | |||
void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | ||||
void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | ||||
void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | ||||
void IntersectEdges(TEdge *e1, TEdge *e2, | void IntersectEdges(TEdge *e1, TEdge *e2, | |||
const IntPoint &pt, const IntersectProtects protects); | const IntPoint &pt, const IntersectProtects protects); | |||
OutRec* CreateOutRec(); | OutRec* CreateOutRec(); | |||
void AddOutPt(TEdge *e, const IntPoint &pt); | void AddOutPt(TEdge *e, const IntPoint &pt); | |||
void DisposeAllPolyPts(); | void DisposeAllPolyPts(); | |||
void DisposeOutRec(PolyOutList::size_type index); | void DisposeOutRec(PolyOutList::size_type index); | |||
bool ProcessIntersections(const long64 botY, const long64 topY); | bool ProcessIntersections(const long64 botY, const long64 topY); | |||
void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
void BuildIntersectList(const long64 botY, const long64 topY); | void BuildIntersectList(const long64 botY, const long64 topY); | |||
void ProcessIntersectList(); | void ProcessIntersectList(); | |||
void ProcessEdgesAtTopOfScanbeam(const long64 topY); | void ProcessEdgesAtTopOfScanbeam(const long64 topY); | |||
void BuildResult(Polygons& polys); | void BuildResult(Polygons& polys); | |||
void BuildResult2(PolyTree& polytree); | void BuildResult2(PolyTree& polytree); | |||
void SetHoleState(TEdge *e, OutRec *OutRec); | void SetHoleState(TEdge *e, OutRec *outrec); | |||
void DisposeIntersectNodes(); | void DisposeIntersectNodes(); | |||
bool FixupIntersectionOrder(); | bool FixupIntersectionOrder(); | |||
void FixupOutPolygon(OutRec &outRec); | void FixupOutPolygon(OutRec &outrec); | |||
bool IsHole(TEdge *e); | bool IsHole(TEdge *e); | |||
void FixHoleLinkage(OutRec &outRec); | void FixHoleLinkage(OutRec &outrec); | |||
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); | void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); | |||
void ClearJoins(); | void ClearJoins(); | |||
void AddHorzJoin(TEdge *e, int idx); | void AddHorzJoin(TEdge *e, int idx); | |||
void ClearHorzJoins(); | void ClearHorzJoins(); | |||
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); | bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); | |||
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); | void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); | |||
void JoinCommonEdges(); | void JoinCommonEdges(); | |||
void DoSimplePolygons(); | ||||
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); | void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); | |||
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); | void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); | |||
}; | }; | |||
//------------------------------------------------------------------------- ----- | //------------------------------------------------------------------------- ----- | |||
//------------------------------------------------------------------------- ----- | //------------------------------------------------------------------------- ----- | |||
class clipperException : public std::exception | class clipperException : public std::exception | |||
{ | { | |||
public: | public: | |||
End of changes. 9 change blocks. | ||||
10 lines changed or deleted | 12 lines changed or added | |||