X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_SplitToZonesTool.cxx;h=16062cf5b19877fd96cb7f8a74be1b6e9aa15890;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=3658fa5c767b89daf4cae83df775bbbbb9612dc9;hpb=fdf964c463d1b26d45057bc3e7963aa8b3d4c20f;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index 3658fa5c..16062cf5 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -23,8 +23,8 @@ #include #include -#define DEB_SPLIT_TO_ZONES 1 -#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1 +//#define DEB_SPLIT_TO_ZONES 1 +//#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1 #if (defined (DEB_SPLIT_TO_ZONES) || defined(DEB_SPLIT_TO_ZONES_CHECK_PARTITION)) #include static TCollection_AsciiString fileNameBefore("BeforeTranslation"); @@ -65,13 +65,13 @@ Standard_Boolean buildLimFace(const TopoDS_Wire& theBndWire, TopoDS_Face& outFac aPln = gp_Pln(aCPnt, gp::OZ().Direction()); BRepBuilderAPI_MakeFace aMkFace(aPln, theBndWire); if(aMkFace.IsDone()) { - outFace = aMkFace.Face(); + outFace = aMkFace.Face(); if(!outFace.IsNull()) { #ifdef DEB_SPLIT_TO_ZONES -// BRepTools::Write(limFace,"FL.brep"); +// BRepTools::Write(limFace,"FL.brep"); #endif return Standard_True; - } + } } return Standard_False; } @@ -83,7 +83,7 @@ void HYDROData_SplitToZonesTool::SetFileNames(const QString& theNameBefore, cons if(!theNameBefore.isNull() && !theNameBefore.isEmpty()) { TCollection_AsciiString aName (theNameBefore.toStdString().data()); - fileNameBefore = aName; + fileNameBefore = aName; } if(!theNameAfter.isNull() && !theNameAfter.isEmpty()) { @@ -94,7 +94,7 @@ void HYDROData_SplitToZonesTool::SetFileNames(const QString& theNameBefore, cons } //====================================================================================== Standard_Integer HYDROData_SplitToZonesTool::SplitFaces(const TopoDS_Compound& theComp, - HYDROData_Transform& theTool) + HYDROData_Transform& theTool) { theTool.Clear(); theTool.SetArgument(theComp); @@ -117,7 +117,9 @@ HYDROData_SplitToZonesTool::SplitDataList // Preparation. // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape. SplitDataList anInputSplitDataList; +#ifdef DEB_SPLIT_TO_ZONES TCollection_AsciiString aNam("Faces_"); +#endif for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ ) { Handle(HYDROData_Object) aGeomObj = @@ -128,9 +130,10 @@ HYDROData_SplitToZonesTool::SplitDataList TopoDS_Shape aShape = aGeomObj->GetTopShape(); if ( aShape.IsNull() ) continue; - //TCollection_AsciiString aName = aNam + anIndex + ".brep"; - //BRepTools::Write(aShape, aName.ToCString()); - +#ifdef DEB_SPLIT_TO_ZONES + TCollection_AsciiString aName = aNam + anIndex + ".brep"; + BRepTools::Write(aShape, aName.ToCString()); +#endif if ( aShape.ShapeType() == TopAbs_COMPOUND ) { // Create split data for each face contained in the compound TopExp_Explorer anExp( aShape, TopAbs_FACE ); @@ -148,7 +151,7 @@ HYDROData_SplitToZonesTool::SplitDataList } // SplitDataList anInputGroupList; - for( int anIndex = 1; anIndex <= theGroupsList.Length(); anIndex++ ) + for( int anIndex = 1, aLength = theGroupsList.Length(); anIndex <=aLength; anIndex++ ) { Handle(HYDROData_ShapesGroup) aGeomGroup = Handle(HYDROData_ShapesGroup)::DownCast( theGroupsList.Value( anIndex ) ); @@ -170,20 +173,28 @@ HYDROData_SplitToZonesTool::SplitDataList SplitData aSplitData( SplitData::Data_Edge, anEdge, aGeomGroup->GetName() ); anInputGroupList.append( aSplitData ); } - } + } } else { SplitData aSplitData( SplitData::Data_Edge, aGroupShape, aGeomGroup->GetName() ); anInputGroupList.append( aSplitData ); +#ifdef DEB_SPLIT_TO_ZONES + QString aStr = aSplitData.ObjectNames.join(" "); + cout << "Group# = " < 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); -#ifdef DEB_SPLIT_TO_ZONES - TCollection_AsciiString aName; -#endif - if(!anInputGroupList.isEmpty() ) { // 1 - aList.Clear(); - TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE); - for (int j =1;exp.More();exp.Next(),j++) { - Standard_Boolean foundE(Standard_False); - const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current()); - //cout << "NB_EDGE_M = " << aListM.Extent() < 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); + #ifdef DEB_SPLIT_TO_ZONES + TCollection_AsciiString aName; + #endif + if(!anInputGroupList.isEmpty() ) { // 1 + TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE); + for (int j =1;exp.More();exp.Next(),j++) { + aList.Clear(); + Standard_Boolean foundE(Standard_False); + const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current()); + //cout << "NB_EDGE_M = " << aListM.Extent() <GetName(); + hasLimits = Standard_True; // DM2 should be filled here + TopExp_Explorer exp (limFace, TopAbs_EDGE); + for (int i =1;exp.More();exp.Next(),i++) { + const TopoDS_Shape& anEdge = exp.Current(); + if(anEdge.IsNull()) continue; + aBndView.Add(anEdge); + QStringList aListOfNames; + aListOfNames.append(aBndName); + aDM3.Bind(anEdge, aListOfNames); + TopTools_ListOfShape aList; + aList.Append(anEdge); + aDM1.Bind(anEdge,aList); + } + HYDROData_MapOfShape aView; + exp.Init (aResult, TopAbs_FACE); + for (int i =1;exp.More();exp.Next(),i++) { const TopoDS_Shape& aFace = exp.Current(); - if(!aFace.IsNull()) { - const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace); - //cout << "Modified: " << aListOfNew.Extent() <