Salome HOME
Composite features update due to changes in Extrusion and Revolution algos
authordbv <dbv@opencascade.com>
Wed, 23 Dec 2015 14:26:16 +0000 (17:26 +0300)
committerdbv <dbv@opencascade.com>
Thu, 24 Dec 2015 07:57:26 +0000 (10:57 +0300)
12 files changed:
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.h
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.h

index f31196f42c0fcbe4fd375a80fd0ebd5e6c22c531..2737a82fb64bfd345a8672a80038f0865201e392 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_MakeSweep.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_Prism.h>
 #include <GeomAlgoAPI_Revolution.h>
@@ -142,7 +143,7 @@ void FeaturesPlugin_CompositeBoolean::execute()
 
   // Pass shells/faces to solids creation function.
   ListOfShape aTools;
-  std::list<std::shared_ptr<GeomAPI_Interface>> aSolidsAlgos;
+  ListOfMakeShape aSolidsAlgos;
   makeSolids(aShells, aTools, aSolidsAlgos);
   if(aTools.empty()) {
     return;
@@ -377,7 +378,7 @@ void FeaturesPlugin_CompositeBoolean::execute()
 //=================================================================================================
 void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                                    const ListOfShape& theShells,
-                                                   const std::list<std::shared_ptr<GeomAPI_Interface>>& theSolidsAlgos,
+                                                   ListOfMakeShape& theSolidsAlgos,
                                                    const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                                                    const ListOfShape& theTools,
                                                    const std::shared_ptr<GeomAPI_Shape> theResultShape,
@@ -403,47 +404,39 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_Resu
     theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
 
     ListOfShape::const_iterator aShellsIter = theShells.begin();
-    std::list<std::shared_ptr<GeomAPI_Interface>>::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
+    ListOfMakeShape::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
     for(; aShellsIter != theShells.end() && aSolidsAlgosIter != theSolidsAlgos.end(); aShellsIter++, aSolidsAlgosIter++) {
-      ListOfShape aFromFaces;
-      ListOfShape aToFaces;
-      std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes;
-
       //Insert lateral face : Face from Edge
-      if(std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter)) {
-        std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter);
-        aSubShapes = aPrismAlgo->mapOfSubShapes();
-        theResultBody->loadAndOrientGeneratedShapes(aPrismAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
+      std::shared_ptr<GeomAlgoAPI_MakeShape> aSolidAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeShape>(*aSolidsAlgosIter);
+      if(aSolidAlgo.get()) {
+        std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aSolidAlgo->mapOfSubShapes();
+        theResultBody->loadAndOrientGeneratedShapes(aSolidAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
                                                     aLatName, *aSubShapes.get());
 
-        aFromFaces = aPrismAlgo->fromFaces();
-        aToFaces = aPrismAlgo->toFaces();
-      } else if(std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter)) {
-        std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter);
-        aSubShapes = aRevolAlgo->mapOfSubShapes();
-        theResultBody->loadAndOrientGeneratedShapes(aRevolAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
-                                                    aLatName, *aSubShapes.get());
-        aFromFaces = aRevolAlgo->fromFaces();
-        aToFaces = aRevolAlgo->toFaces();
-      }
 
-      //Insert to faces
-      for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
-        std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
-        if(aSubShapes->isBound(aToFace)) {
-          aToFace = aSubShapes->find(aToFace);
-        }
-        theResultBody->generated(aToFace, aToName, aToTag++);
-      }
+        std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(aSolidAlgo);
+        if(aSweepAlgo.get()) {
+          //Insert to faces
+          const ListOfShape& aToFaces = aSweepAlgo->toFaces();
+          for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
+            std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
+            if(aSubShapes->isBound(aToFace)) {
+              aToFace = aSubShapes->find(aToFace);
+            }
+            theResultBody->generated(aToFace, aToName, aToTag++);
+          }
 
-      //Insert from faces
-      if (aFromTag < aToTag) aFromTag = aToTag;
-      for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
-        std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
-        if(aSubShapes->isBound(aFromFace)) {
-          aFromFace = aSubShapes->find(aFromFace);
+          //Insert from faces
+          const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
+          if (aFromTag < aToTag) aFromTag = aToTag;
+          for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
+            std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
+            if(aSubShapes->isBound(aFromFace)) {
+              aFromFace = aSubShapes->find(aFromFace);
+            }
+            theResultBody->generated(aFromFace, aFromName, aFromTag++);
+          }
         }
-        theResultBody->generated(aFromFace, aFromName, aFromTag++);
       }
     }
 
index bc2e313d7c90c8e83cccc53b58d9d588b5a3cf5f..f171bc6e85dbee548714b7a769794c8c5cdd7283 100644 (file)
@@ -78,12 +78,12 @@ protected:
   /// Define this function to create solids from faces with extrusion/revolution.
   virtual void makeSolids(const ListOfShape& theFaces,
                           ListOfShape& theResults,
-                          std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos) = 0;
+                          ListOfMakeShape& theAlgos) = 0;
 
   /// Results naming.
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const ListOfShape& theShells,
-                    const std::list<std::shared_ptr<GeomAPI_Interface>>& theSolidsAlgos,
+                    ListOfMakeShape& theSolidsAlgos,
                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                     const ListOfShape& theTools,
                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
index d9ff9ccfce5966c2e27f3d39656674cc71450b70..3f95c49e857afc88cbc4d517705847699e4b2939 100644 (file)
@@ -140,20 +140,17 @@ void FeaturesPlugin_CompositeSketch::execute()
   int aErrorsNum = 0;
   int aResultIndex = 0;
   for(ListOfShape::const_iterator anIter = aShells.cbegin(); anIter != aShells.cend(); anIter++) {
-    std::shared_ptr<GeomAPI_Shape> aResult;
-    ListOfShape aFromFaces, aToFaces;
     std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape;
-    std::shared_ptr<GeomAPI_DataMapOfShapeShape> aDataMap;
 
     std::shared_ptr<GeomAPI_Shape> aBaseFace = *anIter;
-    makeSolid(aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap);
-    if(!aResult.get()) {
+    makeSolid(aBaseFace, aMakeShape);
+    if(!aMakeShape.get()) {
       aErrorsNum++;
       continue;
     }
 
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    loadNamingDS(aResultBody, aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap);
+    loadNamingDS(aResultBody, aBaseFace, aMakeShape);
     setResult(aResultBody, aResultIndex);
     aResultIndex++;
   }
@@ -171,39 +168,41 @@ void FeaturesPlugin_CompositeSketch::execute()
 //=================================================================================================
 void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                                   const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
-                                                  const std::shared_ptr<GeomAPI_Shape>& theResult,
-                                                  const ListOfShape& theFromFaces,
-                                                  const ListOfShape& theToFaces,
-                                                  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                                                  const std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+                                                  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
 {
   //load result
-  theResultBody->storeGenerated(theBaseShape, theResult);
+  theResultBody->storeGenerated(theBaseShape, theMakeShape->shape());
 
   //Insert lateral face : Face from Edge
   const std::string aLatName = "LateralFace";
   const int aLatTag = 1;
-  theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *theDataMap);
-
-  //Insert to faces
-  const std::string aToName = "ToFace";
-  int aToTag = 2;
-  for(ListOfShape::const_iterator anIt = theToFaces.cbegin(); anIt != theToFaces.cend(); anIt++) {
-    std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
-    if(theDataMap->isBound(aToFace)) {
-      aToFace = theDataMap->find(aToFace);
+  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aDataMap = theMakeShape->mapOfSubShapes();
+  theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aDataMap.get());
+
+  std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
+  if(aSweepAlgo.get()) {
+    //Insert to faces
+    const std::string aToName = "ToFace";
+    int aToTag = 2;
+    const ListOfShape& aToFaces = aSweepAlgo->toFaces();
+    for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
+      std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
+      if(aDataMap->isBound(aToFace)) {
+        aToFace = aDataMap->find(aToFace);
+      }
+      theResultBody->generated(aToFace, aToName, aToTag++);
     }
-    theResultBody->generated(aToFace, aToName, aToTag++);
-  }
 
-  //Insert from faces
-  const std::string aFromName = "FromFace";
-  int aFromTag = aToTag > 10000 ? aToTag : 10000;
-  for(ListOfShape::const_iterator anIt = theFromFaces.cbegin(); anIt != theFromFaces.cend(); anIt++) {
-    std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
-    if(theDataMap->isBound(aFromFace)) {
-      aFromFace = theDataMap->find(aFromFace);
+    //Insert from faces
+    const std::string aFromName = "FromFace";
+    int aFromTag = aToTag > 10000 ? aToTag : 10000;
+    const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
+    for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
+      std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
+      if(aDataMap->isBound(aFromFace)) {
+        aFromFace = aDataMap->find(aFromFace);
+      }
+      theResultBody->generated(aFromFace, aFromName, aFromTag++);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag++);
   }
 }
index 350369699202de0246254b8ff0dd63e2f67d1de2..d4307edeb965434798f47bab0fab2a3f5fa9e434 100644 (file)
@@ -70,20 +70,12 @@ protected:
 
   /// Define this function to create solids from faces with extrusion/revolution.
   virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
-                         std::shared_ptr<GeomAPI_Shape>& theResult,
-                         ListOfShape& theFromFaces,
-                         ListOfShape& theToFaces,
-                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                         std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap) = 0;
+                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape) = 0;
 
   /// Results naming.
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
-                    const std::shared_ptr<GeomAPI_Shape>& theResult,
-                    const ListOfShape& theFromFaces,
-                    const ListOfShape& theToFaces,
-                    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+                    const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 };
 
 #endif
index 7fceaf80489907bfbb16bcb6e004d7f4ac0a384a..79b5cda61d94101937d86ac3d0140779e7d11379 100755 (executable)
@@ -35,7 +35,7 @@ void FeaturesPlugin_ExtrusionBoolean::initMakeSolidsAttributes()
 //=================================================================================================
 void FeaturesPlugin_ExtrusionBoolean::makeSolids(const ListOfShape& theFaces,
                                                  ListOfShape& theResults,
-                                                 std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos)
+                                                 ListOfMakeShape& theAlgos)
 {
   // Getting extrusion sizes.
   double aToSize = 0.0;
index c8962430dc775cf6ed2977aa15804bf2c7e2e98f..b9efd63f6f2fc7fa47dea7e517df0afd5735ef19 100644 (file)
@@ -73,7 +73,7 @@ protected:
   /// Create solids from faces with extrusion.
   virtual void makeSolids(const ListOfShape& theFaces,
                           ListOfShape& theResults,
-                          std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos);
+                          ListOfMakeShape& theAlgos);
 
 protected:
   FeaturesPlugin_ExtrusionBoolean(){};
index 94fb46a4c4aa19852895a7ef6f6e7f43c1c38c8a..7854fc2511b306dc287c3b99188e5027697d0ab5 100644 (file)
@@ -39,11 +39,7 @@ void FeaturesPlugin_ExtrusionSketch::initMakeSolidsAttributes()
 
 //=================================================================================================
 void FeaturesPlugin_ExtrusionSketch::makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
-                                               std::shared_ptr<GeomAPI_Shape>& theResult,
-                                               ListOfShape& theFromFaces,
-                                               ListOfShape& theToFaces,
-                                               std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                                               std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+                                               std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
 {
   // Getting extrusion sizes.
   double aToSize = 0.0;
@@ -87,9 +83,5 @@ void FeaturesPlugin_ExtrusionSketch::makeSolid(const std::shared_ptr<GeomAPI_Sha
     return;
   }
 
-  theResult = aPrismAlgo->shape();
-  theFromFaces = aPrismAlgo->fromFaces();
-  theToFaces = aPrismAlgo->toFaces();
   theMakeShape = aPrismAlgo;
-  theDataMap = aPrismAlgo->mapOfSubShapes();
 }
index 71e934aca7d3bc4ba723cd4175715cf165c65137..fd6da45fc92185553ac3ebd95e93144799175cc4 100644 (file)
@@ -86,11 +86,7 @@ protected:
 
   /// Create solid from face with extrusion.
   virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
-                         std::shared_ptr<GeomAPI_Shape>& theResult,
-                         ListOfShape& theFromFaces,
-                         ListOfShape& theToFaces,
-                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                         std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 
 public:
   /// Use plugin manager for features creation.
index ee3e750db2e4bce39f1f45c7c5885b912bd9115c..566cac8a1d05cf1f804cfeaf4655c40b90d23182 100644 (file)
@@ -39,7 +39,7 @@ void FeaturesPlugin_RevolutionBoolean::initMakeSolidsAttributes()
 //=================================================================================================
 void FeaturesPlugin_RevolutionBoolean::makeSolids(const ListOfShape& theFaces,
                                                   ListOfShape& theResults,
-                                                  std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos)
+                                                  ListOfMakeShape& theAlgos)
 {
   //Getting axis.
   std::shared_ptr<GeomAPI_Ax1> anAxis;
index 16862065f46ac79707f536d479eb6449c9d4eb88..b645190f7f8f193594a170075999174e48a65a21 100644 (file)
@@ -79,7 +79,7 @@ protected:
   /// Create solids from faces with revolution.
   virtual void makeSolids(const ListOfShape& theFaces,
                           ListOfShape& theResults,
-                          std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos);
+                          ListOfMakeShape& theAlgos);
 
 protected:
   FeaturesPlugin_RevolutionBoolean(){};
index b2acb5c920dfb3b53728fd1deeb611810659b56c..1835080571091bc69b137f06003ac72c3cfdc90f 100644 (file)
@@ -43,11 +43,7 @@ void FeaturesPlugin_RevolutionSketch::initMakeSolidsAttributes()
 
 //=================================================================================================
 void FeaturesPlugin_RevolutionSketch::makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
-                                                std::shared_ptr<GeomAPI_Shape>& theResult,
-                                                ListOfShape& theFromFaces,
-                                                ListOfShape& theToFaces,
-                                                std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                                                std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+                                                std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
 {
   //Getting axis.
   std::shared_ptr<GeomAPI_Ax1> anAxis;
@@ -104,9 +100,5 @@ void FeaturesPlugin_RevolutionSketch::makeSolid(const std::shared_ptr<GeomAPI_Sh
     return;
   }
 
-  theResult = aRevolAlgo->shape();
-  theFromFaces = aRevolAlgo->fromFaces();
-  theToFaces = aRevolAlgo->toFaces();
   theMakeShape = aRevolAlgo;
-  theDataMap = aRevolAlgo->mapOfSubShapes();
 }
index fe914cc5db0a88cc55a9551c641ec179ad0653f8..b3d61b269955e83cd2a46b94659767e8f3ffe40f 100644 (file)
@@ -93,11 +93,7 @@ protected:
 
   /// Create solids from faces with revolution.
   virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
-                         std::shared_ptr<GeomAPI_Shape>& theResult,
-                         ListOfShape& theFromFaces,
-                         ListOfShape& theToFaces,
-                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
-                         std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+                         std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 
 public:
   /// Use plugin manager for features creation.