]> OCCT Git - occt-copy.git/commitdiff
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 53d3d9fea6a63fbd15fc686ea02fe9ecd5d75d12..b389e603c056e3ded95ef22121196018e11b67af 100644 (file)
@@ -285,11 +285,12 @@ void TDataXtd_Presentation::SetMode(const Standard_Integer theMode)
 //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)
   {
-    Backup();
+    if (theTransaction)
+        Backup();
     mySelectionMode = theSelectionMode;
     myHasOwnSelectionMode = Standard_True;
   }
index e92dc574ca81e732a8876c0596560158f9b4993e..9911b2462ee9c85ca2856c4773de0ab1724ee12e 100644 (file)
@@ -114,7 +114,13 @@ public:
 
   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;
 
index cc8d75f53041cbca254807e4deb097f06e191660..173639ab58d27dfe2d7e63ec47501f20a3598337 100644 (file)
@@ -591,10 +591,11 @@ Standard_Boolean TPrsStd_AISPresentation::HasOwnSelectionMode() const
 //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();
index e72b75982ce35daec2a5da6c2fffaaf05fadc264..6d5ddd22dfa28b48b2622b614fa094556de2c48f 100644 (file)
@@ -157,8 +157,14 @@ public:
   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;