1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
18 #ifndef _BOPDS_Iterator_HeaderFile
19 #define _BOPDS_Iterator_HeaderFile
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
25 #include <Standard_Integer.hxx>
26 #include <BOPDS_PDS.hxx>
27 #include <BOPDS_VectorOfPair.hxx>
28 #include <BOPDS_VectorOfVectorOfPair.hxx>
29 #include <NCollection_BaseAllocator.hxx>
30 #include <Precision.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
34 class IntTools_Context;
37 //! The class BOPDS_Iterator is
38 //! 1.to compute intersections between BRep sub-shapes
39 //! of arguments of an operation (see the class BOPDS_DS)
40 //! in terms of theirs bounding boxes
41 //! 2.provides interface to iterare the pairs of
42 //! intersected sub-shapes of given type
50 Standard_EXPORT BOPDS_Iterator();
51 Standard_EXPORT virtual ~BOPDS_Iterator();
54 //! theAllocator - the allocator to manage the memory
55 Standard_EXPORT BOPDS_Iterator(const Handle(NCollection_BaseAllocator)& theAllocator);
58 //! Sets the data structure <pDS> to process
59 Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
62 //! Returns the data structure
63 Standard_EXPORT const BOPDS_DS& DS() const;
65 //! Initializes the iterator
66 //! theType1 - the first type of shape
67 //! theType2 - the second type of shape
68 Standard_EXPORT void Initialize (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
70 //! Returns true if still there are pairs
71 //! of intersected shapes
72 Standard_EXPORT Standard_Boolean More() const;
74 //! Moves iterations ahead
75 Standard_EXPORT void Next();
77 //! Returns indices (DS) of intersected shapes
78 //! theIndex1 - the index of the first shape
79 //! theIndex2 - the index of the second shape
80 Standard_EXPORT void Value (Standard_Integer& theIndex1,
81 Standard_Integer& theIndex2) const;
83 //! Perform the intersection algorithm and prepare
84 //! the results to be used
85 Standard_EXPORT virtual void Prepare(const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(),
86 const Standard_Boolean theCheckOBB = Standard_False,
87 const Standard_Real theFuzzyValue = Precision::Confusion());
89 //! Returns the number of intersections founded
90 Standard_EXPORT Standard_Integer ExpectedLength() const;
92 //! Returns the block length
93 Standard_EXPORT Standard_Integer BlockLength() const;
95 //! Set the flag of parallel processing
96 //! if <theFlag> is true the parallel processing is switched on
97 //! if <theFlag> is false the parallel processing is switched off
98 Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag);
100 //! Returns the flag of parallel processing
101 Standard_EXPORT Standard_Boolean RunParallel() const;
105 Standard_EXPORT virtual void Intersect(const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(),
106 const Standard_Boolean theCheckOBB = Standard_False,
107 const Standard_Real theFuzzyValue = Precision::Confusion());
109 Handle(NCollection_BaseAllocator) myAllocator;
110 Standard_Integer myLength;
112 BOPDS_VectorOfVectorOfPair myLists;
113 BOPDS_VectorOfPair::Iterator myIterator;
114 Standard_Boolean myRunParallel;
120 #endif // _BOPDS_Iterator_HeaderFile