mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0026960: Visualization, TKOpenGl - update transformation of dynamically highlighted presentation
- added method UpdateHighlightTrsf for immediate update of highlight presentation's transformation; - interfaces for immediate transformation update of corresponding presentations were added to entity owner classes; - test case for issue #26960
This commit is contained in:
@@ -669,3 +669,65 @@ void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_Presentab
|
||||
aPrs->SetShadingAspect (theShadingAspect);
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// =======================================================================
|
||||
// function : updatePrsTransformation
|
||||
// purpose : Internal funtion that scans thePrsList for shadow presentations
|
||||
// and applies transformation theTrsf to them in case if parent ID
|
||||
// of shadow presentation is equal to theRefId
|
||||
// =======================================================================
|
||||
void updatePrsTransformation (const PrsMgr_ListOfPresentations& thePrsList,
|
||||
const Standard_Integer theRefId,
|
||||
const Graphic3d_Mat4& theTrsf)
|
||||
{
|
||||
for (PrsMgr_ListOfPresentations::Iterator anIter (thePrsList); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Prs3d_Presentation)& aPrs = anIter.Value();
|
||||
if (aPrs.IsNull())
|
||||
continue;
|
||||
|
||||
Handle(Prs3d_PresentationShadow) aShadowPrs = Handle(Prs3d_PresentationShadow)::DownCast (aPrs);
|
||||
if (aShadowPrs.IsNull() || aShadowPrs->ParentId() != theRefId)
|
||||
continue;
|
||||
|
||||
aShadowPrs->CStructure()->Transformation = theTrsf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UpdateHighlightTrsf
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
|
||||
const Handle(PrsMgr_PresentableObject)& theObj,
|
||||
const Standard_Integer theMode,
|
||||
const Handle(PrsMgr_PresentableObject)& theSelObj)
|
||||
{
|
||||
if (theObj.IsNull())
|
||||
return;
|
||||
|
||||
const Handle(Prs3d_Presentation)& aBasePrs = Presentation (theObj, theMode, Standard_False)->Presentation();
|
||||
const Handle(Prs3d_Presentation)& aParentPrs = theSelObj.IsNull() ?
|
||||
aBasePrs : Presentation (theSelObj, theMode, Standard_False)->Presentation();
|
||||
const Standard_Integer aParentId = aParentPrs->CStructure()->Id;
|
||||
|
||||
updatePrsTransformation (myImmediateList, aParentId, aBasePrs->CStructure()->Transformation);
|
||||
|
||||
if (!myViewDependentImmediateList.IsEmpty())
|
||||
{
|
||||
for (theViewer->InitActiveViews(); theViewer->MoreActiveViews(); theViewer->NextActiveViews())
|
||||
{
|
||||
const Handle(Graphic3d_CView)& aView = theViewer->ActiveView()->View();
|
||||
Handle(Graphic3d_Structure) aViewDepParentPrs;
|
||||
if (aView->IsComputed (aParentId, aViewDepParentPrs))
|
||||
{
|
||||
updatePrsTransformation (myViewDependentImmediateList,
|
||||
aViewDepParentPrs->CStructure()->Id,
|
||||
aBasePrs->CStructure()->Transformation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -162,6 +162,14 @@ public:
|
||||
//! Optional argument theSelObj specifies parent decomposed object to inherit its view affinity.
|
||||
Standard_EXPORT Handle(PrsMgr_Presentation) Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObject, const Standard_Integer theMode = 0, const Standard_Boolean theToCreate = Standard_False, const Handle(PrsMgr_PresentableObject)& theSelObj = NULL) const;
|
||||
|
||||
//! Allows to apply location transformation to shadow highlight presentation immediately.
|
||||
//! @param theObj defines the base object, it local transformation will be applied to corresponding highlight structure
|
||||
//! @param theMode defines display mode of the base object
|
||||
//! @param theSelObj defines the object produced after decomposition of the base object for local selection
|
||||
Standard_EXPORT void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
|
||||
const Handle(PrsMgr_PresentableObject)& theObj,
|
||||
const Standard_Integer theMode = 0,
|
||||
const Handle(PrsMgr_PresentableObject)& theSelObj = NULL);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user