0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / BRepFill / BRepFill_OffsetAncestors.cxx
CommitLineData
b311480e 1// Created on: 1995-09-01
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1995-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#include <BRepFill_OffsetAncestors.ixx>
18
19#include <TopExp_Explorer.hxx>
20#include <TopoDS_Face.hxx>
21#include <TopTools_ListIteratorOfListOfShape.hxx>
22
23//=======================================================================
24//function : BRepFill_OffsetAncestors
25//purpose :
26//=======================================================================
27
28BRepFill_OffsetAncestors::BRepFill_OffsetAncestors()
29:myIsPerform(Standard_False)
30{
31}
32
33
34//=======================================================================
35//function : BRepFill_OffsetAncestors
36//purpose :
37//=======================================================================
38
39BRepFill_OffsetAncestors::BRepFill_OffsetAncestors
40(BRepFill_OffsetWire& Paral)
41{
42 Perform(Paral);
43}
44
45
46//=======================================================================
47//function : Perform
48//purpose :
49//=======================================================================
50
51void BRepFill_OffsetAncestors::Perform(BRepFill_OffsetWire& Paral)
52{
53 TopoDS_Face Spine = Paral.Spine();
54
55 TopExp_Explorer Exp;
56 TopTools_ListIteratorOfListOfShape it;
57
58 // on itere sur les edges.
59 for ( Exp.Init(Spine, TopAbs_EDGE); Exp.More(); Exp.Next()) {
60 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
61 it.More(); it.Next()) {
62 myMap.Bind( it.Value(), Exp.Current());
63 }
64 }
65
66 // on itere sur les vertex.
67 for ( Exp.Init(Spine, TopAbs_VERTEX); Exp.More(); Exp.Next()) {
68 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
69 it.More(); it.Next()) {
70 myMap.Bind( it.Value(), Exp.Current());
71 }
72 }
73
74 myIsPerform = Standard_True;
75}
76
77//=======================================================================
78//function : IsDone
79//purpose :
80//=======================================================================
81
82Standard_Boolean BRepFill_OffsetAncestors::IsDone() const
83{
84 return myIsPerform;
85}
86
87//=======================================================================
88//function : IsDone
89//purpose :
90//=======================================================================
91
92Standard_Boolean BRepFill_OffsetAncestors:: HasAncestor(const TopoDS_Edge& S1)
93const
94{
95 return myMap.IsBound(S1);
96}
97
98//=======================================================================
99//function : TopoDS_Shape&
100//purpose :
101//=======================================================================
102
103const TopoDS_Shape& BRepFill_OffsetAncestors::Ancestor(const TopoDS_Edge& S1)
104const
105{
106 StdFail_NotDone_Raise_if( !myIsPerform, "");
107 return myMap(S1);
108}