0023024: Update headers of OCCT files
[occt.git] / src / BRepBuilderAPI / BRepBuilderAPI_ModifyShape.cxx
CommitLineData
b311480e 1// Created on: 1994-12-02
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1994-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#include <BRepBuilderAPI_ModifyShape.ixx>
24
25
26#include <Standard_NullObject.hxx>
27
28//=======================================================================
29//function : BRepBuilderAPI_ModifyShape
30//purpose :
31//=======================================================================
32
33BRepBuilderAPI_ModifyShape::BRepBuilderAPI_ModifyShape () {}
34
35
36//=======================================================================
37//function : BRepBuilderAPI_ModifyShape
38//purpose :
39//=======================================================================
40
41BRepBuilderAPI_ModifyShape::BRepBuilderAPI_ModifyShape (const TopoDS_Shape& S):
42 myModifier(S), myInitialShape(S)
43{}
44
45
46//=======================================================================
47//function : BRepBuilderAPI_ModifyShape
48//purpose :
49//=======================================================================
50
51BRepBuilderAPI_ModifyShape::BRepBuilderAPI_ModifyShape
52 (const Handle(BRepTools_Modification)& M)
53{
54 myModification = M;
55}
56
57
58//=======================================================================
59//function : BRepBuilderAPI_ModifyShape
60//purpose :
61//=======================================================================
62
63BRepBuilderAPI_ModifyShape::BRepBuilderAPI_ModifyShape
64 (const TopoDS_Shape& S,
65 const Handle(BRepTools_Modification)& M): myModifier(S),myInitialShape(S)
66{
67 myModification = M;
68 DoModif();
69}
70
71
72//=======================================================================
73//function : DoModif
74//purpose :
75//=======================================================================
76
77void BRepBuilderAPI_ModifyShape::DoModif ()
78{
79 if (myInitialShape.IsNull() || myModification.IsNull()) {
80 Standard_NullObject::Raise();
81 }
82 myModifier.Perform(myModification);
83 if (myModifier.IsDone()) {
84 Done();
85 myShape = myModifier.ModifiedShape(myInitialShape);
86 }
87 else {
88 NotDone();
89 }
90}
91
92
93//=======================================================================
94//function : DoModif
95//purpose :
96//=======================================================================
97
98void BRepBuilderAPI_ModifyShape::DoModif (const TopoDS_Shape& S)
99{
100 if (!S.IsEqual(myInitialShape) || !IsDone()) {
101 myInitialShape = S;
102 myModifier.Init(S);
103 DoModif();
104 }
105}
106
107
108//=======================================================================
109//function : DoModif
110//purpose :
111//=======================================================================
112
113void BRepBuilderAPI_ModifyShape::DoModif (const Handle(BRepTools_Modification)& M)
114{
115 myModification = M;
116 DoModif();
117}
118
119
120//=======================================================================
121//function : DoModif
122//purpose :
123//=======================================================================
124
125void BRepBuilderAPI_ModifyShape::DoModif (const TopoDS_Shape& S,
126 const Handle(BRepTools_Modification)& M)
127{
128 myInitialShape = S;
129 myModifier.Init(S);
130 myModification = M;
131 DoModif();
132}
133
134
135//=======================================================================
136//function : ModifiedShape
137//purpose :
138//=======================================================================
139
140const TopoDS_Shape& BRepBuilderAPI_ModifyShape::ModifiedShape
141 (const TopoDS_Shape& S) const
142{
143 return myModifier.ModifiedShape(S);
144}
145
146//=======================================================================
147//function : Modified
148//purpose :
149//=======================================================================
150
151const TopTools_ListOfShape& BRepBuilderAPI_ModifyShape::Modified
152 (const TopoDS_Shape& F)
153{
154 myGenerated.Clear();
155 myGenerated.Append(myModifier.ModifiedShape(F));
156 return myGenerated;
157}