0025656: Specification of semantic of Closed flag of an edge
[occt.git] / src / BRepPrimAPI / BRepPrimAPI_MakeRevol.cxx
CommitLineData
b311480e 1// Created on: 1993-10-14
2// Created by: Remi LEQUETTE
3// Copyright (c) 1993-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
17// Modified by skv - Fri Mar 4 15:50:09 2005
18// Add methods for supporting history.
19
20#include <BRepPrimAPI_MakeRevol.ixx>
21#include <BRepLib.hxx>
22#include <TopExp_Explorer.hxx>
23#include <BRep_TEdge.hxx>
24
25// perform checks on the argument
26
27static const TopoDS_Shape& check(const TopoDS_Shape& S)
28{
29 BRepLib::BuildCurves3d(S);
30 return S;
31}
32
33//=======================================================================
34//function : BRepPrimAPI_MakeRevol
35//purpose :
36//=======================================================================
37
38BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
39 const gp_Ax1& A,
40 const Standard_Real D,
41 const Standard_Boolean Copy) :
42 myRevol(check(S),A,D,Copy)
43{
44 Build();
45}
46
47
48//=======================================================================
49//function : BRepPrimAPI_MakeRevol
50//purpose :
51//=======================================================================
52
53BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
54 const gp_Ax1& A,
55 const Standard_Boolean Copy) :
56 myRevol(check(S),A,Copy)
57{
58 Build();
59}
60
61
62//=======================================================================
63//function : Revol
64//purpose :
65//=======================================================================
66
67const BRepSweep_Revol& BRepPrimAPI_MakeRevol::Revol() const
68{
69 return myRevol;
70}
71
72
73//=======================================================================
74//function : Build
75//purpose :
76//=======================================================================
77
78void BRepPrimAPI_MakeRevol::Build()
79{
80 myShape = myRevol.Shape();
81 Done();
82// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
83 myDegenerated.Clear();
84
85 TopExp_Explorer anExp(myShape, TopAbs_EDGE);
86
87 for (; anExp.More(); anExp.Next()) {
88 const TopoDS_Shape &anEdge = anExp.Current();
89 Handle(BRep_TEdge) aTEdge = Handle(BRep_TEdge)::DownCast(anEdge.TShape());
90
91 if (aTEdge->Degenerated())
92 myDegenerated.Append(anEdge);
93 }
94// Modified by skv - Fri Mar 4 15:50:09 2005 End
95}
96
97
98//=======================================================================
99//function : FirstShape
100//purpose :
101//=======================================================================
102
103TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape()
104{
105 return myRevol.FirstShape();
106}
107
108
109//=======================================================================
110//function : LastShape
111//purpose :
112//=======================================================================
113
114TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape()
115{
116 return myRevol.LastShape();
117}
118
119
120//=======================================================================
121//function : Generated
122//purpose :
123//=======================================================================
124
125const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Generated (const TopoDS_Shape& S)
126{
127 myGenerated.Clear();
128 if (!myRevol.Shape (S).IsNull())
129 myGenerated.Append (myRevol.Shape (S));
130 return myGenerated;
131}
132
133
134// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
135
136//=======================================================================
137//function : FirstShape
138//purpose : This method returns the shape of the beginning of the revolution,
139// generated with theShape (subShape of the generating shape).
140//=======================================================================
141
142TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape(const TopoDS_Shape &theShape)
143{
144 return myRevol.FirstShape(theShape);
145}
146
147
148//=======================================================================
149//function : LastShape
150//purpose : This method returns the shape of the end of the revolution,
151// generated with theShape (subShape of the generating shape).
152//=======================================================================
153
154TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape(const TopoDS_Shape &theShape)
155{
156 return myRevol.LastShape(theShape);
157}
158
159//=======================================================================
160//function : HasDegenerated
161//purpose :
162//=======================================================================
163
164Standard_Boolean BRepPrimAPI_MakeRevol::HasDegenerated () const
165{
166 return (!myDegenerated.IsEmpty());
167}
168
169
170//=======================================================================
171//function : Degenerated
172//purpose :
173//=======================================================================
174
175const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Degenerated () const
176{
177 return myDegenerated;
178}
179// Modified by skv - Fri Mar 4 15:50:09 2005 End