1 // Created on: 1999-09-24
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRepPrimAPI_MakeBox.hxx>
19 #include <QANewBRepNaming_Box.hxx>
20 #include <QANewBRepNaming_Loader.hxx>
21 #include <Standard_NullObject.hxx>
22 #include <TDF_Label.hxx>
23 #include <TNaming_Builder.hxx>
24 #include <TopoDS_Solid.hxx>
26 //=======================================================================
27 //function : QANewBRepNaming_Box
29 //=======================================================================
30 QANewBRepNaming_Box::QANewBRepNaming_Box() {}
32 //=======================================================================
33 //function : QANewBRepNaming_Box
35 //=======================================================================
37 QANewBRepNaming_Box::QANewBRepNaming_Box(const TDF_Label& Label)
38 : QANewBRepNaming_TopNaming(Label) {}
40 //=======================================================================
43 //=======================================================================
45 void QANewBRepNaming_Box::Init(const TDF_Label& Label) {
47 throw Standard_NullObject("QANewBRepNaming_Box::Init The Result label is Null ...");
48 myResultLabel = Label;
51 //=======================================================================
54 //=======================================================================
56 void QANewBRepNaming_Box::Load (BRepPrimAPI_MakeBox& MS, const QANewBRepNaming_TypeOfPrimitive3D Type) const {
57 //Load the faces of the box :
58 TopoDS_Face BottomFace = MS.BottomFace ();
59 TNaming_Builder BottomFaceIns (Bottom ());
60 BottomFaceIns.Generated (BottomFace);
62 TopoDS_Face TopFace = MS.TopFace ();
63 TNaming_Builder TopFaceIns (Top ());
64 TopFaceIns.Generated (TopFace);
66 TopoDS_Face FrontFace = MS.FrontFace ();
67 TNaming_Builder FrontFaceIns (Front ());
68 FrontFaceIns.Generated (FrontFace);
70 TopoDS_Face RightFace = MS.RightFace ();
71 TNaming_Builder RightFaceIns (Right ());
72 RightFaceIns.Generated (RightFace);
74 TopoDS_Face BackFace = MS.BackFace ();
75 TNaming_Builder BackFaceIns (Back ());
76 BackFaceIns.Generated (BackFace);
78 TopoDS_Face LeftFace = MS.LeftFace ();
79 TNaming_Builder LeftFaceIns (Left ());
80 LeftFaceIns.Generated (LeftFace);
82 TNaming_Builder Builder (ResultLabel());
83 if (Type == QANewBRepNaming_SOLID) Builder.Generated (MS.Solid());
84 else if (Type == QANewBRepNaming_SHELL) Builder.Generated (MS.Shell());
87 cout<<"QANewBRepNaming_Box::Load(): Unexpected type of result"<<endl;
88 Builder.Generated (MS.Shape());
93 //=======================================================================
96 //=======================================================================
98 TDF_Label QANewBRepNaming_Box::Back () const {
99 return ResultLabel().FindChild(1,Standard_True);
102 //=======================================================================
105 //=======================================================================
107 TDF_Label QANewBRepNaming_Box::Front () const {
108 return ResultLabel().FindChild(2,Standard_True);
111 //=======================================================================
114 //=======================================================================
116 TDF_Label QANewBRepNaming_Box::Left () const {
117 return ResultLabel().FindChild(3,Standard_True);
120 //=======================================================================
123 //=======================================================================
125 TDF_Label QANewBRepNaming_Box::Right () const {
126 return ResultLabel().FindChild(4,Standard_True);
129 //=======================================================================
132 //=======================================================================
134 TDF_Label QANewBRepNaming_Box::Bottom () const {
135 return ResultLabel().FindChild(5,Standard_True);
138 //=======================================================================
141 //=======================================================================
143 TDF_Label QANewBRepNaming_Box::Top () const {
144 return ResultLabel().FindChild(6,Standard_True);