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