From: isn Date: Wed, 21 Nov 2018 17:50:46 +0000 (+0300) Subject: debug of GroupDefinition (regression on new occt) X-Git-Tag: HYDRO_V2_0_0~3^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d6696556e90be32794554e9347af25cf93993a0;p=modules%2Fhydro.git debug of GroupDefinition (regression on new occt) refs #1834 --- diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx index 5961978f..0a32ca18 100644 --- a/src/HYDROData/HYDROData_Region.cxx +++ b/src/HYDROData/HYDROData_Region.cxx @@ -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; } diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index 7eaad896..c0d0c761 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -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 ); }