0031939: Coding - correction of spelling errors in comments [part 10]
[occt.git] / src / ShapeAnalysis / ShapeAnalysis_WireVertex.hxx
1 // Created on: 1998-06-03
2 // Created by: data exchange team
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _ShapeAnalysis_WireVertex_HeaderFile
18 #define _ShapeAnalysis_WireVertex_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TColStd_HArray1OfInteger.hxx>
25 #include <TColgp_HArray1OfXYZ.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Integer.hxx>
30 class ShapeExtend_WireData;
31 class TopoDS_Wire;
32 class gp_XYZ;
33
34 // resolve name collisions with X11 headers
35 #ifdef Status
36   #undef Status
37 #endif
38
39 //! Analyzes and records status of vertices in a Wire
40 //!
41 //! The Wire has formerly been loaded in a ShapeExtend_WireData
42 //! For each Vertex, a status and some data can be attached
43 //! (case found, position and parameters)
44 //! Then, these information can be used to fix problems
45 class ShapeAnalysis_WireVertex 
46 {
47 public:
48
49   DEFINE_STANDARD_ALLOC
50
51   
52   //! Empty constructor
53   Standard_EXPORT ShapeAnalysis_WireVertex();
54   
55   Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
56   
57   Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
58   
59   Standard_EXPORT void Load (const TopoDS_Wire& wire);
60   
61   Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
62   
63   //! Sets the precision for work
64   //! Analysing: for each Vertex, comparison between the end of the
65   //! preceding edge and the start of the following edge
66   //! Each Vertex rank corresponds to the End Vertex of the Edge of
67   //! same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
68   //! Edge <num> is the preceding one, <num+1> is the following one
69   Standard_EXPORT void SetPrecision (const Standard_Real preci);
70   
71   Standard_EXPORT void Analyze();
72   
73   //! Records status "Same Vertex" (logically) on Vertex <num>
74   Standard_EXPORT void SetSameVertex (const Standard_Integer num);
75   
76   //! Records status "Same Coords" (at the Vertices Tolerances)
77   Standard_EXPORT void SetSameCoords (const Standard_Integer num);
78   
79   //! Records status "Close Coords" (at the Precision of <me>)
80   Standard_EXPORT void SetClose (const Standard_Integer num);
81   
82   //! <num> is the End of preceding Edge, and its projection on the
83   //! following one lies on it at the Precision of <me>
84   //! <ufol> gives the parameter on the following edge
85   Standard_EXPORT void SetEnd (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real ufol);
86   
87   //! <num> is the Start of following Edge, its projection on the
88   //! preceding one lies on it at the Precision of <me>
89   //! <upre> gives the parameter on the preceding edge
90   Standard_EXPORT void SetStart (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre);
91   
92   //! <num> is the Intersection of both Edges
93   //! <upre> is the parameter on preceding edge, <ufol> on
94   //! following edge
95   Standard_EXPORT void SetInters (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre, const Standard_Real ufol);
96   
97   //! <num> cannot be said as same vertex
98   Standard_EXPORT void SetDisjoined (const Standard_Integer num);
99   
100   //! Returns True if analysis was performed, else returns False
101   Standard_EXPORT Standard_Boolean IsDone() const;
102   
103   //! Returns precision value used in analysis
104   Standard_EXPORT Standard_Real Precision() const;
105   
106   //! Returns the number of edges in analyzed wire (i.e. the
107   //! length of all arrays)
108   Standard_EXPORT Standard_Integer NbEdges() const;
109   
110   //! Returns analyzed wire
111   Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
112   
113   //! Returns the recorded status for a vertex
114   //! More detail by method Data
115   Standard_EXPORT Standard_Integer Status (const Standard_Integer num) const;
116   
117   Standard_EXPORT gp_XYZ Position (const Standard_Integer num) const;
118   
119   Standard_EXPORT Standard_Real UPrevious (const Standard_Integer num) const;
120   
121   Standard_EXPORT Standard_Real UFollowing (const Standard_Integer num) const;
122   
123   //! Returns the recorded status for a vertex
124   //! With its recorded position and parameters on both edges
125   //! These values are relevant regarding the status:
126   //! Status  Meaning    Position  Preceding   Following
127   //! 0       Same       no        no          no
128   //! 1       SameCoord  no        no          no
129   //! 2       Close      no        no          no
130   //! 3       End        yes       no          yes
131   //! 4       Start      yes       yes         no
132   //! 5       Inters     yes       yes         yes
133   //! -1      Disjoined  no        no          no
134   Standard_EXPORT Standard_Integer Data (const Standard_Integer num, gp_XYZ& pos, Standard_Real& upre, Standard_Real& ufol) const;
135   
136   //! For a given status, returns the rank of the vertex which
137   //! follows <num> and has the same status. 0 if no more
138   //! Acts as an iterator, starts on the first one
139   Standard_EXPORT Standard_Integer NextStatus (const Standard_Integer stat, const Standard_Integer num = 0) const;
140   
141   //! For a given criter, returns the rank of the vertex which
142   //! follows <num> and has the same status. 0 if no more
143   //! Acts as an iterator, starts on the first one
144   //! Criters are:
145   //! 0: same vertex (status 0)
146   //! 1: a solution exists (status >= 0)
147   //! 2: same coords (i.e. same params) (status 0 1 2)
148   //! 3: same coods but not same vertex (status 1 2)
149   //! 4: redefined coords (status 3 4 5)
150   //! -1: no solution (status -1)
151   Standard_EXPORT Standard_Integer NextCriter (const Standard_Integer crit, const Standard_Integer num = 0) const;
152
153
154
155
156 protected:
157
158
159
160
161
162 private:
163
164
165
166   Handle(ShapeExtend_WireData) myWire;
167   Handle(TColStd_HArray1OfInteger) myStat;
168   Handle(TColgp_HArray1OfXYZ) myPos;
169   Handle(TColStd_HArray1OfReal) myUPre;
170   Handle(TColStd_HArray1OfReal) myUFol;
171   Standard_Real myPreci;
172   Standard_Boolean myDone;
173
174
175 };
176
177
178
179
180
181
182
183 #endif // _ShapeAnalysis_WireVertex_HeaderFile