1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026641: Visualization, TKOpenGl - handle correctly transformation persistence within perspective projection.

Add a new method AIS_InteractiveContext::SetTransformPersistence, which sets transform persistence to object and selection.
Add a new method SelectMgr_SelectionManager::UpdateSelection, which re-adds selectable object in BVHs in all viewer selectors.
Add a new method SelectMgr_ViewerSelector::MoveSelectableObject, which moves object from set of not transform persistence objects to set of transform persistence objects (or vice versa).
Add a new method Graphic3d_TransformUtils::Convert, which converts gp_Trsf to Graphic3d_Mat4.
Remove the method PrsMgr_PresentableObject::SetTransformPersistence(flag, point).
This commit is contained in:
isk
2016-07-05 13:32:52 +03:00
committed by bugmaster
parent fbad941bd4
commit 1d92133e83
20 changed files with 254 additions and 77 deletions

View File

@@ -974,3 +974,35 @@ void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr
}
}
}
//=======================================================================
//function : UpdateSelection
//purpose :
//=======================================================================
void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObject)
{
if (myGlobal.Contains (theObject))
{
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
Handle(SelectMgr_ViewerSelector) aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key());
if (aSelector->Contains (theObject))
{
aSelector->MoveSelectableObject (theObject);
}
}
}
if (myLocal.IsBound (theObject))
{
const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject);
for (SelectMgr_SequenceOfSelector::Iterator aSelectorsIter (aSelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.ChangeValue();
if (aSelector->Contains (theObject))
{
aSelector->MoveSelectableObject (theObject);
}
}
}
}

View File

@@ -125,6 +125,9 @@ public:
const Standard_Integer theMode,
const Standard_Integer theNewSens);
//! Re-adds selectable object in BVHs in all viewer selectors.
Standard_EXPORT void UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObj);
DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectionManager,MMgt_TShared)
protected:

View File

@@ -322,6 +322,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
{
const Graphic3d_Mat4d& aProjection = mySelectingVolumeMgr.ProjectionMatrix();
const Graphic3d_Mat4d& aWorldView = mySelectingVolumeMgr.WorldViewMatrix();
Standard_Integer aViewportWidth;
Standard_Integer aViewportHeight;
mySelectingVolumeMgr.WindowSize (aViewportWidth, aViewportHeight);
@@ -810,6 +811,27 @@ void SelectMgr_ViewerSelector::AddSelectionToObject (const Handle(SelectMgr_Sele
}
}
//=======================================================================
// function : MoveSelectableObject
// purpose :
//=======================================================================
void SelectMgr_ViewerSelector::MoveSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject)
{
if (!mySelectableObjects.Remove (theObject))
{
mySelectableObjectsTrsfPers.Remove (theObject);
}
if (!theObject->TransformPersistence().Flags)
{
mySelectableObjects.Append (theObject);
}
else
{
mySelectableObjectsTrsfPers.Append (theObject);
}
}
//=======================================================================
// function : RemoveSelectableObject
// purpose : Removes selectable object from map of selectable ones

View File

@@ -217,6 +217,10 @@ public:
Standard_EXPORT void AddSelectionToObject (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_Selection)& theSelection);
//! Moves existing object from set of not transform persistence objects
//! to set of transform persistence objects (or vice versa).
Standard_EXPORT void MoveSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject);
//! Removes selectable object from map of selectable ones
Standard_EXPORT void RemoveSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject);