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.
16 #include <QANewBRepNaming_Cylinder.ixx>
17 #include <TNaming_Builder.hxx>
18 #include <Standard_NullObject.hxx>
19 #include <TopoDS_Solid.hxx>
21 #include <TDataStd_Name.hxx>
24 //=======================================================================
25 //function : QANewBRepNaming_Cylinder
27 //=======================================================================
29 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder() {}
31 //=======================================================================
32 //function : QANewBRepNaming_Cylinder
34 //=======================================================================
36 QANewBRepNaming_Cylinder::QANewBRepNaming_Cylinder(const TDF_Label& ResultLabel):
37 QANewBRepNaming_TopNaming(ResultLabel) {}
39 //=======================================================================
42 //=======================================================================
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;
50 //=======================================================================
53 //=======================================================================
55 TDF_Label QANewBRepNaming_Cylinder::Bottom() const {
57 TDataStd_Name::Set(ResultLabel().FindChild(1, Standard_True), "Bottom");
59 return ResultLabel().FindChild(1, Standard_True);
62 //=======================================================================
65 //=======================================================================
67 TDF_Label QANewBRepNaming_Cylinder::Top() const {
69 TDataStd_Name::Set(ResultLabel().FindChild(2, Standard_True), "Top");
71 return ResultLabel().FindChild(2, Standard_True);
74 //=======================================================================
77 //=======================================================================
79 TDF_Label QANewBRepNaming_Cylinder::Lateral() const {
81 TDataStd_Name::Set(ResultLabel().FindChild(3, Standard_True), "Lateral");
83 return ResultLabel().FindChild(3, Standard_True);
86 //=======================================================================
87 //function : StartSide
89 //=======================================================================
91 TDF_Label QANewBRepNaming_Cylinder::StartSide() const {
93 TDataStd_Name::Set(ResultLabel().FindChild(4, Standard_True), "StartSide");
95 return ResultLabel().FindChild(4, Standard_True);
98 //=======================================================================
101 //=======================================================================
103 TDF_Label QANewBRepNaming_Cylinder::EndSide() const {
105 TDataStd_Name::Set(ResultLabel().FindChild(5, Standard_True), "EndSide");
107 return ResultLabel().FindChild(5, Standard_True);
110 //=======================================================================
111 //function : Load (Cylinder)
113 //=======================================================================
115 void QANewBRepNaming_Cylinder::Load (BRepPrimAPI_MakeCylinder& mkCylinder,
116 const QANewBRepNaming_TypeOfPrimitive3D Type) const
118 BRepPrim_Cylinder& S = mkCylinder.Cylinder();
121 TopoDS_Face BottomFace = S.BottomFace();
122 TNaming_Builder BottomFaceIns(Bottom());
123 BottomFaceIns.Generated(BottomFace);
127 TopoDS_Face TopFace = S.TopFace();
128 TNaming_Builder TopFaceIns(Top());
129 TopFaceIns.Generated(TopFace);
132 TopoDS_Face LateralFace = S.LateralFace();
133 TNaming_Builder LateralFaceIns(Lateral());
134 LateralFaceIns.Generated(LateralFace);
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);
145 TNaming_Builder Builder (ResultLabel());
146 if (Type == QANewBRepNaming_SOLID) Builder.Generated (mkCylinder.Solid());
147 else if (Type == QANewBRepNaming_SHELL) Builder.Generated (mkCylinder.Shell());
150 cout<<"QANewBRepNaming_Cylinder::Load(): Unexpected type of result"<<endl;
151 Builder.Generated (mkCylinder.Shape());