0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / Bnd / Bnd_BoundSortBox.hxx
1 // Created on: 1992-11-24
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1992-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 _Bnd_BoundSortBox_HeaderFile
18 #define _Bnd_BoundSortBox_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Bnd_Box.hxx>
25 #include <Bnd_HArray1OfBox.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TColStd_DataMapOfIntegerInteger.hxx>
29 #include <TColStd_ListOfInteger.hxx>
30 #include <Standard_Address.hxx>
31 class Standard_NullValue;
32 class Standard_MultiplyDefined;
33 class Bnd_Box;
34 class gp_Pln;
35
36
37 //! A tool to compare a bounding box or a plane with a set of
38 //! bounding boxes. It sorts the set of bounding boxes to give
39 //! the list of boxes which intersect the element being compared.
40 //! The boxes being sorted generally bound a set of shapes,
41 //! while the box being compared bounds a shape to be
42 //! compared. The resulting list of intersecting boxes therefore
43 //! gives the list of items which potentially intersect the shape to be compared.
44 class Bnd_BoundSortBox 
45 {
46 public:
47
48   DEFINE_STANDARD_ALLOC
49
50   
51   //! Constructs an empty comparison algorithm for bounding boxes.
52   //! The bounding boxes are then defined using the Initialize function.
53   Standard_EXPORT Bnd_BoundSortBox();
54   
55   //! Initializes this comparison algorithm with
56   //! -   the set of bounding boxes SetOfBox.
57   Standard_EXPORT void Initialize (const Bnd_Box& CompleteBox, const Handle(Bnd_HArray1OfBox)& SetOfBox);
58   
59   //! Initializes this comparison algorithm with
60   //! -   the set of bounding boxes SetOfBox, where
61   //! CompleteBox is given as the global bounding box of SetOfBox.
62   Standard_EXPORT void Initialize (const Handle(Bnd_HArray1OfBox)& SetOfBox);
63   
64   //! Initializes this comparison algorithm, giving it only
65   //! -   the maximum number nbComponents
66   //! of the bounding boxes to be managed. Use the Add
67   //! function to define the array of bounding boxes to be sorted by this algorithm.
68   Standard_EXPORT void Initialize (const Bnd_Box& CompleteBox, const Standard_Integer nbComponents);
69   
70   //! Adds the bounding box theBox at position boxIndex in
71   //! the array of boxes to be sorted by this comparison algorithm.
72   //! This function is used only in conjunction with the third
73   //! syntax described in the synopsis of Initialize.
74   //!
75   //! Exceptions:
76   //!
77   //! - Standard_OutOfRange if boxIndex is not in the
78   //! range [ 1,nbComponents ] where
79   //! nbComponents is the maximum number of bounding
80   //! boxes declared for this comparison algorithm at
81   //! initialization.
82   //!
83   //! - Standard_MultiplyDefined if a box already exists at
84   //! position boxIndex in the array of boxes to be sorted by
85   //! this comparison algorithm.
86   Standard_EXPORT void Add (const Bnd_Box& theBox, const Standard_Integer boxIndex);
87   
88   //! Compares the bounding box theBox,
89   //! with the set of bounding boxes to be sorted by this
90   //! comparison algorithm, and returns the list of intersecting
91   //! bounding boxes as a list of indexes on the array of
92   //! bounding boxes used by this algorithm.
93   Standard_EXPORT const TColStd_ListOfInteger& Compare (const Bnd_Box& theBox);
94   
95   //! Compares the plane P
96   //! with the set of bounding boxes to be sorted by this
97   //! comparison algorithm, and returns the list of intersecting
98   //! bounding boxes as a list of indexes on the array of
99   //! bounding boxes used by this algorithm.
100   Standard_EXPORT const TColStd_ListOfInteger& Compare (const gp_Pln& P);
101   
102   Standard_EXPORT void Dump() const;
103   
104   Standard_EXPORT void Destroy();
105 ~Bnd_BoundSortBox()
106 {
107   Destroy();
108 }
109
110
111
112
113 protected:
114
115
116
117
118
119 private:
120
121   
122   //! Prepares  BoundSortBox and  sorts   the  boxes of
123   //! <SetOfBox> .
124   Standard_EXPORT void SortBoxes();
125
126
127   Bnd_Box myBox;
128   Handle(Bnd_HArray1OfBox) myBndComponents;
129   Standard_Real Xmin;
130   Standard_Real Ymin;
131   Standard_Real Zmin;
132   Standard_Real deltaX;
133   Standard_Real deltaY;
134   Standard_Real deltaZ;
135   Standard_Integer discrX;
136   Standard_Integer discrY;
137   Standard_Integer discrZ;
138   Standard_Integer theFound;
139   TColStd_DataMapOfIntegerInteger Crible;
140   TColStd_ListOfInteger lastResult;
141   Standard_Address TabBits;
142
143
144 };
145
146
147
148
149
150
151
152 #endif // _Bnd_BoundSortBox_HeaderFile