]> OCCT Git - occt-copy.git/commitdiff
0031197: Visualization - SetTransformPersistence for highlight, select presentations CR31197_1
authornds <nds@opencascade.com>
Thu, 5 Dec 2019 14:15:09 +0000 (17:15 +0300)
committernds <nds@opencascade.com>
Wed, 12 Feb 2020 21:47:50 +0000 (00:47 +0300)
(cherry picked from commit df3644aa354c932483d89f553b09a2f399135f0f)

src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_InteractiveObject.cxx
src/AIS/AIS_InteractiveObject.hxx

index 5d4454d5e77bf9c6b6ce0cfd5ed20fc914c5790b..aef6de6533bac9e474b4b186a1d28139d7342adc 100644 (file)
@@ -2554,6 +2554,15 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
                                                       const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
   theObject->SetTransformPersistence (theTrsfPers);
+  UpdateOnTransformPersistence (theObject);
+}
+
+//=======================================================================
+//function : UpdateOnTransformPersistence
+//purpose  :
+//=======================================================================
+void AIS_InteractiveContext::UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theObject)
+{
   if (!myObjects.IsBound (theObject))
   {
     return;
index 0e1b56d8ff990f7d13ebfd5b8bfdb716b438f619..bfb74eddd5762515777129f55adc35b7270e1a01 100644 (file)
@@ -344,6 +344,11 @@ public: //! @name object local transformation management
   Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
                                                 const Handle(Graphic3d_TransformPers)& theTrsfPers);
 
+  //! Updates displayed interactive object by checking and recomputing its flagged as "to be recomputed" presentation and selection structures.
+  //! This method does not force any recomputation on its own.
+  //! The method recomputes selections even if they are loaded without activation in particular selector.
+  Standard_EXPORT void UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theIObj);
+
   Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
   void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
                                 const Graphic3d_TransModeFlags&      theFlag,
index 79139abe4d445e7c38cd0ad538efa37fc20f8fda..52d203eb97709929943f887aa08dc665865576bf 100644 (file)
@@ -83,6 +83,17 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
   }
 }
 
+//-----------------------------------------------------------------------------
+void AIS_InteractiveObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
+{
+  SelectMgr_SelectableObject::SetTransformPersistence (theTrsfPers);
+
+  if (!GetContext().IsNull())
+  {
+    GetContext()->UpdateOnTransformPersistence (this);
+  }
+}
+
 //=======================================================================
 //function : HasPresentation
 //purpose  :
index e66043f9664bd72bb6c3f15fcc54c5fecabdb252..e461140b0a909a4cb2f26a1f45ba6a3ef6a2e137 100644 (file)
@@ -108,6 +108,11 @@ public:
   //! Returns the context pointer to the interactive context.
   Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
 
+  //! Sets up Transform Persistence defining a special Local Coordinate system where this object should be located.
+  //! Updates the presentation in context if it is not NULL
+  //! @sa Graphic3d_TransformPers class description
+  Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
   //! Returns TRUE when this object has a presentation in the current DisplayMode()
   Standard_EXPORT Standard_Boolean HasPresentation() const;