//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
if (mySensType == Select3D_TOS_BOUNDARY)
{
- SetSensitivityFactor (6);
+ SetSensitivityFactor (Sensitivity());
}
}
if (mySensType == Select3D_TOS_BOUNDARY)
{
- SetSensitivityFactor (6);
+ SetSensitivityFactor (Sensitivity());
}
}
if (mySensType == Select3D_TOS_BOUNDARY)
{
- SetSensitivityFactor (6);
+ SetSensitivityFactor (Sensitivity());
}
}
if (mySensType == Select3D_TOS_BOUNDARY)
{
- SetSensitivityFactor (6);
+ SetSensitivityFactor (Sensitivity());
}
}
//! Builds BVH tree for a circle's edge segments if needed
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 6; }
+
protected:
//! Calculates distance from the 3d projection of used-picked screen point
myCurve (theCurve)
{
loadPoints (theCurve, theNbPnts);
- SetSensitivityFactor (3);
+ SetSensitivityFactor (Sensitivity());
}
//==================================================
: Select3D_SensitivePoly (theOwnerId, thePoints, Standard_True)
{
- SetSensitivityFactor (3);
+ SetSensitivityFactor (Sensitivity());
}
//==================================================
const TColgp_Array1OfPnt& thePoints)
: Select3D_SensitivePoly (theOwnerId, thePoints, Standard_True)
{
- SetSensitivityFactor (3);
+ SetSensitivityFactor (Sensitivity());
}
//==================================================
//! Returns the copy of this
Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 3; }
+
private:
void loadPoints (const Handle(Geom_Curve)& aCurve,
//=======================================================================
Select3D_SensitiveEntity::Select3D_SensitiveEntity (const Handle(SelectMgr_EntityOwner)& theOwnerId)
: myOwnerId (theOwnerId),
- mySFactor (2)
+ mySFactor (Sensitivity())
{
//
}
//! Otherwise, returns identity matrix.
virtual gp_GTrsf InvInitLocation() const { return gp_GTrsf(); }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
//! Returns the amount of sub-entities (points or planar convex polygons)
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
const gp_Pnt& thePoint)
: Select3D_SensitiveEntity (theOwner)
{
- SetSensitivityFactor (12);
+ SetSensitivityFactor (Sensitivity());
myPoint = thePoint;
}
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 12; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
//! Return the second node of last topmost detected edge or -1 if undefined (axis picking).
Standard_Integer LastDetectedEdgeNode2() const { return myDetectedEdgeNode2; }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
//! changes the end point of the segment
void EndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
//! Returns a number of nodes in 1 BVH leaf
Standard_Integer GetLeafNodeSize() const { return myContent.Builder()->LeafNodeSize(); }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
const TopLoc_Location& GetInitLocation() const { return myInitLocation; }
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
+ //! Returns default sensitivity factor of the type
+ static Standard_Integer Sensitivity() { return 2; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
SelectMgr_IndexedMapOfOwner.hxx
SelectMgr_ListIteratorOfListOfFilter.hxx
SelectMgr_ListOfFilter.hxx
+SelectMgr_MapOfSensitivityFactor.hxx
SelectMgr_OrFilter.cxx
SelectMgr_OrFilter.hxx
SelectMgr_PickingStrategy.hxx
--- /dev/null
+// Copyright (c) 1996-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.
+
+#ifndef SelectMgr_MapOfSensitivityFactor_HeaderFile
+#define SelectMgr_MapOfSensitivityFactor_HeaderFile
+
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <NCollection_DataMap.hxx>
+
+typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer> SelectMgr_MapOfSensitivityFactor;
+
+
+#endif
protected:
SelectMgr_SequenceOfSelection myselections; //!< list of selections
+ NCollection_Map<Standard_Integer, Standard_Integer> mySensitivityFactors; //!< container of sensitive factor values
Handle(Prs3d_Presentation) mySelectionPrs; //!< optional presentation for highlighting selected object
Handle(Prs3d_Presentation) myHilightPrs; //!< optional presentation for highlighting detected object
Standard_Integer myGlobalSelMode; //!< global selection mode
}
else
{
+ Standard_Integer aSensitivityFactor;
+ if (mySensitivityFactors.Find (anEntity->DynamicType()->Name(), aSensitivityFactor))
+ anEntity->BaseSensitive()->SetSensitivityFactor (aSensitivityFactor);
+
mySensFactor = Max (mySensFactor, anEntity->BaseSensitive()->SensitivityFactor());
}
}
}
}
+// =======================================================================
+// function : SensitivityFactor
+// purpose :
+// =======================================================================
+Standard_Boolean SelectMgr_Selection::SensitivityFactor (const TCollection_AsciiString& theType, Standard_Integer& theValue)
+{
+ return mySensitivityFactors.Find (theType, theValue);
+}
+
+// =======================================================================
+// function : DumpJson
+// purpose :
+// =======================================================================
+void SelectMgr_Selection::SetSensitivityFactor (const TCollection_AsciiString& theType, const Standard_Integer theValue)
+{
+ if (!mySensitivityFactors.IsBound (theType))
+ {
+ mySensitivityFactors.Bind (theType, theValue);
+ }
+}
+
// =======================================================================
// function : DumpJson
// purpose :
#define _SelectMgr_Selection_HeaderFile
#include <NCollection_Vector.hxx>
+#include <SelectMgr_MapOfSensitivityFactor.hxx>
#include <SelectMgr_SensitiveEntity.hxx>
#include <SelectMgr_StateOfSelection.hxx>
#include <SelectMgr_TypeOfBVHUpdate.hxx>
//! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method.
Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens);
+ //!< Returns container of default sensitive factor values
+ const SelectMgr_MapOfSensitivityFactor& SensitivityFactors() const { return mySensitivityFactors; }
+
+ //!< Sets sensitive factor value for some type
+ Standard_EXPORT Standard_Boolean SensitivityFactor (const TCollection_AsciiString& theType, Standard_Integer& theValue);
+
+ //!< Sets sensitive factor value for some type
+ Standard_EXPORT void SetSensitivityFactor (const TCollection_AsciiString& theType, const Standard_Integer theValue);
+
+ //!< Returns container of default sensitive factor values
+ void SetSensitivityFactors (const SelectMgr_MapOfSensitivityFactor& theValues) { mySensitivityFactors = theValues; }
+
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
private:
NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities;
+
+ SelectMgr_MapOfSensitivityFactor mySensitivityFactors;
Standard_Integer myEntityIter;
Standard_Integer myMode;
SelectMgr_TypeOfUpdate myUpdateStatus;
// Purpose :
//==================================================
SelectMgr_SelectionManager::SelectMgr_SelectionManager (const Handle(SelectMgr_ViewerSelector)& theSelector)
-: mySelector (theSelector)
+: mySelector (theSelector), myDefaultSensitivityFactor (2)
{
//
}
}
}
+//=======================================================================
+//function : SetDefaultSelectionSensitivity
+//purpose :
+//=======================================================================
+void SelectMgr_SelectionManager::SetDefaultSensitivityFactor (const TCollection_AsciiString& theType, const Standard_Integer theValue)
+{
+ mySensitivityFactors.Bind (theType, theValue);
+}
+
//=======================================================================
//function : UpdateSelection
//purpose :
#ifndef _SelectMgr_SelectionManager_HeaderFile
#define _SelectMgr_SelectionManager_HeaderFile
+#include <SelectMgr_MapOfSensitivityFactor.hxx>
#include <SelectMgr_ViewerSelector.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
const Standard_Integer theMode,
const Standard_Integer theNewSens);
+ //!< Sets default sensitive factor, used for types where other is not defined
+ Standard_Integer DefaultSensitivityFactor() const { return myDefaultSensitivityFactor; }
+
+ //!< Returns default sensitive factor
+ void SetDefaultSensitivityFactor (const Standard_Integer theValue) { myDefaultSensitivityFactor = theValue; }
+
+ //!< Sets sensitive factor values for some type
+ Standard_EXPORT void SetDefaultSensitivityFactor (const TCollection_AsciiString& theType, const Standard_Integer theValue);
+
+ //!< Returns container of default sensitive factor values
+ const SelectMgr_MapOfSensitivityFactor& DefaultSensitivityFactors() const { return mySensitivityFactors; }
+
//! Re-adds selectable object in BVHs in all viewer selectors.
Standard_EXPORT void UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObj);
Handle(SelectMgr_ViewerSelector) mySelector;
NCollection_Map<Handle(SelectMgr_SelectableObject)> myGlobal;
+ SelectMgr_MapOfSensitivityFactor mySensitivityFactors; //!< container of sensitive factor values
+ Standard_Integer myDefaultSensitivityFactor;
};