1 // Created on: 2000-10-31
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <BRepPrimAPI_MakeCylinder.hxx>
18 #include <QANewBRepNaming_Cylinder.hxx>
19 #include <Standard_NullObject.hxx>
20 #include <TDF_Label.hxx>
21 #include <TNaming_Builder.hxx>
22 #include <TopoDS_Solid.hxx>
25 #include <TDataStd_Name.hxx>
28 //=======================================================================
29 //function : QANewBRepNaming_Cylinder
31 //=======================================================================
33 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder() {}
35 //=======================================================================
36 //function : QANewBRepNaming_Cylinder
38 //=======================================================================
40 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder(const TDF_Label& ResultLabel):
41 QANewBRepNaming_TopNaming(ResultLabel) {}
43 //=======================================================================
46 //=======================================================================
48 void QANewBRepNaming_Cylinder::Init(const TDF_Label& ResultLabel) {
49 if(ResultLabel.IsNull())
50 throw Standard_NullObject("QANewBRepNaming_Cylinder::Init The Result label is Null ...");
51 myResultLabel = ResultLabel;
54 //=======================================================================
57 //=======================================================================
59 TDF_Label QANewBRepNaming_Cylinder::Bottom() const {
61 TDataStd_Name::Set(ResultLabel().FindChild(1, Standard_True), "Bottom");
63 return ResultLabel().FindChild(1, Standard_True);
66 //=======================================================================
69 //=======================================================================
71 TDF_Label QANewBRepNaming_Cylinder::Top() const {
73 TDataStd_Name::Set(ResultLabel().FindChild(2, Standard_True), "Top");
75 return ResultLabel().FindChild(2, Standard_True);
78 //=======================================================================
81 //=======================================================================
83 TDF_Label QANewBRepNaming_Cylinder::Lateral() const {
85 TDataStd_Name::Set(ResultLabel().FindChild(3, Standard_True), "Lateral");
87 return ResultLabel().FindChild(3, Standard_True);
90 //=======================================================================
91 //function : StartSide
93 //=======================================================================
95 TDF_Label QANewBRepNaming_Cylinder::StartSide() const {
97 TDataStd_Name::Set(ResultLabel().FindChild(4, Standard_True), "StartSide");
99 return ResultLabel().FindChild(4, Standard_True);
102 //=======================================================================
105 //=======================================================================
107 TDF_Label QANewBRepNaming_Cylinder::EndSide() const {
109 TDataStd_Name::Set(ResultLabel().FindChild(5, Standard_True), "EndSide");
111 return ResultLabel().FindChild(5, Standard_True);
114 //=======================================================================
115 //function : Load (Cylinder)
117 //=======================================================================
119 void QANewBRepNaming_Cylinder::Load (BRepPrimAPI_MakeCylinder& mkCylinder,
120 const QANewBRepNaming_TypeOfPrimitive3D Type) const
122 BRepPrim_Cylinder& S = mkCylinder.Cylinder();
125 TopoDS_Face BottomFace = S.BottomFace();
126 TNaming_Builder BottomFaceIns(Bottom());
127 BottomFaceIns.Generated(BottomFace);
131 TopoDS_Face TopFace = S.TopFace();
132 TNaming_Builder TopFaceIns(Top());
133 TopFaceIns.Generated(TopFace);
136 TopoDS_Face LateralFace = S.LateralFace();
137 TNaming_Builder LateralFaceIns(Lateral());
138 LateralFaceIns.Generated(LateralFace);
141 TopoDS_Face StartFace = S.StartFace();
142 TNaming_Builder StartFaceIns(StartSide());
143 StartFaceIns.Generated(StartFace);
144 TopoDS_Face EndFace = S.EndFace();
145 TNaming_Builder EndFaceIns(EndSide());
146 EndFaceIns.Generated(EndFace);
149 TNaming_Builder Builder (ResultLabel());
150 if (Type == QANewBRepNaming_SOLID) Builder.Generated (mkCylinder.Solid());
151 else if (Type == QANewBRepNaming_SHELL) Builder.Generated (mkCylinder.Shell());
154 cout<<"QANewBRepNaming_Cylinder::Load(): Unexpected type of result"<<endl;
155 Builder.Generated (mkCylinder.Shape());