|
|
|||
File indexing completed on 2026-07-29 09:16:15
0001 // Copyright (c) 2016 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _SelectMgr_ToleranceMap_HeaderFile 0015 #define _SelectMgr_ToleranceMap_HeaderFile 0016 0017 #include <NCollection_DataMap.hxx> 0018 0019 //! An internal class for calculation of current largest tolerance value which will be applied for 0020 //! creation of selecting frustum by default. Each time the selection set is deactivated, maximum 0021 //! tolerance value will be recalculated. If a user enables custom precision using 0022 //! StdSelect_ViewerSelector3d::SetPixelTolerance, it will be applied to all sensitive entities 0023 //! without any checks. 0024 class SelectMgr_ToleranceMap 0025 { 0026 public: 0027 //! Sets tolerance values to -1.0 0028 Standard_EXPORT SelectMgr_ToleranceMap(); 0029 0030 Standard_EXPORT ~SelectMgr_ToleranceMap(); 0031 0032 //! Adds the value given to map, checks if the current tolerance value 0033 //! should be replaced by theTolerance 0034 Standard_EXPORT void Add(const Standard_Integer& theTolerance); 0035 0036 //! Decrements a counter of the tolerance given, checks if the current tolerance value 0037 //! should be recalculated 0038 Standard_EXPORT void Decrement(const Standard_Integer& theTolerance); 0039 0040 //! Returns a current tolerance that must be applied 0041 Standard_Integer Tolerance() const 0042 { 0043 if (myLargestKey < 0) 0044 { 0045 return 2; // default tolerance value 0046 } 0047 return myCustomTolerance < 0 ? myLargestKey : myLargestKey + myCustomTolerance; 0048 } 0049 0050 //! Sets tolerance to the given one and disables adaptive checks 0051 void SetCustomTolerance(const Standard_Integer theTolerance) { myCustomTolerance = theTolerance; } 0052 0053 //! Unsets a custom tolerance and enables adaptive checks 0054 void ResetDefaults() { myCustomTolerance = -1; } 0055 0056 //! Returns the value of custom tolerance regardless of it validity 0057 Standard_Integer CustomTolerance() const { return myCustomTolerance; } 0058 0059 //! Returns true if custom tolerance value is greater than zero 0060 Standard_Boolean IsCustomTolSet() const { return myCustomTolerance > 0; } 0061 0062 private: 0063 NCollection_DataMap<Standard_Integer, Standard_Integer> myTolerances; 0064 Standard_Integer myLargestKey; 0065 Standard_Integer myCustomTolerance; 0066 }; 0067 0068 #endif // _SelectMgr_ToleranceMap_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|