@@ -85,22 +85,22 @@ struct IntPoint {
85
85
cInt Y;
86
86
#ifdef use_xyz
87
87
cInt Z;
88
- IntPoint (cInt x = 0 , cInt y = 0 , cInt z = 0 ) : X(x), Y(y), Z(z){};
89
- IntPoint (IntPoint const &ip) : X(ip.X), Y(ip.Y), Z(ip.Z) {}
88
+ IntPoint (cInt x = 0 , cInt y = 0 , cInt z = 0 ) noexcept : X(x), Y(y), Z(z) {}
89
+ IntPoint (IntPoint const &ip) noexcept : X(ip.X), Y(ip.Y), Z(ip.Z) {}
90
90
#else
91
- IntPoint (cInt x = 0 , cInt y = 0 ) : X(x), Y(y){};
92
- IntPoint (IntPoint const &ip) : X(ip.X), Y(ip.Y) {}
91
+ IntPoint (cInt x = 0 , cInt y = 0 ) noexcept : X(x), Y(y) {}
92
+ IntPoint (IntPoint const &ip) noexcept : X(ip.X), Y(ip.Y) {}
93
93
#endif
94
94
95
95
inline void reset (cInt x = 0 , cInt y = 0 ) noexcept {
96
96
X = x;
97
97
Y = y;
98
98
}
99
99
100
- friend inline bool operator ==(const IntPoint &a, const IntPoint &b) {
100
+ friend inline bool operator ==(const IntPoint &a, const IntPoint &b) noexcept {
101
101
return a.X == b.X && a.Y == b.Y ;
102
102
}
103
- friend inline bool operator !=(const IntPoint &a, const IntPoint &b) {
103
+ friend inline bool operator !=(const IntPoint &a, const IntPoint &b) noexcept {
104
104
return a.X != b.X || a.Y != b.Y ;
105
105
}
106
106
};
@@ -109,18 +109,18 @@ struct IntPoint {
109
109
typedef std::vector<IntPoint> Path;
110
110
typedef std::vector<Path> Paths;
111
111
112
- inline Path &operator <<(Path &poly, IntPoint &&p) {
112
+ inline Path &operator <<(Path &poly, IntPoint &&p) noexcept {
113
113
poly.emplace_back (std::forward<IntPoint>(p));
114
114
return poly;
115
115
}
116
- inline Paths &operator <<(Paths &polys, Path &&p) {
116
+ inline Paths &operator <<(Paths &polys, Path &&p) noexcept {
117
117
polys.emplace_back (std::forward<Path>(p));
118
118
return polys;
119
119
}
120
120
121
- std::ostream &operator <<(std::ostream &s, const IntPoint &p);
122
- std::ostream &operator <<(std::ostream &s, const Path &p);
123
- std::ostream &operator <<(std::ostream &s, const Paths &p);
121
+ std::ostream &operator <<(std::ostream &s, const IntPoint &p) noexcept ;
122
+ std::ostream &operator <<(std::ostream &s, const Path &p) noexcept ;
123
+ std::ostream &operator <<(std::ostream &s, const Paths &p) noexcept ;
124
124
125
125
struct DoublePoint {
126
126
double X;
@@ -158,69 +158,75 @@ typedef std::vector<PolyNode *> PolyNodes;
158
158
159
159
class PolyNode {
160
160
public:
161
- PolyNode ();
162
- virtual ~PolyNode (){};
161
+ PolyNode () noexcept ;
162
+ virtual ~PolyNode () {}
163
163
Path Contour;
164
164
PolyNodes Childs;
165
165
PolyNode *Parent;
166
- PolyNode *GetNext () const ;
167
- bool IsHole () const ;
168
- bool IsOpen () const ;
169
- int ChildCount () const ;
166
+ PolyNode *GetNext () const noexcept ;
167
+ bool IsHole () const noexcept ;
168
+ bool IsOpen () const noexcept ;
169
+ int ChildCount () const noexcept ;
170
170
171
171
private:
172
172
// PolyNode& operator =(PolyNode& other);
173
173
unsigned Index; // node index in Parent.Childs
174
174
bool m_IsOpen;
175
175
JoinType m_jointype;
176
176
EndType m_endtype;
177
- PolyNode *GetNextSiblingUp () const ;
178
- void AddChild (PolyNode &child);
177
+ PolyNode *GetNextSiblingUp () const noexcept ;
178
+ void AddChild (PolyNode &child) noexcept ;
179
179
friend class Clipper ; // to access Index
180
180
friend class ClipperOffset ;
181
181
};
182
182
183
183
class PolyTree : public PolyNode {
184
184
public:
185
- ~PolyTree () { Clear (); };
186
- PolyNode *GetFirst () const ;
187
- void Clear ();
188
- int Total () const ;
185
+ ~PolyTree () { Clear (); }
186
+ PolyNode *GetFirst () const noexcept ;
187
+ void Clear () noexcept ;
188
+ int Total () const noexcept ;
189
189
190
190
private:
191
191
// PolyTree& operator =(PolyTree& other);
192
192
PolyNodes AllNodes;
193
193
friend class Clipper ; // to access AllNodes
194
194
};
195
195
196
- bool Orientation (const Path &poly);
197
- double Area (const Path &poly);
198
- int PointInPolygon (const IntPoint &pt, const Path &path);
196
+ bool Orientation (const Path &poly) noexcept ;
197
+ double Area (const Path &poly) noexcept ;
198
+ int PointInPolygon (const IntPoint &pt, const Path &path) noexcept ;
199
199
200
+ #if 0
200
201
void SimplifyPolygon(const Path &in_poly, Paths &out_polys,
201
202
PolyFillType fillType = pftEvenOdd);
202
203
void SimplifyPolygons(const Paths &in_polys, Paths &out_polys,
203
204
PolyFillType fillType = pftEvenOdd);
204
205
void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
206
+ #endif
205
207
206
- void CleanPolygon (const Path &in_poly, Path &out_poly, double distance = 1.415 );
207
- void CleanPolygon (Path &poly, double distance = 1.415 );
208
+ void CleanPolygon (const Path &in_poly, Path &out_poly,
209
+ double distance = 1.415 ) noexcept ;
210
+ void CleanPolygon (Path &poly, double distance = 1.415 ) noexcept ;
208
211
void CleanPolygons (const Paths &in_polys, Paths &out_polys,
209
- double distance = 1.415 );
210
- void CleanPolygons (Paths &polys, double distance = 1.415 );
212
+ double distance = 1.415 ) noexcept ;
213
+ void CleanPolygons (Paths &polys, double distance = 1.415 ) noexcept ;
211
214
215
+ #if 0
212
216
void MinkowskiSum(const Path &pattern, const Path &path, Paths &solution,
213
217
bool pathIsClosed);
214
218
void MinkowskiSum(const Path &pattern, const Paths &paths, Paths &solution,
215
219
bool pathIsClosed);
220
+
216
221
void MinkowskiDiff(const Path &poly1, const Path &poly2, Paths &solution);
222
+ #endif
217
223
218
- void PolyTreeToPaths (const PolyTree &polytree, Paths &paths);
219
- void ClosedPathsFromPolyTree (const PolyTree &polytree, Paths &paths);
220
- void OpenPathsFromPolyTree (PolyTree &polytree, Paths &paths);
224
+ void PolyTreeToPaths (const PolyTree &polytree, Paths &paths) noexcept ;
225
+ void ClosedPathsFromPolyTree (const PolyTree &polytree, Paths &paths) noexcept ;
226
+ void OpenPathsFromPolyTree (PolyTree &polytree, Paths &paths) noexcept ;
221
227
222
- void ReversePath (Path &p);
223
- void ReversePaths (Paths &p);
228
+ void ReversePath (Path &p) noexcept ;
229
+ void ReversePaths (Paths &p) noexcept ;
224
230
225
231
struct IntRect {
226
232
cInt left;
@@ -252,29 +258,29 @@ typedef std::vector<IntersectNode *> IntersectList;
252
258
// polygon coordinates into edge objects that are stored in a LocalMinima list.
253
259
class ClipperBase {
254
260
public:
255
- ClipperBase ();
261
+ ClipperBase () noexcept ;
256
262
virtual ~ClipperBase ();
257
263
virtual bool AddPath (const Path &pg, PolyType PolyTyp, bool Closed);
258
264
bool AddPaths (const Paths &ppg, PolyType PolyTyp, bool Closed);
259
- virtual void Clear ();
260
- IntRect GetBounds ();
261
- bool PreserveCollinear () { return m_PreserveCollinear; };
262
- void PreserveCollinear (bool value) { m_PreserveCollinear = value; };
265
+ virtual void Clear () noexcept ;
266
+ IntRect GetBounds () noexcept ;
267
+ bool PreserveCollinear () const noexcept { return m_PreserveCollinear; }
268
+ void PreserveCollinear (bool value) noexcept { m_PreserveCollinear = value; }
263
269
264
270
protected:
265
- void DisposeLocalMinimaList ();
266
- TEdge *AddBoundsToLML (TEdge *e, bool IsClosed);
267
- virtual void Reset ();
268
- TEdge *ProcessBound (TEdge *E, bool IsClockwise);
269
- void InsertScanbeam (const cInt Y);
270
- bool PopScanbeam (cInt &Y);
271
- bool LocalMinimaPending ();
272
- bool PopLocalMinima (cInt Y, const LocalMinimum *&locMin);
273
- OutRec *CreateOutRec ();
274
- void DisposeAllOutRecs ();
275
- void DisposeOutRec (PolyOutList::size_type index);
276
- void SwapPositionsInAEL (TEdge *edge1, TEdge *edge2);
277
- void DeleteFromAEL (TEdge *e);
271
+ void DisposeLocalMinimaList () noexcept ;
272
+ TEdge *AddBoundsToLML (TEdge *e, bool IsClosed) noexcept ;
273
+ virtual void Reset () noexcept ;
274
+ TEdge *ProcessBound (TEdge *E, bool IsClockwise) noexcept ;
275
+ void InsertScanbeam (const cInt Y) noexcept ;
276
+ bool PopScanbeam (cInt &Y) noexcept ;
277
+ bool LocalMinimaPending () noexcept ;
278
+ bool PopLocalMinima (cInt Y, const LocalMinimum *&locMin) noexcept ;
279
+ OutRec *CreateOutRec () noexcept ;
280
+ void DisposeAllOutRecs () noexcept ;
281
+ void DisposeOutRec (PolyOutList::size_type index) noexcept ;
282
+ void SwapPositionsInAEL (TEdge *edge1, TEdge *edge2) noexcept ;
283
+ void DeleteFromAEL (TEdge *e) noexcept ;
278
284
void UpdateEdgeIntoAEL (TEdge *&e);
279
285
280
286
typedef std::vector<LocalMinimum> MinimaList;
@@ -295,26 +301,26 @@ class ClipperBase {
295
301
296
302
class Clipper : public virtual ClipperBase {
297
303
public:
298
- Clipper (int initOptions = 0 );
304
+ Clipper (int initOptions = 0 ) noexcept ;
299
305
bool Execute (ClipType clipType, Paths &solution,
300
306
PolyFillType fillType = pftEvenOdd);
301
307
bool Execute (ClipType clipType, Paths &solution, PolyFillType subjFillType,
302
308
PolyFillType clipFillType);
303
309
bool Execute (ClipType clipType, PolyTree &polytree,
304
- PolyFillType fillType = pftEvenOdd);
310
+ PolyFillType fillType = pftEvenOdd) noexcept ;
305
311
bool Execute (ClipType clipType, PolyTree &polytree, PolyFillType subjFillType,
306
- PolyFillType clipFillType);
307
- bool ReverseSolution () { return m_ReverseOutput; };
308
- void ReverseSolution (bool value) { m_ReverseOutput = value; };
309
- bool StrictlySimple () { return m_StrictSimple; };
310
- void StrictlySimple (bool value) { m_StrictSimple = value; };
312
+ PolyFillType clipFillType) noexcept ;
313
+ bool ReverseSolution () const noexcept { return m_ReverseOutput; }
314
+ void ReverseSolution (bool value) noexcept { m_ReverseOutput = value; }
315
+ bool StrictlySimple () const noexcept { return m_StrictSimple; }
316
+ void StrictlySimple (bool value) noexcept { m_StrictSimple = value; }
311
317
// set the callback function for z value filling on intersections (otherwise Z
312
318
// is 0)
313
319
#ifdef use_xyz
314
- void ZFillFunction (ZFillCallback zFillFunc);
320
+ void ZFillFunction (ZFillCallback zFillFunc) noexcept ;
315
321
#endif
316
322
protected:
317
- virtual bool ExecuteInternal ();
323
+ virtual bool ExecuteInternal () noexcept ;
318
324
319
325
private:
320
326
JoinList m_Joins;
@@ -333,71 +339,73 @@ class Clipper : public virtual ClipperBase {
333
339
#ifdef use_xyz
334
340
ZFillCallback m_ZFill; // custom callback
335
341
#endif
336
- void SetWindingCount (TEdge &edge);
337
- bool IsEvenOddFillType (const TEdge &edge) const ;
338
- bool IsEvenOddAltFillType (const TEdge &edge) const ;
339
- void InsertLocalMinimaIntoAEL (const cInt botY);
340
- void InsertEdgeIntoAEL (TEdge *edge, TEdge *startEdge);
341
- void AddEdgeToSEL (TEdge *edge);
342
- bool PopEdgeFromSEL (TEdge *&edge);
343
- void CopyAELToSEL ();
344
- void DeleteFromSEL (TEdge *e);
345
- void SwapPositionsInSEL (TEdge *edge1, TEdge *edge2);
346
- bool IsContributing (const TEdge &edge) const ;
347
- bool IsTopHorz (const cInt XPos);
342
+ void SetWindingCount (TEdge &edge) noexcept ;
343
+ bool IsEvenOddFillType (const TEdge &edge) const noexcept ;
344
+ bool IsEvenOddAltFillType (const TEdge &edge) const noexcept ;
345
+ void InsertLocalMinimaIntoAEL (const cInt botY) noexcept ;
346
+ void InsertEdgeIntoAEL (TEdge *edge, TEdge *startEdge) noexcept ;
347
+ void AddEdgeToSEL (TEdge *edge) noexcept ;
348
+ bool PopEdgeFromSEL (TEdge *&edge) noexcept ;
349
+ void CopyAELToSEL () noexcept ;
350
+ void DeleteFromSEL (TEdge *e) noexcept ;
351
+ void SwapPositionsInSEL (TEdge *edge1, TEdge *edge2) noexcept ;
352
+ bool IsContributing (const TEdge &edge) const noexcept ;
353
+ bool IsTopHorz (const cInt XPos) noexcept ;
348
354
void DoMaxima (TEdge *e);
349
- void ProcessHorizontals ();
350
- void ProcessHorizontal (TEdge *horzEdge);
351
- void AddLocalMaxPoly (TEdge *e1 , TEdge *e2 , const IntPoint &pt);
352
- OutPt *AddLocalMinPoly (TEdge *e1 , TEdge *e2 , const IntPoint &pt);
353
- OutRec *GetOutRec (int idx);
354
- void AppendPolygon (TEdge *e1 , TEdge *e2 );
355
- void IntersectEdges (TEdge *e1 , TEdge *e2 , IntPoint &pt);
356
- OutPt *AddOutPt (TEdge *e, const IntPoint &pt);
357
- OutPt *GetLastOutPt (TEdge *e);
355
+ void ProcessHorizontals () noexcept ;
356
+ void ProcessHorizontal (TEdge *horzEdge) noexcept ;
357
+ void AddLocalMaxPoly (TEdge *e1 , TEdge *e2 , const IntPoint &pt) noexcept ;
358
+ OutPt *AddLocalMinPoly (TEdge *e1 , TEdge *e2 , const IntPoint &pt) noexcept ;
359
+ OutRec *GetOutRec (int idx) noexcept ;
360
+ void AppendPolygon (TEdge *e1 , TEdge *e2 ) noexcept ;
361
+ void IntersectEdges (TEdge *e1 , TEdge *e2 , IntPoint &pt) noexcept ;
362
+ OutPt *AddOutPt (TEdge *e, const IntPoint &pt) noexcept ;
363
+ OutPt *GetLastOutPt (TEdge *e) noexcept ;
358
364
bool ProcessIntersections (const cInt topY);
359
- void BuildIntersectList (const cInt topY);
360
- void ProcessIntersectList ();
365
+ void BuildIntersectList (const cInt topY) noexcept ;
366
+ void ProcessIntersectList () noexcept ;
361
367
void ProcessEdgesAtTopOfScanbeam (const cInt topY);
362
- void BuildResult (Paths &polys);
363
- void BuildResult2 (PolyTree &polytree);
364
- void SetHoleState (TEdge *e, OutRec *outrec);
365
- void DisposeIntersectNodes ();
366
- bool FixupIntersectionOrder ();
367
- void FixupOutPolygon (OutRec &outrec);
368
- void FixupOutPolyline (OutRec &outrec);
369
- bool IsHole (TEdge *e);
370
- bool FindOwnerFromSplitRecs (OutRec &outRec, OutRec *&currOrfl);
371
- void FixHoleLinkage (OutRec &outrec);
372
- void AddJoin (OutPt *op1, OutPt *op2, const IntPoint offPt);
373
- void ClearJoins ();
374
- void ClearGhostJoins ();
375
- void AddGhostJoin (OutPt *op, const IntPoint offPt);
376
- bool JoinPoints (Join *j, OutRec *outRec1, OutRec *outRec2);
377
- void JoinCommonEdges ();
378
- void DoSimplePolygons ();
379
- void FixupFirstLefts1 (OutRec *OldOutRec, OutRec *NewOutRec);
380
- void FixupFirstLefts2 (OutRec *InnerOutRec, OutRec *OuterOutRec);
381
- void FixupFirstLefts3 (OutRec *OldOutRec, OutRec *NewOutRec);
368
+ void BuildResult (Paths &polys) noexcept ;
369
+ void BuildResult2 (PolyTree &polytree) noexcept ;
370
+ void SetHoleState (TEdge *e, OutRec *outrec) noexcept ;
371
+ void DisposeIntersectNodes () noexcept ;
372
+ bool FixupIntersectionOrder () noexcept ;
373
+ void FixupOutPolygon (OutRec &outrec) noexcept ;
374
+ void FixupOutPolyline (OutRec &outrec) noexcept ;
375
+ bool IsHole (TEdge *e) noexcept ;
376
+ bool FindOwnerFromSplitRecs (OutRec &outRec, OutRec *&currOrfl) noexcept ;
377
+ void FixHoleLinkage (OutRec &outrec) noexcept ;
378
+ void AddJoin (OutPt *op1, OutPt *op2, const IntPoint offPt) noexcept ;
379
+ void ClearJoins () noexcept ;
380
+ void ClearGhostJoins () noexcept ;
381
+ void AddGhostJoin (OutPt *op, const IntPoint offPt) noexcept ;
382
+ bool JoinPoints (Join *j, OutRec *outRec1, OutRec *outRec2) noexcept ;
383
+ void JoinCommonEdges () noexcept ;
384
+ void DoSimplePolygons () noexcept ;
385
+ void FixupFirstLefts1 (OutRec *OldOutRec, OutRec *NewOutRec) noexcept ;
386
+ void FixupFirstLefts2 (OutRec *InnerOutRec, OutRec *OuterOutRec) noexcept ;
387
+ void FixupFirstLefts3 (OutRec *OldOutRec, OutRec *NewOutRec) noexcept ;
382
388
#ifdef use_xyz
383
- void SetZ (IntPoint &pt, TEdge &e1 , TEdge &e2 );
389
+ void SetZ (IntPoint &pt, TEdge &e1 , TEdge &e2 ) noexcept ;
384
390
#endif
385
391
};
386
392
// ------------------------------------------------------------------------------
387
393
388
394
class ClipperOffset {
389
395
public:
390
- ClipperOffset (double miterLimit = 2.0 , double roundPrecision = 0.25 );
396
+ ClipperOffset (double miterLimit = 2.0 , double roundPrecision = 0.25 ) noexcept ;
391
397
~ClipperOffset ();
392
- void AddPath (const Path &path, JoinType joinType, EndType endType);
393
- void AddPaths (const Paths &paths, JoinType joinType, EndType endType);
394
- void Execute (Paths &solution, double delta);
395
- void Execute (PolyTree &solution, double delta);
396
- void Clear ();
398
+ void AddPath (const Path &path, JoinType joinType, EndType endType) noexcept ;
399
+ void AddPaths (const Paths &paths, JoinType joinType,
400
+ EndType endType) noexcept ;
401
+ bool Execute (Paths &solution, double delta) noexcept ;
402
+ bool Execute (PolyTree &solution, double delta) noexcept ;
403
+ void Clear () noexcept ;
404
+
405
+ private:
397
406
double MiterLimit;
398
407
double ArcTolerance;
399
408
400
- private:
401
409
Paths m_destPolys;
402
410
Path m_srcPoly;
403
411
Path m_destPoly;
@@ -407,20 +415,20 @@ class ClipperOffset {
407
415
IntPoint m_lowest;
408
416
PolyNode m_polyNodes;
409
417
410
- void FixOrientations ();
411
- void DoOffset (double delta);
412
- void OffsetPoint (int j, int &k, JoinType jointype);
413
- void DoSquare (int j, int k);
414
- void DoMiter (int j, int k, double r);
415
- void DoRound (int j, int k);
418
+ void FixOrientations () noexcept ;
419
+ void DoOffset (double delta) noexcept ;
420
+ void OffsetPoint (int j, int &k, JoinType jointype) noexcept ;
421
+ void DoSquare (int j, int k) noexcept ;
422
+ void DoMiter (int j, int k, double r) noexcept ;
423
+ void DoRound (int j, int k) noexcept ;
416
424
};
417
425
// ------------------------------------------------------------------------------
418
426
419
427
class clipperException : public std ::exception {
420
428
public:
421
- clipperException (const char *description) : m_descr(description) {}
422
- virtual ~clipperException () throw () {}
423
- virtual const char *what () const throw() { return m_descr.c_str (); }
429
+ clipperException (const char *description) noexcept : m_descr(description) {}
430
+ ~clipperException () {}
431
+ virtual const char *what () const noexcept { return m_descr.c_str (); }
424
432
425
433
private:
426
434
std::string m_descr;
0 commit comments