0030850: Visualization, OpenGl_Text - text within trihedron persistence jitters when...
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_ShellFaceSet.cxx
1 // Created on: 1993-06-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-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 #ifdef DRAW
18 #include <DBRep.hxx>
19 static TCollection_AsciiString PRODINS("dins ");
20 #endif
21
22
23 #include <TCollection_AsciiString.hxx>
24 #include <TopoDS.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <TopoDS_Solid.hxx>
27 #include <TopOpeBRepBuild_Builder.hxx>
28 #include <TopOpeBRepBuild_define.hxx>
29 #include <TopOpeBRepBuild_ShellFaceSet.hxx>
30
31 #ifdef OCCT_DEBUG
32 extern Standard_Boolean TopOpeBRepBuild_GettraceCHK();
33 #endif
34
35 //=======================================================================
36 //function : TopOpeBRepBuild_ShellFaceSet
37 //purpose  : 
38 //=======================================================================
39
40 TopOpeBRepBuild_ShellFaceSet::TopOpeBRepBuild_ShellFaceSet() :
41 TopOpeBRepBuild_ShapeSet(TopAbs_EDGE)
42 {
43 #ifdef OCCT_DEBUG
44   myDEBName = "SFS";
45 #endif
46 }
47
48 //=======================================================================
49 //function : TopOpeBRepBuild_ShellFaceSet
50 //purpose  : 
51 //=======================================================================
52
53 TopOpeBRepBuild_ShellFaceSet::TopOpeBRepBuild_ShellFaceSet
54 #ifdef OCCT_DEBUG
55 (const TopoDS_Shape& S,const Standard_Address A) : // DEB
56 #else
57 (const TopoDS_Shape& S,const Standard_Address) : // DEB
58 #endif
59 TopOpeBRepBuild_ShapeSet(TopAbs_EDGE)
60 {
61   mySolid = TopoDS::Solid(S);
62
63 #ifdef OCCT_DEBUG
64   myDEBName = "SFS";
65   if (A != NULL) {
66     TopOpeBRepBuild_Builder* pB = ((TopOpeBRepBuild_Builder*)((void*)A));
67     myDEBNumber = pB->GdumpSHASETindex();
68     Standard_Integer iS; Standard_Boolean tSPS = pB->GtraceSPS(S,iS);
69     if(tSPS){cout<<"creation SFS "<<myDEBNumber<<" on ";}
70     if(tSPS){pB->GdumpSHA(S,NULL);cout<<endl;}
71   }
72
73   if (TopOpeBRepBuild_GettraceCHK() && !myCheckShape) {
74     DumpName(cout,"no checkshape in creation of ");cout<<endl;
75   }
76 #endif
77 }
78
79 //=======================================================================
80 //function : AddShape
81 //purpose  : 
82 //=======================================================================
83 void TopOpeBRepBuild_ShellFaceSet::AddShape(const TopoDS_Shape& S)
84 {
85   TopOpeBRepBuild_ShapeSet::AddShape(S);
86 }
87
88 //=======================================================================
89 //function : AddStartElement
90 //purpose  : 
91 //=======================================================================
92 void TopOpeBRepBuild_ShellFaceSet::AddStartElement(const TopoDS_Shape& S)
93 {
94   TopOpeBRepBuild_ShapeSet::ProcessAddStartElement(S);
95 }
96
97 //=======================================================================
98 //function : AddElement
99 //purpose  : 
100 //=======================================================================
101 void TopOpeBRepBuild_ShellFaceSet::AddElement(const TopoDS_Shape& S)
102 {
103   TopOpeBRepBuild_ShapeSet::AddElement(S);
104 }
105
106 //=======================================================================
107 //function : Solid
108 //purpose  : 
109 //=======================================================================
110
111 const TopoDS_Solid& TopOpeBRepBuild_ShellFaceSet::Solid() const 
112 {
113   return mySolid;
114 }
115
116 //=======================================================================
117 //function : DumpSS
118 //purpose  : 
119 //=======================================================================
120
121 void TopOpeBRepBuild_ShellFaceSet::DumpSS()
122 {
123 #ifdef OCCT_DEBUG
124   TopOpeBRepBuild_ShapeSet::DumpSS();
125 #endif
126 }
127
128 //=======================================================================
129 //function : SName
130 //purpose  : 
131 //=======================================================================
132 #ifdef DRAW
133 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SName(const TopoDS_Shape& S,
134                                                             const TCollection_AsciiString& sb,
135                                                             const TCollection_AsciiString& sa) const
136 {
137   TCollection_AsciiString str=sb;
138
139   str=str+TopOpeBRepBuild_ShapeSet::SName(S);
140   str=str+sa;
141   DBRep::Set(str.ToCString(),S);
142
143   return str;
144 }
145 #else
146 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SName(const TopoDS_Shape&,
147                                                             const TCollection_AsciiString& sb,
148                                                             const TCollection_AsciiString&) const
149 {
150   TCollection_AsciiString str=sb;
151   return str;
152 }
153 #endif
154
155 //=======================================================================
156 //function : SNameori
157 //purpose  : 
158 //=======================================================================
159 #ifdef DRAW
160 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SNameori(const TopoDS_Shape& S,
161                                                                const TCollection_AsciiString& sb,
162                                                                const TCollection_AsciiString& sa) const
163 #else
164 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SNameori(const TopoDS_Shape&,
165                                                                const TCollection_AsciiString& sb,
166                                                                const TCollection_AsciiString&) const
167 #endif
168 {
169   TCollection_AsciiString str=sb;
170 #ifdef DRAW
171   str=str+TopOpeBRepBuild_ShapeSet::SNameori(S);
172   if ( S.ShapeType() == TopAbs_FACE ) {
173     const TopoDS_Shape& F = TopoDS::Face(S);
174     DBRep::Set(str.ToCString(),S);
175   }
176 #endif
177   return str;
178 }
179
180 //=======================================================================
181 //function : SName
182 //purpose  : 
183 //=======================================================================
184 #ifdef DRAW
185 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SName(const TopTools_ListOfShape& L,
186                                                             const TCollection_AsciiString& sb,
187                                                             const TCollection_AsciiString& sa) const
188 {
189   TCollection_AsciiString str;
190
191   for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next()) str=str+sb+SName(it.Value())+sa+" ";
192
193   return str;
194 }
195 #else
196 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SName(const TopTools_ListOfShape&,
197                                                             const TCollection_AsciiString&,
198                                                             const TCollection_AsciiString&) const
199 {
200   TCollection_AsciiString str;
201   return str;
202 }
203 #endif
204
205 //=======================================================================
206 //function : SNameori
207 //purpose  : 
208 //=======================================================================
209 TCollection_AsciiString TopOpeBRepBuild_ShellFaceSet::SNameori(const TopTools_ListOfShape& /*L*/,
210                                                                const TCollection_AsciiString& /*sb*/,
211                                                                const TCollection_AsciiString& /*sa*/) const
212 {
213   TCollection_AsciiString str;
214 #ifdef DRAW
215   for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next()) str=str+sb+SNameori(it.Value())+sa+" ";
216 #endif
217   return str;
218 }