| 1 | // File: BRepFill_OffsetAncestors.cxx |
| 2 | // Created: Fri Sep 1 14:32:44 1995 |
| 3 | // Author: Bruno DUMORTIER |
| 4 | // <dub@fuegox> |
| 5 | |
| 6 | |
| 7 | #include <BRepFill_OffsetAncestors.ixx> |
| 8 | |
| 9 | #include <TopExp_Explorer.hxx> |
| 10 | #include <TopoDS_Face.hxx> |
| 11 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
| 12 | |
| 13 | //======================================================================= |
| 14 | //function : BRepFill_OffsetAncestors |
| 15 | //purpose : |
| 16 | //======================================================================= |
| 17 | |
| 18 | BRepFill_OffsetAncestors::BRepFill_OffsetAncestors() |
| 19 | :myIsPerform(Standard_False) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | |
| 24 | //======================================================================= |
| 25 | //function : BRepFill_OffsetAncestors |
| 26 | //purpose : |
| 27 | //======================================================================= |
| 28 | |
| 29 | BRepFill_OffsetAncestors::BRepFill_OffsetAncestors |
| 30 | (BRepFill_OffsetWire& Paral) |
| 31 | { |
| 32 | Perform(Paral); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | //======================================================================= |
| 37 | //function : Perform |
| 38 | //purpose : |
| 39 | //======================================================================= |
| 40 | |
| 41 | void BRepFill_OffsetAncestors::Perform(BRepFill_OffsetWire& Paral) |
| 42 | { |
| 43 | TopoDS_Face Spine = Paral.Spine(); |
| 44 | |
| 45 | TopExp_Explorer Exp; |
| 46 | TopTools_ListIteratorOfListOfShape it; |
| 47 | |
| 48 | // on itere sur les edges. |
| 49 | for ( Exp.Init(Spine, TopAbs_EDGE); Exp.More(); Exp.Next()) { |
| 50 | for (it.Initialize(Paral.GeneratedShapes(Exp.Current())); |
| 51 | it.More(); it.Next()) { |
| 52 | myMap.Bind( it.Value(), Exp.Current()); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // on itere sur les vertex. |
| 57 | for ( Exp.Init(Spine, TopAbs_VERTEX); Exp.More(); Exp.Next()) { |
| 58 | for (it.Initialize(Paral.GeneratedShapes(Exp.Current())); |
| 59 | it.More(); it.Next()) { |
| 60 | myMap.Bind( it.Value(), Exp.Current()); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | myIsPerform = Standard_True; |
| 65 | } |
| 66 | |
| 67 | //======================================================================= |
| 68 | //function : IsDone |
| 69 | //purpose : |
| 70 | //======================================================================= |
| 71 | |
| 72 | Standard_Boolean BRepFill_OffsetAncestors::IsDone() const |
| 73 | { |
| 74 | return myIsPerform; |
| 75 | } |
| 76 | |
| 77 | //======================================================================= |
| 78 | //function : IsDone |
| 79 | //purpose : |
| 80 | //======================================================================= |
| 81 | |
| 82 | Standard_Boolean BRepFill_OffsetAncestors:: HasAncestor(const TopoDS_Edge& S1) |
| 83 | const |
| 84 | { |
| 85 | return myMap.IsBound(S1); |
| 86 | } |
| 87 | |
| 88 | //======================================================================= |
| 89 | //function : TopoDS_Shape& |
| 90 | //purpose : |
| 91 | //======================================================================= |
| 92 | |
| 93 | const TopoDS_Shape& BRepFill_OffsetAncestors::Ancestor(const TopoDS_Edge& S1) |
| 94 | const |
| 95 | { |
| 96 | StdFail_NotDone_Raise_if( !myIsPerform, ""); |
| 97 | return myMap(S1); |
| 98 | } |