1 // Created on: 1995-09-01
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRepFill_OffsetAncestors.hxx>
19 #include <BRepFill_OffsetWire.hxx>
20 #include <StdFail_NotDone.hxx>
21 #include <TopExp_Explorer.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopTools_ListIteratorOfListOfShape.hxx>
27 //=======================================================================
28 //function : BRepFill_OffsetAncestors
30 //=======================================================================
31 BRepFill_OffsetAncestors::BRepFill_OffsetAncestors()
32 :myIsPerform(Standard_False)
37 //=======================================================================
38 //function : BRepFill_OffsetAncestors
40 //=======================================================================
42 BRepFill_OffsetAncestors::BRepFill_OffsetAncestors
43 (BRepFill_OffsetWire& Paral)
49 //=======================================================================
52 //=======================================================================
54 void BRepFill_OffsetAncestors::Perform(BRepFill_OffsetWire& Paral)
56 TopoDS_Face Spine = Paral.Spine();
59 TopTools_ListIteratorOfListOfShape it;
61 // on itere sur les edges.
62 for ( Exp.Init(Spine, TopAbs_EDGE); Exp.More(); Exp.Next()) {
63 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
64 it.More(); it.Next()) {
65 myMap.Bind( it.Value(), Exp.Current());
69 // on itere sur les vertex.
70 for ( Exp.Init(Spine, TopAbs_VERTEX); Exp.More(); Exp.Next()) {
71 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
72 it.More(); it.Next()) {
73 myMap.Bind( it.Value(), Exp.Current());
77 myIsPerform = Standard_True;
80 //=======================================================================
83 //=======================================================================
85 Standard_Boolean BRepFill_OffsetAncestors::IsDone() const
90 //=======================================================================
93 //=======================================================================
95 Standard_Boolean BRepFill_OffsetAncestors:: HasAncestor(const TopoDS_Edge& S1)
98 return myMap.IsBound(S1);
101 //=======================================================================
102 //function : TopoDS_Shape&
104 //=======================================================================
106 const TopoDS_Shape& BRepFill_OffsetAncestors::Ancestor(const TopoDS_Edge& S1)
109 StdFail_NotDone_Raise_if (!myIsPerform, "BRepFill_OffsetAncestors::Ancestor() - Perform() should be called before accessing results");