- 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
Handle(StdSelect_ViewerSelector3d) aTempSel = myLocalContexts (myCurLocalIndex)->MainSelector();
mgrSelector->Update (theIObj, aTempSel, Standard_False);
}
+
+ // if the object or its part is highlighted dynamically, it is necessary to apply location transformation
+ // to its highlight structure immediately
+ if (!myLastPicked.IsNull() && myLastPicked->Selectable() == theIObj)
+ {
+ myLastPicked->UpdateHighlightTrsf (myMainVwr,
+ myMainPM,
+ theIObj->HasDisplayMode() ? theIObj->DisplayMode() : 0);
+ }
}
//=======================================================================
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);
+ }
+ }
+ }
+}
//! 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);
{
//
}
+
+//=======================================================================
+//function : UpdateHighlightTrsf
+//purpose :
+//=======================================================================
+void SelectMgr_EntityOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
+ const Handle(PrsMgr_PresentationManager3d)& theManager,
+ const Standard_Integer theDispMode)
+{
+ if (mySelectable == NULL)
+ return;
+
+ theManager->UpdateHighlightTrsf (theViewer, mySelectable, theDispMode);
+}
class SelectMgr_SelectableObject;
class PrsMgr_PresentationManager;
class TopLoc_Location;
+class V3d_Viewer;
class SelectMgr_EntityOwner;
//! Set Z layer ID and update all presentations.
Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId);
-
+ //! Implements immediate application of location transformation of parent object to dynamic highlight structure
+ Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
+ const Handle(PrsMgr_PresentationManager3d)& theManager,
+ const Standard_Integer theDispMode);
DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner,SelectBasics_EntityOwner)
myPrsSh->SetZLayer (theLayerId);
}
}
+
+//=======================================================================
+//function : UpdateHighlightTrsf
+//purpose :
+//=======================================================================
+void StdSelect_BRepOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
+ const Handle(PrsMgr_PresentationManager3d)& theManager,
+ const Standard_Integer theDispMode)
+{
+ if (myPrsSh.IsNull() && Selectable().IsNull())
+ return;
+
+ theManager->UpdateHighlightTrsf (theViewer, Selectable(), theDispMode, myPrsSh);
+}
//! Set Z layer ID and update all presentations.
Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId) Standard_OVERRIDE;
-
-
+ //! Implements immediate application of location transformation of parent object to dynamic highlight structure
+ Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
+ const Handle(PrsMgr_PresentationManager3d)& theManager,
+ const Standard_Integer theDispMode) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner,SelectMgr_EntityOwner)
--- /dev/null
+puts "========"
+puts "OCC26960"
+puts "========"
+puts ""
+##################################################################
+puts "Visualization, TKOpenGl - update transformation of dynamically highlighted presentation"
+##################################################################
+
+pload VISUALIZATION MODELING
+
+box b 1 2 3
+
+vclear
+vinit View1
+
+vdisplay -dispmode 1 -highmode 1 b
+vfit
+vselmode 4 1
+vmoveto 250 250
+if {[vreadpixel 350 140 rgb name] != "BLACK"} {
+ puts "ERROR: wrong inital location"
+}
+vsetlocation b 0.5 0 0
+if {[vreadpixel 350 140 rgb name] != "CYAN1"} {
+ puts "ERROR: the transformation was not applied to highlight structure"
+}
+
+set only_screen 1