0024171: Eliminate CLang compiler warning -Wreorder
[occt.git] / src / ShapeFix / ShapeFix_Wire.cdl
1 -- Created on: 1998-06-03
2 -- Created by: data exchange team
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21
22
23 class Wire from ShapeFix inherits Root from ShapeFix
24
25     ---Purpose: This class provides a set of tools for repairing a wire.
26     --
27     --          These are methods Fix...(), organised in two levels:
28     --
29     -- Level 1: Advanced - each method in this level fixes one separate problem, 
30     --          usually dealing with either single edge or connection of the
31     --          two adjacent edges. These methods should be used carefully and
32     --          called in right sequence, because some of them depend on others.
33     --
34     -- Level 2: Public (API) - methods which group several methods of level 1 
35     --          and call them in a proper sequence in order to make some 
36     --          consistent set of fixes for a whole wire. It is possible to 
37     --          control calls to methods of the advanced level from methods of 
38     --          the public level by use of flags Fix..Mode() (see below).
39     --
40     --          Fixes can be made in three ways:
41     --       1. Increasing tolerance of an edge or a vertex
42     --       2. Changing topology (adding/removing/replacing edge in the wire
43     --          and/or replacing the vertex in the edge)
44     --       3. Changing geometry (shifting vertex or adjusting ends of edge
45     --          curve to vertices, or recomputing curves of the edge)
46     --
47     --          When fix can be made in more than one way (e.g., either
48     --          by increasing tolerance or shifting a vertex), it is choosen
49     --          according to the flags:
50     --          ModifyTopologyMode - allows modification of the topology.
51     --                               This flag can be set when fixing a wire on 
52     --                               the separate (free) face, and should be
53     --                               unset for face which is part of shell.
54     --          ModifyGeometryMode - allows modification of the geometry.
55     --
56     --          The order of descriptions of Fix() methods in this CDL 
57     --          approximately corresponds to the optimal order of calls.
58     --
59     --          NOTE: most of fixing methods expect edges in the 
60     --          ShapeExtend_WireData to be ordered, so it is necessary to make
61     --          call to FixReorder() before any other fixes
62     --
63     --          ShapeFix_Wire should be initialized prior to any fix by the 
64     --          following data:
65     --          a) Wire (ether TopoDS_Wire or ShapeExtend_Wire)
66     --          b) Face or surface
67     --          c) Precision
68     --          This can be done either by calling corresponding methods
69     --          (LoadWire, SetFace or SetSurface, and SetPrecision), or
70     --          by loading already filled ShapeAnalisis_Wire with method Load
71
72 uses 
73
74     Surface   from Geom,
75     Face      from TopoDS,
76     Vertex    from TopoDS, 
77     Wire      from TopoDS, 
78     Location  from TopLoc,
79     WireData  from ShapeExtend, 
80     Status    from ShapeExtend,
81     Wire      from ShapeAnalysis,
82     WireOrder from ShapeAnalysis,
83     Edge      from ShapeFix
84
85 is
86
87     Create returns Wire from ShapeFix;
88         ---Purpose: Empty Constructor, creates clear object with default flags
89
90     Create (wire: Wire from TopoDS; face: Face from TopoDS; prec: Real)
91     returns Wire from ShapeFix;
92         ---Purpose: Create new object with default flags and prepare it for use
93         --          (Loads analyzer with all the data for the wire and face)
94
95     --- Loading and extracting the wire and other working data:
96
97     ClearModes (me: mutable);
98         ---Purpose: Sets all modes to default
99
100     ClearStatuses (me: mutable);
101         ---Purpose: Clears all statuses
102     
103     Init (me: mutable; wire: Wire from TopoDS; 
104                       face: Face from TopoDS; prec: Real);
105         ---Purpose: Load analyzer with all the data for the wire and face
106         --          and drops all fixing statuses 
107
108     Init (me: mutable; saw: Wire from ShapeAnalysis);
109         ---Purpose: Load analyzer with all the data already prepared
110         --          and drops all fixing statuses 
111         --          If analyzer contains face, there is no need to set it
112         --          by SetFace or SetSurface
113
114     Load (me: mutable; wire: Wire from TopoDS);
115         ---Purpose: Load data for the wire, and drops all fixing statuses
116         ---Note   : It is necessary to set face or surface for the wire before fixes
117     
118     Load (me: mutable; sbwd: WireData from ShapeExtend);
119         ---Purpose: Load data for the wire, and drops all fixing statuses
120         ---Note   : It is necessary to set face or surface for the wire before fixes
121     
122     SetFace (me: mutable; face: Face from TopoDS);
123         ---C++: inline
124         ---Purpose: Set working face for the wire
125     
126     SetSurface (me: mutable; surf: Surface from Geom);
127         ---C++: inline
128         ---Purpose: Set surface for the wire
129         ---Remark : This function creates new face and calls SetFace
130     
131     SetSurface (me: mutable; surf: Surface from Geom; 
132                             loc: Location from TopLoc);
133         ---C++: inline
134         ---Purpose: Set surface for the wire
135         ---Remark : This function creates new face and calls SetFace
136     
137     SetPrecision (me: mutable; prec: Real) is redefined;
138         ---Purpose: Set working precision (to root and to analyzer)
139
140     IsLoaded (me) returns Boolean;
141         ---C++: inline
142         ---Purpose: Tells if the wire is loaded 
143         ---Remark:  returns myAnalyzer.IsLoadaed()
144
145     IsReady (me) returns Boolean;
146         ---C++: inline
147         ---Purpose: Tells if the wire and face are loaded 
148         ---Remark:  returns myAnalyzer.IsReady()
149
150     NbEdges (me) returns Integer;
151         ---Purpose: returns number of edges in the working wire
152         ---Remark:  returns myAnalyzer.NbEdges()
153
154     Wire (me) returns Wire from TopoDS;
155         ---C++: inline
156         ---Purpose: Makes the resulting Wire (by basic Brep_Builder)
157         ---Remark:  returns myAnalyzer.Wire()
158
159     WireAPIMake (me) returns Wire from TopoDS;
160         ---C++: inline
161         ---Purpose: Makes the resulting Wire (by BRepAPI_MakeWire)
162         ---Remark:  returns myAnalyzer.WireAPIMake()
163
164     Analyzer (me) returns Wire from ShapeAnalysis;
165         ---Purpose: returns field Analyzer (working tool)
166
167     WireData (me) returns WireData from ShapeExtend;
168         ---C++: inline
169         ---C++: return const &
170         ---Purpose: returns working wire
171         ---Remark:  calls Analyzer.WireData()
172
173     Face (me) returns Face from TopoDS;
174         ---C++: inline
175         ---C++: return const &
176         ---Purpose: returns working face (Analyzer.Face())
177
178     --- Parameters:
179
180     ModifyTopologyMode (me: mutable) returns Boolean;
181         ---C++: inline
182         ---C++: return &
183         ---Purpose: Returns (modifiable) the flag which defines whether it is 
184         --          allowed to modify topology of the wire during fixing
185         --          (adding/removing edges etc.)
186         ---Use    : This flag can be set to True for wire on separate (free) face.
187         --          It should be set to False if the wire is on face which is a part
188         --          of a shell.
189         ---Default: False
190
191     ModifyGeometryMode (me: mutable) returns Boolean;
192         ---C++: inline
193         ---C++: return &
194         ---Purpose: Returns (modifiable) the flag which defines whether the Fix..()
195         --          methods are allowed to modify geometry of the edges and vertices
196         ---Default: True
197         ---Remark : Currently is not used
198
199     ModifyRemoveLoopMode (me: mutable) returns Integer;
200         ---C++: inline
201         ---C++: return &
202         ---Purpose: Returns (modifiable) the flag which defines whether the Fix..()
203         --          methods are allowed to modify RemoveLoop of the edges 
204         ---Default: -1
205         ---Remark : Currently is not used
206
207     ClosedWireMode (me: mutable) returns Boolean;
208         ---C++: inline
209         ---C++: return &
210         ---Purpose: Returns (modifiable) the flag which defines whether the wire
211         --          is to be closed (by calling methods like FixDegenerated() 
212         --          and FixConnected() for last and first edges). 
213         ---Use    : This flag should be set to False if wire is not a face boundary 
214         --          but is a (not closed) curve on a face.
215         ---Default: True
216
217     PreferencePCurveMode (me: mutable) returns Boolean;
218         ---C++: inline
219         ---C++: return &
220         ---Purpose: Returns (modifiable) the flag which defines whether the 2d (True)
221         --          representation of the wire is preferable over 3d one (in the 
222         --          case of ambiguity in FixEdgeCurves).
223         ---Default: True (means that 2d representation is preferable).
224         ---Remark : Currently is not used
225
226     FixGapsByRangesMode (me: mutable) returns Boolean;
227         ---C++: inline
228         ---C++: return &
229         ---Purpose: Returns (modifiable) the flag which defines whether tool
230         --          tries to fix gaps first by changing curves ranges (i.e.
231         --          using intersection, extrema, projections) or not.
232         ---Default: False (means that tool will only bend curves).
233         ---Remark : Currently is not used
234
235     --- Flags:
236
237     --- Level: Public (API)
238     --         These flags are only used in Perform()
239     FixReorderMode (me: mutable) returns Integer;
240         ---C++: inline
241         ---C++: return &
242     FixSmallMode (me: mutable) returns Integer;
243         ---C++: inline
244         ---C++: return &
245     FixConnectedMode (me: mutable) returns Integer;
246         ---C++: inline
247         ---C++: return &
248     FixEdgeCurvesMode (me: mutable) returns Integer;
249         ---C++: inline
250         ---C++: return &
251     FixDegeneratedMode (me: mutable) returns Integer;
252         ---C++: inline
253         ---C++: return &
254     FixSelfIntersectionMode (me: mutable) returns Integer;
255         ---C++: inline
256         ---C++: return &
257     FixLackingMode (me: mutable) returns Integer;
258         ---C++: inline
259         ---C++: return &
260     FixGaps3dMode (me: mutable) returns Integer;
261         ---C++: inline
262         ---C++: return &
263     FixGaps2dMode (me: mutable) returns Integer;
264         ---C++: inline
265         ---C++: return &
266         ---Purpose: Returns (modifiable) the flag for corresponding Fix..() method
267         --          which defines whether this method will be called from the
268         --          method APIFix():
269         --       -1 default
270         --        1 method will be called
271         --        0 method will not be called
272
273     --- Level: Advanced: 
274     --         These flags are only used in FixEdgeCurves() and FixSelfIntersection()
275     --         For FixEdgeCurves():
276     FixReversed2dMode (me: mutable) returns Integer;
277         ---C++: inline
278         ---C++: return &
279     FixRemovePCurveMode (me: mutable) returns Integer;
280         ---C++: inline
281         ---C++: return &
282     FixAddPCurveMode (me: mutable) returns Integer;
283         ---C++: inline
284         ---C++: return &
285     FixRemoveCurve3dMode (me: mutable) returns Integer;
286         ---C++: inline
287         ---C++: return &
288     FixAddCurve3dMode (me: mutable) returns Integer;
289         ---C++: inline
290         ---C++: return &
291     FixSeamMode (me: mutable) returns Integer;
292         ---C++: inline
293         ---C++: return &
294     FixShiftedMode (me: mutable) returns Integer;
295         ---C++: inline
296         ---C++: return &
297     FixSameParameterMode (me: mutable) returns Integer;
298         ---C++: inline
299         ---C++: return &
300     FixVertexToleranceMode (me: mutable) returns Integer;
301         ---C++: inline
302         ---C++: return &
303     --         For FixSelfIntersection():
304     FixNotchedEdgesMode (me: mutable) returns Integer;
305         ---C++: inline
306         ---C++: return &
307     FixSelfIntersectingEdgeMode (me: mutable) returns Integer;
308         ---C++: inline
309         ---C++: return &
310     FixIntersectingEdgesMode (me: mutable) returns Integer;
311         ---C++: inline
312         ---C++: return &
313     FixNonAdjacentIntersectingEdgesMode (me: mutable) returns Integer;
314         ---C++: inline
315         ---C++: return &    
316         ---Purpose: Returns (modifiable) the flag for corresponding Fix..() method
317         --          which defines whether this method will be called from the 
318         --          corresponding Fix..() method of the public level:
319         --       -1 default
320         --        1 method will be called
321         --        0 method will not be called
322
323     --- Fixing methods:
324     
325     --- Level: Public (API)
326
327     Perform (me: mutable) returns Boolean;
328         ---Purpose: This method performs all the available fixes.
329         --          If some fix is turned on or off explicitly by the Fix..Mode() flag,
330         --          this fix is either called or not depending on that flag.
331         --          Else (i.e. if flag is default) fix is called depending on the 
332         --          situation: some fixes are not called or are limited if order of 
333         --          edges in the wire is not OK, or depending on modes
334         --
335         --          The order of the fixes and default behaviour of Perform() are:
336         --          FixReorder
337         --          FixSmall (with lockvtx true if ! TopoMode or if wire is not ordered)
338         --          FixConnected (if wire is ordered)
339         --          FixEdgeCurves (without FixShifted if wire is not ordered)
340         --          FixDegenerated (if wire is ordered)
341         --          FixSelfIntersection (if wire is ordered and ClosedMode is True)
342         --          FixLacking (if wire is ordered)
343         --
344         ---Returns: False if nothing done, else True
345         --          Use methods Status...() to investigate the results of calls to the
346         --          each fixing method. All statuses are dropped at the start of Perform().
347
348     FixReorder (me: mutable) returns Boolean;
349         ---Purpose: Performs an analysis and reorders edges in the wire using 
350         --          class WireOrder 
351         ---Returns: False if nothing to do, True if some edges were reordered
352         ---Status : See StatusReorder() for details
353         --          FAIL1 - ShapeAnalysis_WireOrder has detected several loops
354         --          FAIL2 - ShapeAnalysis_WireOrder failed (result is incorrect)
355         --          DONE1 - Reorder done OK
356         --          DONE2 - in addition to DONE1 - some gaps remain
357         --          DONE3 - in addition to DONE1 - some edges were reversed
358
359     FixSmall (me: mutable; lockvtx: Boolean; precsmall: Real = 0.0) 
360     returns Integer;
361         ---Purpose: Applies FixSmall(num) to all edges in the wire
362         ---Returns: True if some edges were removed, else False
363         ---Status : See StatusSmall() for details
364         --          OK   : Edge is not null-length
365         --          DONE1: Edge is null-length and has the same vertices at begin 
366         --                 and end; removed
367         --          DONE2: (only if lockvtx is False and ModifyTopologyMode is True)
368         --                 Edge is null-length and has different vertices at begin and end; 
369         --                 edge removed, and CheckConnected called for adjacent edges
370         --          FAIL1: Edge cannot be checked (no 3d curve and no pcurve)
371         --          FAIL2: Edge is null-length and has different vertices at begin 
372         --                 and end, and lockvtx is True or ModifyTopologyMode is False; 
373         --                 edge is not removed
374         --          FAIL3: In the case of DONE2, CheckConnected has failed
375
376     FixConnected (me: mutable; prec: Real = -1.0) returns Boolean;
377         ---Purpose: Applies FixConnected(num) to all edges in the wire
378         --          Connection between first and last edges is treated only if 
379         --          flag ClosedMode is True
380         --          If <prec> is -1 then MaxTolerance() is taken.
381         ---Returns: True if some vertices were replaced, False if OK or fail
382         ---Status : See StatusConnected() for details
383         --          OK   : If they are already the same, nothing done
384         --          DONE1: Absolutely confused (gp::Resolution), set the same
385         --          DONE2: Confused with Analyzer.Precision(), set the same
386         --          DONE3: Confused with <prec> but not Analyzer.Precision(), set the same
387         --          FAIL1: Not confused neither with prec nor Analyzer.Precision()
388     
389     FixEdgeCurves (me: mutable) returns Boolean;
390         ---Purpose: Groups the fixes dealing with 3d and pcurves of the edges.
391         --          The order of the fixes and the default behaviour are:
392         --          ShapeFix_Edge::FixReversed2d
393         --          ShapeFix_Edge::FixRemovePCurve (only if forced)
394         --          ShapeFix_Edge::FixAddPCurve
395         --          ShapeFix_Edge::FixRemoveCurve3d (only if forced)
396         --          ShapeFix_Edge::FixAddCurve3d
397         --          FixSeam,
398         --          FixShifted,
399         --          ShapeFix_Edge::FixSameParameter
400         ---Returns: False if nothing done, else True
401         ---Status : See StatusEdgeCurves() for details
402         --          OK - no problem was detected, nothing fixed
403         --          DONE1, FAIL1 - FixReversed2d was fixed and/or failed
404         --          DONE2, FAIL2 - FixRemovePCurve was fixed and/or failed
405         --          DONE3, FAIL3 - FixAddPCurve was fixed and/or failed
406         --          DONE4, FAIL4 - FixRemoveCurve3d was fixed and/or failed
407         --          DONE5, FAIL5 - FixAddCurve3d was fixed and/or failed
408         --          DONE6, FAIL6 - FixSeam was fixed and/or failed
409         --          DONE7, FAIL7 - FixShifted was fixed and/or failed
410         --          DONE8, FAIL8 - FixSameParameter or FixVertexTolerance were fixed and/or failed
411
412     FixDegenerated (me: mutable) returns Boolean;
413         ---Purpose: Applies FixDegenerated(num) to all edges in the wire
414         --          Connection between first and last edges is treated only if 
415         --          flag ClosedMode is True
416         ---Returns: True if at least one degenerated edge was fixed or added
417         ---Status : See StatusDegenerated() for details
418         --          OK   : Nothing done
419         --          FAIL1: Analysis has failed
420         --          DONE1: New degenerated edge was added
421         --          DONE2: Edge <num> was made degenerated
422     
423     FixSelfIntersection ( me: mutable ) returns Boolean;
424         ---Purpose: Applies FixSelfIntersectingEdge(num) and 
425         --          FixIntersectingEdges(num) to all edges in the wire and
426         --          FixIntersectingEdges(num1, num2) for all pairs num1 and num2
427         --          such that num2 >= num1 + 2
428         --          and removes wrong edges if any
429         ---Returns: True if something was fixed, else False
430         ---Status : See StatusSelfIntersection() for details
431         --          OK   : No intersection found
432         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
433         --          FAIL2: self-intersection was found, but not fixed because of 
434         --                 limit of increasing tolerance (MaxTolerance)
435         --          FAIL3: intercestion of non adjacent edges found, but not fixed 
436         --                 because of limit of increasing tolerance (MaxTolerance) 
437         --          DONE1: tolerance of vertex was increased to fix self-intersection
438         --          DONE2: vertex was moved to fix self-intersection
439         --          DONE3: some edges were removed because of intersection
440         --          DONE4: pcurve(s) was(were) modified
441         --          DONE5: non adjacent intersection fixed by increasing tolerance of
442         --                 vertex(vertices)
443         --          DONE6: tolerance of edge was increased to hide intersection
444         --          DONE7: range of some edges was decreased to avoid intersection
445
446     FixLacking (me: mutable; force: Boolean = Standard_False) returns Boolean;
447         ---Purpose: Applies FixLacking(num) to all edges in the wire
448         --          Connection between first and last edges is treated only if 
449         --          flag ClosedMode is True
450         --          If <force> is False (default), test for connectness is done with 
451         --          precision of vertex between edges, else it is done with minimal
452         --          value of vertex tolerance and Analyzer.Precision().
453         --          Hence, <force> will lead to inserting lacking edges in replacement
454         --          of vertices which have big tolerances.
455         ---Returns: True if lacking edge was fixed, else False.
456         ---Status : See StatusLacking() for more details
457         --          OK   : No problems detected
458         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
459         --          FAIL2: lacking edge not fixed because of 
460         --                 limit of increasing tolerance (MaxTolerance)
461         --          FAIL3: failed to build lacking edge (3d curve) 
462         --          DONE1: tolerance was increased to fix lacking edge
463         --          DONE2: lacking edge was inserted
464
465     FixClosed (me: mutable; prec: Real = -1.0) returns Boolean;
466         ---Purpose: Fixes a wire to be well closed
467         --          It performs FixConnected, FixDegenerated and FixLacking between
468         --          last and first edges (independingly on flag ClosedMode and modes
469         --          for these fixings)
470         --          If <prec> is -1 then MaxTolerance() is taken.
471         ---Returns: False if nothing done, else True
472         ---Status : See StatusClosed() for details
473         --          OK - no problem was detected, nothing fixed
474         --          DONE1, FAIL1 - FixConnected was fixed and/or failed
475         --          DONE2, FAIL2 - FixDegenerated was fixed and/or failed
476         --          DONE3, FAIL3 - FixLacking was fixed and/or failed
477
478     FixGaps3d (me: mutable) returns Boolean;
479         ---Purpose: Fixes gaps between ends of 3d curves on adjacent edges
480         --          myPrecision is used to detect the gaps.
481         ---Returns: False if nothing done, else True
482         ---Status : See StatusGaps3d() for details
483         --          OK - no problem was detected, nothing fixed
484         --          DONE1 - Some gaps in 3d were found and fixed
485         --          FAIL1 - There was no 3d curve found on some edges
486         --          FAIL2 - Method failed to fix some gaps
487
488     FixGaps2d (me: mutable) returns Boolean;
489         ---Purpose: Fixes gaps between ends of pcurves on adjacent edges
490         --          myPrecision is used to detect the gaps.
491         ---Returns: False if nothing done, else True
492         ---Status : See StatusGaps2d() for details
493         --          OK - no problem was detected, nothing fixed
494         --          DONE1 - Some gaps in 2d were found and fixed
495         --          FAIL1 - There was no pcurve found on some edges
496         --          FAIL2 - Method failed to fix some gaps
497
498     --- Level: Advanced
499     
500     ---Status: For analyzing the status of the last performed method use 
501     --         LastFixStatus(status)
502     --
503     --         All the Fix.. methods below return False if the problem was not 
504     --         fixed, in this case LastFixStatus contains either FAIL or OK.
505     --         If a method returns True the LastFixStatus contains DONE,
506     --         this means that some fix was made
507     --         For detailed meaning of Status see corresponding method.
508     
509     FixReorder (me: mutable; wi: in WireOrder from ShapeAnalysis) returns Boolean;
510         ---Purpose: Reorder edges in the wire as determined by WireOrder
511         --          that should be filled and computed before
512         ---Returns: False if nothing to do, True if some edges were reordered
513         ---Status : See LastFixStatus() for details
514         --          OK    - edges are ordered well
515         --          FAIL1 - WireOrder has detected several loops
516         --          FAIL2 - WireOrder is incorrect (wrong number of edges)
517         --          FAIL3 - WireOrder is incorrect 
518         --          DONE1 - reorder was performed successfully
519
520     FixSmall (me: mutable; num: Integer; lockvtx: Boolean; precsmall: Real)
521     returns Boolean;
522         ---Purpose: Fixes Null Length Edge to be removed
523         --          If an Edge has Null Length (regarding preci, or <precsmall>
524         --          - what is smaller), it should be removed
525         --          It can be with no problem if its two vertices are the same
526         --          Else, if lockvtx is False, it is removed and its end vertex
527         --          is put on the preceeding edge
528         --          But if lockvtx is True, this edge must be kept ...
529         ---Use    : Is to be used in the case if some edges can be too short, and 
530         --          should be removed (hence, if topology of the wire can be modified). 
531         --          It is recommended to call this method before FixIntersection()
532         --
533         ---Returns: True if null edge was removed, False if nothing done
534         ---Status : See LastFixStatus() for details
535         --          OK   : Edge is not null-length
536         --          DONE1: Edge is null-length and has the same vertices at begin 
537         --                 and end; removed
538         --          DONE2: (only if lockvtx is False and ModifyTopologyMode is True)
539         --                 Edge is null-length and has different vertices at begin and end; 
540         --                 edge removed, and CheckConnected called for adjacent edges
541         --          FAIL1: Edge cannot be checked (no 3d curve and no pcurve)
542         --          FAIL2: Edge is null-length and has different vertices at begin 
543         --                 and end, and lockvtx is True or ModifyTopologyMode is False; 
544         --                 edge is not removed
545         --          FAIL3: In the case of DONE2, CheckConnected has failed
546
547     FixConnected (me: mutable; num: Integer; prec: Real)
548     returns Boolean;
549         ---Purpose: Fixes connected edges (preceeding and current)
550         --          Forces Vertices (end of preceeding-begin of current) to be
551         --          the same one
552         --          Tests with starting preci or, if given greater, <prec>
553         --          If <prec> is -1 then MaxTolerance() is taken.
554         --
555         ---Use    : It is to be used if two consequent edges in the wire have not
556         --          the same common vertex, e.g., if wire was constructed from 
557         --          not connected edges or some operations like adding/removing an
558         --          edge were done.
559         --          While it may change vertices, it should not be
560         --          called in cases when vertices may not be changed ...
561         --
562         ---Remark : Replacement of vertices in the edges is made by copying these edges
563         --
564         ---Returns: False if edges are already connected (vertices are the same) or if
565         --          it is not possible to perform fix (edges have a gap more than <prec>); 
566         --          True if disconnected situation was fixed by producing a new Vertex 
567         --          at the middle of the former ones.
568         ---Status:
569         --          OK   : If they are already the same, nothing done
570         --          DONE1: Absolutely confused (gp::Resolution), set the same
571         --          DONE2: Confused with Analyzer.Precision(), set the same
572         --          DONE3: Confused with <prec> but not Analyzer.Precision(), set the same
573         --          FAIL1: Not confused neither with prec nor Analyzer.Precision()
574
575     FixSeam (me: mutable; num: Integer) returns Boolean;
576         ---Purpose: Fixes a seam edge
577         --          A Seam edge has two pcurves, one for forward. one for reversed
578         --          The forward pcurve must be set as first
579         --
580         --          NOTE that correct order of pcurves in the seam edge depends on
581         --          its orientation (i.e., on orientation of the wire, method of 
582         --          exploration of edges etc.).
583         --          Since wire represented by the ShapeExtend_WireData is always forward
584         --          (orientation is accounted by edges), it will work correct if:
585         --       1. Wire created from ShapeExtend_WireData with methods 
586         --          ShapeExtend_WireData::Wire..() is added into the FORWARD face 
587         --          (orientation can be applied later)
588         --       2. Wire is extracted from the face with orientation not composed
589         --          with orientation of the face
590         --
591         ---Use    : This operation should be called after reversing the wire if it 
592         --          contains seam edges. 
593         --
594         ---Returns: True if edge is a seam and its curves were fixed (reordered), else False
595         ---Status : See StatusSeam() for details
596         --          OK - edge is not a seam or has pcurves OK
597         --          DONE1 - seam pcurves were fixed
598
599     FixShifted (me: mutable) returns Boolean;
600         ---Purpose: Fixes edges which have pcurves shifted by whole parameter 
601         --          range on the closed surface (the case may occur if pcurve 
602         --          of edge was computed by projecting 3d curve, which goes 
603         --          along the seam). 
604         --          It compares each two consequent edges and tries to connect them 
605         --          if distance between ends is near to range of the surface.
606         --          It also can detect and fix the case if all pcurves are connected,
607         --          but lie out of parametric bounds of the surface.
608         --          In addition to FixShifted from ShapeFix_Wire, more
609         --          sophisticated check of degenerate points is performed,
610         --          and special cases like sphere given by two meridians 
611         --          are treated.
612         ---Use    : Is to be used if some pcurves were recomputed.
613         --          It is recommended to use it before FixDegenerated.
614         ---Returns: False if nothing done, else True
615         ---Status : See StatusShifted() for details
616         --          OK: If pcurves are OK
617         --          FAIL1: some pcurves are missing
618         --          DONE1: some pcurves were shifted in order to ensure connection 
619         --                 between edges
620         --          DONE2: all pcurves were shifted in order to be in the parametric 
621         --                 range of a surface
622
623     FixDegenerated (me: mutable; num: Integer) returns Boolean;
624         ---Purpose: Fixes Degenerated Edge
625         --          Checks an <num-th> edge or a point between <num>th-1 and <num>th
626         --          edges for a singularity on a supporting surface.
627         --          If singularity is detected, either adds new degenerated edge 
628         --          (before <num>th), or makes <num>th edge to be degenerated.
629         ---Use    : It is to be called for faces which lie on surfaces with 
630         --          singularities. 
631         --          It should be called after all pcurves are correctly computed.
632         ---Returns: False if nothing done, else True
633         ---Status : See LastFixStatus() for details
634         --          OK   : Nothing done
635         --          FAIL1: Analysis has failed
636         --          DONE1: New degenerated edge was added
637         --          DONE2: Edge <num> was made degenerated
638         --          DONE3: Edge <num> was incorrectly coded as degenerated, removed
639
640     FixSelfIntersectingEdge ( me: mutable; num: Integer )
641     returns Boolean is private;
642         ---Purpose: Detect and fix self-intersecting pcurve of edge <num>.
643         --          Fix is made by one of two methods:
644         --          - cut out the self-intersection loop on pcurve (thus 
645         --            producing C0 pcurve). This also increases tolerance of edge
646         --            in order to satisfy SameParameter requirement.
647         --          - increase tolerance of the vertex of edge nearest to the 
648         --            self-intersection point so that it comprises that point.
649         --          The first method is considered only if ModifyGeometryMode 
650         --          is True. In that case, the method which requires less 
651         --          increasing of tolerance is selected. 
652         ---Returns: True if it was done, else False
653         ---Status : See LastFixStatus() for details
654         --          OK   : Edge is not self-intersecting
655         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
656         --          FAIL2: self-intersection was found, but not fixed because of 
657         --                 limit of increasing tolerance (MaxTolerance)
658         --          DONE1: tolerance was increased to fix self-intersection
659         --          DONE4: pcurve was modified (self-intersection loop cutted out)
660
661     FixIntersectingEdges ( me: mutable; num: Integer )
662     returns Boolean is private;
663         ---Purpose: Test if two consequent edges are intersecting and fix it
664         --          by increasing of tolerance of vertex between edges,
665         --          shifting this vertex to the point of intersection,
666         --          cutting edges to the intersection point.
667         --          It also can give signal to remove edge if it whole is cut by
668         --          intersection (if flag ModifyTopologyMode is set).
669         --
670         ---Returns: False if nothing done, True if something was fixed.
671         ---Status : See LastFixStatus() for details
672         --          OK   : No intersection found
673         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
674         --          FAIL2: self-intersection was found, but not fixed because of 
675         --                 limit of increasing tolerance (MaxTolerance)
676         --          DONE1: tolerance was increased to fix self-intersection
677         --          DONE2: vertex was moved to fix self-intersection
678         --          DONE3: previous or
679         --          DONE4: current edge should be removed because of intersection
680         --          DONE6: tolerance of edge was increased to hide intersection
681         --          DONE7: range of some edges was decreased to avoid intersection
682
683     FixIntersectingEdges (me: mutable; num1  : Integer;
684                                       num2  : Integer)
685     returns Boolean is private;
686         ---Purpose: Tests if two edges <num1> and <num2> are intersecting and
687         --          fix intersection by increasing of tolerance of vertex
688         --          nearest to the point of intersection.
689         --
690         ---Returns: False if nothing done, True if something was fixed.
691         ---Status : See LastFixStatus() for details
692         --          OK   : No intersection found
693         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
694         --          FAIL2: self-intersection was found, but not fixed because of 
695         --                 limit of increasing tolerance (MaxTolerance)
696         --          DONE1: tolerance was increased to fix self-intersection
697     
698     FixLacking ( me: mutable; num: Integer; force: Boolean = Standard_False )
699     returns Boolean;
700         ---Purpose: Fixes Lacking Edge 
701         --          Test if two adjucent edges are disconnected in 2d (while 
702         --          connected in 3d), and in that case either increase tolerance 
703         --          of the vertex or add a new edge (straight in 2d space), in 
704         --          order to close wire in 2d.
705         --          Returns True if edge was added or tolerance was increased.
706         ---Algorithm:
707         --       1. Compute the 2d gap between edges and calculate a tolerance
708         --          which should have vertex in order to comprise the gap
709         --          (using GeomAdaptor_Surface); computed value is inctol
710         --       2. If inctol < tol of vertex, return False (everything is OK)
711         --       3. If inctol < Precision, just increase tolerance of vertex to inctol
712         --       4. Else (if both edges are not degenerated) try to add new edge 
713         --          with straight pcurve (in order to close the gap):
714         --       a) if flag MayEdit is False
715         --          1. if inctol < MaxTolerance, increase tolerance of vertex to inctol
716         --          2. else try to add degenerated edge (check that middle point of 
717         --             that pcurve is inside the vertex)
718         --       b) if MayEdit is True
719         --          1. try to replace big vertex with two new small vertices 
720         --             connected by new edge. This is made if there is a 3d space
721         --             between ends of adjacent edges.
722         --          2. if inctol < MaxTolerance, increase tolerance of vertex to inctol
723         --          3. else add either degenerated or closed edge (if middle point
724         --             of a pcurve of a new edge is inside the vertex, then
725         --             degenerated edge is added, else new edge is closed).
726         --       5. If new edge cannot be added, but inctol < MaxTolerance,
727         --          when increase tolerance of vertex to a value of inctol
728         --
729         ---Use    : This method should be used after all pcurves in the wire are 
730         --          correctly computed. It is not recommended to use this method 
731         --          after FixDegenerated() and before FixSelfIntersection().
732         --
733         ---Returns: False if nothing done, else True.
734         ---Status : See LastFixStatus() for more details
735         --          OK   : If nothing done
736         --          FAIL1: analysis failed (edge has no pcurve, or no vertices etc.)
737         --          FAIL2: lacking edge not fixed because of 
738         --                 limit of increasing tolerance (MaxTolerance)
739         --          FAIL3: failed to build lacking edge (3d curve) 
740         --          DONE1: tolerance was increased to fix lacking edge
741         --          DONE2: lacking edge was inserted
742         --          DONE3: (in addition to DONE2) inserted edge is degenerated
743         --          DONE4: (in addition to DONE2) inserted edge is closed
744         --          DONE5: pcurves of edges were bent (only if ModifyGeometry is True)
745     
746     FixNotchedEdges(me: mutable) returns Boolean;
747     
748     FixDummySeam(me: mutable; num: Integer) is private;
749
750     FixGap3d ( me: mutable; num: Integer; convert: Boolean = Standard_False )
751     returns Boolean;
752         ---Purpose: Fixes gap between ends of 3d curves on num-1 and num-th edges.
753         --          myPrecision is used to detect the gap.
754         --          If convert is True, converts curves to bsplines to bend.
755         ---Algorithm:
756         ---Returns: False if nothing done, else True
757         ---Status : See StatusGaps3d() for details
758         --          OK - no problem was detected, nothing fixed
759         --          DONE1 - A gap in 3d were found and fixed
760         --          FAIL1 - There was no 3d curve found on some edge
761         --          FAIL2 - Method failed to fix the gap
762
763     FixGap2d ( me: mutable; num: Integer; convert: Boolean = Standard_False )
764     returns Boolean;
765         ---Purpose: Fixes gap between ends of pcurves on num-1 and num-th edges.
766         --          myPrecision is used to detect the gap.
767         --          If convert is True, converts pcurves to bsplines to bend.
768         ---Algorithm:
769         ---Returns: False if nothing done, else True
770         ---Status : See StatusGaps2d() for details
771         --          OK - no problem was detected, nothing fixed
772         --          DONE1 - A gap in 2d were found and fixed
773         --          FAIL1 - There was no pcurve found on some edge
774         --          FAIL2 - Method failed to fix the gap
775
776     --- Result of fixes: 
777
778     StatusReorder          (me; status: Status from ShapeExtend) returns Boolean;
779         ---C++: inline
780     StatusSmall            (me; status: Status from ShapeExtend) returns Boolean;
781         ---C++: inline
782     StatusConnected        (me; status: Status from ShapeExtend) returns Boolean;
783         ---C++: inline
784     StatusEdgeCurves       (me; status: Status from ShapeExtend) returns Boolean;
785         ---C++: inline
786     StatusDegenerated      (me; status: Status from ShapeExtend) returns Boolean;
787         ---C++: inline
788     StatusSelfIntersection (me; status: Status from ShapeExtend) returns Boolean;
789         ---C++: inline
790     StatusLacking          (me; status: Status from ShapeExtend) returns Boolean;
791         ---C++: inline
792     StatusClosed           (me; status: Status from ShapeExtend) returns Boolean;
793         ---C++: inline
794     StatusGaps3d           (me; status: Status from ShapeExtend) returns Boolean;
795         ---C++: inline
796     StatusGaps2d           (me; status: Status from ShapeExtend) returns Boolean;
797         ---C++: inline
798     StatusNotches          (me; status: Status from ShapeExtend) returns Boolean;
799         ---C++: inline
800     StatusRemovedSegment   (me) returns Boolean;
801         ---C++: inline
802         ---Purpose: Querying the status of perfomed API fixing procedures
803         --          Each Status..() methods gives information about the last call to
804         --          the corresponding Fix..() method of API level:
805         --          OK  : no problems detected; nothing done
806         --          DONE: some problem(s) was(were) detected and successfully fixed
807         --          FAIL: some problem(s) cannot be fixed
808         ---Level  : Public (API)
809     LastFixStatus (me; status: Status from ShapeExtend) returns Boolean;                 
810         ---C++: inline
811         ---Purpose: Queries the status of last call to methods Fix... of 
812         --          advanced level
813         --          For details see corresponding methods; universal statuses are:
814         --          OK  : problem not detected; nothing done
815         --          DONE: problem was detected and successfully fixed
816         --          FAIL: problem cannot be fixed
817         ---Level  : Advanced
818         
819     FixEdgeTool (me) returns Edge from ShapeFix;
820         ---Purpose: Returns tool for fixing wires.
821         ---C++: inline
822
823     UpdateWire (me: mutable) is protected;
824         ---Purpose: Updates WireData if some replacements are made
825         --          This is necessary for wires (unlike other shape types)
826         --          since one edge can present in wire several times
827         
828 fields
829
830     myFixEdge : Edge from ShapeFix is protected;
831     myAnalyzer: Wire from ShapeAnalysis is protected; -- working analyzer
832
833     myGeomMode:        Boolean is protected; -- may change geometry
834     myTopoMode:        Boolean is protected; -- may change topology
835     myClosedMode:      Boolean is protected; -- should wire be closed?
836     myPreference2d:    Boolean is protected; -- is 2d representation of edge preferred
837     myFixGapsByRanges: Boolean is protected; -- try to fix gaps by changing curves ranges
838
839     myFixReversed2dMode:                    Integer is protected;
840     myFixRemovePCurveMode:                  Integer is protected;
841     myFixAddPCurveMode:                     Integer is protected;
842     myFixRemoveCurve3dMode:                 Integer is protected;
843     myFixAddCurve3dMode:                    Integer is protected;
844     myFixSeamMode:                          Integer is protected;
845     myFixShiftedMode:                       Integer is protected;
846     myFixSameParameterMode:                 Integer is protected;
847     myFixVertexToleranceMode:               Integer is protected;
848     myFixNotchedEdgesMode:                  Integer is protected;
849     myFixSelfIntersectingEdgeMode:          Integer is protected;
850     myFixIntersectingEdgesMode:             Integer is protected;
851     myFixNonAdjacentIntersectingEdgesMode:  Integer is protected;
852
853     myRemoveLoopMode:                       Integer is protected;
854       -- -1 - old variant (default)
855       --  0 - try remove both 2d loop and 3d loop
856       --  1 - try insert new vertex
857
858     myFixReorderMode:          Integer is protected;
859     myFixSmallMode:            Integer is protected;
860     myFixConnectedMode:        Integer is protected;
861     myFixEdgeCurvesMode:       Integer is protected;
862     myFixDegeneratedMode:      Integer is protected;
863     myFixSelfIntersectionMode: Integer is protected;
864     myFixLackingMode:          Integer is protected;
865     myFixGaps3dMode:           Integer is protected;
866     myFixGaps2dMode:           Integer is protected;
867   
868     myLastFixStatus:          Integer is protected; -- status of last fix of advanced level
869
870     -- statuses corresponding to API methods, queried by Status..(status) methods
871     myStatusReorder:          Integer is protected;    
872     myStatusSmall:            Integer is protected;    
873     myStatusConnected:        Integer is protected;    
874     myStatusEdgeCurves:       Integer is protected;    
875     myStatusDegenerated:      Integer is protected;    
876     myStatusClosed:           Integer is protected;    
877     myStatusSelfIntersection: Integer is protected; 
878     myStatusLacking:          Integer is protected;
879     myStatusGaps3d:           Integer is protected;
880     myStatusGaps2d:           Integer is protected;
881     myStatusRemovedSegment:   Boolean is protected;
882     myStatusNotches:          Integer is protected;
883 end Wire;