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

0032365: Visualization - refactoring of viewer selector

Add SelectMgr_BaseIntersector class as base intersector that can have any geometry not only frustum.
Remove cached static array of selecting volumes from selecting volume manager. Keep only one the latest active selection volume.
Change initialization interface of active volume frustum inside of selecting volume manager: Init*SelectingVolume(), set required parameters, BuildSelectingVolume(). Mark existing BuildSelectingVolume() methods as deprecated.
Use SelectMgr_SelectionType instead of SelectBasics_SelectingVolumeManager::SelectionType (the last one is marked as deprecated).
Add interface GetViewRayDirection() to selecting volume manager to get view ray direction (instead of computation it as vector from near to far point).
Add interface IsScalableActiveVolume() to selecting volume manager to check possibility of scaling of current active selecting volume.
This commit is contained in:
osa
2021-05-13 18:52:39 +03:00
committed by bugmaster
parent 77d94fd174
commit e1eb39d29d
34 changed files with 1397 additions and 578 deletions

View File

@@ -4145,24 +4145,22 @@ static Standard_Integer OCC26195 (Draw_Interpretor& theDI, Standard_Integer theA
}
SelectMgr_SelectingVolumeManager* aMgr = new SelectMgr_SelectingVolumeManager();
aMgr->SetActiveSelectionType (theArgNb > 4 ?
SelectMgr_SelectingVolumeManager::Box : SelectMgr_SelectingVolumeManager::Point);
if (theArgNb > 4)
{
aMgr->InitBoxSelectingVolume (aPxPnt1, aPxPnt2);
}
else
{
aMgr->InitPointSelectingVolume (aPxPnt1);
}
aMgr->SetCamera (ViewerTest::CurrentView()->Camera());
aMgr->SetPixelTolerance (ViewerTest::GetAISContext()->PixelTolerance());
Standard_Integer aWidth, aHeight;
ViewerTest::CurrentView()->View()->Window()->Size (aWidth, aHeight);
aMgr->SetWindowSize (aWidth, aHeight);
if (theArgNb > 4)
{
aMgr->BuildSelectingVolume (aPxPnt1, aPxPnt2);
}
else
{
aMgr->BuildSelectingVolume (aPxPnt1);
}
aMgr->BuildSelectingVolume();
const gp_Pnt* aVerts = aMgr->GetVertices();
gp_Pnt aNearPnt = aMgr->GetNearPickedPnt();
gp_Pnt aFarPnt = aMgr->GetFarPickedPnt();
BRepBuilderAPI_MakePolygon aWireBldrs[4];
aWireBldrs[0].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
@@ -4202,6 +4200,17 @@ static Standard_Integer OCC26195 (Draw_Interpretor& theDI, Standard_Integer theA
aCmp->SetColor (Quantity_NOC_GREEN);
ViewerTest::Display ("c", aCmp, Standard_True, Standard_True);
gp_Pnt aNearPnt = aMgr->GetNearPickedPnt();
gp_Pnt aFarPnt = aMgr->GetFarPickedPnt();
if (Precision::IsInfinite (aFarPnt.X()) ||
Precision::IsInfinite (aFarPnt.Y()) ||
Precision::IsInfinite (aFarPnt.Z()))
{
theDI << "Near: " << aNearPnt.X() << " " << aNearPnt.Y() << " " << aNearPnt.Z() << "\n";
theDI << "Far: infinite point " << "\n";
return 0;
}
Handle(Geom_CartesianPoint) aPnt1 = new Geom_CartesianPoint (aNearPnt);
Handle(Geom_CartesianPoint) aPnt2 = new Geom_CartesianPoint (aFarPnt);