X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ShapesGroup.cxx;h=92fd7e17d88987d26050ff51a39f6cae9d2d1eba;hb=9082efb75ca2505f8b4c5096d37e8d87491cd5d9;hp=3501522148c06f9bad65239ca0433896b1e9c665;hpb=f0688b4c39fcc3e49c2b58a90724b9c1c84f1337;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index 35015221..92fd7e17 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -17,23 +17,20 @@ // #include "HYDROData_ShapesGroup.h" - #include "HYDROData_ShapesTool.h" +#include #include +#include +#include #include #include #include #include - -#include -#include - -#include - #include +#include IMPLEMENT_STANDARD_HANDLE(HYDROData_ShapesGroup,HYDROData_Entity) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ShapesGroup,HYDROData_Entity) @@ -117,6 +114,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"; @@ -137,7 +172,7 @@ void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream& theSt HYDROData_ShapesGroup::HYDROData_ShapesGroup() -: HYDROData_Entity() +: HYDROData_Entity( Geom_Groups ) { }