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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _ShapeAnalysis_WireVertex_HeaderFile
18 #define _ShapeAnalysis_WireVertex_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
34 // resolve name collisions with X11 headers
39 //! Analyzes and records status of vertices in a Wire
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 informations can be used to fix problems
45 class ShapeAnalysis_WireVertex
53 Standard_EXPORT ShapeAnalysis_WireVertex();
55 Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
57 Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
59 Standard_EXPORT void Load (const TopoDS_Wire& wire);
61 Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
63 //! Sets the precision for work
64 //! Analysing: for each Vertex, comparison between the end of the
65 //! preceeding 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 preceeding one, <num+1> is the following one
69 Standard_EXPORT void SetPrecision (const Standard_Real preci);
71 Standard_EXPORT void Analyze();
73 //! Records status "Same Vertex" (logically) on Vertex <num>
74 Standard_EXPORT void SetSameVertex (const Standard_Integer num);
76 //! Records status "Same Coords" (at the Vertices Tolerances)
77 Standard_EXPORT void SetSameCoords (const Standard_Integer num);
79 //! Records status "Close Coords" (at the Precision of <me>)
80 Standard_EXPORT void SetClose (const Standard_Integer num);
82 //! <num> is the End of preceeding 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);
87 //! <num> is the Start of following Edge, its projection on the
88 //! preceeding one lies on it at the Precision of <me>
89 //! <upre> gives the parameter on the preceeding edge
90 Standard_EXPORT void SetStart (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre);
92 //! <num> is the Intersection of both Edges
93 //! <upre> is the parameter on preceeding edge, <ufol> on
95 Standard_EXPORT void SetInters (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre, const Standard_Real ufol);
97 //! <num> cannot be said as same vertex
98 Standard_EXPORT void SetDisjoined (const Standard_Integer num);
100 //! Returns True if analysis was performed, else returns False
101 Standard_EXPORT Standard_Boolean IsDone() const;
103 //! Returns precision value used in analysis
104 Standard_EXPORT Standard_Real Precision() const;
106 //! Returns the number of edges in analyzed wire (i.e. the
107 //! length of all arrays)
108 Standard_EXPORT Standard_Integer NbEdges() const;
110 //! Returns analyzed wire
111 Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
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;
117 Standard_EXPORT gp_XYZ Position (const Standard_Integer num) const;
119 Standard_EXPORT Standard_Real UPrevious (const Standard_Integer num) const;
121 Standard_EXPORT Standard_Real UFollowing (const Standard_Integer num) const;
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 Preceeding Following
128 //! 1 SameCoord no no no
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;
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;
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
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;
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;
183 #endif // _ShapeAnalysis_WireVertex_HeaderFile