0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / HLRBRep / HLRBRep_Algo.cxx
1 // Created on: 1994-08-04
2 // Created by: Christophe MARION
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #define No_Standard_OutOfRange
18
19 #include <HLRBRep_Algo.ixx>
20 #include <HLRBRep_ShapeBounds.hxx>
21 #include <HLRTopoBRep_OutLiner.hxx>
22
23 //=======================================================================
24 //function : HLRBRep_Algo
25 //purpose  : 
26 //=======================================================================
27
28 HLRBRep_Algo::HLRBRep_Algo ()
29 {}
30
31 //=======================================================================
32 //function : HLRBRep_Algo
33 //purpose  : 
34 //=======================================================================
35
36 HLRBRep_Algo::HLRBRep_Algo (const Handle(HLRBRep_Algo)& A) :
37 HLRBRep_InternalAlgo(A)
38 {}
39
40 //=======================================================================
41 //function : Add
42 //purpose  : 
43 //=======================================================================
44
45 void  HLRBRep_Algo::Add (const TopoDS_Shape& S,
46                          const Handle(MMgt_TShared)& SData,
47                          const Standard_Integer nbIso)
48 {
49   Load(new HLRTopoBRep_OutLiner(S),SData,nbIso);
50 }
51
52 //=======================================================================
53 //function : Add
54 //purpose  : 
55 //=======================================================================
56
57 void  HLRBRep_Algo::Add (const TopoDS_Shape& S,
58                          const Standard_Integer nbIso)
59 {
60   Load(new HLRTopoBRep_OutLiner(S),nbIso);
61 }
62
63 //=======================================================================
64 //function : Index
65 //purpose  : 
66 //=======================================================================
67
68 Standard_Integer HLRBRep_Algo::Index (const TopoDS_Shape& S)
69 {
70   Standard_Integer n = NbShapes();
71
72   for (Standard_Integer i = 1; i <= n; i++) {
73     if (ShapeBounds(i).Shape()->OriginalShape() == S) return i;
74     if (ShapeBounds(i).Shape()->OutLinedShape() == S) return i;
75   }
76
77   return 0;
78 }
79
80 //=======================================================================
81 //function : OutLinedShapeNullify
82 //purpose  : 
83 //=======================================================================
84
85 void HLRBRep_Algo::OutLinedShapeNullify ()
86 {
87   Standard_Integer n = NbShapes();
88
89   for (Standard_Integer i = 1; i <= n; i++) {
90     ShapeBounds(i).Shape()->OutLinedShape(TopoDS_Shape());
91     ShapeBounds(i).Shape()->DataStructure().Clear();
92   }
93 }