]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_ResultCompSolid.cpp
Salome HOME
Issue #2192 : change the naming principles of compsolid in case of Partition to make...
[modules/shaper.git] / src / Model / Model_ResultCompSolid.cpp
index 823001cd6bff70b05f80e1537e277138da873250..e97a541bb4f24fff552e5d35cedb3d1783bf0cd6 100755 (executable)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        Model_ResultCompSolid.cpp
-// Created:     20 Jul 2015
-// Author:      Natalia ERMOLAEVA
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <Model_ResultCompSolid.h>
 
@@ -51,6 +65,27 @@ void Model_ResultCompSolid::storeModified(const std::shared_ptr<GeomAPI_Shape>&
   updateSubs(theNewShape);
 }
 
+void Model_ResultCompSolid::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
+    std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
+    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
+    const bool theIsStoreSeparate,
+    const bool theIsStoreAsGenerated)
+{
+  if (mySubs.size()) { // consists of subs
+    std::vector<std::shared_ptr<ModelAPI_ResultBody> >::const_iterator aSubIter = mySubs.cbegin();
+    for(; aSubIter != mySubs.cend(); aSubIter++) {
+      (*aSubIter)->loadAndOrientModifiedShapes(
+        theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
+        theIsStoreAsGenerated);
+    }
+  } else { // do for this directly
+    ModelAPI_ResultCompSolid::loadAndOrientModifiedShapes(
+    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
+    theIsStoreAsGenerated);
+  }
+}
+
+
 int Model_ResultCompSolid::numberOfSubs(bool forTree) const
 {
   return int(mySubs.size());
@@ -79,12 +114,13 @@ void Model_ResultCompSolid::colorConfigInfo(std::string& theSection, std::string
   theDefault = DEFAULT_COLOR();
 }
 
-bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
+bool Model_ResultCompSolid::setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+                                        const bool theFlag)
 {
   bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
   if (aChanged) { // state is changed, so modifications are needed
     myBuilder->evolutionToSelection(theFlag);
-    updateSubs(shape()); // to set disabled/enabled 
+    updateSubs(shape()); // to set disabled/enabled
   }
   return aChanged;
 }
@@ -112,7 +148,7 @@ bool Model_ResultCompSolid::isConcealed()
         if (aResult) { // hidden unit must be redisplayed (hidden)
           ModelAPI_EventCreator::get()->sendDeleted(document(), (*aSubIter)->groupName());
           // redisplay for the viewer (it must be disappeared also)
-          static Events_ID EVENT_DISP = 
+          static Events_ID EVENT_DISP =
             Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
           ModelAPI_EventCreator::get()->sendUpdated(*aSubIter, EVENT_DISP);
         } else { // was not concealed become concealed => delete event
@@ -121,6 +157,10 @@ bool Model_ResultCompSolid::isConcealed()
         }
       }
     }
+    // update the display state of the subs: explicitly call Model_ResultBody::isConcealed
+    for(aSubIter = mySubs.cbegin(); aSubIter != mySubs.cend(); aSubIter++) {
+      (*aSubIter)->isConcealed();
+    }
   }
   return aResult;
 }
@@ -134,7 +174,7 @@ void Model_ResultCompSolid::setIsConcealed(const bool theValue)
         if (theValue) { // hidden unit must be redisplayed (hidden)
           ModelAPI_EventCreator::get()->sendDeleted(document(), (*aSubIter)->groupName());
           // redisplay for the viewer (it must be disappeared also)
-          static Events_ID EVENT_DISP = 
+          static Events_ID EVENT_DISP =
             Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
           ModelAPI_EventCreator::get()->sendUpdated(*aSubIter, EVENT_DISP);
         } else { // was not concealed become concealed => delete event