0024751: Performance improvements in the Edge/Edge intersection algorithm
[occt.git] / src / IntTools / IntTools_CurveRangeLocalizeData.cxx
CommitLineData
b311480e 1// Created on: 2005-10-14
2// Created by: Mikhail KLOKOV
973c2be1 3// Copyright (c) 2005-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#include <IntTools_CurveRangeLocalizeData.ixx>
17#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
18#include <IntTools_ListIteratorOfListOfBox.hxx>
19#include <IntTools_MapIteratorOfMapOfCurveSample.hxx>
20
21IntTools_CurveRangeLocalizeData::IntTools_CurveRangeLocalizeData(const Standard_Integer theNbSample,
22 const Standard_Real theMinRange)
23{
24 myNbSampleC = theNbSample;
25 myMinRangeC = theMinRange;
26}
27
28void IntTools_CurveRangeLocalizeData::AddOutRange(const IntTools_CurveRangeSample& theRange)
29{
30 myMapRangeOut.Add(theRange);
31 myMapBox.UnBind(theRange);
32}
33
34void IntTools_CurveRangeLocalizeData::AddBox(const IntTools_CurveRangeSample& theRange,
35 const Bnd_Box& theBox)
36{
37 myMapBox.Bind(theRange, theBox);
38}
39
40Standard_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
49Standard_Boolean IntTools_CurveRangeLocalizeData::IsRangeOut(const IntTools_CurveRangeSample& theRange) const
50{
51 return myMapRangeOut.Contains(theRange);
52}
53
54void 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