X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ShapesGroup.cxx;h=9db2e01cbc0e4abcbf8a3adbae0b2e89b8674331;hb=58bb6b7459bebeeb089c9ed486c4683a8bae7288;hp=1a086b7671699be8932e76b12a90f149e30ecf04;hpb=a0f46af000e5038df100106897aa04901ad59e49;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index 1a086b76..9db2e01c 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -30,6 +30,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ShapesGroup,HYDROData_Entity) @@ -112,6 +113,44 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* } } +void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* theGroupsDefs, + BRepTools_ReShape* theAlgo ) +{ + if ( !theGroupsDefs || !theAlgo ) + return; + + SeqOfGroupsDefs::Iterator anIter( *theGroupsDefs ); + for ( ; anIter.More(); anIter.Next() ) + { + GroupDefinition& aGroupDef = anIter.ChangeValue(); + if ( aGroupDef.Shapes.IsEmpty() ) + continue; + + TopTools_ListOfShape aShapesToAdd; + for ( int i = 1; i <= aGroupDef.Shapes.Length(); ++i ) + { + TopoDS_Shape aShape = aGroupDef.Shapes.Value( i ); + + TopoDS_Shape aGeneratedByAlgo = theAlgo->Value( aShape ); + 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; + } + } + + HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); + } +} + void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream& theStream ) const { theStream << "Name: " << Name.ToCString() << "\n";