1 // File: QANewBRepNaming_Intersection.cdl
2 // Created: Tue Oct 31 15:01:54 2000
3 // Author: Vladislav ROMASHKO
4 // <vro@flox.nnov.matra-dtv.fr>
5 // Copyright: Matra Datavision 2000
7 const static char sccsid[] = "@(#) 3.0-00-3, 01/10/01@(#)";
9 // Lastly modified by :
10 // +---------------------------------------------------------------------------+
11 // ! szy ! Modified Load ! 8-05-2003! 3.0-00-%L%!
12 // +---------------------------------------------------------------------------+
14 #include <QANewBRepNaming_Intersection.ixx>
15 #include <TNaming_Builder.hxx>
16 #include <QANewBRepNaming_Loader.hxx>
17 #include <TopTools_ListIteratorOfListOfShape.hxx>
18 #include <TopOpeBRepBuild_HBuilder.hxx>
19 #include <TopoDS_Iterator.hxx>
22 #include <TDataStd_Name.hxx>
23 #include <TNaming_NamedShape.hxx>
37 //=======================================================================
38 //function : QANewBRepNaming_Intersection
40 //=======================================================================
42 QANewBRepNaming_Intersection::QANewBRepNaming_Intersection() {}
44 //=======================================================================
45 //function : QANewBRepNaming_Intersection
47 //=======================================================================
49 QANewBRepNaming_Intersection::QANewBRepNaming_Intersection(const TDF_Label& ResultLabel)
50 :QANewBRepNaming_BooleanOperationFeat(ResultLabel) {}
52 //=======================================================================
55 //=======================================================================
57 void QANewBRepNaming_Intersection::Load(BRepAlgoAPI_BooleanOperation& MS) const {
58 TopoDS_Shape ResSh = MS.Shape();
61 cout<<"QANewBRepNaming_Intersection::Load(): The result of the Intersection is null"<<endl;
66 const TopAbs_ShapeEnum& ResType = ShapeType(ResSh);
67 const TopoDS_Shape& ObjSh = MS.Shape1();
68 const TopoDS_Shape& ToolSh = MS.Shape2();
70 // If the shapes are the same - select the result and exit:
71 if (IsResultChanged(MS)) {
73 cout<<"QANewBRepNaming_Intersection::Load(): The object and the result of INTERSECTION operation are the same"<<endl;
76 if (ResType == TopAbs_COMPOUND) {
77 Standard_Integer nbSubResults = 0;
78 TopoDS_Iterator itr(MS.Shape());
79 for (; itr.More(); itr.Next()) nbSubResults++;
80 if (nbSubResults == 1) {
81 itr.Initialize(MS.Shape());
82 if (itr.More()) ResSh = itr.Value();
85 TNaming_Builder aBuilder(ResultLabel());
86 aBuilder.Select(ResSh, ObjSh);
90 const TopAbs_ShapeEnum& anObjType = ShapeType(ObjSh);
91 const TopAbs_ShapeEnum& aToolType = ShapeType(ToolSh);
109 case TopAbs_SHELL://2
148 if(anArg == UNEXPECTED) {
150 cout <<"QANewBRepNaming_Intersection:: Unexpected Use Case" << endl;
156 // Naming of modified, deleted and new sub shapes:
157 if (anArg == SHELL_SHELL) { // Result Wire/Edge
158 //Generated Edges and (may be) vertexes
159 if(MS.HasGenerated()) {
160 TNaming_Builder nBuilder (NewShapes());
161 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_FACE, nBuilder);
162 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, nBuilder);
163 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder);
164 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_EDGE, nBuilder);
167 TNaming_Builder DelFBuilder(DeletedFaces());
168 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_FACE, DelFBuilder);
169 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_FACE, DelFBuilder);
170 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder);
171 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_EDGE, DelFBuilder);
174 else if (anArg == SOLID_WIRE || anArg == WIRE_SOLID ||
175 anArg == SHELL_WIRE || anArg == WIRE_SHELL) { // Result ==> Vertex
177 if(MS.HasGenerated()) {
178 TNaming_Builder nBuilder (NewShapes());
179 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_FACE, nBuilder);
180 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_FACE, nBuilder);
181 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder);
182 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_EDGE, nBuilder);
185 TNaming_Builder DelFBuilder(DeletedFaces());
186 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_FACE, DelFBuilder);
187 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_FACE, DelFBuilder);
188 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder);
189 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_EDGE, DelFBuilder);
190 if(anArg == SOLID_WIRE || anArg == SHELL_WIRE) {
191 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_VERTEX, DelFBuilder);
193 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_VERTEX, DelFBuilder);
195 } else if (anArg == WIRE_WIRE) {
196 if(MS.HasGenerated()) {
197 TNaming_Builder nBuilder (NewShapes());
198 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ObjSh, TopAbs_EDGE, nBuilder);
199 QANewBRepNaming_Loader::LoadGeneratedShapes (MS, ToolSh, TopAbs_EDGE, nBuilder);
202 TNaming_Builder DelFBuilder(DeletedFaces());
203 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_EDGE, DelFBuilder);
204 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_EDGE, DelFBuilder);
205 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ToolSh, TopAbs_VERTEX, DelFBuilder);
206 QANewBRepNaming_Loader::LoadDeletedShapes(MS, ObjSh, TopAbs_VERTEX, DelFBuilder);
212 // Naming of the content:
213 // if (ShapeType(ResSh) == TopAbs_VERTEX) LoadContent(MS);
218 // Lastly modified by : vro Date : 31-10-2000
220 // File history synopsis (creation,modification,correction)
221 // +---------------------------------------------------------------------------+
222 // ! Developer ! Comments ! Date ! Version !
223 // +-----------!-----------------------------------------!----------!----------+
224 // ! vro ! Creation !31-10-2000!3.0-00-3!
225 // ! vro ! Redesign !13-12-2000! 3.0-00-3!
226 // ! vro ! Result control !07-03-2001! 3.0-00-3!
227 // ! vro ! Result may be null !19-03-2001! 3.0-00-3!
228 // ! szy ! Modified Load ! 8-05-2003! 3.0-00-%L%!
229 // +---------------------------------------------------------------------------+
230 // Lastly modified by : szy Date : 8-05-2003