0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / HLRBRep / HLRBRep_ShapeBounds.cxx
1 // Created on: 1997-04-17
2 // Created by: Christophe MARION
3 // Copyright (c) 1997-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
18 #include <HLRBRep_ShapeBounds.hxx>
19 #include <HLRTopoBRep_OutLiner.hxx>
20 #include <Standard_Transient.hxx>
21
22 //=======================================================================
23 //function : HLRBRep_ShapeBounds
24 //purpose  : 
25 //=======================================================================
26 HLRBRep_ShapeBounds::
27 HLRBRep_ShapeBounds (const Handle(HLRTopoBRep_OutLiner)& S,
28                      const Handle(Standard_Transient)& SData,
29                      const Standard_Integer nbIso,
30                      const Standard_Integer V1,
31                      const Standard_Integer V2,
32                      const Standard_Integer E1,
33                      const Standard_Integer E2,
34                      const Standard_Integer F1,
35                      const Standard_Integer F2) :
36                      myShape(S),
37                      myShapeData(SData),
38                      myNbIso(nbIso),
39                      myVertStart(V1),myVertEnd(V2),
40                      myEdgeStart(E1),myEdgeEnd(E2),
41                      myFaceStart(F1),myFaceEnd(F2)
42 {}
43
44 //=======================================================================
45 //function : HLRBRep_ShapeBounds
46 //purpose  : 
47 //=======================================================================
48
49 HLRBRep_ShapeBounds::
50 HLRBRep_ShapeBounds (const Handle(HLRTopoBRep_OutLiner)& S,
51                      const Standard_Integer nbIso,
52                      const Standard_Integer V1,
53                      const Standard_Integer V2,
54                      const Standard_Integer E1,
55                      const Standard_Integer E2,
56                      const Standard_Integer F1,
57                      const Standard_Integer F2) :
58                      myShape(S),
59                      myNbIso(nbIso),
60                      myVertStart(V1),myVertEnd(V2),
61                      myEdgeStart(E1),myEdgeEnd(E2),
62                      myFaceStart(F1),myFaceEnd(F2)
63 {}
64
65 //=======================================================================
66 //function : Translate
67 //purpose  : 
68 //=======================================================================
69
70 void HLRBRep_ShapeBounds::Translate (const Standard_Integer NV,
71                                      const Standard_Integer NE,
72                                      const Standard_Integer NF)
73 {
74   myVertStart += NV;
75   myVertEnd   += NV;
76   myEdgeStart += NE;
77   myEdgeEnd   += NE;
78   myFaceStart += NF;
79   myFaceEnd   += NF;
80 }
81
82 //=======================================================================
83 //function : Sizes
84 //purpose  : 
85 //=======================================================================
86
87 void HLRBRep_ShapeBounds::Sizes (Standard_Integer& NV,
88                                  Standard_Integer& NE,
89                                  Standard_Integer& NF) const
90 {
91   NV = myVertEnd + 1 - myVertStart;
92   NE = myEdgeEnd + 1 - myEdgeStart;
93   NF = myFaceEnd + 1 - myFaceStart;
94 }
95
96 //=======================================================================
97 //function : Bounds
98 //purpose  : 
99 //=======================================================================
100
101 void HLRBRep_ShapeBounds::Bounds (Standard_Integer& V1,
102                                   Standard_Integer& V2,
103                                   Standard_Integer& E1,
104                                   Standard_Integer& E2,
105                                   Standard_Integer& F1,
106                                   Standard_Integer& F2) const
107 {
108   V1 = myVertStart;
109   V2 = myVertEnd;
110   E1 = myEdgeStart;
111   E2 = myEdgeEnd;
112   F1 = myFaceStart;
113   F2 = myFaceEnd;
114 }