]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug of GroupDefinition (regression on new occt)
authorisn <isn@opencascade.com>
Wed, 21 Nov 2018 17:50:46 +0000 (20:50 +0300)
committerisn <isn@opencascade.com>
Wed, 21 Nov 2018 17:53:36 +0000 (20:53 +0300)
refs #1834

src/HYDROData/HYDROData_Region.cxx
src/HYDROData/HYDROData_ShapesGroup.cxx

index 5961978fe65e7b570be9886567f85593f21a73f5..0a32ca181227460d561de20d23d6551332b22203 100644 (file)
@@ -371,43 +371,25 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs*
 
     aFuseShape = HYDROData_Tool::RebuildCmp(aFuseShape);
 
-    BRep_Builder BB;
-    TopoDS_Face DF;
+    ShapeUpgrade_UnifySameDomain unif( aFuseShape, Standard_False, Standard_True, Standard_False );
     if (!IE.IsEmpty())
     {
-      DEBTRACE("---!IE.IsEmpty() ");
-      //add dummy face to existing shell
-      //this face contains all internal edges
-      //USD algo will skip such edges and will not perform unifying through them 
-      //(more than 2 faces are connected to one edge + non same domain surfaces)
-      TopoDS_Wire DW;
-      Handle(Geom_Plane) DPl = new Geom_Plane(gp_Pln (gp_Pnt(0,0,0), gp_Dir(0,1,0))); //non same domain with the main surf
-      BB.MakeFace(DF, DPl, Precision::Confusion());
-      BB.MakeWire(DW);
+      TopTools_MapOfShape IEM;
       for (int i = 1; i <= IE.Extent(); i++)
-        BB.Add(DW, IE(i));
-      BB.Add(DF, DW);
-      BB.Add(aFuseShape, DF);
+        IEM.Add(IE(i));
+      unif.KeepShapes(IEM);
     }
 
-    ShapeUpgrade_UnifySameDomain unif( aFuseShape, Standard_False, Standard_True, Standard_False );
     unif.Build();
     TopoDS_Shape anUnitedShape;
-    const TopoDS_Shape& out = unif.Shape();
+    anUnitedShape = unif.Shape();
 
     HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &unif );
 
-    if (!IE.IsEmpty())
-    {
-      //remove dummy face from shell; shell becomes valid
-      const TopoDS_Shape& NDF = unif.History()->Modified(DF).First();
-      BRepTools_ReShape ReShaper;
-      ReShaper.Remove(NDF);
-      anUnitedShape = ReShaper.Apply(out);
-      HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &ReShaper );
-    }
-    else
-      anUnitedShape = out;
+    //cout << "inif:   fuseshape: " << aFuseShape.TShape().get() << "unifS " << anUnitedShape.TShape().get() << endl;
+#ifdef DEB_GET_REGION_SHAPE
+    HYDROData_ShapesGroup::GroupDefinition::Dump( std::cout, aSeqOfUsedGroups );
+#endif
 
     TopTools_SequenceOfShape aShapeFaces;
     HYDROData_ShapesTool::ExploreShapeToShapes( anUnitedShape, TopAbs_FACE, aShapeFaces );
@@ -451,7 +433,7 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs*
       *theSeqOfGroups = aSeqOfGroups;
     }
   }
-
+                                                     
   return aResShape;
 }
 
index 7eaad896c05b0786c72a1decae36ea25ab0044f3..c0d0c7614ea2cccfdac2106f692a0a3c142cb265 100644 (file)
@@ -85,6 +85,9 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs*
     return;
 
   SeqOfGroupsDefs::Iterator anIter( *theGroupsDefs );
+  if (theAlgo->History().IsNull())
+    return;
+
   for ( ; anIter.More(); anIter.Next() )
   {
     GroupDefinition& aGroupDef = anIter.ChangeValue();
@@ -96,27 +99,27 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs*
     {
       TopoDS_Shape aShape = aGroupDef.Shapes.Value( i );
 
-      TopoDS_Shape aGeneratedByAlgo = TopoDS_Shape();
-      if ( !theAlgo->History().IsNull() && ! aShape.IsNull())
+      TopoDS_Shape aModifSh;
+      if ( !aShape.IsNull())
+      {
+        const TopTools_ListOfShape& listModified = theAlgo->History()->Modified(aShape);
+        if (listModified.Extent() > 0)
         {
-          const TopTools_ListOfShape& listModified = theAlgo->History()->Modified(aShape);
-          if (listModified.Extent() > 0)
-            aGeneratedByAlgo = listModified.First();
+          aModifSh = listModified.First(); 
+          // Edge has been modified
+          aShapesToAdd.Append( aModifSh );
+          aGroupDef.Shapes.Remove( i );
+          --i;      
         }
-      if ( aGeneratedByAlgo.IsNull() )
-      {
-        // Edge has been removed
-        aGroupDef.Shapes.Remove( i );
-        --i;
-      }
-      else if ( !aShape.IsEqual( aGeneratedByAlgo ) )
-      {
-        // Edge has been modified
-        aShapesToAdd.Append( aGeneratedByAlgo );
-        aGroupDef.Shapes.Remove( i );
-        --i;
+        else if ( theAlgo->History()->IsRemoved(aShape) )
+        {    
+          // Edge has been removed
+          aGroupDef.Shapes.Remove( i );
+          --i;
+        }
+  
       }      
-    }
+   }
 
     HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd );
   }