DiscussionsIssue archiveOCCT:Visualization

Archived issue #0028088

Visualization, AIS_InteractiveContext - drop default value for Update Viewer parameter

Open CASCADEOCCT:Visualizationclosed26 public notes

Search issues

Description

AIS_InteractiveContext defines many methods taking parameter to update viewer or not. The problem is that this parameter has default value which is TRUE.

Existing syntax simplifies first usage of OCCT - e.g. application developer sees all changes immediately in 3D Viewer exactly at the line where AIS_InteractiveContext method is called.

However, this approach is inefficient and error-prone, because real application usually performs several changes in AIS_InteractiveContext at once, and performing additional Viewer updates in between significantly impacts overall performance.

The usual approach is to set the UpdateViewer parameter to FALSE for every called method AIS_InteractiveContext, and calling Viewer update explicitly once after all modifications have been done. This approach works well, however the problem is that default value in all methods is TRUE and it is easy to miss argument at application code leading to implicit redundant Viewer updates which are not well-seen to developer, but still impact performance.

It is proposed to alter existing API and remove default value to UpdateViewer flag from all AIS_InteractiveContext methods, so that user should always specify desired effect.

Steps to reproduce

N/A

Public activity

26 archived notes

Participants are labeled by their role within this record.

01Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Fri Dec 23 11:20:29 2016 +0300

    0028088: Visualization, AIS_InteractiveContext - drop default value for Update Viewer parameter
02Commenter 2
Some methods of AIS_InteractiveContext have several default parameters:

void ClearPrs (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer theMode = 0, const Standard_Boolean theToUpdateViewer = Standard_True);

void Redisplay (const AIS_KindOfInteractive theTypeOfObject, const Standard_Integer theSignature = -1, const Standard_Boolean theToUpdateViewer = Standard_True);

void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Real theValue = 0.6, const Standard_Boolean theToUpdateViewer = Standard_True);

void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theMode, const Standard_ShortReal theFactor = 1.0, const Standard_ShortReal theUnits = 0.0, const Standard_Boolean theToUpdateViewer = Standard_True);

void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect, const Standard_Boolean theGlobalChange = Standard_True, const Standard_Boolean theToUpdateViewer = Standard_True);

void CloseLocalContext (const Standard_Integer theIndex = -1, const Standard_Boolean theToUpdateViewer = Standard_True);

void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);

It is not clear what with them to do.
03Author
ClearPrs(), Redisplay(), SetTransparency(), SetPolygonOffsets() - all default values can be removed.

SetSelectedAspect() - remove unused second argument and default value for theToUpdateViewer.

CloseLocalContext() - deprecated method, can be left as is.

FitSelected() - define one more method without theMargin argument. In the current definition - remove default values from both arguments.

04Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Tue Dec 27 13:24:08 2016 +0300

    0028088: Visualization, AIS_InteractiveContext - drop default value for Update Viewer parameter
05Author
Please add notes to upgrade guide and update sample for C# wrapper.
06Author
Please remove also the following line within AIS_Manipulator::Attach():
    aContext->CurrentViewer()->RedrawImmediate();
07Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Wed Dec 28 14:25:38 2016 +0300

    Add notes to upgrade guide and update AIS_Manipulator::Attach().

08Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Tue Dec 27 13:24:08 2016 +0300

    0028088: Visualization, AIS_InteractiveContext - drop default value for Update Viewer parameter
09Author
Please test the patch.
10Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
11Commenter 11
Dear Ilya,

Please, rebase CR28088_2 (from occt git-repositories) and CR28088_1 (from products git-repositories) on the current masters. Thank you in advance.
12Commenter 3
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
13Author
Rebased.
14Commenter 14
15Commenter 15
Dear Kirill,

Branches CR28088_2 (from occt git-repositoriy) and CR28088_1 (from products git-repository) have been rejected due to:
- compilation errors
16Commenter 3
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Tue Jan 10 13:45:17 2017 +0300

    fix compilation errors

17Commenter 3
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Tue Dec 27 13:24:08 2016 +0300

    0028088: Visualization, AIS_InteractiveContext - drop default value for Update Viewer parameter
18Author
Please check updated patch in branch CR28088_3.
19Commenter 19
Dear Commenter 1,

Branch CR28088_3 from occt git-repository (and CR28088_3 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MasOS: 0 (0 on master)
products component:
   Linux: 63
   Windows: 0
   MacOS: 1143

Compilation errors have been detected during building of Products MFC-samples on Windows:
http://jenkins-test-05.nnov.opencascade.com/view/CR28088_3-CR28088_3/job/CR28088_3-CR28088_3-Products-Windows-64-VC10-mfc-samples/1/parsed_console/

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
occt component:
Total MEMORY difference: 93319680 / 92886504 [+0.47%]
Total CPU difference: 21383.38000000012 / 21505.9100000003 [-0.57%]
products component:
Total MEMORY difference: 30362708 / 30395462 [-0.11%]
Total CPU difference: 5347.099999999976 / 5312.789999999971 [+0.65%]

Testing on Windows:
occt component:
Total MEMORY difference: 58639028 / 58649007 [-0.02%]
Total CPU difference: 19320.879850998477 / 19749.742200098677 [-2.17%]
products component:
Total MEMORY difference: 21150835 / 21118126 [+0.15%]
Total CPU difference: 5170.419143499968 / 5256.094892699988 [-1.63%]
20Commenter 20
Dear Kirill,

Branches CR28088_3 (from occt and products git-repositories) have been rejected due to:
- compilation errors
21Author
Please check building Product samples within updated patch.
Regression testing is not needed.
22Commenter 22
Dear Commenter 1,

Branch CR28088_3 from occt git-repository (and CR28088_3 from products git-repository) was compiled on Linux, MacOS and Windows platforms.
[revision removed]
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MasOS: 0 (0 on master)
products component:
   Linux: 63
   Windows: 0
   MacOS: 1136

23Commenter 3
Branch [archived branch] has been deleted by Author.

[revision removed]
24Commenter 3
Branch [archived branch] has been deleted by Author.

[revision removed]
25Commenter 3
Branch [archived branch] has been deleted by Author.

[revision removed]
26Commenter 3
Branch [archived branch] has been deleted by Author.

[revision removed]

Related records