0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[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
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#include <BRepFill_OffsetAncestors.ixx>
24
25#include <TopExp_Explorer.hxx>
26#include <TopoDS_Face.hxx>
27#include <TopTools_ListIteratorOfListOfShape.hxx>
28
29//=======================================================================
30//function : BRepFill_OffsetAncestors
31//purpose :
32//=======================================================================
33
34BRepFill_OffsetAncestors::BRepFill_OffsetAncestors()
35:myIsPerform(Standard_False)
36{
37}
38
39
40//=======================================================================
41//function : BRepFill_OffsetAncestors
42//purpose :
43//=======================================================================
44
45BRepFill_OffsetAncestors::BRepFill_OffsetAncestors
46(BRepFill_OffsetWire& Paral)
47{
48 Perform(Paral);
49}
50
51
52//=======================================================================
53//function : Perform
54//purpose :
55//=======================================================================
56
57void BRepFill_OffsetAncestors::Perform(BRepFill_OffsetWire& Paral)
58{
59 TopoDS_Face Spine = Paral.Spine();
60
61 TopExp_Explorer Exp;
62 TopTools_ListIteratorOfListOfShape it;
63
64 // on itere sur les edges.
65 for ( Exp.Init(Spine, TopAbs_EDGE); Exp.More(); Exp.Next()) {
66 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
67 it.More(); it.Next()) {
68 myMap.Bind( it.Value(), Exp.Current());
69 }
70 }
71
72 // on itere sur les vertex.
73 for ( Exp.Init(Spine, TopAbs_VERTEX); Exp.More(); Exp.Next()) {
74 for (it.Initialize(Paral.GeneratedShapes(Exp.Current()));
75 it.More(); it.Next()) {
76 myMap.Bind( it.Value(), Exp.Current());
77 }
78 }
79
80 myIsPerform = Standard_True;
81}
82
83//=======================================================================
84//function : IsDone
85//purpose :
86//=======================================================================
87
88Standard_Boolean BRepFill_OffsetAncestors::IsDone() const
89{
90 return myIsPerform;
91}
92
93//=======================================================================
94//function : IsDone
95//purpose :
96//=======================================================================
97
98Standard_Boolean BRepFill_OffsetAncestors:: HasAncestor(const TopoDS_Edge& S1)
99const
100{
101 return myMap.IsBound(S1);
102}
103
104//=======================================================================
105//function : TopoDS_Shape&
106//purpose :
107//=======================================================================
108
109const TopoDS_Shape& BRepFill_OffsetAncestors::Ancestor(const TopoDS_Edge& S1)
110const
111{
112 StdFail_NotDone_Raise_if( !myIsPerform, "");
113 return myMap(S1);
114}