1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024623: Visualization - improve selection mechanism

Redesign of selection mechanism:
- implemented 3-level BVH tree for selection;
- selection now calculates in 3D space;
- intersection tests were moved to SelectMgr_BaseFrustum descendants;
- removed .cdl files in Select3D and .cdl related to selection in MeshVS;
- SelectMgr_ViewerSelectors are now shared between local and global contexts;
- transformations of sensitive entities are now stored in SelectMgr_SelectableObject only. Sensitive entities are independent from transformations, it is applied to SelectMgr_SelectingVolumeManager instance only;
- connected and multiple connected interactive objects are now represented by their child objects only for SelectMgr_SelectionManager;
- if interactive object has child objects, they will be stored as separate objects in SelectMgr_SelectionManager now.
- test cases bugs/vis/bug24623_1, bug24623_2, bug24623_3, bug24623_4 to test performance and memory issues.
This commit is contained in:
vpa
2015-04-06 12:31:00 +03:00
committed by bugmaster
parent 7a91ad6e81
commit f751596e46
269 changed files with 12626 additions and 11723 deletions

View File

@@ -43,6 +43,7 @@
#include <Prs3d_PlaneAspect.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <Standard_Atomic.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <UnitsAPI.hxx>
#include <AIS_Trihedron.hxx>
@@ -2364,6 +2365,9 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
if (theIObj.IsNull()
|| !myObjects.IsBound (theIObj))
{
// for cases when reference shape of connected interactives was not displayed
// but its selection primitives were calculated
mgrSelector->Remove (theIObj);
return;
}
@@ -2584,65 +2588,11 @@ void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObj
//
}
//=======================================================================
//function : SetSensitivityMode
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSensitivityMode (const StdSelect_SensitivityMode theMode)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSensitivityMode (theMode);
}
else
{
myMainSel->SetSensitivityMode (theMode);
}
}
//=======================================================================
//function : SensitivityMode
//purpose :
//=======================================================================
StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->SensitivityMode()
: myMainSel->SensitivityMode();
}
//=======================================================================
//function : SetSensitivity
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSensitivity (const Standard_Real thePrecision)
{
if (HasOpenedContext())
{
myLocalContexts(myCurLocalIndex)->SetSensitivity (thePrecision);
}
else
{
myMainSel->SetSensitivity (thePrecision);
}
}
//=======================================================================
//function : Sensitivity
//purpose :
//=======================================================================
Standard_Real AIS_InteractiveContext::Sensitivity() const
{
return HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Sensitivity()
: myMainSel->Sensitivity();
}
//=======================================================================
//function : SetPixelTolerance
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Real thePrecision)
{
if (HasOpenedContext())
{
@@ -2658,7 +2608,7 @@ void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecis
//function : PixelTolerance
//purpose :
//=======================================================================
Standard_Integer AIS_InteractiveContext::PixelTolerance() const
Standard_Real AIS_InteractiveContext::PixelTolerance() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->PixelTolerance()
@@ -2836,3 +2786,37 @@ Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_Interactive
? theIObj->ZLayer()
: Graphic3d_ZLayerId_UNKNOWN;
}
//=======================================================================
//function : RebuildSelectionStructs
//purpose : Rebuilds 1st level of BVH selection forcibly
//=======================================================================
void AIS_InteractiveContext::RebuildSelectionStructs()
{
myMainSel->RebuildObjectsTree (Standard_True);
}
//=======================================================================
//function : Disconnect
//purpose : Disconnects selectable object from an assembly and updates selection structures
//=======================================================================
void AIS_InteractiveContext::Disconnect (const Handle(AIS_InteractiveObject)& theAssembly,
const Handle(AIS_InteractiveObject)& theObjToDisconnect)
{
if (theAssembly->IsInstance ("AIS_MultipleConnectedInteractive"))
{
const Handle(AIS_MultipleConnectedInteractive)& theObj =
Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly);
theObj->Disconnect (theObjToDisconnect);
mgrSelector->Remove (theObjToDisconnect);
}
else if (theAssembly->IsInstance ("AIS_ConnectedInteractive") && theObjToDisconnect == NULL)
{
const Handle(AIS_ConnectedInteractive)& theObj =
Handle(AIS_ConnectedInteractive)::DownCast (theAssembly);
theObj->Disconnect();
mgrSelector->Remove (theObj);
}
else
return;
}