0024639: Parallelization FillDS part of BO
[occt.git] / src / IntTools / IntTools_CurveRangeLocalizeData.cxx
1 // Created on: 2005-10-14
2 // Created by: Mikhail KLOKOV
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <IntTools_CurveRangeLocalizeData.ixx>
17 #include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
18 #include <IntTools_ListIteratorOfListOfBox.hxx>
19 #include <IntTools_MapIteratorOfMapOfCurveSample.hxx>
20
21 IntTools_CurveRangeLocalizeData::IntTools_CurveRangeLocalizeData(const Standard_Integer theNbSample,
22                                                                  const Standard_Real theMinRange)
23 {
24   myNbSampleC = theNbSample;
25   myMinRangeC = theMinRange;
26 }
27
28 void IntTools_CurveRangeLocalizeData::AddOutRange(const IntTools_CurveRangeSample& theRange) 
29 {
30   myMapRangeOut.Add(theRange);
31   myMapBox.UnBind(theRange);
32 }
33
34 void IntTools_CurveRangeLocalizeData::AddBox(const IntTools_CurveRangeSample& theRange,
35                                              const Bnd_Box& theBox) 
36 {
37   myMapBox.Bind(theRange, theBox);
38 }
39
40 Standard_Boolean IntTools_CurveRangeLocalizeData::FindBox(const IntTools_CurveRangeSample& theRange,Bnd_Box& theBox) const
41 {
42   if(myMapBox.IsBound(theRange)) {
43     theBox = myMapBox(theRange);
44     return Standard_True;
45   }
46   return Standard_False;
47 }
48
49 Standard_Boolean IntTools_CurveRangeLocalizeData::IsRangeOut(const IntTools_CurveRangeSample& theRange) const
50 {
51   return myMapRangeOut.Contains(theRange);
52 }
53
54 void IntTools_CurveRangeLocalizeData::ListRangeOut(IntTools_ListOfCurveRangeSample& theList) const
55 {
56   IntTools_MapIteratorOfMapOfCurveSample anIt(myMapRangeOut);
57
58   for(; anIt.More(); anIt.Next())
59     theList.Append(anIt.Key());
60 }
61