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 | |
92efcf78 |
28 | IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,MMgt_TShared) |
29 | |
7fd59977 |
30 | #define PntX1 ((Standard_Real*)Coordinates)[ 0] |
31 | #define PntY1 ((Standard_Real*)Coordinates)[ 1] |
32 | #define PntZ1 ((Standard_Real*)Coordinates)[ 2] |
33 | #define PntX2 ((Standard_Real*)Coordinates)[ 3] |
34 | #define PntY2 ((Standard_Real*)Coordinates)[ 4] |
35 | #define PntZ2 ((Standard_Real*)Coordinates)[ 5] |
36 | #define PntXP1 ((Standard_Real*)Coordinates)[ 6] |
37 | #define PntYP1 ((Standard_Real*)Coordinates)[ 7] |
38 | #define PntZP1 ((Standard_Real*)Coordinates)[ 8] |
39 | #define PntXP2 ((Standard_Real*)Coordinates)[ 9] |
40 | #define PntYP2 ((Standard_Real*)Coordinates)[10] |
41 | #define PntZP2 ((Standard_Real*)Coordinates)[11] |
42 | |
43 | #define TotXMin ((Standard_Real*)TotMinMax)[0] |
44 | #define TotYMin ((Standard_Real*)TotMinMax)[1] |
45 | #define TotZMin ((Standard_Real*)TotMinMax)[2] |
46 | #define TotXMax ((Standard_Real*)TotMinMax)[3] |
47 | #define TotYMax ((Standard_Real*)TotMinMax)[4] |
48 | #define TotZMax ((Standard_Real*)TotMinMax)[5] |
49 | |
50 | //======================================================================= |
51 | //function : HLRAlgo_PolyShellData |
52 | //purpose : |
53 | //======================================================================= |
54 | |
55 | HLRAlgo_PolyShellData:: |
56 | HLRAlgo_PolyShellData (const Standard_Integer nbFace) |
57 | : myPolyg(0,nbFace) |
58 | {} |
59 | |
60 | //======================================================================= |
61 | //function : UpdateGlobalMinMax |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | void |
66 | HLRAlgo_PolyShellData:: |
67 | UpdateGlobalMinMax(const Standard_Address TotMinMax) |
68 | { |
69 | HLRAlgo_ListIteratorOfListOfBPoint it; |
70 | |
71 | for (it.Initialize(mySegList); it.More(); it.Next()) { |
72 | HLRAlgo_BiPoint& BP = it.Value(); |
73 | const Standard_Address Coordinates = BP.Coordinates(); |
74 | if (PntXP1 < PntXP2) { |
75 | if (TotXMin > PntXP1) TotXMin = PntXP1; |
76 | else if (TotXMax < PntXP2) TotXMax = PntXP2; |
77 | } |
78 | else { |
79 | if (TotXMin > PntXP2) TotXMin = PntXP2; |
80 | else if (TotXMax < PntXP1) TotXMax = PntXP1; |
81 | } |
82 | if (PntYP1 < PntYP2) { |
83 | if (TotYMin > PntYP1) TotYMin = PntYP1; |
84 | else if (TotYMax < PntYP2) TotYMax = PntYP2; |
85 | } |
86 | else { |
87 | if (TotYMin > PntYP2) TotYMin = PntYP2; |
88 | else if (TotYMax < PntYP1) TotYMax = PntYP1; |
89 | } |
90 | if (PntZP1 < PntZP2) { |
91 | if (TotZMin > PntZP1) TotZMin = PntZP1; |
92 | else if (TotZMax < PntZP2) TotZMax = PntZP2; |
93 | } |
94 | else { |
95 | if (TotZMin > PntZP2) TotZMin = PntZP2; |
96 | else if (TotZMax < PntZP1) TotZMax = PntZP1; |
97 | } |
98 | } |
99 | Standard_Integer nbFace = myPolyg.Upper(); |
1d47d8d0 |
100 | Handle(HLRAlgo_PolyData)* pd = NULL; |
7fd59977 |
101 | if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1)); |
102 | |
103 | for (Standard_Integer i = 1; i <= nbFace; i++) { |
104 | (*pd)->UpdateGlobalMinMax(TotMinMax); |
105 | pd++; |
106 | } |
107 | } |
108 | |
109 | //======================================================================= |
110 | //function : UpdateHiding |
111 | //purpose : |
112 | //======================================================================= |
113 | |
114 | void HLRAlgo_PolyShellData:: |
115 | UpdateHiding (const Standard_Integer nbHiding) |
116 | { |
117 | if (nbHiding > 0) |
118 | myHPolHi = new TColStd_HArray1OfTransient(1,nbHiding); |
119 | else myHPolHi.Nullify(); |
120 | } |