b311480e |
1 | // Created on: 1993-06-09 |
2 | // Created by: Laurent BOURESCHE |
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 | |
42cf5bc1 |
17 | |
18 | #include <BRepSweep_Tool.hxx> |
19 | #include <Standard_OutOfRange.hxx> |
7fd59977 |
20 | #include <TopExp.hxx> |
42cf5bc1 |
21 | #include <TopoDS_Shape.hxx> |
7fd59977 |
22 | |
23 | //======================================================================= |
24 | //function : BRepSweep_Tool |
25 | //purpose : |
26 | //======================================================================= |
7fd59977 |
27 | BRepSweep_Tool::BRepSweep_Tool(const TopoDS_Shape& aShape) |
28 | { |
29 | TopExp::MapShapes(aShape,myMap); |
30 | } |
31 | |
32 | |
33 | //======================================================================= |
34 | //function : NbShapes |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | Standard_Integer BRepSweep_Tool::NbShapes()const |
39 | { |
40 | return myMap.Extent(); |
41 | } |
42 | |
43 | |
44 | //======================================================================= |
45 | //function : Index |
46 | //purpose : |
47 | //======================================================================= |
48 | |
49 | Standard_Integer BRepSweep_Tool::Index(const TopoDS_Shape& aShape)const |
50 | { |
51 | if(!myMap.Contains(aShape)) return 0; |
52 | return myMap.FindIndex(aShape); |
53 | } |
54 | |
55 | |
56 | //======================================================================= |
57 | //function : Shape |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | TopoDS_Shape BRepSweep_Tool::Shape(const Standard_Integer anIndex)const |
62 | { |
63 | return myMap.FindKey(anIndex); |
64 | } |
65 | |
66 | |
67 | //======================================================================= |
68 | //function : Type |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | TopAbs_ShapeEnum BRepSweep_Tool::Type(const TopoDS_Shape& aShape)const |
73 | { |
74 | return aShape.ShapeType(); |
75 | } |
76 | |
77 | |
78 | //======================================================================= |
79 | //function : Orientation |
80 | //purpose : |
81 | //======================================================================= |
82 | |
83 | TopAbs_Orientation BRepSweep_Tool::Orientation |
84 | (const TopoDS_Shape& aShape)const |
85 | { |
86 | return aShape.Orientation(); |
87 | } |
88 | |
89 | |
90 | //======================================================================= |
91 | //function : SetOrientation |
92 | //purpose : |
93 | //======================================================================= |
94 | |
95 | void BRepSweep_Tool::SetOrientation (TopoDS_Shape& aShape, |
96 | const TopAbs_Orientation Or)const |
97 | { |
98 | aShape.Orientation(Or); |
99 | } |