X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_SplitToZonesTool.cxx;h=cd7a2d0de9c0701a925441c9cd2d0ddc6f7dd1cb;hb=e744ba34fd38d6744d11b54cd15b6f86350695b2;hp=ae9518b34665fe76c66e5e773a8b910b9bdd2a46;hpb=b578011fe730e320bdd1c4a43a708dfd6365a728;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index ae9518b3..cd7a2d0d 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -1,7 +1,25 @@ +// 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_SplitToZonesTool.h" #include "HYDROData_PolylineXY.h" +#include "HYDROData_LandCover.h" #include "HYDROData_ShapesGroup.h" #include #include @@ -122,12 +140,19 @@ HYDROData_SplitToZonesTool::SplitDataList #endif for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ ) { - Handle(HYDROData_Object) aGeomObj = - Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) ); - if( aGeomObj.IsNull() ) - continue; + Handle(HYDROData_Entity) anObj = theObjectList.Value( anIndex ); + TopoDS_Shape aShape; + + Handle(HYDROData_Object) aGeomObj = Handle(HYDROData_Object)::DownCast( anObj ); + if( !aGeomObj.IsNull() ) { + aShape = aGeomObj->GetTopShape(); + } else { + Handle(HYDROData_LandCover) aLandCoverObj = Handle(HYDROData_LandCover)::DownCast( anObj ); + if ( !aLandCoverObj.IsNull() ) { + aShape = aLandCoverObj->GetShape(); + } + } - TopoDS_Shape aShape = aGeomObj->GetTopShape(); if ( aShape.IsNull() ) continue; #ifdef DEB_SPLIT_TO_ZONES @@ -140,12 +165,12 @@ HYDROData_SplitToZonesTool::SplitDataList for ( ; anExp.More(); anExp.Next() ) { const TopoDS_Face& aFace = TopoDS::Face( anExp.Current() ); if ( !aFace.IsNull() ) { - SplitData aSplitData( SplitData::Data_Zone, aFace, aGeomObj->GetName() ); + SplitData aSplitData( SplitData::Data_Zone, aFace, anObj->GetName() ); anInputSplitDataList.append( aSplitData ); } } } else { - SplitData aSplitData( SplitData::Data_Zone, aShape, aGeomObj->GetName() ); + SplitData aSplitData( SplitData::Data_Zone, aShape, anObj->GetName() ); anInputSplitDataList.append( aSplitData ); } } @@ -201,7 +226,7 @@ HYDROData_SplitToZonesTool::SplitDataList QStringList aListOfNames; for (int i=0;i < anInputGroupList.size() ;i++) { const TopoDS_Shape& aSh = anInputGroupList.at(i).Shape; - aDM3.Bind(aSh, anInputGroupList.at(i).ObjectNames); + aDM3.Add(aSh, anInputGroupList.at(i).ObjectNames); } } @@ -214,7 +239,7 @@ HYDROData_SplitToZonesTool::SplitDataList aBB.MakeCompound(aCmp); for (int i=0;i < anInputSplitDataList.size() ;i++) { const TopoDS_Shape& aSh = anInputSplitDataList.at(i).Shape; - aDM3.Bind(aSh, anInputSplitDataList.at(i).ObjectNames); + aDM3.Add(aSh, anInputSplitDataList.at(i).ObjectNames); aLS.Append(aSh); aBB.Add(aCmp,aSh); #ifdef DEB_SPLIT_TO_ZONES @@ -260,13 +285,24 @@ HYDROData_SplitToZonesTool::SplitDataList const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value()); if(!aListOfNew.IsEmpty()) foundF = Standard_True; + TopTools_ListOfShape aList; + TopTools_ListIteratorOfListOfShape it(aListOfNew); for(;it.More();it.Next()) - aList.Append(it.Value()); + aList.Append(it.Value()); + /* ********************************************************************* + // Bug in History: partition should give only modified entities! => temporary solution is used + //const TopTools_ListOfShape& aListOfGen = splitTool.Generated(anIt.Value()); + //if(!aListOfGen.IsEmpty()) + //foundF = Standard_True; + //it.Initialize(aListOfGen); + //for(;it.More();it.Next()) + // aList.Append(it.Value()); + ********************************************************************* */ if(!foundF) // face is not modified aList.Append (anIt.Value()); - aDM1.Bind(anIt.Value(), aList); + aDM1.Add(anIt.Value(), aList); #ifdef DEB_SPLIT_TO_ZONES TCollection_AsciiString aName; #endif @@ -286,7 +322,14 @@ HYDROData_SplitToZonesTool::SplitDataList //BRepTools::Write(it.Value(),aName.ToCString()); #endif } + /* ********************************************************************* + //const TopTools_ListOfShape& aListG = splitTool.Generated(exp.Current()); + //if(aListG.Extent()) foundE = Standard_True; + //it.Initialize(aListG); + //for(int k=1;it.More();it.Next(),k++) + //aList.Append(it.Value()); //cout << "NB_EDGE = " << aList.Extent() <