1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't update all aspects

AIS_InteractiveObject::SynchronizeAspects() now propagates event
to OpenGl_Group::SynchronizeAspects() which properly handles
all aspects defined within the group.
This commit is contained in:
mnv 2018-09-24 11:53:12 +03:00 committed by bugmaster
parent f2eaecb217
commit eaac086605
9 changed files with 59 additions and 32 deletions

View 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();
}
}
}

View 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;

View 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:

View 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:

View 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:

View File

@ -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:

View 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();

View 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 :

View 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,