]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Partition naming
authordbv <dbv@opencascade.com>
Fri, 20 Nov 2015 13:16:19 +0000 (16:16 +0300)
committerdbv <dbv@opencascade.com>
Fri, 20 Nov 2015 15:24:19 +0000 (18:24 +0300)
CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Partition.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h

index bd81e21070f532b951358e76c76aa29cdee37776..5117aeb1000c49981d1136348262401c60b26cbe 100644 (file)
@@ -58,6 +58,7 @@ ADD_SUBDIRECTORY (src/SketchPlugin)
 ADD_SUBDIRECTORY (src/SketchSolver)
 ADD_SUBDIRECTORY (src/ModuleBase)
 ADD_SUBDIRECTORY (src/PartSet)
+ADD_SUBDIRECTORY (src/DFBrowser)
 
 IF(NOT ${HAVE_SALOME})
     ADD_SUBDIRECTORY (src/AppElements)
index 5929e1e9f00f00c43b4e076e9607216a528b664a..2a584910c218521ee7350e879b2a02d8122ec9ca 100755 (executable)
@@ -22,6 +22,8 @@
 #include <GeomAlgoAPI_MakeShapeList.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
+#include <sstream>
+
 //=================================================================================================
 FeaturesPlugin_Partition::FeaturesPlugin_Partition()
 {
@@ -191,21 +193,28 @@ void FeaturesPlugin_Partition::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody>
   if(theBaseShape->isEqual(theResultShape)) {
     theResultBody->store(theResultShape);
   } else {
-    const int aModifyTag = 1;
-    const int aDeletedTag = 2;
-    const int aSubsolidsTag = 3; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
+    const int aDeletedTag = 1;
+    const int aSubsolidsTag = 2; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
+    const int aModifyTag = 100000;
+    int aModifyToolsTag = 200000;
+    std::ostringstream aStream;
 
     theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
 
     std::string aModName = "Modified";
     theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
-                                               aModifyTag, aModName, theMapOfShapes);
+                                               aModifyTag, aModName, theMapOfShapes, true);
     theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDeletedTag);
 
+    int anIndex = 1;
     for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
+      aStream.str(std::string());
+      aStream.clear();
+      aStream << aModName << "_" << anIndex++;
       theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
-                                                 aModifyTag, aModName, theMapOfShapes);
+                                                 aModifyToolsTag, aStream.str(), theMapOfShapes, true);
       theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
+      aModifyToolsTag += 10000;
     }
   }
 }
index 76514a28d17e2e3fec5c861aac27889b80a8b1f3..84d4c29741c0f72c2164c07bac7915cfb4d6e35b 100644 (file)
@@ -98,8 +98,13 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
     (theSubShape == anOldShape || (theSubShape && anOldShape && theSubShape->isEqual(anOldShape)));
   if (isOldShape) return; // shape is the same, so context is also unchanged
   // update the referenced object if needed
-  if (!isOldContext)
-    myRef.setValue(theContext);
+  if (!isOldContext) {
+    ResultCompSolidPtr anOwner = ModelAPI_Tools::compSolidOwner(theContext);
+    if (anOwner.get())
+      myRef.setValue(anOwner);
+    else
+      myRef.setValue(theContext);
+  }
 
   // do noth use naming if selected shape is result shape itself, but not sub-shape
   TDF_Label aSelLab = selectionLabel();
index 22a621d622344e8b42ea4841bd2e1e3324505513..45befbcb4889d791083b9edba20b61fad728d490 100755 (executable)
@@ -329,8 +329,13 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes (
   const int  theKindOfShape,
   const int  theTag,
   const std::string& theName,
-  GeomAPI_DataMapOfShapeShape& theSubShapes)
+  GeomAPI_DataMapOfShapeShape& theSubShapes,
+  const bool theIsStoreSeparate)
 {
+  int aTag = theTag;
+  std::string aName = theName;
+  std::ostringstream aStream;
+  int anIndex = 1;
   TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
   TopTools_MapOfShape aView;
   bool isBuilt = theName.empty();
@@ -350,9 +355,19 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes (
         aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
       }
       if (!aRoot.IsSame (aNewShape)) {
-        builder(theTag)->Modify(aRoot,aNewShape);
-        if(!isBuilt) 
-          buildName(theTag, theName);          
+        builder(aTag)->Modify(aRoot,aNewShape);
+        if(!isBuilt) {
+          if(theIsStoreSeparate) {
+            aStream.str(std::string());
+            aStream.clear();
+            aStream << theName << "_" << anIndex++;
+            aName = aStream.str();
+          }
+          buildName(aTag, aName);
+        }
+        if(theIsStoreSeparate) {
+          aTag++;
+        }
       }
     }
   }
index 3785d2164243e2370fa7651dfe2cf7f14cc8b222..90092e59eba3be0425989f2573d5e273697e5639 100755 (executable)
@@ -83,7 +83,8 @@ public:
                                                const int  theKindOfShape,
                                                const int  theTag,
                                                                                           const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes);
+                                               GeomAPI_DataMapOfShapeShape& theSubShapes,
+                                               const bool theIsStoreSeparate = false);
    /// load and orient generated shapes
   MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
                                                   GeomAlgoAPI_MakeShape* theMS,
index 38f2868a97c8b34bc2dba827158686ff50c45111..424f9857b5f43558c8b430e160c6cdbe92d4acf5 100755 (executable)
@@ -78,7 +78,8 @@ public:
                                                const int  theKindOfShape,
                                                const int  theTag,
                                                                                           const std::string& theName,
-                                               GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
+                                               GeomAPI_DataMapOfShapeShape& theSubShapes,
+                                               const bool theIsStoreSeparate = false) = 0;
   /// load and orient generated shapes
   virtual void loadAndOrientGeneratedShapes (
                                                   GeomAlgoAPI_MakeShape* theMS,
index 6f3543548318e30cd019e0c8457b9678ee54c1ed..bcdc0bcb59442dbc1114e7b02d77184e8b160c52 100644 (file)
@@ -110,10 +110,10 @@ 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 std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate)
 {
   myBuilder->loadAndOrientModifiedShapes(
-    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
+    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
 }
 
 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
index 272d94e3e6e50e89183fefd4926a953327024e29..a09c80638c103c6b72a69e294f407dae8f69bddf 100644 (file)
@@ -93,7 +93,7 @@ public:
   /// load and orient modified shapes
   MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
-    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
+    const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate = false);
   /// load and orient generated shapes
   MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,