DiscussionsIssue archiveOCCT:Visualization

Archived issue #0023649

Visualization, AIS_LocalContext - make highlighting of already selected objects consistent with and without Shift modifier

Open CASCADEOCCT:Visualizationclosed21 public notes

Search issues

Description

There is different behavior of highlighting after shift selection:
1) The first selected sub-shapes (either single-click or by rectangle) will not be highlighted when mouse cursor moves on it/them.
2) After shift selection another selected sub-shapes will be highlight-able.

Reference from source code (AIS_LocalContext_1.cxx):
#define BUC60569 // GG_051199
Enable to select the local context in any case and especially in multi selection mode.
Note that right now when an hilighted owner is selected this owner is unhilighted,this permits to see the selection!

Principle : an owner can have 3 state:
 1 : The owner is selected and no more highlightable
 0 : The owner is NOT selected
-1 : The owner is selected but stay highlightable (NEW)

Additional information

Dynamic highlighting of already selected objects now controlled by AIS_InteractiveContext::ToHilightSelected() flag within within AIS_LocalContext as well and does not affected by Shift modifier (this behavior might be implemented on application level using ::SetHilightSelected() method).

Added new DrawHarness command vhighlightselected to control AIS_InteractiveContext::ToHilightSelected() flag.

Public activity

21 archived notes

Participants are labeled by their role within this record.

01Commenter 1
The proposed solution:

1. Keep only 0 (not selected) and 1 (selected) states for SelectMgr_EntityOwner, eliminate -1 state ("selected but still highlightable").
2. By default, detected objects (in both neutral point and local context) should always be highlighted, no matter if they are selected or not.
3. Consider possibility to introduce SelectMgr_StateFilter selection filter class that should pass the entity owners with a given state. Add this filter to the interactive context in ViewerTest package to illustrate how only non-selected objects can be highlighted. This filter should be enabled by default in DRAW test 3D view and disabled when the user moves the mouse with <Shift> key pressed. Also vmoveto command should be extended taking this into account.
4. Provide detailed explanation of the highlighting improvement in Git commit message to give a hint to the users how to adjust the highlighting behavior in their applications if necessary.

02Commenter 2
> Consider possibility to introduce SelectMgr_StateFilter
> selection filter class that should pass the entity owners with a given state.
Concerning additional filter, it has been considered redundant.
Simple flag to support two modes (highlight always, and highlight only not selected) would be sufficient for most applications.

Special cases should be implemented by general selection filter. E.g., if application implements Add selection mode - selection filter should discard all already selected entities; if application implements Remove selection mode - selection filter should allow only selected entities.

This is already possible (and actually used in at least one project).
But states (as numbers -1 0 1) are not documented in public API and their usage outside AIS_InteractiveContext/AIS_LocalContext might be considered not safe.
03Commenter 3
Branch [archived branch] has been created by Author.

[revision removed]
04Commenter 4
The git branch CR23649 is ready for review:

1) SelectMgr_EntityOwner::State() method was replaced with SelectMgr_EntityOwner::IsSelected() and SelectMgr_EntityOwner::MakeSelected()
to determine if corresponding entity is selected.

2) AIS_InteractiveContext::ToHilightSelected() and AIS_InteractiveContext::SetToHilightSelected() is to be used to enable highlighting of selected objects.

3) By default selected objects are not highlighted (old behavior).

4) ViewerTest_ViewerCommands: vhighlightselected command was added to enable/disable 'highlight selected objects' mode.

5) AIS_LocalContext, AIS_InteractiveContext : style changes in Select and ShiftSelect methods.

6) test cases /bugs/vis bug23649_1 and /bugs/vis bug23649_2 were added.


Dear kgv,

please review.

05Commenter 2
Dear Anastasia,

please add the similar test cases for hilighting in non-local selection mode.

>> 2) AIS_InteractiveContext::ToSelectHilighted() and AIS_InteractiveContext::SetToHilightSelected() is to be used to enable highlighting of selected objects.
There is no ToSelectHilighted() method in AIS_InteractiveContext.
06Commenter 3
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
07Commenter 7
The branch CR23649 was updated.

Dear kgv,

please review.
08Commenter 3
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
09Commenter 3
Branch [archived branch] has been updated by Author.

[revision removed]
10Commenter 2
Please test the patch.
11Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
12Commenter 12
Dear Commenter 1,

Branch CR23649 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 15 (15 on master)
   Windows: 0 (0 on master)
   MacOS: 196 (196 on master)
products component :
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

Regressions/Differences:
http://occt-tests/CR23649-master-occt/Debian60-64/summary.html
http://occt-tests/CR23649-master-occt/Windows-32-VC10/summary.html
bugs vis bug597_3
bugs vis bug597_6

Testing cases:
Absent

Testing on Linux:
Total MEMORY difference: 351918376 / 351718880
Total CPU difference: 45176.320000000225 / 46258.30000000032

Testing on Windows:
Total MEMORY difference: 239185724 / 239641860
Total CPU difference: 28839.984375 / 30707.734375

There are differences in images found by testdiff:
http://occt-tests/CR23649-master-occt/Debian60-64/diff-Debian60-64.html
http://occt-tests/CR23649-master-occt/Windows-32-VC10/diff-Windows-32-VC10.html
13Commenter 3
Branch [archived branch] has been updated by Author.

[revision removed]


      from 6ec038e Remarks
       new 6ce4a30 Updated test cases


Detailed log of new commits:

[revision removed]
Author: Author
Date: Thu Aug 7 16:05:53 2014 +0400

    Updated test cases

14Commenter 2
Please integrate.
15Commenter 15
Dear Commenter 1,

test cases bugs/vis/bug597_3 and bugs/vis/bug597_6 were updated to support old behavior.

Could you please run tests once more?

Additionally, the behavior of highlighting has been changed: by default shift-selected sub-shapes are not highlighted.
Could you please update images of test cases from v3d tests (on which differences were found)?
16Commenter 16
Please reconsider this:

> Additionally, the behavior of highlighting has been changed: by default shift-selected sub-shapes are not highlighted.
> Could you please update images of test cases from v3d tests (on which differences were found)?

It would be more consistent to have all selectable objects always dynamically highlighted. The purpose of highlighting is to inform the user which entity will be hit if mouse button is clicked at that position. The behavior of selection (will this object be selected or not as the result) is defined by application, it is not a job of the viewer class to decide on that and change highlighting behavior basing on such guesses.
17Commenter 3
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
18Commenter 18
The git branch CR23649 was updated:

- default behavior was changed: all selected objects are highlighted by default.
This behavior can be changed with AIS_InteractiveContext::SetToHilightSelected() method or with draw command vhighlightselected.
- test case /bugs/vis/bug597_2 was updated.

Dear kgv,

please review.
19Commenter 2
Please test.
20Commenter 20
Dear Commenter 1,

Branch CR23649 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 15 (15 on master)
   Windows: 0 (0 on master)
products component :
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

Regressions/Differences:
Not detected

Testing cases:
bugs vis bug23649_1 - OK
http://occt-tests/CR23649-master-occt/Windows-32-VC10/bugs/vis/bug23649_1.html
http://occt-tests/CR23649-master-occt/Debian60-64/bugs/vis/bug23649_1.html
bugs vis bug23649_2 - OK
http://occt-tests/CR23649-master-occt/Windows-32-VC10/bugs/vis/bug23649_2.html
http://occt-tests/CR23649-master-occt/Debian60-64/bugs/vis/bug23649_2.html
bugs vis bug23649_3 - OK
http://occt-tests/CR23649-master-occt/Windows-32-VC10/bugs/vis/bug23649_3.html
http://occt-tests/CR23649-master-occt/Debian60-64/bugs/vis/bug23649_3.html
bugs vis bug23649_4 - OK
http://occt-tests/CR23649-master-occt/Windows-32-VC10/bugs/vis/bug23649_4.html
http://occt-tests/CR23649-master-occt/Debian60-64/bugs/vis/bug23649_4.html

Testing on Linux:
Total MEMORY difference: 351872596 / 351869736
Total CPU difference: 45232.360000000284 / 43716.430000000044

Testing on Windows:
Total MEMORY difference: 239353720 / 239709320
Total CPU difference: 29007.125 / 28459.0625

There are differences in images found by testdiff:
http://occt-tests/CR23649-master-occt/Debian60-64/diff-Debian60-64.html
http://occt-tests/CR23649-master-occt/Windows-32-VC10/diff-Windows-32-VC10.html
21Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records