0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[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
42cf5bc1 16
17#include <Bnd_Box.hxx>
18#include <IntTools_CurveRangeLocalizeData.hxx>
19#include <IntTools_CurveRangeSample.hxx>
7fd59977 20#include <IntTools_ListIteratorOfListOfBox.hxx>
42cf5bc1 21#include <IntTools_ListIteratorOfListOfCurveRangeSample.hxx>
7fd59977 22#include <IntTools_MapIteratorOfMapOfCurveSample.hxx>
23
24IntTools_CurveRangeLocalizeData::IntTools_CurveRangeLocalizeData(const Standard_Integer theNbSample,
25 const Standard_Real theMinRange)
26{
27 myNbSampleC = theNbSample;
28 myMinRangeC = theMinRange;
29}
30
31void IntTools_CurveRangeLocalizeData::AddOutRange(const IntTools_CurveRangeSample& theRange)
32{
33 myMapRangeOut.Add(theRange);
34 myMapBox.UnBind(theRange);
35}
36
37void IntTools_CurveRangeLocalizeData::AddBox(const IntTools_CurveRangeSample& theRange,
38 const Bnd_Box& theBox)
39{
40 myMapBox.Bind(theRange, theBox);
41}
42
43Standard_Boolean IntTools_CurveRangeLocalizeData::FindBox(const IntTools_CurveRangeSample& theRange,Bnd_Box& theBox) const
44{
45 if(myMapBox.IsBound(theRange)) {
46 theBox = myMapBox(theRange);
47 return Standard_True;
48 }
49 return Standard_False;
50}
51
52Standard_Boolean IntTools_CurveRangeLocalizeData::IsRangeOut(const IntTools_CurveRangeSample& theRange) const
53{
54 return myMapRangeOut.Contains(theRange);
55}
56
57void IntTools_CurveRangeLocalizeData::ListRangeOut(IntTools_ListOfCurveRangeSample& theList) const
58{
59 IntTools_MapIteratorOfMapOfCurveSample anIt(myMapRangeOut);
60
61 for(; anIt.More(); anIt.Next())
62 theList.Append(anIt.Key());
63}
64