]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#20441 : Fix issue in algo
authorJérôme <jerome.lucas@cesgenslab.fr>
Mon, 7 Dec 2020 13:28:54 +0000 (14:28 +0100)
committerJérôme <jerome.lucas@cesgenslab.fr>
Mon, 7 Dec 2020 13:28:54 +0000 (14:28 +0100)
src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp
src/FeaturesPlugin/sharedFaces_widget.xml
src/GeomAlgoAPI/GeomAlgoAPI_SharedFaces.cpp
src/GeomAlgoAPI/GeomAlgoAPI_SharedFaces.h
src/ModelAPI/CMakeLists.txt

index c5d3afd93d891b821e9f15bd386d23ccce4623b5..718b163563969568d237c1d9ae4dff5cda6421bc 100644 (file)
@@ -61,17 +61,6 @@ void FeaturesPlugin_SharedFaces::initAttributes()
   data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
 
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), GROUP_NAME_ID());
-  boolean(CREATE_GROUP_ID())->setValue(false);
-}
-
-void explodeCompound(const GeomShapePtr& theCompound, ListOfShape& theSubs)
-{
-  if (theCompound->isCompound() || theCompound->isCompSolid()) {
-    GeomAPI_ShapeIterator anIt(theCompound);
-    for (; anIt.more(); anIt.next())
-      explodeCompound(anIt.current(), theSubs);
-  } else
-    theSubs.push_back(theCompound);
 }
 
 //=================================================================================================
@@ -126,13 +115,14 @@ void FeaturesPlugin_SharedFaces::attributeChanged(const std::string& theID)
       if (aShape) {
         std::string anError;
         ListOfShape aFaces;
-        ListOfShape theSubs;
-        explodeCompound(aShape, theSubs);
-        if( !GetSharedredFaces( theSubs,
-                                aFaces,
-                                true,
-                                anError))
-          setError("Error in GetSharedredFaces calculation :" +  anError);
+        ListOfShape theShapes;
+
+        theShapes.push_back(aShape);
+        if (!GetSharedFaces(theShapes,
+                               aFaces,
+                               false,
+                               anError))
+          setError("Error in GetSharedFaces calculation :" +  anError);
 
         AttributeSelectionListPtr aFacesListAttr =
                     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
@@ -149,7 +139,7 @@ void FeaturesPlugin_SharedFaces::attributeChanged(const std::string& theID)
           GeomShapePtr aFacePtr = *anIt;
 
           if (!aFacePtr.get()) {
-            setError("GetSharedredFaces : An invalid face found " +  anError);
+            setError("GetSharedFaces : An invalid face found " +  anError);
           }
           aFacesListAttr->append( ancompSolidAttr->context(), aFacePtr);
         }
index 960c960c6ecb80ed3f442404000e1bfa39eaa0df..3e08994fdb0d604eee680a802911f9c8e5a64ba2 100644 (file)
@@ -11,7 +11,7 @@
   <groupbox title="Shared faces">
     <label id="number_shared_faces"/>
     <multi_selector id="faces"
-                      label="Liste of faces :"
+                      label="List of faces :"
                       icon=""
                       shape_types="faces"
                       Block_selection = "true"
index a2039bbe3762493e8644efd58624457189ef9243..791126741d827f52465a13f308c8148f2dd15176 100644 (file)
 //     Result: sub-shapes of all possible couples of all top-level sub-objects of
 //     theShapes[0].
 //=================================================================================================
-bool GetSharedredFaces(const ListOfShape& theShapes,
-                       ListOfShape & theFaces,
-                       const bool  theMultiShare,
-                       std::string& theError)
+bool GetSharedFaces(const ListOfShape& theShapes,
+                    ListOfShape & theFaces,
+                    const bool  theMultiShare,
+                    std::string& theError)
 {
 
   #ifdef _DEBUG
-  std::cout << "GetSharedredFaces " << std::endl;
+  std::cout << "GetSharedFaces " << std::endl;
   #endif
   int aLen = theShapes.size();
   if (aLen < 1) return NULL;
@@ -81,7 +81,7 @@ bool GetSharedredFaces(const ListOfShape& theShapes,
     GeomShapePtr aShapePtr = *anIt;
 
     if (!aShapePtr.get()) {
-      theError = "GetSharedredFaces : An invalid argument";
+      theError = "GetSharedFaces : An invalid argument";
       return false;
     }
     aShape = aShapePtr->impl<TopoDS_Shape>();
@@ -102,9 +102,9 @@ bool GetSharedredFaces(const ListOfShape& theShapes,
   // find shared shapes
 
   // number of iterations
-  int nbIters  =  theMultiShare || theShapes.size() > 1 ? 1 : aShapesSeq.Length()-1;
+  int nbIters  = theMultiShare || theShapes.size() > 1 ? 1 : aShapesSeq.Length()-1;
   // numShares factor to search (i.e. by what nb of shapes each found sub-shape should be shared)
-  int nbShares =  theMultiShare ? aShapesSeq.Length()-1 : 1;
+  int nbShares = theMultiShare ? aShapesSeq.Length()-1 : 1;
 
   for (int iter = 1; iter <= nbIters; iter++) {
     for (int ind = iter+1; ind <= aShapesSeq.Length(); ind++) {
index 6aa21b0b9b96104de8b87747282134b7d15f940f..ffc45e59e573183f05e3cc4c78a6670a74f37cd1 100644 (file)
@@ -30,9 +30,9 @@
 /// \param theFaces  the faces shared
 /// \param theError  error
 GEOMALGOAPI_EXPORT
-bool GetSharedredFaces(const ListOfShape& theShapes,
-                       ListOfShape & theFaces,
-                       const bool  theMultiShare,
-                       std::string& theError);
+bool GetSharedFaces(const ListOfShape& theShapes,
+                    ListOfShape & theFaces,
+                    const bool  theMultiShare,
+                    std::string& theError);
 
 #endif //GEOMALGOAPI_SHAREDFACES_H_
index 7b7876165946fb970b92faf8a221c3f33b3e7693..711c74093a682ae3145496e0cad208e2f98a2c25 100644 (file)
@@ -269,4 +269,6 @@ ADD_UNIT_TESTS(TestConstants.py
                Test19707.py
                Test19726.py
                Test19912.py
+               Test19932.py
+               Test19989.py
 )