]> OCCT Git - occt-copy.git/commitdiff
0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't...
authormnv <mnv@opencascade.com>
Mon, 24 Sep 2018 08:53:12 +0000 (11:53 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 26 Sep 2018 09:19:07 +0000 (12:19 +0300)
AIS_InteractiveObject::SynchronizeAspects() now propagates event
to OpenGl_Group::SynchronizeAspects() which properly handles
all aspects defined within the group.

src/AIS/AIS_InteractiveObject.cxx
src/Graphic3d/Graphic3d_Group.hxx
src/OpenGl/OpenGl_AspectFace.hxx
src/OpenGl/OpenGl_AspectLine.hxx
src/OpenGl/OpenGl_AspectMarker.hxx
src/OpenGl/OpenGl_AspectText.hxx
src/OpenGl/OpenGl_Element.hxx
src/OpenGl/OpenGl_Group.cxx
src/OpenGl/OpenGl_Group.hxx

index fba30b6cf06b0d9e48670d89edcb5d77e6bca789..8e63104341ac6e926f4d45b0f202ecb99ecf22a0 100644 (file)
@@ -615,31 +615,9 @@ void AIS_InteractiveObject::SynchronizeAspects()
 
     for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
     {
-      Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
-      if (aGrp.IsNull())
+      if (!aGroupIter.Value().IsNull())
       {
-        continue;
-      }
-
-      Handle(Graphic3d_AspectLine3d)     aLineAspect   = aGrp->LineAspect();
-      Handle(Graphic3d_AspectFillArea3d) aFaceAspect   = aGrp->FillAreaAspect();
-      Handle(Graphic3d_AspectMarker3d)   aMarkerAspect = aGrp->MarkerAspect();
-      Handle(Graphic3d_AspectText3d)     aTextAspect   = aGrp->TextAspect();
-      if (!aLineAspect.IsNull())
-      {
-        aGrp->SetGroupPrimitivesAspect (aLineAspect);
-      }
-      if (!aFaceAspect.IsNull())
-      {
-        aGrp->SetGroupPrimitivesAspect (aFaceAspect);
-      }
-      if (!aMarkerAspect.IsNull())
-      {
-        aGrp->SetGroupPrimitivesAspect (aMarkerAspect);
-      }
-      if (!aTextAspect.IsNull())
-      {
-        aGrp->SetGroupPrimitivesAspect (aTextAspect);
+        aGroupIter.ChangeValue()->SynchronizeAspects();
       }
     }
   }
index 4e1c26f9decb9829a31ab31dcbb4e69d4cdbed49..d0f1a478b32fa991b629b5197165055af17ef406 100644 (file)
@@ -146,6 +146,9 @@ public:
   //! after this call in the group.
   virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) = 0;
 
+  //! Update presentation aspects after their modification.
+  virtual void SynchronizeAspects() = 0;
+
   //! Returns TRUE if aspect is set for the group.
   Standard_EXPORT Standard_Boolean IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const;
 
index e5bf75c7e714dd9a9028b80cf0d27fb54ff7c6d4..8d93a114d68c1e7bf6e49a3ae98c2633873d4a5e 100644 (file)
@@ -79,8 +79,11 @@ public:
     return myResources.ShaderProgram;
   }
 
-  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
+  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
+
+  //! Update presentation aspects parameters after their modification.
+  virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); }
 
 protected:
 
index bc35f9ba9317c54550639087c1a4880f3f7c1263..a44bd54671e8de6f9c338f6e87f4b81345e90745 100644 (file)
@@ -53,8 +53,11 @@ public:
     return myResources.ShaderProgram;
   }
 
-  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
+  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
+
+  //! Update presentation aspects parameters after their modification.
+  virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); }
 
 protected:
 
index 2f83701ee3b82b1df8757dc39741086f3ee53bbe..c4178aa4b4db9bb27f08a6a8ad591178d4f62e32 100644 (file)
@@ -95,8 +95,11 @@ public:
     return myResources.ShaderProgram();
   }
 
-  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
+  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
+
+  //! Update presentation aspects parameters after their modification.
+  virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); }
 
 protected:
 
index 0be8f3d74ef65500056e1ebe372b3288621650dd..2596b878a86673afe3f3b89f4e8b9ee26eb6df17 100755 (executable)
@@ -59,8 +59,11 @@ public:
     return myResources.ShaderProgram;
   }
 
-  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
+  Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
+
+  //! Update presentation aspects parameters after their modification.
+  virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); }
 
 protected:
 
index 0708f42c14c4f38f74c464870d60acbc39a72e10..8a14275a1ab8811341fcd781e2c38729cbe7a964 100644 (file)
@@ -60,6 +60,9 @@ public:
   //! Return TRUE if primitive type generates shaded triangulation (to be used in filters).
   virtual Standard_Boolean IsFillDrawMode() const { return false; }
 
+  //! Update parameters of the drawable elements.
+  virtual void SynchronizeAspects() {}
+
 protected:
 
   Standard_EXPORT virtual ~OpenGl_Element();
index c9211adcc52d55ffb8497f053be98104397cd1d9..8e0b41514b4f3f1693fa4b69e2b27b9363898d30 100644 (file)
@@ -264,6 +264,34 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& th
   Update();
 }
 
+// =======================================================================
+// function : SynchronizeAspects
+// purpose  :
+// =======================================================================
+void OpenGl_Group::SynchronizeAspects()
+{
+  if (myAspectFace != NULL)
+  {
+    myAspectFace->SynchronizeAspects();
+  }
+  if (myAspectLine != NULL)
+  {
+    myAspectLine->SynchronizeAspects();
+  }
+  if (myAspectMarker != NULL)
+  {
+    myAspectMarker->SynchronizeAspects();
+  }
+  if (myAspectText != NULL)
+  {
+    myAspectText->SynchronizeAspects();
+  }
+  for (OpenGl_ElementNode* aNode = myFirst; aNode != NULL; aNode = aNode->next)
+  {
+    aNode->elem->SynchronizeAspects();
+  }
+}
+
 // =======================================================================
 // function : AddPrimitiveArray
 // purpose  :
index c845615d48f3563b46fd6369ec71aa091ab9c261..eb779abad78dab04b9a65246b9689d51be3ba1ec 100644 (file)
@@ -103,6 +103,9 @@ public:
   //! Append text aspect as an element.
   Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) Standard_OVERRIDE;
 
+  //! Update presentation aspects after their modification.
+  Standard_EXPORT virtual void SynchronizeAspects() Standard_OVERRIDE;
+
   //! Add primitive array element
   Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
                                                   const Handle(Graphic3d_IndexBuffer)& theIndices,