X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ShapesGroup.cxx;h=6c0d5ae00a91fa2b54fd081020f6ebc63e767855;hb=d398a8be8e0b0259b476b358d53d234ce4c82379;hp=a540e527f0599b13fa3e22939c9fd5a274556c34;hpb=b33da0d7f657c56dfa2a57e2617eecce308ccb91;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index a540e527..6c0d5ae0 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -1,21 +1,34 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include "HYDROData_ShapesGroup.h" - #include "HYDROData_ShapesTool.h" +#include #include +#include +#include #include #include #include #include - -#include -#include - -#include - #include IMPLEMENT_STANDARD_HANDLE(HYDROData_ShapesGroup,HYDROData_Entity) @@ -38,32 +51,24 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* t for ( int i = 1; i <= aGroupDef.Shapes.Length(); ++i ) { TopoDS_Shape aShape = aGroupDef.Shapes.Value( i ); - /* - if ( theAlgo->IsDeleted( aShape ) ) + + const TopTools_ListOfShape& aModifiedByAlgo = theAlgo->Modified( aShape ); + if ( !aModifiedByAlgo.IsEmpty() ) { + HYDROData_ShapesTool::AddShapes( aShapesToAdd, aModifiedByAlgo ); aGroupDef.Shapes.Remove( i ); --i; } - else - {*/ - const TopTools_ListOfShape& aModifiedByAlgo = theAlgo->Modified( aShape ); - if ( !aModifiedByAlgo.IsEmpty() ) + else + { + const TopTools_ListOfShape& aGeneratedByAlgo = theAlgo->Generated( aShape ); + if ( !aGeneratedByAlgo.IsEmpty() ) { - HYDROData_ShapesTool::AddShapes( aShapesToAdd, aModifiedByAlgo ); + HYDROData_ShapesTool::AddShapes( aShapesToAdd, aGeneratedByAlgo ); aGroupDef.Shapes.Remove( i ); --i; } - else - { - const TopTools_ListOfShape& aGeneratedByAlgo = theAlgo->Generated( aShape ); - if ( !aGeneratedByAlgo.IsEmpty() ) - { - HYDROData_ShapesTool::AddShapes( aShapesToAdd, aGeneratedByAlgo ); - aGroupDef.Shapes.Remove( i ); - --i; - } - } - //} + } } HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); @@ -89,20 +94,46 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* TopoDS_Shape aShape = aGroupDef.Shapes.Value( i ); TopoDS_Shape aGeneratedByAlgo = theAlgo->Generated( aShape ); - if ( aGeneratedByAlgo.IsNull() || aShape.IsEqual( aGeneratedByAlgo ) ) - continue; - - aShapesToAdd.Append( aGeneratedByAlgo ); - 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; + } } HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); } } +void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream& theStream ) const +{ + theStream << "Name: " << Name.ToCString() << "\n"; + HYDROData_ShapesTool::DumpSequenceOfShapes( theStream, Shapes ); +} + +void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream& theStream, + const SeqOfGroupsDefs& theGroups ) +{ + SeqOfGroupsDefs::Iterator anIter( theGroups ); + for ( ; anIter.More(); anIter.Next() ) + { + const GroupDefinition& aGroupDef = anIter.Value(); + aGroupDef.Dump( theStream ); + } +} + + + HYDROData_ShapesGroup::HYDROData_ShapesGroup() -: HYDROData_Entity() +: HYDROData_Entity( Geom_Groups ) { }