0022904: Clean up sccsid variables
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_Cut.cxx
CommitLineData
7fd59977 1// File: QANewBRepNaming_Cut.cxx
2// Created: Tue Oct 31 14:42:07 2000
3// Author: Sergey ZARITCHNY
4// <s-zaritchny@opencascade.com>
5// Copyright: Open CASCADE 2003
6
7fd59977 7// Lastly modified by :
8// +---------------------------------------------------------------------------+
9// ! szy ! Added workaround ! 9-12-2003! 5.1-01-4 !
10// +---------------------------------------------------------------------------+
11
12#include <QANewBRepNaming_Cut.ixx>
13#include <TopoDS_Iterator.hxx>
14#include <TopoDS_Shell.hxx>
15#include <BRep_Builder.hxx>
16#include <TopExp_Explorer.hxx>
17#include <TopTools_ListOfShape.hxx>
18#include <TopTools_ListIteratorOfListOfShape.hxx>
19//
20#include <TNaming_NamedShape.hxx>
21#include <TNaming_Tool.hxx>
22#include <TNaming_Builder.hxx>
23#include <TNaming_Builder.hxx>
24#include <QANewBRepNaming_Loader.hxx>
25
26
27//=======================================================================
28//function : QANewBRepNaming_Cut
29//purpose :
30//=======================================================================
31
32QANewBRepNaming_Cut::QANewBRepNaming_Cut() {}
33
34//=======================================================================
35//function : QANewBRepNaming_Cut
36//purpose :
37//=======================================================================
38
39QANewBRepNaming_Cut::QANewBRepNaming_Cut(const TDF_Label& ResultLabel)
40 :QANewBRepNaming_BooleanOperationFeat(ResultLabel) {}
41
42//=======================================================================
43//function : Load
44//purpose :
45//=======================================================================
46
47void QANewBRepNaming_Cut::Load(BRepAlgoAPI_BooleanOperation& MS) const {
48
49 TopoDS_Shape ResSh = MS.Shape();
50 const TopoDS_Shape& ObjSh = MS.Shape1();
51 const TopoDS_Shape& ToolSh = MS.Shape2();
52 const TopAbs_ShapeEnum& TypeSh = ShapeType(ObjSh);
53
54 if (ResSh.IsNull()) {
55#ifdef DEB
56 cout<<"QANewBRepNaming_Cut::Load(): The result of the boolean operation is null"<<endl;
57#endif
58 return;
59 }
60
61 // If the shapes are the same - select the result and exit:
62 if (IsResultChanged(MS)) {
63#ifdef DEB
64 cout<<"QANewBRepNaming_Cut::Load(): The object and the result of CUT operation are the same"<<endl;
65#endif
66 if (MS.Shape().ShapeType() == TopAbs_COMPOUND) {
67 Standard_Integer nbSubResults = 0;
68 TopoDS_Iterator itr(MS.Shape());
69 for (; itr.More(); itr.Next()) nbSubResults++;
70 if (nbSubResults == 1) { //
71 itr.Initialize(MS.Shape());
72 if (itr.More()) ResSh = itr.Value();
73 } //
74 }
75 TNaming_Builder aBuilder(ResultLabel());
76 aBuilder.Select(ResSh, ObjSh);
77 return;
78 }
79 //
80 Standard_Boolean aWRCase = IsWRCase(MS);
81 // Naming of the result:
82 LoadResult(MS);
83
84 // Naming of modified, deleted and new sub shapes:
85 if (TypeSh == TopAbs_WIRE || TypeSh == TopAbs_EDGE) {//LoadWire(MS);
86//Modified
87 TNaming_Builder ModEBuilder(ModifiedEdges());
88 QANewBRepNaming_Loader::LoadModifiedShapes(MS, ObjSh, TopAbs_EDGE, ModEBuilder, Standard_True);
89//Generated vertexes
90 if(MS.HasGenerated()) {
91 TNaming_Builder nBuilder (NewShapes());
92 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder);
93 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, nBuilder);
94 }
95//Deleted (Faces, Edges, Vertexes)
96 if(MS.HasDeleted()){
97 TNaming_Builder DelFBuilder(DeletedFaces()); // all deleted shapes
98 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder);
99 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_VERTEX, DelFBuilder);
100 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_FACE, DelFBuilder);
101 }
102
103 }
104 else if (TypeSh == TopAbs_SHELL || TypeSh == TopAbs_FACE) {//LoadShell(MS);
105//Modified
106 if(!aWRCase) {
107 TNaming_Builder ModFBuilder(ModifiedFaces());
108 QANewBRepNaming_Loader::LoadModifiedShapes(MS, ObjSh, TopAbs_FACE, ModFBuilder, Standard_True);
109 } else {
110 LoadSymmetricalEdges(MS);
111 LoadModified1n (MS, ObjSh, TopAbs_FACE);
112 LoadModified11 (MS, ObjSh, TopAbs_FACE);
113 }
114 TNaming_Builder ModEBuilder(ModifiedEdges());
115 QANewBRepNaming_Loader::LoadModifiedShapes(MS, ObjSh, TopAbs_EDGE, ModEBuilder, Standard_True);
116//
117
118
119//Generated edges (edges of free boundaries)
120 if(MS.HasGenerated()) {
121 TNaming_Builder nBuilder (NewShapes());
122 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_FACE, nBuilder);
123 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, nBuilder);
124 }
125//Deleted
126 if(MS.HasDeleted()){
127 TNaming_Builder DelFBuilder(DeletedFaces());
128 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_FACE, DelFBuilder);
129 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder);
130 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_FACE, DelFBuilder);
131 }
132 }
133 else { // Solid
134
135 if(MS.HasModified()){
136 if(aWRCase) {
137 LoadSymmetricalEdges(MS);
138 LoadModified1n (MS, ObjSh, TopAbs_FACE);
139 LoadModified11 (MS, ObjSh, TopAbs_FACE);
140 LoadModified11 (MS, ToolSh, TopAbs_FACE);
141 } else if(QANewBRepNaming_BooleanOperationFeat::IsWRCase2(MS)) {
142 LoadModified1n (MS, ObjSh, TopAbs_FACE);
143 LoadModified11 (MS, ObjSh, TopAbs_FACE);
144 LoadModified11 (MS, ToolSh, TopAbs_FACE);
145 LoadWRCase(MS);
146 } else {
147 TNaming_Builder ModBuilder(ModifiedFaces());
148 QANewBRepNaming_Loader::LoadModifiedShapes (MS, ObjSh, TopAbs_FACE, ModBuilder, Standard_True);
149 QANewBRepNaming_Loader::LoadModifiedShapes (MS, ToolSh, TopAbs_FACE, ModBuilder, Standard_True);
150 }
151 }
152
153
154 if(MS.HasDeleted()){
155 TNaming_Builder DelBuilder(DeletedFaces());
156 QANewBRepNaming_Loader::LoadDeletedShapes (MS, ObjSh, TopAbs_FACE, DelBuilder);
157 QANewBRepNaming_Loader::LoadDeletedShapes (MS, ToolSh, TopAbs_FACE, DelBuilder);
158 }
159 }
160
161 LoadDegenerated(MS);
162
163 // Naming of the content:
164 if (ShapeType(ObjSh) == TopAbs_SOLID) LoadContent(MS);
165}
166
167// @@SDM: begin
168
169// File history synopsis (creation,modification,correction)
170// +---------------------------------------------------------------------------+
171// ! Developer ! Comments ! Date ! Version !
172// +-----------!-----------------------------------------!----------!----------+
173// ! vro ! Creation !31-10-2000!3.0-00-3!
174// ! vro ! Redesign !13-12-2000! 3.0-00-3!
175// ! vro ! Result control !07-03-2001! 3.0-00-3!
176// ! vro ! Result may be null !19-03-2001! 3.0-00-3!
177// ! szy ! Modified Load ! 8-05-2003! 3.0-00-1!
178// ! szy ! Modified Load !21-05-2003! 3.0-00-1!
179// ! szy ! Added workaround ! 9-12-2003! 5.1-01-4!
180// +---------------------------------------------------------------------------+
181// Lastly modified by : szy Date : 9-12-2003
182
183// @@SDM: end