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
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.
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.
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.
22 #include <QANewBRepNaming_Box.ixx>
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>
30 //=======================================================================
31 //function : QANewBRepNaming_Box
33 //=======================================================================
35 QANewBRepNaming_Box::QANewBRepNaming_Box() {}
37 //=======================================================================
38 //function : QANewBRepNaming_Box
40 //=======================================================================
42 QANewBRepNaming_Box::QANewBRepNaming_Box(const TDF_Label& Label)
43 : QANewBRepNaming_TopNaming(Label) {}
45 //=======================================================================
48 //=======================================================================
50 void QANewBRepNaming_Box::Init(const TDF_Label& Label) {
52 Standard_NullObject::Raise("QANewBRepNaming_Box::Init The Result label is Null ...");
53 myResultLabel = Label;
56 //=======================================================================
59 //=======================================================================
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);
67 TopoDS_Face TopFace = MS.TopFace ();
68 TNaming_Builder TopFaceIns (Top ());
69 TopFaceIns.Generated (TopFace);
71 TopoDS_Face FrontFace = MS.FrontFace ();
72 TNaming_Builder FrontFaceIns (Front ());
73 FrontFaceIns.Generated (FrontFace);
75 TopoDS_Face RightFace = MS.RightFace ();
76 TNaming_Builder RightFaceIns (Right ());
77 RightFaceIns.Generated (RightFace);
79 TopoDS_Face BackFace = MS.BackFace ();
80 TNaming_Builder BackFaceIns (Back ());
81 BackFaceIns.Generated (BackFace);
83 TopoDS_Face LeftFace = MS.LeftFace ();
84 TNaming_Builder LeftFaceIns (Left ());
85 LeftFaceIns.Generated (LeftFace);
87 TNaming_Builder Builder (ResultLabel());
88 if (Type == QANewBRepNaming_SOLID) Builder.Generated (MS.Solid());
89 else if (Type == QANewBRepNaming_SHELL) Builder.Generated (MS.Shell());
92 cout<<"QANewBRepNaming_Box::Load(): Unexpected type of result"<<endl;
93 Builder.Generated (MS.Shape());
98 //=======================================================================
101 //=======================================================================
103 TDF_Label QANewBRepNaming_Box::Back () const {
104 return ResultLabel().FindChild(1,Standard_True);
107 //=======================================================================
110 //=======================================================================
112 TDF_Label QANewBRepNaming_Box::Front () const {
113 return ResultLabel().FindChild(2,Standard_True);
116 //=======================================================================
119 //=======================================================================
121 TDF_Label QANewBRepNaming_Box::Left () const {
122 return ResultLabel().FindChild(3,Standard_True);
125 //=======================================================================
128 //=======================================================================
130 TDF_Label QANewBRepNaming_Box::Right () const {
131 return ResultLabel().FindChild(4,Standard_True);
134 //=======================================================================
137 //=======================================================================
139 TDF_Label QANewBRepNaming_Box::Bottom () const {
140 return ResultLabel().FindChild(5,Standard_True);
143 //=======================================================================
146 //=======================================================================
148 TDF_Label QANewBRepNaming_Box::Top () const {
149 return ResultLabel().FindChild(6,Standard_True);