0028579: Get rid of the obsolete QANewModTopOpe_* and QANewBRepNaming_* algorithms
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_Chamfer.cxx
1 // Created on: 1997-09-22
2 // Created by: VAUTHIER Jean-Claude
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <BRepFilletAPI_MakeChamfer.hxx>
19 #include <QANewBRepNaming_Chamfer.hxx>
20 #include <QANewBRepNaming_Loader.hxx>
21 #include <Standard_NullObject.hxx>
22 #include <TDF_Label.hxx>
23 #include <TNaming_Builder.hxx>
24 #include <TopoDS_Shape.hxx>
25
26 //=======================================================================
27 //function : QANewBRepNaming_Chamfer
28 //purpose  : 
29 //=======================================================================
30 QANewBRepNaming_Chamfer::QANewBRepNaming_Chamfer()
31 {}
32
33 //=======================================================================
34 //function : QANewBRepNaming_Chamfer
35 //purpose  : 
36 //=======================================================================
37
38 QANewBRepNaming_Chamfer::QANewBRepNaming_Chamfer(const TDF_Label& ResultLabel):
39        QANewBRepNaming_TopNaming(ResultLabel)
40 {}
41
42 //=======================================================================
43 //function : Init
44 //purpose  : 
45 //=======================================================================
46
47 void QANewBRepNaming_Chamfer::Init(const TDF_Label& ResultLabel)
48 {
49   if(ResultLabel.IsNull())
50     throw Standard_NullObject("QANewBRepNaming_Chamfer::Init The Result label is Null ...");
51   myResultLabel = ResultLabel;
52 }   
53
54 //=======================================================================
55 //function : Load
56 //purpose  : 
57 //=======================================================================
58
59 void  QANewBRepNaming_Chamfer::Load (const TopoDS_Shape&  part,
60                                 BRepFilletAPI_MakeChamfer& mkChamfer) const
61 {
62   TNaming_Builder Ins(ResultLabel());
63   Ins.Modify (part, mkChamfer.Shape());
64
65   //New Faces generated from  edges
66   TNaming_Builder Builder1(FacesFromEdges());
67   QANewBRepNaming_Loader::LoadGeneratedShapes (mkChamfer, part, TopAbs_EDGE, Builder1);
68
69   //Faces of the initial shape modified by MakeChamfer
70   TNaming_Builder Builder2(ModifiedFaces());
71   QANewBRepNaming_Loader::LoadModifiedShapes (mkChamfer, part, TopAbs_FACE, Builder2, Standard_False);
72
73   //Deleted Faces of the initial shape
74   TNaming_Builder Builder3(DeletedFaces());
75   QANewBRepNaming_Loader::LoadDeletedShapes(mkChamfer, part, TopAbs_FACE, Builder3);
76 }
77
78 //=======================================================================
79 //function : FacesFromEdges
80 //purpose  : 
81 //=======================================================================
82
83 TDF_Label QANewBRepNaming_Chamfer::FacesFromEdges() const
84 {
85   return ResultLabel().FindChild(1, Standard_True);
86 }
87
88 //=======================================================================
89 //function : ModifiedFaces
90 //purpose  : 
91 //=======================================================================
92
93 TDF_Label QANewBRepNaming_Chamfer::ModifiedFaces() const
94 {
95   return ResultLabel().FindChild(2, Standard_True);
96 }
97
98 //=======================================================================
99 //function : DeletedFaces
100 //purpose  : 
101 //=======================================================================
102
103 TDF_Label QANewBRepNaming_Chamfer::DeletedFaces() const
104 {
105   return ResultLabel().FindChild(3, Standard_True);
106 }