0026719: Visualization - cannot pick zoom persistent object
[occt.git] / src / SelectMgr / SelectMgr_ViewerSelector.lxx
CommitLineData
b311480e 1// Copyright (c) 1998-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
29a4908e 15//=======================================================================
16// function: Tolerance
17// purpose : Returns a current tolerance that must be applied
18//=======================================================================
3bf9a45f 19inline Standard_Integer SelectMgr_ToleranceMap::Tolerance() const
29a4908e 20{
21 if (myLargestKey < Precision::Confusion())
3bf9a45f 22 return 2; // default tolerance value
29a4908e 23
3bf9a45f 24 return myCustomTolerance < 0 ? myLargestKey : myLargestKey + myCustomTolerance;
29a4908e 25}
26
27//=======================================================================
28// function: SetCustomTolerance
29// purpose : Sets tolerance to the given one and disables adaptive checks
30//=======================================================================
3bf9a45f 31inline void SelectMgr_ToleranceMap::SetCustomTolerance (const Standard_Integer theTolerance)
29a4908e 32{
33 myCustomTolerance = theTolerance;
34}
35
36//=======================================================================
37// function: CustomTolerance
38// purpose : Returns current value of custom tolerance regardless of it is set or not
39//=======================================================================
3bf9a45f 40inline Standard_Integer SelectMgr_ToleranceMap::CustomTolerance() const
29a4908e 41{
42 return myCustomTolerance;
43}
44
45//=======================================================================
46// function: IsCustomTolSet
47// purpose : Checks if custom tolerance value is greater than zero
48//=======================================================================
49inline Standard_Boolean SelectMgr_ToleranceMap::IsCustomTolSet() const
50{
3bf9a45f 51 return myCustomTolerance > 0;
29a4908e 52}
53
54//=======================================================================
55// function: ResetDefaults
56// purpose : Unsets a custom tolerance and enables adaptive checks
57//=======================================================================
58inline void SelectMgr_ToleranceMap::ResetDefaults()
59{
3bf9a45f 60 myCustomTolerance = -1;
29a4908e 61}
62
3c982548 63inline Standard_Real SelectMgr_ViewerSelector::Sensitivity() const
64{
29a4908e 65 return myTolerances.Tolerance();
3c982548 66}
67
7fd59977 68inline void SelectMgr_ViewerSelector::Init()
69{
70 myCurRank = 1;
71}
72
73inline void SelectMgr_ViewerSelector::Next()
74{
75 myCurRank++;
76}
77
78inline void SelectMgr_ViewerSelector::SetPickClosest (const Standard_Boolean preferClosest)
79{
80 preferclosest = preferClosest;
81}
82
f751596e 83inline void SelectMgr_ViewerSelector::InitDetected()
8e7c8ccf 84{
f751596e 85 myDetectedIter.Initialize (myMapOfDetected);
8e7c8ccf 86}
87
f751596e 88inline void SelectMgr_ViewerSelector::NextDetected()
7fd59977 89{
f751596e 90 myDetectedIter.Next();
91}
92
93inline Standard_Boolean SelectMgr_ViewerSelector::MoreDetected()
94{
95 return myDetectedIter.More();
96}
97
98inline SelectMgr_SelectingVolumeManager& SelectMgr_ViewerSelector::GetManager()
99{
100 return mySelectingVolumeMgr;
7fd59977 101}