DiscussionsIssue archiveOCCT:Visualization

Archived issue #0031221

Visualization - selection filter in context should provide AND option

Open CASCADEOCCT:Visualizationclosed33 public notes

Search issues

Description

AIS_InteractiveContext has the root filter is "Or", but we need in application use "And" combination of filters.

To provide "And" combination, we need to add into context auxilliary "And" filter above all our filters and work with it, not context. It seems to be more convenient to change root filter in context for it as we need not "Or" combination at all.

At the same time, the root "Or" filter of context has some code for hidden object, that works like "And" filter indeed.

Public activity

33 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Dec 13 10:55:35 2019 +0300

    0031221: Visualization - selection filter in context
02Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Sun Dec 8 18:57:34 2019 +0300

    0031221: Visualization - selection filter in context
03Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Fri Dec 13 16:27:51 2019 +0300

    0031221: Visualization - selection filter in context
04Author
Dear Svetlana

could you please take care about the issue. Please, provide some visual image with a scheme of the previous and the current filters architecture.
The current branch is CR31221_2.

Thank you in advance, Natalia
05Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Wed Sep 9 14:13:16 2020 +0300

    0031221: Visualization - selection filter in context
06Commenter 2
Dear Kirill, could you please review CR31221_3.

Thank you in advance, Svetlana.

07Commenter 3
+  SelectMgr_FilterReaction_Highlight = 0x0001, //!< the reaction to highlght presentation (MoveTo)
+  SelectMgr_FilterReaction_Select = 0x0002, //!< the reaction to highlght presentation (Select)

Please move out this change to dedicated patch (or reject).
08Commenter 1
Branch [archived branch] has been updated by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Wed Sep 9 22:53:11 2020 +0300

    0031221: Visualization - selection filter in context

09Commenter 1
Branch [archived branch] has been updated by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 07:37:01 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the new selection filter type - SelectMgr_AndFilter to provide "And" combination for two or more types of entity
     - To use SelectMgr_AndFilter it's necessary to call context->SetFilter (new SelectMgr_AndFilter)
     - SelectMgr_OrFilter - default filter
     - Added class SelectMgr_DisabledObjectsFilter to provide the disabling selection of the specified objects
     - Added the test

10Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 09:03:22 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the parent composition filter which consists the active filters
     - To use SelectMgr_AndFilter it's necessary to call context->SetFilter (new SelectMgr_AndFilter)
     - SelectMgr_OrFilter - default filter
     - Added class SelectMgr_DisabledObjectsFilter to provide the disabling selection of the specified objects
     - Added the root filter (SelectMgr_AndFilter) which consists the list of the non-selectable objects and the parent composition filter.
     - Added the test
    
    (cherry picked from [revision removed])
11Commenter 2
Dear Kirill, could you please review CR31221_4.

Thank you in advance, Svetlana.
12Commenter 1
Branch [archived branch] has been updated by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 13:22:49 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the parent composition filter which consists the active filters
     - To use SelectMgr_AndFilter it's necessary to call context->SetFilter (new SelectMgr_AndFilter)
     - SelectMgr_OrFilter - default filter
     - Added class SelectMgr_DisabledObjectsFilter to provide the disabling selection of the specified objects
     - Added the root filter (SelectMgr_AndFilter) which consists the list of the non-selectable objects and the parent composition filter.
     - Added the test

13Commenter 3
SelectMgr_OrFilter, SelectMgr_AndFilter, SelectMgr_CompositionFilter
AIS_InteractiveContext::SetCompositionFilter()

As far as I understand the main issue of the bug is that it is wanted using And instead of Or as a composition filter in AIS_InteractiveContext.
Wouldn't it be simpler defining SelectMgr_AndOrFilter which behavior could be switched by a Boolean flag and propagate it to AIS_InteractiveContext?
Or there is indeed some scenarios, where application would like to put a custom composition filter?

+  //! It is impossible to nullify the default context filter, do nothing in this case.
+  Standard_EXPORT void SetCompositionFilter (const Handle(SelectMgr_CompositionFilter)& theFilter);

I think it will be more clear raising an exception on attempt to set a NULL filter here.
14Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 13:47:36 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the new filter SelectMgr_AndOrFilter which allows to define the context filter. By default OR selection filter is used.
     - To choose the context filter set SetUseOrFilter in the AIS_InteractiveContext
     - Added the test
     - SelectMgr_OrFilter don't store the disabled objects, it's stored in SelectMgr_AndOrFilter
15Commenter 2
16Commenter 3
+  Standard_Boolean myIsUseOrFilter; //!< flag to use OR selection filter.

Please use an enumeration instead of a Boolean flag - such flag is very confusing in case of and/or pair.

+  Standard_EXPORT void SetUseOrFilter (const Standard_Boolean theUseOrFilter) { myIsUseOrFilter = theUseOrFilter; }

Please remove redundant Standard_EXPORT from this and other inline methods.

+  //! Constructs an empty or selection filter.
+  Standard_EXPORT SelectMgr_AndOrFilter();

Please define constructor taking and/or parameter.

+#include <Standard_Boolean.hxx>
+#include <SelectMgr_CompositionFilter.hxx>
+
+class SelectMgr_EntityOwner;
+class SelectMgr_CompositionFilter;
+class SelectMgr_AndOrFilter;

These forward declarations look redundant.

+++ b/src/SelectMgr/SelectMgr_AndOrFilter.hxx
@@ -0,0 +1,65 @@
+//
+// This file is part of Open CASCADE Technology software library.

Copyright date is missing for new file.

+      TCollection_AsciiString aVal (theArgv[++anArgIter]);
+      if (aVal == "AND")
+      {
+        aContext->SetUseOrFilter (Standard_False);
+      }
+      else
+      {
+        aContext->SetUseOrFilter (Standard_True);
+      }

Please use case-insensitive check here and do not tolerate errors in "OR" option - print a syntax error in this case.

+    "\n                              use value AND. (OR by default)"

Brackets normally come before the dot closing a sentence.

+if { $aNbSelected != 0 } { puts "Error: combined filter("AND" filter) was not applied" }

Do unescaped nested quotes really works in Tcl script?

+                                                       //!  Selection aren't applyied for this objects.

selection is not applied to these objects.

+  SelectMgr_ListIteratorOfListOfFilter anIter(myFilters);
+  for ( ; anIter.More();anIter.Next())

Please put iterator variable into for(;;) header.

-  //! Returns the list of filters active in a local context.
   Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;

Please provide description for this method.

+#include <SelectMgr_AndOrFilter.hxx>
 
-class SelectMgr_OrFilter;
+class SelectMgr_AndOrFilter;

Either forward declaration or include should be removed.
17Commenter 1
Branch [archived branch] has been updated by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 21:32:07 2020 +0300

    #correct remarks
    
     - Added the enumeration SelectMgr_FilterType provides filter types
     - To define behavior SelectMgr_AndOrFilter use SetFilterType in AIS_InteractiveContext

18Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 10 21:45:20 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the new filter SelectMgr_AndOrFilter which allows to define the context filter. By default OR selection filter is used
     - Added the enumeration SelectMgr_FilterType provides filter types
     - To define behavior SelectMgr_AndOrFilter use SetFilterType in AIS_InteractiveContext
     - Added the test
     - SelectMgr_OrFilter don't store the disabled objects, it's stored in SelectMgr_AndOrFilter
19Commenter 2
20Commenter 3
+SelectMgr_AndOrFilter::SelectMgr_AndOrFilter():
+myFilterType (SelectMgr_FilterType_OR)

Please remove ambiguous and useless constructor.

+  Standard_EXPORT Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anobj) const Standard_OVERRIDE;

Please add "virtual" and rename anobj -> theOwner.

+  //!  Selection isn't applyied for this objects.

Misprint is still there.
21Commenter 1
Branch [archived branch] has been updated by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Fri Sep 11 11:53:38 2020 +0300

    #fix remarks

22Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Fri Sep 11 12:14:58 2020 +0300

    0031221: Visualization - selection filter in context
    
     - Added the new filter SelectMgr_AndOrFilter which allows to define the context filter. By default OR selection filter is used
     - Added the enumeration SelectMgr_FilterType provides filter types
     - To define behavior SelectMgr_AndOrFilter use SetFilterType in AIS_InteractiveContext
     - Added the test
     - SelectMgr_OrFilter don't store the disabled objects, it's stored in SelectMgr_AndOrFilter
23Commenter 1
Branch [archived branch] has been updated forcibly by Commenter 2.

[revision removed]
24Commenter 3
Please raise the patch
- OCCT branch: [archived branch]

25Commenter 4
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: 17333.360000000142 / 17325.800000000123 [+0.04%]
Products
Total CPU difference: 12056.720000000096 / 12079.64000000011 [-0.19%]
Windows-64-VC14:
OCCT
Total CPU difference: 18817.921875 / 18792.46875 [+0.14%]
Products
Total CPU difference: 13294.09375 / 13274.75 [+0.15%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
26Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]
27Commenter 1
Branch [archived branch] has been deleted by Participant.

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

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

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

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

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

[revision removed]
33Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]