0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / QANewBRepNaming / QANewBRepNaming_BooleanOperation.cxx
CommitLineData
b311480e 1// Created on: 1999-11-11
2// Created by: Vladislav ROMASHKO
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <BRepAlgo_BooleanOperation.hxx>
19#include <QANewBRepNaming_BooleanOperation.hxx>
20#include <QANewBRepNaming_Loader.hxx>
7fd59977 21#include <Standard_NullObject.hxx>
42cf5bc1 22#include <TDF_Label.hxx>
7fd59977 23#include <TNaming_Builder.hxx>
7fd59977 24#include <TopOpeBRepBuild_HBuilder.hxx>
7fd59977 25#include <TopTools_ListIteratorOfListOfShape.hxx>
42cf5bc1 26#include <TopTools_ListOfShape.hxx>
7fd59977 27
28//=======================================================================
29//function : QANewBRepNaming_BooleanOperation
30//purpose :
31//=======================================================================
7fd59977 32QANewBRepNaming_BooleanOperation::QANewBRepNaming_BooleanOperation()
33{}
34
35//=======================================================================
36//function : QANewBRepNaming_BooleanOperation
37//purpose :
38//=======================================================================
39
40QANewBRepNaming_BooleanOperation::QANewBRepNaming_BooleanOperation(const TDF_Label& Label)
41 : QANewBRepNaming_TopNaming(Label)
42{}
43
44//=======================================================================
45//function : Init
46//purpose :
47//=======================================================================
48
49void QANewBRepNaming_BooleanOperation::Init(const TDF_Label& Label)
50{
51 if(Label.IsNull())
52 Standard_NullObject::Raise("QANewBRepNaming_BooleanOperation::Init The Result label is Null ...");
53 myResultLabel = Label;
54}
55
56//=======================================================================
57//function : FirstModified
58//purpose :
59//=======================================================================
60
61TDF_Label QANewBRepNaming_BooleanOperation::FirstModified() const
62{
63 return ResultLabel().FindChild(1, Standard_True);
64}
65
66//=======================================================================
67//function : FirstDeleted
68//purpose :
69//=======================================================================
70
71TDF_Label QANewBRepNaming_BooleanOperation::FirstDeleted() const
72{
73 return ResultLabel().FindChild(2, Standard_True);
74}
75
76//=======================================================================
77//function : SecondModified
78//purpose :
79//=======================================================================
80
81TDF_Label QANewBRepNaming_BooleanOperation::SecondModified() const
82{
83 return ResultLabel().FindChild(3, Standard_True);
84}
85
86//=======================================================================
87//function : SecondDeleted
88//purpose :
89//=======================================================================
90
91TDF_Label QANewBRepNaming_BooleanOperation::SecondDeleted() const
92{
93 return ResultLabel().FindChild(4, Standard_True);
94}
95
96//=======================================================================
97//function : Intersections
98//purpose :
99//=======================================================================
100
101TDF_Label QANewBRepNaming_BooleanOperation::Intersections() const
102{
103 return ResultLabel().FindChild(5, Standard_True);
104}
105
106//=======================================================================
107//function : Load (BooleanOperation)
108//purpose : for a new part
109//=======================================================================
110//modified by NIZNHY-PKV Wed Jun 19 09:07:51 2002 f
111void QANewBRepNaming_BooleanOperation::Load (BRepAlgo_BooleanOperation& MS) const
112//void QANewBRepNaming_BooleanOperation::Load (BRepAlgoAPI_BooleanOperation& MS) const
113//modified by NIZNHY-PKV Wed Jun 19 09:07:55 2002 t
114{
115 const TopoDS_Shape& S1 = MS.Shape1();
116 const TopoDS_Shape& S2 = MS.Shape2();
117
118 TNaming_Builder Builder (ResultLabel());
119 Builder.Modify (S1, MS.Shape());
120 Builder.Modify (S2, MS.Shape());
121
122 TopAbs_ShapeEnum SST1 = TopAbs_FACE;
123 TopAbs_ShapeEnum SST2 = TopAbs_FACE;
124
125 if (S1.ShapeType() == TopAbs_FACE || S1.ShapeType() == TopAbs_WIRE )
126 SST1 = TopAbs_EDGE;
127
128 if (S2.ShapeType() == TopAbs_FACE || S2.ShapeType() == TopAbs_WIRE )
129 SST2 = TopAbs_EDGE;
130
131 TNaming_Builder Builder1(FirstModified());
132 QANewBRepNaming_Loader::LoadModifiedShapes(MS, S1, SST1, Builder1);
133 TNaming_Builder Builder2(FirstDeleted());
134 QANewBRepNaming_Loader::LoadDeletedShapes(MS, S1, SST1, Builder2);
135
136 TNaming_Builder Builder3(SecondModified());
137 QANewBRepNaming_Loader::LoadModifiedShapes(MS, S2, SST2, Builder3);
138 TNaming_Builder Builder4(SecondDeleted());
139 QANewBRepNaming_Loader::LoadDeletedShapes(MS, S2, SST2, Builder4);
140
141 // load the intersection edges
142 TNaming_Builder Builder5(Intersections());
143 Handle(TopOpeBRepBuild_HBuilder) build = MS.Builder();
144 TopTools_ListIteratorOfListOfShape its = build->Section();
145 for (; its.More(); its.Next()) {
146 Builder5.Select(its.Value(),its.Value());
147 }
148}