X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_SplitToZonesTool.cxx;h=07a515ff296c6723f1a6d9c14a4da6bc5785204b;hb=8d4dba4a45855249f5eb022e9cc7dcff202bce3c;hp=01027235bc52aaa5febae9d0b7fc7b5e2bf7e6fe;hpb=2cf9e838e652ae811d9b3931914771ad1836c6b8;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index 01027235..07a515ff 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -34,12 +34,18 @@ #include #include #include +#include #include #include #include #include #include +#include +#include +#include +#include + //#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)) @@ -47,6 +53,9 @@ static TCollection_AsciiString fileNameBefore("BeforeTranslation"); #endif +//#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const { TopoDS_Face aResFace; @@ -127,10 +136,16 @@ Standard_Integer HYDROData_SplitToZonesTool::SplitFaces(const TopoDS_Compound& t HYDROData_SplitToZonesTool::SplitDataList HYDROData_SplitToZonesTool::Split( const HYDROData_SequenceOfObjects& theObjectList, const HYDROData_SequenceOfObjects& theGroupsList, - const Handle(HYDROData_PolylineXY)& thePolyline ) + const Handle(HYDROData_PolylineXY)& thePolyline, + const HYDROData_SequenceOfObjects& InterPolys) { +#ifndef NDEBUG + DEBTRACE("Split"); +#endif SplitDataList anOutputSplitDataList; - if(theObjectList.IsEmpty()) return anOutputSplitDataList; + NCollection_DataMap OutNE; + if(theObjectList.IsEmpty()) + return anOutputSplitDataList; // Preparation. // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape. SplitDataList anInputSplitDataList; @@ -139,16 +154,18 @@ 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(); + } - TopoDS_Shape aShape = aGeomObj->GetTopShape(); if ( aShape.IsNull() ) continue; #ifdef DEB_SPLIT_TO_ZONES - TCollection_AsciiString aName = aNam + anIndex + ".brep"; + TCollection_AsciiString aName = aNam + anIndex + "_a.brep"; BRepTools::Write(aShape, aName.ToCString()); #endif if ( aShape.ShapeType() == TopAbs_COMPOUND ) { @@ -157,12 +174,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 ); } } @@ -196,7 +213,7 @@ HYDROData_SplitToZonesTool::SplitDataList anInputGroupList.append( aSplitData ); #ifdef DEB_SPLIT_TO_ZONES QString aStr = aSplitData.ObjectNames.join(" "); - cout << "Group# = " <GetShape()); + if (! thePolyline.IsNull()) { + Handle(TopTools_HSequenceOfShape) aConnectedWires = new TopTools_HSequenceOfShape; + int nbWires = thePolyline->GetNbConnectedWires(aConnectedWires); + const TopoDS_Wire aBndWire = TopoDS::Wire(aConnectedWires->Value(1)); if(!aBndWire.IsNull()) { TopoDS_Face limFace; if(buildLimFace(aBndWire, limFace)) { @@ -380,12 +483,14 @@ HYDROData_SplitToZonesTool::SplitDataList const TopoDS_Shape& aFace = exp.Current(); if(!aFace.IsNull()) { const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace); - //cout << "Modified: " << aListOfNew.Extent() <::Iterator spit(OutNE); + for (;spit.More();spit.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(spit.Key()); + if (E.IsNull()) + continue; + SplitData SDI(SplitData::Data_IntEdge, E, spit.Value()->GetName()); + anOutputSplitDataList.append(SDI); + } + // Step 4. Fill output structure. #ifdef DEB_SPLIT_TO_ZONES TCollection_AsciiString aNam4 ("SC_"); @@ -553,7 +670,7 @@ HYDROData_SplitToZonesTool::SplitDataList else { aDestSplitData.Type = SplitData::Data_Edge; #ifdef DEB_SPLIT_TO_ZONES - TCollection_AsciiString aName = aNam4 + i + ".brep"; + TCollection_AsciiString aName = aNam4 + i + "_k.brep"; BRepTools::Write(aKey,aName.ToCString()); #endif } @@ -567,19 +684,19 @@ HYDROData_SplitToZonesTool::SplitDataList const QStringList& ObjectNames = aDM3.FindFromKey(aSh); aListOfNames.append(ObjectNames); #ifdef DEB_SPLIT_TO_ZONES - TCollection_AsciiString aName = aNam4 + i +"_" + j + ".brep"; + TCollection_AsciiString aName = aNam4 + i +"_" + j + "_l.brep"; BRepTools::Write(aSh ,aName.ToCString()); #endif } else { #ifdef DEB_SPLIT_TO_ZONES - TCollection_AsciiString aName = aNam4 +"__" + i +"_" + j + ".brep"; + TCollection_AsciiString aName = aNam4 +"__" + i +"_" + j + "_m.brep"; BRepTools::Write(aSh ,aName.ToCString()); - cout <