]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Partition naming
authordbv <dbv@opencascade.com>
Tue, 1 Sep 2015 08:38:13 +0000 (11:38 +0300)
committerdbv <dbv@opencascade.com>
Tue, 1 Sep 2015 08:38:26 +0000 (11:38 +0300)
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Partition.cpp
src/FeaturesPlugin/FeaturesPlugin_Partition.h
src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp

index e05b22cf57ce4b48e4e81466239d7378b285e1f1..b761d0665459c905c90dc0f85aedf4ff23ba2df2 100644 (file)
@@ -369,8 +369,6 @@ void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> t
 
     theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
 
-    GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape();
-
     std::string aModName = "Modified";
     theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
                                                aModifyTag, aModName, theMapOfShapes);
index 362081c0bc879260d67041940c2fffc6ca28bc0b..6000c9d8431e8cc102bd828e01f2ddbafd2c7910 100755 (executable)
@@ -123,11 +123,8 @@ void FeaturesPlugin_Partition::execute()
 
     if (GeomAlgoAPI_ShapeTools::volume(aPartitionAlgo.shape()) > 1.e-7) {
       std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
-
       aResultBody->store(aPartitionAlgo.shape());
-
-//      LoadNamingDS(aResultBody, anObject, aTools, aPartitionAlgo);
-
+      loadNamingDS(aResultBody, anObject, aTools, aPartitionAlgo);
       setResult(aResultBody, aResultIndex);
       aResultIndex++;
     }
@@ -136,3 +133,35 @@ void FeaturesPlugin_Partition::execute()
   // remove the rest results if there were produced in the previous pass
   removeResults(aResultIndex);
 }
+
+//=================================================================================================
+void FeaturesPlugin_Partition::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+                                            const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                                            const ListOfShape& theTools,
+                                            const GeomAlgoAPI_Partition& thePartitionAlgo)
+{
+  //load result
+  if(theBaseShape->isEqual(thePartitionAlgo.shape())) {
+    theResultBody->store(thePartitionAlgo.shape());
+  } 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
+
+    theResultBody->storeModified(theBaseShape, thePartitionAlgo.shape(), aSubsolidsTag);
+
+    std::shared_ptr<GeomAlgoAPI_MakeShape> aMkShape = thePartitionAlgo.makeShape();
+    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = thePartitionAlgo.mapOfShapes();
+
+    std::string aModName = "Modified";
+    theResultBody->loadAndOrientModifiedShapes(aMkShape.get(), theBaseShape, GeomAPI_Shape::FACE,
+                                               aModifyTag, aModName, *aMapOfShapes.get());
+    theResultBody->loadDeletedShapes(aMkShape.get(), theBaseShape, GeomAPI_Shape::FACE, aDeletedTag);
+
+    for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
+      theResultBody->loadAndOrientModifiedShapes(aMkShape.get(), *anIter, GeomAPI_Shape::FACE,
+                                                 aModifyTag, aModName, *aMapOfShapes.get());
+      theResultBody->loadDeletedShapes(aMkShape.get(), *anIter, GeomAPI_Shape::FACE, aDeletedTag);
+    }
+  }
+}
index 444d3e8fbd235d8d019fd89a4c79794022da2859..a058fd8438f6630d832413014692b418472c1663 100755 (executable)
@@ -10,6 +10,8 @@
 #include "FeaturesPlugin.h"
 #include <ModelAPI_Feature.h>
 
+#include <GeomAlgoAPI_Partition.h>
+
 /**\class FeaturesPlugin_Partition
  * \ingroup Plugins
  * \brief Feature for applying of Partition operations on Solids. Partition makes conjunctional
@@ -57,6 +59,12 @@ public:
 private:
   std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
 
+  /// Load Naming data structure of the feature to the document
+  void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+                    const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                    const ListOfShape& theTools,
+                    const GeomAlgoAPI_Partition& thePartitionAlgo);
+
 };
 
 #endif
index 512ac28c6d5620e2dadda12f183db3c4a0168c84..cd1e00d2854d2ce8fa858e561004d6ee3d54af32 100644 (file)
@@ -47,14 +47,12 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects,
   myMkShape.reset(new GeomAlgoAPI_MakeShape(anOperation, GeomAlgoAPI_MakeShape::BOPAlgoBuilder));
 
   // Getting objects.
-  TopTools_ListOfShape anObjects;
   for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) {
     const TopoDS_Shape& aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
     anOperation->AddArgument(aShape);
   }
 
   // Getting tools.
-  TopTools_ListOfShape aTools;
   for (ListOfShape::const_iterator aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) {
     const TopoDS_Shape& aShape = (*aToolsIt)->impl<TopoDS_Shape>();
     anOperation->AddTool(aShape);
@@ -81,7 +79,6 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects,
   }
   myShape.reset(new GeomAPI_Shape());
   myShape->setImpl(new TopoDS_Shape(aResult));
-
 }
 
 //=================================================================================================