Warnings on vc14 were eliminated
[occt.git] / src / HLRAlgo / HLRAlgo_PolyShellData.cxx
1 // Created on: 1995-05-05
2 // Created by: Christophe MARION
3 // Copyright (c) 1995-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 #ifndef No_Exception
18 //#define No_Exception
19 #endif
20
21
22 #include <HLRAlgo_BiPoint.hxx>
23 #include <HLRAlgo_ListIteratorOfListOfBPoint.hxx>
24 #include <HLRAlgo_PolyData.hxx>
25 #include <HLRAlgo_PolyShellData.hxx>
26 #include <Standard_Type.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,MMgt_TShared)
29
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 
46 HLRAlgo_PolyShellData::UpdateGlobalMinMax(HLRAlgo_PolyData::Box& theBox)
47 {
48   HLRAlgo_ListIteratorOfListOfBPoint it;
49   
50   for (it.Initialize(mySegList); it.More(); it.Next()) {      
51     HLRAlgo_BiPoint& BP = it.Value();
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();
56     }
57     else             {
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();
60     }
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();
64     }
65     else             {
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();
68     }
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();
72     }
73     else             {
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();
76     }
77   }
78   Standard_Integer nbFace      = myPolyg.Upper();
79   Handle(HLRAlgo_PolyData)* pd = NULL;
80   if(nbFace > 0) pd =  (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1));
81   
82   for (Standard_Integer i = 1; i <= nbFace; i++) {
83     (*pd)->UpdateGlobalMinMax(theBox);
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 }