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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 //#define No_Exception
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>
28 IMPLEMENT_STANDARD_RTTIEXT(HLRAlgo_PolyShellData,MMgt_TShared)
30 //=======================================================================
31 //function : HLRAlgo_PolyShellData
33 //=======================================================================
35 HLRAlgo_PolyShellData::
36 HLRAlgo_PolyShellData (const Standard_Integer nbFace)
40 //=======================================================================
41 //function : UpdateGlobalMinMax
43 //=======================================================================
46 HLRAlgo_PolyShellData::UpdateGlobalMinMax(HLRAlgo_PolyData::Box& theBox)
48 HLRAlgo_ListIteratorOfListOfBPoint it;
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();
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();
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();
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();
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();
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();
78 Standard_Integer nbFace = myPolyg.Upper();
79 Handle(HLRAlgo_PolyData)* pd = NULL;
80 if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(myPolyg.ChangeValue(1));
82 for (Standard_Integer i = 1; i <= nbFace; i++) {
83 (*pd)->UpdateGlobalMinMax(theBox);
88 //=======================================================================
89 //function : UpdateHiding
91 //=======================================================================
93 void HLRAlgo_PolyShellData::
94 UpdateHiding (const Standard_Integer nbHiding)
97 myHPolHi = new TColStd_HArray1OfTransient(1,nbHiding);
98 else myHPolHi.Nullify();