42cf5bc1 |
1 | // Created on: 1994-11-16 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1994-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 _IGESSolid_TopoBuilder_HeaderFile |
18 | #define _IGESSolid_TopoBuilder_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Integer.hxx> |
25 | #include <TColStd_HSequenceOfTransient.hxx> |
26 | #include <TColStd_HSequenceOfInteger.hxx> |
27 | #include <TColgp_HSequenceOfXYZ.hxx> |
28 | class IGESSolid_ManifoldSolid; |
29 | class IGESSolid_Shell; |
30 | class IGESSolid_Face; |
31 | class IGESData_IGESEntity; |
32 | class IGESSolid_Loop; |
33 | class IGESSolid_EdgeList; |
34 | class IGESSolid_VertexList; |
35 | class Standard_DomainError; |
36 | class gp_XYZ; |
37 | |
38 | |
39 | //! This class manages the creation of an IGES Topologic entity |
40 | //! (BREP : ManifoldSolid, Shell, Face) |
41 | //! This includes definiting of Vertex and Edge Lists, |
42 | //! building of Edges and Loops |
43 | class IGESSolid_TopoBuilder |
44 | { |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
49 | |
50 | //! Creates an empty TopoBuilder |
51 | //! This creates also a unique VertexList and a unique EdgeList, |
52 | //! empty, but which can be referenced from starting |
53 | Standard_EXPORT IGESSolid_TopoBuilder(); |
54 | |
55 | //! Resets the TopoBuilder for an entirely new operation |
56 | //! (with a new EdgeList, a new VertexList, new Shells, ...) |
57 | Standard_EXPORT void Clear(); |
58 | |
59 | //! Adds a Vertex to the VertexList |
60 | Standard_EXPORT void AddVertex (const gp_XYZ& val); |
61 | |
62 | //! Returns the count of already recorded Vertices |
63 | Standard_EXPORT Standard_Integer NbVertices() const; |
64 | |
65 | //! Returns a Vertex, given its rank |
66 | Standard_EXPORT const gp_XYZ& Vertex (const Standard_Integer num) const; |
67 | |
68 | //! Returns the VertexList. It can be referenced, but it remains |
69 | //! empty until call to EndShell or EndSolid |
70 | Standard_EXPORT Handle(IGESSolid_VertexList) VertexList() const; |
71 | |
72 | //! Adds an Edge (3D) to the EdgeList, defined by a Curve and |
73 | //! two number of Vertex, for start and end |
74 | Standard_EXPORT void AddEdge (const Handle(IGESData_IGESEntity)& curve, const Standard_Integer vstart, const Standard_Integer vend); |
75 | |
76 | //! Returns the count of recorded Edges (3D) |
77 | Standard_EXPORT Standard_Integer NbEdges() const; |
78 | |
79 | //! Returns the definition of an Edge (3D) given its rank |
80 | Standard_EXPORT void Edge (const Standard_Integer num, Handle(IGESData_IGESEntity)& curve, Standard_Integer& vstart, Standard_Integer& vend) const; |
81 | |
82 | //! Returns the EdgeList. It can be referenced, but it remains |
83 | //! empty until call to EndShell or EndSolid |
84 | Standard_EXPORT Handle(IGESSolid_EdgeList) EdgeList() const; |
85 | |
86 | //! Begins the definition of a new Loop : it is the Current Loop |
87 | //! All Edges (UV) defined by MakeEdge/EndEdge will be added in it |
88 | //! The Loop can then be referenced but is empty. It will be |
89 | //! filled with its Edges(UV) by EndLoop (from SetOuter/AddInner) |
90 | Standard_EXPORT void MakeLoop(); |
91 | |
92 | //! Defines an Edge(UV), to be added in the current Loop by EndEdge |
93 | //! <edgetype> gives the type of the edge |
94 | //! <edge3d> identifies the Edge(3D) used as support |
95 | //! The EdgeList is allways the current one |
96 | //! <orientation gives the orientation flag |
97 | //! It is then necessary to : |
98 | //! - give the parametric curves |
99 | //! - close the definition of this edge(UV) by EndEdge, else |
100 | //! the next call to MakeEdge will erase this one |
101 | Standard_EXPORT void MakeEdge (const Standard_Integer edgetype, const Standard_Integer edge3d, const Standard_Integer orientation); |
102 | |
103 | //! Adds a Parametric Curve (UV) to the current Edge(UV) |
104 | Standard_EXPORT void AddCurveUV (const Handle(IGESData_IGESEntity)& curve, const Standard_Integer iso); |
105 | |
106 | //! Closes the definition of an Edge(UV) and adds it to the |
107 | //! current Loop |
108 | Standard_EXPORT void EndEdge(); |
109 | |
110 | //! Begins the definition of a new Face, on a surface |
111 | //! All Loops defined by MakeLoop will be added in it, according |
112 | //! the closing call : SetOuter for the Outer Loop (by default, |
113 | //! if SetOuter is not called, no OuterLoop is defined); |
114 | //! AddInner for the list of Inner Loops (there can be none) |
115 | Standard_EXPORT void MakeFace (const Handle(IGESData_IGESEntity)& surface); |
116 | |
117 | //! Closes the current Loop and sets it Loop as Outer Loop. If no |
118 | //! current Loop has yet been defined, does nothing. |
119 | Standard_EXPORT void SetOuter(); |
120 | |
121 | //! Closes the current Loop and adds it to the list of Inner Loops |
122 | //! for the current Face |
123 | Standard_EXPORT void AddInner(); |
124 | |
125 | //! Closes the definition of the current Face, fills it and adds |
126 | //! it to the current Shell with an orientation flag (0/1) |
127 | Standard_EXPORT void EndFace (const Standard_Integer orientation); |
128 | |
129 | //! Begins the definition of a new Shell (either Simple or in a |
130 | //! Solid) |
131 | Standard_EXPORT void MakeShell(); |
132 | |
133 | //! Closes the whole definition as that of a simple Shell |
134 | Standard_EXPORT void EndSimpleShell(); |
135 | |
136 | //! Closes the definition of the current Shell as for the Main |
137 | //! Shell of a Solid, with an orientation flag (0/1) |
138 | Standard_EXPORT void SetMainShell (const Standard_Integer orientation); |
139 | |
140 | //! Closes the definition of the current Shell and adds it to the |
141 | //! list of Void Shells of a Solid, with an orientation flag (0/1) |
142 | Standard_EXPORT void AddVoidShell (const Standard_Integer orientation); |
143 | |
144 | //! Closes the whole definition as that of a ManifoldSolid |
145 | //! Its call is exclusive from that of EndSimpleShell |
146 | Standard_EXPORT void EndSolid(); |
147 | |
148 | //! Returns the current Shell. The current Shell is created empty |
149 | //! by MakeShell and filled by EndShell |
150 | Standard_EXPORT Handle(IGESSolid_Shell) Shell() const; |
151 | |
152 | //! Returns the current ManifoldSolid. It is created empty by |
153 | //! Create and filled by EndSolid |
154 | Standard_EXPORT Handle(IGESSolid_ManifoldSolid) Solid() const; |
155 | |
156 | |
157 | |
158 | |
159 | protected: |
160 | |
161 | |
162 | //! Closes the definition of Vertex and Edge Lists |
163 | //! Warning : Called only by EndSimpleShell and EndSolid |
164 | Standard_EXPORT void EndLists(); |
165 | |
166 | //! Closes the definition of a Loop and fills it |
167 | //! Warning : EndLoop should not be called directly but through |
168 | //! SetOuter or AddInner, which work on the current Face |
169 | Standard_EXPORT void EndLoop(); |
170 | |
171 | //! Closes the definition of the current Shell |
172 | //! Warning : EndShell should not be called directly but through |
173 | //! EndSimpleShell (for a simple Shell), SetMainShell (for main |
174 | //! Shell of a Solid) or AddVoidShell (to a Solid) |
175 | Standard_EXPORT void EndShell(); |
176 | |
177 | |
178 | |
179 | |
180 | private: |
181 | |
182 | |
183 | |
184 | Handle(IGESSolid_ManifoldSolid) thesolid; |
185 | Handle(IGESSolid_Shell) themains; |
dde68833 |
186 | Standard_Boolean themflag; |
42cf5bc1 |
187 | Handle(TColStd_HSequenceOfTransient) thevoids; |
188 | Handle(TColStd_HSequenceOfInteger) thevflag; |
189 | Handle(IGESSolid_Shell) theshell; |
190 | Handle(TColStd_HSequenceOfTransient) thefaces; |
191 | Handle(TColStd_HSequenceOfInteger) thefflag; |
192 | Handle(IGESSolid_Face) theface; |
193 | Handle(IGESData_IGESEntity) thesurf; |
dde68833 |
194 | Standard_Boolean theouter; |
42cf5bc1 |
195 | Handle(TColStd_HSequenceOfTransient) theinner; |
196 | Handle(IGESSolid_Loop) theloop; |
197 | Handle(TColStd_HSequenceOfInteger) theetype; |
198 | Handle(TColStd_HSequenceOfInteger) thee3d; |
199 | Handle(TColStd_HSequenceOfInteger) theeflag; |
200 | Handle(TColStd_HSequenceOfTransient) theeuv; |
201 | Handle(TColStd_HSequenceOfInteger) theisol; |
202 | Handle(TColStd_HSequenceOfTransient) thecuruv; |
203 | Handle(TColStd_HSequenceOfTransient) theiso; |
204 | Handle(IGESSolid_EdgeList) theedgel; |
205 | Handle(TColStd_HSequenceOfTransient) thecur3d; |
206 | Handle(TColStd_HSequenceOfInteger) thevstar; |
207 | Handle(TColStd_HSequenceOfInteger) thevend; |
208 | Handle(IGESSolid_VertexList) thevertl; |
209 | Handle(TColgp_HSequenceOfXYZ) thepoint; |
210 | |
211 | |
212 | }; |
213 | |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | #endif // _IGESSolid_TopoBuilder_HeaderFile |