b311480e |
1 | // Created on: 1995-05-05 |
2 | // Created by: Christophe MARION |
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. |
733a0e55 |
16 | |
7fd59977 |
17 | #ifndef No_Exception |
18 | //#define No_Exception |
19 | #endif |
42cf5bc1 |
20 | |
21 | |
7fd59977 |
22 | #include <HLRAlgo_BiPoint.hxx> |
42cf5bc1 |
23 | #include <HLRAlgo_ListIteratorOfListOfBPoint.hxx> |
7fd59977 |
24 | #include <HLRAlgo_PolyData.hxx> |
42cf5bc1 |
25 | #include <HLRAlgo_PolyShellData.hxx> |
26 | #include <Standard_Type.hxx> |
7fd59977 |
27 | |
25e59720 |
28 | IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,Standard_Transient) |
92efcf78 |
29 | |
7fd59977 |
30 | //======================================================================= |
31 | //function : HLRAlgo_PolyShellData |
32 | //purpose : |
33 | //======================================================================= |
34 | |
35 | HLRAlgo_PolyShellData:: |
36 | HLRAlgo_PolyShellData (const Standard_Integer nbFace) |
37 | : myPolyg(0,nbFace) |
38 | {} |
39 | |
40 | //======================================================================= |
41 | //function : UpdateGlobalMinMax |
42 | //purpose : |
43 | //======================================================================= |
44 | |
45 | void |
681f3919 |
46 | HLRAlgo_PolyShellData::UpdateGlobalMinMax(HLRAlgo_PolyData::Box& theBox) |
7fd59977 |
47 | { |
48 | HLRAlgo_ListIteratorOfListOfBPoint it; |
49 | |
50 | for (it.Initialize(mySegList); it.More(); it.Next()) { |
51 | HLRAlgo_BiPoint& BP = it.Value(); |
681f3919 |
52 | HLRAlgo_BiPoint::PointsT& aPoints = BP.Points(); |
53 | if (aPoints.PntP1.X() < aPoints.PntP2.X()) { |
54 | if (theBox.XMin > aPoints.PntP1.X()) theBox.XMin = aPoints.PntP1.X(); |
55 | else if (theBox.XMax < aPoints.PntP2.X()) theBox.XMax = aPoints.PntP2.X(); |
7fd59977 |
56 | } |
57 | else { |
681f3919 |
58 | if (theBox.XMin > aPoints.PntP2.X()) theBox.XMin = aPoints.PntP2.X(); |
59 | else if (theBox.XMax < aPoints.PntP1.X()) theBox.XMax = aPoints.PntP1.X(); |
7fd59977 |
60 | } |
681f3919 |
61 | if (aPoints.PntP1.Y() < aPoints.PntP2.Y()) { |
62 | if (theBox.YMin > aPoints.PntP1.Y()) theBox.YMin = aPoints.PntP1.Y(); |
63 | else if (theBox.YMax < aPoints.PntP2.Y()) theBox.YMax = aPoints.PntP2.Y(); |
7fd59977 |
64 | } |
65 | else { |
681f3919 |
66 | if (theBox.YMin > aPoints.PntP2.Y()) theBox.YMin = aPoints.PntP2.Y(); |
67 | else if (theBox.YMax < aPoints.PntP1.Y()) theBox.YMax = aPoints.PntP1.Y(); |
7fd59977 |
68 | } |
681f3919 |
69 | if (aPoints.PntP1.Z() < aPoints.PntP2.Z()) { |
70 | if (theBox.ZMin > aPoints.PntP1.Z()) theBox.ZMin = aPoints.PntP1.Z(); |
71 | else if (theBox.ZMax < aPoints.PntP2.Z()) theBox.ZMax = aPoints.PntP2.Z(); |
7fd59977 |
72 | } |
73 | else { |
681f3919 |
74 | if (theBox.ZMin > aPoints.PntP2.Z()) theBox.ZMin = aPoints.PntP2.Z(); |
75 | else if (theBox.ZMax < aPoints.PntP1.Z()) theBox.ZMax = aPoints.PntP1.Z(); |
7fd59977 |
76 | } |
77 | } |
78 | Standard_Integer nbFace = myPolyg.Upper(); |
1d47d8d0 |
79 | Handle(HLRAlgo_PolyData)* pd = NULL; |
7fd59977 |
80 | if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1)); |
81 | |
82 | for (Standard_Integer i = 1; i <= nbFace; i++) { |
681f3919 |
83 | (*pd)->UpdateGlobalMinMax(theBox); |
7fd59977 |
84 | pd++; |
85 | } |
86 | } |
87 | |
88 | //======================================================================= |
89 | //function : UpdateHiding |
90 | //purpose : |
91 | //======================================================================= |
92 | |
93 | void HLRAlgo_PolyShellData:: |
94 | UpdateHiding (const Standard_Integer nbHiding) |
95 | { |
96 | if (nbHiding > 0) |
97 | myHPolHi = new TColStd_HArray1OfTransient(1,nbHiding); |
98 | else myHPolHi.Nullify(); |
99 | } |