Salome HOME
Issue #1854 Recover feature control update
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultBody.cpp
index bcdc0bcb59442dbc1114e7b02d77184e8b160c52..e5f023f11c46af0cfd20166a1094dd9af6060b62 100644 (file)
@@ -12,6 +12,7 @@
 ModelAPI_ResultBody::ModelAPI_ResultBody()
 : myBuilder(0)
 {
+  myConnect = ConnectionNotComputed;
 }
 
 ModelAPI_ResultBody::~ModelAPI_ResultBody()
@@ -25,9 +26,11 @@ std::string ModelAPI_ResultBody::groupName()
   return group();
 }
 
-void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape)
+void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+                                const bool theIsStoreSameShapes)
 {
-  myBuilder->store(theShape);
+  myBuilder->store(theShape, theIsStoreSameShapes);
+  myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
@@ -39,6 +42,7 @@ void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& t
                                  const std::shared_ptr<GeomAPI_Shape>& theToShape)
 {
   myBuilder->storeGenerated(theFromShape, theToShape);
+  myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
@@ -51,6 +55,7 @@ void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& th
                             const int theDecomposeSolidsTag)
 {
   myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
+  myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
@@ -61,6 +66,7 @@ void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& th
 void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
 {
   myBuilder->storeWithoutNaming(theShape);
+  myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
@@ -80,7 +86,7 @@ void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNew
 }
 
 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, 
+    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
     const int theTag)
 {
   myBuilder->generated(theOldShape, theNewShape, theName, theTag);
@@ -99,7 +105,7 @@ void ModelAPI_ResultBody::deleted(
 {
   myBuilder->deleted(theOldShape, theTag);
 }
-  
+
 void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
                                   std::shared_ptr<GeomAPI_Shape>  theShapeIn,
                                   const int  theKindOfShape,
@@ -110,7 +116,8 @@ void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
 
 void ModelAPI_ResultBody::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 std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
+    const bool theIsStoreSeparate)
 {
   myBuilder->loadAndOrientModifiedShapes(
     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
@@ -124,7 +131,7 @@ void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* t
     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
 }
 
-void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, 
+void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
     const std::string& theName, int&  theTag)
 {
   myBuilder->loadFirstLevel(theShape, theName, theTag);
@@ -141,3 +148,11 @@ void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape
 {
   myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
 }
+
+bool ModelAPI_ResultBody::isConnectedTopology()
+{
+  if (myConnect == ConnectionNotComputed) {
+    myConnect = shape()->isConnectedTopology() ? IsConnected : IsNotConnected;
+  }
+  return myConnect == IsConnected;
+}