0029940: The method TPrsStd_AISPresentation::SetSelectionMode() seems useless for...
authorvro <vro@opencascade.com>
Tue, 10 Jul 2018 11:58:08 +0000 (14:58 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 1 Aug 2018 13:39:24 +0000 (16:39 +0300)
A boolean parameter is added with a default value to the method TPrsStd_AISPresentation::SetSelectionMode().
By default, behavior of the method is not changed. But if the parameter's value is changed to FALSE, change of selection mode for the object will not influence the transaction. In other words, the attribute will not set modified and will not put into transaction delta. This behavior suits the usual notion of the object in an application: the object has color, material, transparency, but selection mode is not a property of the object. It is a property of an operation involving the object. Therefore, it has sense to remove the method SetSelectionMode() from TPrsStd_AISPresentation. For a while, it is marked as obsolete.

src/TDataXtd/TDataXtd_Presentation.cxx
src/TDataXtd/TDataXtd_Presentation.hxx
src/TPrsStd/TPrsStd_AISPresentation.cxx
src/TPrsStd/TPrsStd_AISPresentation.hxx

index 53d3d9f..b389e60 100644 (file)
@@ -285,11 +285,12 @@ void TDataXtd_Presentation::SetMode(const Standard_Integer theMode)
 //function : SetSelectionMode
 //purpose  : 
 //=======================================================================
 //function : SetSelectionMode
 //purpose  : 
 //=======================================================================
-void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode)
+void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction)
 {
   if (! myHasOwnSelectionMode || mySelectionMode != theSelectionMode)
   {
 {
   if (! myHasOwnSelectionMode || mySelectionMode != theSelectionMode)
   {
-    Backup();
+    if (theTransaction)
+        Backup();
     mySelectionMode = theSelectionMode;
     myHasOwnSelectionMode = Standard_True;
   }
     mySelectionMode = theSelectionMode;
     myHasOwnSelectionMode = Standard_True;
   }
index e92dc57..9911b24 100644 (file)
@@ -114,7 +114,13 @@ public:
 
   Standard_EXPORT void SetMode(const Standard_Integer theMode);
 
 
   Standard_EXPORT void SetMode(const Standard_Integer theMode);
 
-  Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode);
+  //! Sets selection mode.
+  //! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
+  //! (the attribute doesn't participate in undo/redo).
+  //! Certainly, if any other data of the attribute is modified (display mode, color, ...),
+  //! the attribute will be included into transaction.
+  //! Obsolete method (may be removed later).
+  Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
 
   Standard_EXPORT Standard_Integer MaterialIndex() const;
 
 
   Standard_EXPORT Standard_Integer MaterialIndex() const;
 
index cc8d75f..173639a 100644 (file)
@@ -591,10 +591,11 @@ Standard_Boolean TPrsStd_AISPresentation::HasOwnSelectionMode() const
 //function : SetSelectionMode
 //purpose  : 
 //=======================================================================
 //function : SetSelectionMode
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode)
+void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction)
 {
 {
-  Backup();
-  getData()->SetSelectionMode (theSelectionMode);
+  if (theTransaction)
+    Backup();
+  getData()->SetSelectionMode (theSelectionMode, theTransaction);
   
   if ( myAIS.IsNull() )
     AISUpdate();
   
   if ( myAIS.IsNull() )
     AISUpdate();
index e72b759..6d5ddd2 100644 (file)
@@ -157,8 +157,14 @@ public:
   Standard_EXPORT void UnsetMode();
   
   Standard_EXPORT Standard_Integer SelectionMode() const;
   Standard_EXPORT void UnsetMode();
   
   Standard_EXPORT Standard_Integer SelectionMode() const;
-  
-  Standard_EXPORT void SetSelectionMode (const Standard_Integer theSelectionMode);
+
+  //! Sets selection mode.
+  //! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
+  //! (the attribute doesn't participate in undo/redo).
+  //! Certainly, if any other data of the attribute is modified (display mode, color, ...),
+  //! the attribute will be included into transaction.
+  //! Obsolete method (may be removed later).
+  Standard_EXPORT void SetSelectionMode (const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
   
   Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
   
   
   Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;