Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultBody.cpp
index 6792f18bc335dd0bdc7c07b89e9aad0468e7a60e..947dc9bd573ec1a32b59980f23829253284e6093 100644 (file)
@@ -12,6 +12,7 @@
 ModelAPI_ResultBody::ModelAPI_ResultBody()
 : myBuilder(0)
 {
+  myConnect = ConnectionNotComputed;
 }
 
 ModelAPI_ResultBody::~ModelAPI_ResultBody()
@@ -29,6 +30,7 @@ void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
                                 const bool theIsStoreSameShapes)
 {
   myBuilder->store(theShape, theIsStoreSameShapes);
+  myConnect = ConnectionNotComputed;
 
   static Events_Loop* aLoop = Events_Loop::loop();
   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
@@ -40,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);
@@ -52,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);
@@ -62,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);
@@ -81,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);
@@ -100,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,
@@ -111,10 +116,13 @@ 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,
+    const bool theIsStoreAsGenerated)
 {
   myBuilder->loadAndOrientModifiedShapes(
-    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
+    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
+    theIsStoreAsGenerated);
 }
 
 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
@@ -125,7 +133,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);
@@ -142,3 +150,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;
+}