DiscussionsIssue archiveOCCT:Visualization

Archived issue #0030124

Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic

Open CASCADEOCCT:Visualizationclosed32 public notes

Search issues

Description

AIS_InteractiveObject has several properties related to presentation invalidation:
- RecomputeEveryPrs()/ListOfRecomputeModes()/MustRecomputePrs()/SetRecomputeOk()
- ToBeUpdated()/SetToUpdate()

The usage of first set of methods looks like a nonsense - they are used as temporary flags within modified object while it is modified by methods like AIS_InteractiveContext::SetWidth() so that invalidated modes are recomputed by AIS_InteractiveContext::redisplayPrsRecModes(). At the same time, RecomputeEveryPrs() flag is messed up with the list of invalidated modes. The list of invalidated modes is stored as AIS_InteractiveObject class field regardless of existence of these modes.

The second set looks more clear, since they invalidate already computed presentations and handled by AIS_InteractiveContext::redisplayPrsModes() as well as by PrsMgr_PresentationManager.

It looks unreasonable having 2 duplicated mechanisms for invalidating presentations, so that one (first) should be removed and replaced by another.

Command vdisplay might require changes so that to rely on invalidation flag.

Steps to reproduce

Not required

Public activity

32 archived notes

Participants are labeled by their role within this record.

01Commenter 3
I have been struggling with presentation invalidation. Has it something to do with this issue?

https://www.opencascade.com/content/lazy-presentation-update
02Author
> I have been struggling with presentation invalidation.
> Has it something to do with this issue?
Sorry, but I have almost zero knowledge about TPrsStd to comment.
This bug is related to applications working directly with AIS objects
and having an issue how properly mark presentation invalidated to force Recompute later on, since there are several similar methods.

TPrsStd is part of Application Framework, not Visualization;
although it deals with AIS objects.

03Commenter 3
Okay, thank you.
04Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mnv
Date: Fri Sep 28 13:06:23 2018 +0300

    0030124: Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic
    
    Removed excess mechanism for invalidating presentations.
    Updated vdisplay command logic for redisplaying presentations.
05Author
+  TColStd_ListOfInteger aModes;
+  theIObj->ToBeUpdated (aModes);
+  for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())

I think it would be better replacing this logic by direct iteration through Object presentations
(probably by improving / extending PrsMgr_PresentableObject::Update() methods).

06Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
07Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
08Commenter 8
Patch is ready for review.
09Author
   TColStd_ListOfInteger aPrsModes;
   theIObj->ToBeUpdated (aPrsModes);

Please update the code to avoid creation of temporary list of presentation modes to update.
10Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mnv
Date: Fri Sep 28 13:06:23 2018 +0300

    0030124: Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic
    
    Removed excess mechanism for invalidating presentations.
11Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
12Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
13Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
14Commenter 14
15Author
@@ -1006,12 +1006,7 @@ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIOb
     return;
   }
 
-  TColStd_ListOfInteger aPrsModes;
-  theIObj->ToBeUpdated (aPrsModes);
-  for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
-  {
-    theIObj->Update (aPrsModesIt.Value(), Standard_False);
-  }
+  theIObj->Update();
...
+void PrsMgr_PresentableObject::Update (const Standard_Boolean theAllModes,
+                                       const Standard_Boolean theClearOther)
...
+    if (theAllModes)
+    {
+      aPrsMgr->Update (this, aModedPrs.Mode());
+    }
+    else
+    {
+      if (aPrsMgr->IsDisplayed (this, aModedPrs.Mode())
+       || aPrsMgr->IsHighlighted (this, aModedPrs.Mode()))
+      {
+        aPrsMgr->Update (this, aModedPrs.Mode());
+      }
+      else
+      {
+        SetToUpdate (aModedPrs.Mode());
+      }

It doesn't look intended to work at all - with ClearOther set to FALSE,
MustBeUpdated is ignored at all, and all active presentations
are re-computed unconditionally while inactive presentations
are invalidated unconditionally.
16Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mnv
Date: Fri Sep 28 13:06:23 2018 +0300

    0030124: Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic
    
    Removed excess mechanism for invalidating presentations.
17Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
18Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
19Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mnv
Date: Fri Sep 28 13:06:23 2018 +0300

    0030124: Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic
    
    Removed excess mechanism for invalidating presentations.
20Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
21Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
22Commenter 4
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: mnv
Date: Thu Mar 7 20:45:58 2019 +0300

    0030124: Visualization, AIS_InteractiveObject - clean up confusing Presentation invalidation logic
    
    Removed excess mechanism for invalidating presentations AIS_InteractiveObject::myRecomputeEveryPrs.
    PrsMgr_PresentableObject::Update() has been deprecated and replaced by PrsMgr_PresentableObject::UpdatePresentations()
    recomputing only explicitly invalidated presentations.
23Commenter 4
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
24Author
25Commenter 1
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16568.019999999964 / 16562.049999999996 [+0.04%]
Products
Total CPU difference: 9114.850000000039 / 9082.700000000026 [+0.35%]
Windows-64-VC14:
OCCT
Total CPU difference: 17967.078125 / 17955.015625 [+0.07%]
Products
Total CPU difference: 10455.78125 / 10469.015625 [-0.13%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
26Commenter 4
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Mar 13 07:58:18 2019 +0300

    # gcc compiler fix

27Commenter 4
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
28Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]
29Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]
30Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]
31Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]
32Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records