0024624: Lost word in license statement in source files
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakeThickSolid.cxx
1 // Created on: 1996-02-13
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <BRepOffsetAPI_MakeThickSolid.ixx>
18 #include <BRepOffset_MakeOffset.hxx>
19 #include <Standard_ConstructionError.hxx>
20 #include <TopTools_ListIteratorOfListOfShape.hxx>
21 #include <TopoDS.hxx>
22
23
24 //=======================================================================
25 //function : BRepOffsetAPI_MakeThickSolid
26 //purpose  : 
27 //=======================================================================
28
29 BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()
30 {
31 }
32
33
34 //=======================================================================
35 //function : BRepOffsetAPI_MakeThickSolid
36 //purpose  : 
37 //=======================================================================
38
39 BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid
40 (const TopoDS_Shape&         S, 
41  const TopTools_ListOfShape& ClosingFaces,
42  const Standard_Real         Offset, 
43  const Standard_Real         Tol, 
44  const BRepOffset_Mode       Mode,
45  const Standard_Boolean      Intersection,
46  const Standard_Boolean      SelfInter,
47  const GeomAbs_JoinType      Join)
48 {
49   myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,Join);
50   TopTools_ListIteratorOfListOfShape it(ClosingFaces);
51   for (; it.More(); it.Next()) {
52     myOffsetShape.AddFace(TopoDS::Face(it.Value()));
53   }
54   Build();
55 }
56
57 //=======================================================================
58 //function : virtual
59 //purpose  : 
60 //=======================================================================
61
62 void BRepOffsetAPI_MakeThickSolid::Build()
63 {
64   if (!IsDone()) {
65     myOffsetShape.MakeThickSolid();
66     if (!myOffsetShape.IsDone()) return;
67     myShape  = myOffsetShape.Shape();
68     Done();
69   }
70 }
71
72
73
74 //=======================================================================
75 //function : Modified
76 //purpose  : 
77 //=======================================================================
78
79 const TopTools_ListOfShape& BRepOffsetAPI_MakeThickSolid::Modified (const TopoDS_Shape& F) 
80
81 {
82   myGenerated.Clear();
83   if (myOffsetShape.OffsetFacesFromShapes().HasImage(F)) {
84     if (myOffsetShape.ClosingFaces().Contains(F)) { 
85       myOffsetShape.OffsetFacesFromShapes().LastImage (F, myGenerated); 
86       // Les face du resultat sont orientees comme dans la piece initiale.
87       //si offset a l interieur.
88       TopTools_ListIteratorOfListOfShape it(myGenerated);
89       for (; it.More(); it.Next())
90         it.Value().Reverse();
91    
92     }
93   }
94   return myGenerated;
95 }