0025418: Debug output to be limited to OCC development environment
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_Cylinder.cxx
1 // Created on: 2000-10-31
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <QANewBRepNaming_Cylinder.ixx>
17 #include <TNaming_Builder.hxx>
18 #include <Standard_NullObject.hxx>
19 #include <TopoDS_Solid.hxx>
20 #ifdef OCCT_DEBUG
21 #include <TDataStd_Name.hxx>
22 #endif
23
24 //=======================================================================
25 //function : QANewBRepNaming_Cylinder
26 //purpose  : 
27 //=======================================================================
28
29 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder() {}
30
31 //=======================================================================
32 //function : QANewBRepNaming_Cylinder
33 //purpose  : 
34 //=======================================================================
35
36 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder(const TDF_Label& ResultLabel):
37        QANewBRepNaming_TopNaming(ResultLabel) {}
38
39 //=======================================================================
40 //function : Init
41 //purpose  : 
42 //=======================================================================
43
44 void QANewBRepNaming_Cylinder::Init(const TDF_Label& ResultLabel) {
45   if(ResultLabel.IsNull())
46     Standard_NullObject::Raise("QANewBRepNaming_Cylinder::Init The Result label is Null ..."); 
47   myResultLabel = ResultLabel;
48 }    
49
50 //=======================================================================
51 //function : Bottom
52 //purpose  : 
53 //=======================================================================
54
55 TDF_Label QANewBRepNaming_Cylinder::Bottom() const {
56 #ifdef OCCT_DEBUG
57   TDataStd_Name::Set(ResultLabel().FindChild(1, Standard_True), "Bottom");
58 #endif
59   return ResultLabel().FindChild(1, Standard_True);
60 }
61
62 //=======================================================================
63 //function : Top
64 //purpose  : 
65 //=======================================================================
66
67 TDF_Label QANewBRepNaming_Cylinder::Top() const {
68 #ifdef OCCT_DEBUG
69   TDataStd_Name::Set(ResultLabel().FindChild(2, Standard_True), "Top");
70 #endif
71   return ResultLabel().FindChild(2, Standard_True);
72 }
73
74 //=======================================================================
75 //function : Lateral
76 //purpose  : 
77 //=======================================================================
78
79 TDF_Label QANewBRepNaming_Cylinder::Lateral() const {
80 #ifdef OCCT_DEBUG
81   TDataStd_Name::Set(ResultLabel().FindChild(3, Standard_True), "Lateral");
82 #endif
83   return ResultLabel().FindChild(3, Standard_True);
84 }
85
86 //=======================================================================
87 //function : StartSide
88 //purpose  : 
89 //=======================================================================
90
91 TDF_Label QANewBRepNaming_Cylinder::StartSide() const {
92 #ifdef OCCT_DEBUG
93   TDataStd_Name::Set(ResultLabel().FindChild(4, Standard_True), "StartSide");
94 #endif
95   return ResultLabel().FindChild(4, Standard_True);
96 }
97
98 //=======================================================================
99 //function : EndSide
100 //purpose  : 
101 //=======================================================================
102
103 TDF_Label QANewBRepNaming_Cylinder::EndSide() const {
104 #ifdef OCCT_DEBUG
105   TDataStd_Name::Set(ResultLabel().FindChild(5, Standard_True), "EndSide");
106 #endif
107   return ResultLabel().FindChild(5, Standard_True);
108 }
109
110 //=======================================================================
111 //function : Load (Cylinder)
112 //purpose  : 
113 //=======================================================================
114
115 void QANewBRepNaming_Cylinder::Load (BRepPrimAPI_MakeCylinder& mkCylinder,
116                                 const QANewBRepNaming_TypeOfPrimitive3D Type) const
117 {
118   BRepPrim_Cylinder& S = mkCylinder.Cylinder();
119
120   if (S.HasBottom()) {
121     TopoDS_Face BottomFace = S.BottomFace();
122     TNaming_Builder BottomFaceIns(Bottom()); 
123     BottomFaceIns.Generated(BottomFace); 
124   }
125
126   if (S.HasTop()) {
127     TopoDS_Face TopFace = S.TopFace();
128     TNaming_Builder TopFaceIns(Top()); 
129     TopFaceIns.Generated(TopFace); 
130   }
131
132   TopoDS_Face LateralFace = S.LateralFace();
133   TNaming_Builder LateralFaceIns(Lateral()); 
134   LateralFaceIns.Generated(LateralFace); 
135
136   if (S.HasSides()) {
137     TopoDS_Face StartFace = S.StartFace();
138     TNaming_Builder StartFaceIns(StartSide()); 
139     StartFaceIns.Generated(StartFace); 
140     TopoDS_Face EndFace = S.EndFace();
141     TNaming_Builder EndFaceIns(EndSide()); 
142     EndFaceIns.Generated(EndFace); 
143   }
144
145   TNaming_Builder Builder (ResultLabel());
146   if (Type == QANewBRepNaming_SOLID) Builder.Generated (mkCylinder.Solid());
147   else if (Type == QANewBRepNaming_SHELL) Builder.Generated (mkCylinder.Shell());
148   else {
149 #ifdef OCCT_DEBUG
150     cout<<"QANewBRepNaming_Cylinder::Load(): Unexpected type of result"<<endl;
151     Builder.Generated (mkCylinder.Shape());
152 #endif
153   }
154 }
155