public:
//! Construct adaptor.
- BVHBuilderAdaptorRegular (ObjectsMap& theObjects) : myObjects (theObjects) {};
+ BVHBuilderAdaptorRegular (ObjectsMap& theObjects, const NCollection_Map<Graphic3d_ZLayerId>& theDisabledZLayers)
+ : myObjects (theObjects), myDisabledZLayers (theDisabledZLayers) {};
//! Returns bounding box of object with index theIndex
virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE
{
const Handle(SelectMgr_SelectableObject)& anObject = myObjects.FindKey (theIndex + 1);
+ if (!anObject.IsNull() && myDisabledZLayers.Contains (anObject->ZLayer()))
+ return Select3D_BndBox3d();
+
Bnd_Box aBox;
anObject->BoundingBox (aBox);
if (aBox.IsVoid())
private:
ObjectsMap& myObjects;
+ NCollection_Map<Graphic3d_ZLayerId> myDisabledZLayers;
mutable Select3D_BndBox3d myBox;
};
//! theWidth, theHeight [in] view properties used for computation of
//! bounding boxes within the world view camera space.
BVHBuilderAdaptorPersistent (ObjectsMap& theObjects,
+ const NCollection_Map<Graphic3d_ZLayerId>& theDisabledZLayers,
const Handle(Graphic3d_Camera)& theCamera,
const Graphic3d_Mat4d& theProjectionMat,
const Graphic3d_Mat4d& theWorldViewMat,
const Standard_Integer theWidth,
const Standard_Integer theHeight)
- : myObjects (theObjects)
+ : myObjects (theObjects), myDisabledZLayers (theDisabledZLayers)
{
myBoundings.ReSize (myObjects.Size());
for (Standard_Integer anI = 1; anI <= myObjects.Size(); ++anI)
{
const Handle(SelectMgr_SelectableObject)& anObject = myObjects (anI);
+ if (!anObject.IsNull() && myDisabledZLayers.Contains (anObject->ZLayer()))
+ {
+ myBoundings.Add (new Select3D_HBndBox3d());
+ continue;
+ }
Bnd_Box aBoundingBox;
anObject->BoundingBox (aBoundingBox);
private:
ObjectsMap& myObjects;
+ NCollection_Map<Graphic3d_ZLayerId> myDisabledZLayers;
mutable Select3D_BndBox3d myBox;
typedef NCollection_Shared<Select3D_BndBox3d> Select3D_HBndBox3d;
NCollection_IndexedMap<Handle(Select3D_HBndBox3d)> myBoundings;
if (!IsEmpty (BVHSubset_3d) && myIsDirty[BVHSubset_3d])
{
// construct adaptor over private fields to provide direct access for the BVH builder
- BVHBuilderAdaptorRegular anAdaptor (myObjects[BVHSubset_3d]);
+ BVHBuilderAdaptorRegular anAdaptor (myObjects[BVHSubset_3d], myDisabledZLayers);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_3d]->Build (&anAdaptor, myBVH[BVHSubset_3d].get(), anAdaptor.Box());
(myIsDirty[BVHSubset_3dPersistent] || myLastViewState.IsChanged (theViewState) || isWindowSizeChanged))
{
// construct adaptor over private fields to provide direct access for the BVH builder
- BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_3dPersistent],
+ BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_3dPersistent], myDisabledZLayers,
theCamera, theProjectionMat, theWorldViewMat, theViewportWidth, theViewportHeight);
// update corresponding BVH tree data structure
(myIsDirty[BVHSubset_2dPersistent] || myLastViewState.IsProjectionChanged (theViewState) || isWindowSizeChanged))
{
// construct adaptor over private fields to provide direct access for the BVH builder
- BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_2dPersistent],
+ BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_2dPersistent], myDisabledZLayers,
theCamera, theProjectionMat, SelectMgr_SelectableObjectSet_THE_IDENTITY_MAT, theViewportWidth, theViewportHeight);
// update corresponding BVH tree data structure
const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight)
{
+ if (!theObject.IsNull() && myDisabledZLayers.Contains (theObject->ZLayer()))
+ return;
+
Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
if (anEntitySet->Size() == 0)
{
{
mySelectingVolumeMgr.AllowOverlapDetection (theIsToAllow);
}
+
+//=======================================================================
+//function : SetDisabledZLayers
+//purpose :
+//=======================================================================
+void SelectMgr_ViewerSelector::SetDisabledZLayers (const NCollection_Map<Graphic3d_ZLayerId>& theLayers)
+{
+ myDisabledZLayers = theLayers;
+ mySelectableObjects.SetDisabledZLayers (theLayers);
+}
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
+#include <NCollection_Map.hxx>
#include <OSD_Chronometer.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx>
//! mark both included and overlapped entities as matched
Standard_EXPORT void AllowOverlapDetection (const Standard_Boolean theIsToAllow);
+ //! Sets container of Z layers, that should not be processed by selection
+ Standard_EXPORT void SetDisabledZLayers (const NCollection_Map<Graphic3d_ZLayerId>& theLayers);
+
public:
//! Begins an iteration scanning for the owners detected at a position in the view.
gp_Dir myCameraDir;
Standard_Real myCameraScale;
+ NCollection_Map<Graphic3d_ZLayerId> myDisabledZLayers;
+
private:
Handle(TColStd_HArray1OfInteger) myIndexes;