Corrections for tests after integration of 2012-12-07
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_Box.cxx
1 // Created on: 1999-09-24
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22 #include <QANewBRepNaming_Box.ixx>
23
24 #include <QANewBRepNaming_Loader.hxx>
25 #include <TNaming_Builder.hxx>
26 #include <TDF_Label.hxx>
27 #include <Standard_NullObject.hxx>
28 #include <TopoDS_Solid.hxx>
29
30 //=======================================================================
31 //function : QANewBRepNaming_Box
32 //purpose  : 
33 //=======================================================================
34
35 QANewBRepNaming_Box::QANewBRepNaming_Box() {}
36
37 //=======================================================================
38 //function : QANewBRepNaming_Box
39 //purpose  : 
40 //=======================================================================
41
42 QANewBRepNaming_Box::QANewBRepNaming_Box(const TDF_Label& Label)
43      : QANewBRepNaming_TopNaming(Label) {}
44
45 //=======================================================================
46 //function : Init
47 //purpose  : 
48 //=======================================================================
49
50 void QANewBRepNaming_Box::Init(const TDF_Label& Label) {
51   if(Label.IsNull())
52     Standard_NullObject::Raise("QANewBRepNaming_Box::Init The Result label is Null ..."); 
53   myResultLabel = Label;
54 }  
55
56 //=======================================================================
57 //function : Load
58 //purpose  : 
59 //=======================================================================
60
61 void QANewBRepNaming_Box::Load (BRepPrimAPI_MakeBox& MS, const QANewBRepNaming_TypeOfPrimitive3D Type) const {
62   //Load the faces of the box :
63   TopoDS_Face BottomFace = MS.BottomFace ();
64   TNaming_Builder BottomFaceIns (Bottom ()); 
65   BottomFaceIns.Generated (BottomFace);
66  
67   TopoDS_Face TopFace = MS.TopFace ();
68   TNaming_Builder TopFaceIns (Top ()); 
69   TopFaceIns.Generated (TopFace); 
70
71   TopoDS_Face FrontFace = MS.FrontFace ();
72   TNaming_Builder FrontFaceIns (Front ()); 
73   FrontFaceIns.Generated (FrontFace); 
74
75   TopoDS_Face RightFace = MS.RightFace ();
76   TNaming_Builder RightFaceIns (Right ()); 
77   RightFaceIns.Generated (RightFace); 
78
79   TopoDS_Face BackFace = MS.BackFace ();
80   TNaming_Builder BackFaceIns (Back ()); 
81   BackFaceIns.Generated (BackFace); 
82
83   TopoDS_Face LeftFace = MS.LeftFace ();
84   TNaming_Builder LeftFaceIns (Left ()); 
85   LeftFaceIns.Generated (LeftFace); 
86
87   TNaming_Builder Builder (ResultLabel());
88   if (Type == QANewBRepNaming_SOLID) Builder.Generated (MS.Solid());
89   else if (Type == QANewBRepNaming_SHELL) Builder.Generated (MS.Shell());
90   else {
91 #ifdef MDTV_DEB
92     cout<<"QANewBRepNaming_Box::Load(): Unexpected type of result"<<endl;
93     Builder.Generated (MS.Shape());
94 #endif
95   }
96 }
97
98 //=======================================================================
99 //function : Back
100 //purpose  : 
101 //=======================================================================
102
103 TDF_Label QANewBRepNaming_Box::Back () const {
104   return ResultLabel().FindChild(1,Standard_True); 
105 }
106
107 //=======================================================================
108 //function : Front
109 //purpose  : 
110 //=======================================================================
111
112 TDF_Label QANewBRepNaming_Box::Front () const {
113   return ResultLabel().FindChild(2,Standard_True); 
114 }
115
116 //=======================================================================
117 //function : Left
118 //purpose  : 
119 //=======================================================================
120
121 TDF_Label QANewBRepNaming_Box::Left () const {
122   return ResultLabel().FindChild(3,Standard_True); 
123 }
124
125 //=======================================================================
126 //function : Right
127 //purpose  : 
128 //=======================================================================
129
130 TDF_Label QANewBRepNaming_Box::Right () const {
131   return ResultLabel().FindChild(4,Standard_True); 
132 }
133
134 //=======================================================================
135 //function : Bottom
136 //purpose  : 
137 //=======================================================================
138
139 TDF_Label QANewBRepNaming_Box::Bottom () const {
140   return ResultLabel().FindChild(5,Standard_True); 
141 }
142
143 //=======================================================================
144 //function : Top
145 //purpose  : 
146 //=======================================================================
147
148 TDF_Label QANewBRepNaming_Box::Top () const {
149   return ResultLabel().FindChild(6,Standard_True); 
150 }
151