return myDefaultDrawer->IsoOnTriangulation();
}
+//=======================================================================
//function : SetPixelTolerance
-//purpose : Disables the mechanism of adaptive tolerance calculation in
-// SelectMgr_ViewerSelector and sets the given tolerance for ALL
-// sensitive entities activated. For more information, see
-// SelectMgr_ViewerSelector.hxx
+//purpose :
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
{
Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
- //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
- //! sets the given tolerance for ALL sensitive entities activated. For more information, see
- //! SelectMgr_ViewerSelector documentation
- //! Warning: When a local context is open the sensitivity is apply on it
- //! instead on the main context.
- Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
-
- //! Returns the pixel tolerance.
+ //! Setup pixel tolerance for MoveTo() operation.
+ Standard_EXPORT void SetPixelTolerance (const Standard_Integer thePrecision = 2);
+
+ //! Returns the pixel tolerance, default is 2.
+ //! Pixel Tolerance extends sensitivity within MoveTo() operation (picking by point)
+ //! and can be adjusted by application based on user input precision (e.g. screen pixel density, input device precision, etc.).
Standard_EXPORT Standard_Integer PixelTolerance() const;
//! Allows to manage sensitivity of a particular selection of interactive object theObject
// purpose :
//=======================================================================
SelectMgr_ToleranceMap::SelectMgr_ToleranceMap()
+: myLargestKey (-1),
+ myCustomTolerance (-1)
{
- myLargestKey = -1;
- myCustomTolerance = -1;
+ //
}
//=======================================================================
//=======================================================================
void SelectMgr_ToleranceMap::Add (const Standard_Integer& theTolerance)
{
- if (myTolerances.IsBound (theTolerance))
+ if (Standard_Integer* aFreq = myTolerances.ChangeSeek (theTolerance))
{
- Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
- aFreq++;
-
- if (aFreq == 1 && theTolerance != myLargestKey)
+ ++(*aFreq);
+ if (*aFreq == 1 && theTolerance != myLargestKey)
+ {
myLargestKey = Max (theTolerance, myLargestKey);
+ }
+ return;
+ }
+
+ myTolerances.Bind (theTolerance, 1);
+ if (myTolerances.Extent() == 1)
+ {
+ myLargestKey = theTolerance;
}
else
{
- if (myTolerances.IsEmpty())
- {
- myTolerances.Bind (theTolerance, 1);
- myLargestKey = theTolerance;
- return;
- }
-
- myTolerances.Bind (theTolerance, 1);
myLargestKey = Max (theTolerance, myLargestKey);
}
}
//=======================================================================
void SelectMgr_ToleranceMap::Decrement (const Standard_Integer& theTolerance)
{
- if (myTolerances.IsBound (theTolerance))
+ Standard_Integer* aFreq = myTolerances.ChangeSeek (theTolerance);
+ if (aFreq == NULL)
{
- Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
- aFreq--;
+ return;
+ }
- if (Abs (theTolerance - myLargestKey) < Precision::Confusion() && aFreq == 0)
+ --(*aFreq);
+ if (theTolerance == myLargestKey
+ && *aFreq == 0)
+ {
+ myLargestKey = 0;
+ for (NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
{
- myLargestKey = 0;
- for (NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
+ if (anIter.Value() != 0)
{
- if (anIter.Value() != 0)
- myLargestKey = Max (myLargestKey, anIter.Key());
+ myLargestKey = Max (myLargestKey, anIter.Key());
}
}
}
StdSelect_TypeOfSelectionImage.hxx
StdSelect_ViewerSelector3d.cxx
StdSelect_ViewerSelector3d.hxx
-StdSelect_ViewerSelector3d.lxx
Standard_EXPORT void SetPixelTolerance (const Standard_Integer theTolerance);
//! Returns the pixel tolerance.
- inline Standard_Integer PixelTolerance() const;
+ Standard_Integer PixelTolerance() const { return myTolerances.Tolerance(); }
//! Picks the sensitive entity at the pixel coordinates of
//! the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners.
DEFINE_STANDARD_HANDLE(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
-#include <StdSelect_ViewerSelector3d.lxx>
-
#endif
+++ /dev/null
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline Standard_Integer StdSelect_ViewerSelector3d::PixelTolerance() const
-{
- return myTolerances.Tolerance();
-}