From ff7a125ce3ce036b80e48ad4a05fd99549daa55d Mon Sep 17 00:00:00 2001 From: szy Date: Mon, 20 Jan 2014 13:37:10 +0000 Subject: [PATCH] 20.01.2014. Fix for case 1 object + limiting contour. --- src/HYDROData/HYDROData_SplitToZonesTool.cxx | 57 +++++++++++++++----- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index 3661c514..c85539b2 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -179,11 +179,15 @@ HYDROData_SplitToZonesTool::SplitDataList } // If only one shape is given we don't split it // algorithm just returns the unpacked input data - if(theObjectList.Size() == 1) { - anOutputSplitDataList.append(anInputSplitDataList); - if(!theGroupsList.IsEmpty() ) - anOutputSplitDataList.append(anInputGroupList); - return anOutputSplitDataList; + bool limplus1Object(false); + if(theObjectList.Size() == 1 ) { + if(thePolyline.IsNull()) { + anOutputSplitDataList.append(anInputSplitDataList); + if(!theGroupsList.IsEmpty() ) + anOutputSplitDataList.append(anInputGroupList); + return anOutputSplitDataList; + } else + limplus1Object = true;// size =1 && hasLimits } HYDROData_DataMapOfShapeListOfString aDM3; if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names @@ -194,6 +198,7 @@ HYDROData_SplitToZonesTool::SplitDataList } } // Step 1. Prepare Partition structures. + TopoDS_Shape aResult; BOPCol_ListOfShape aLS; QStringList aListOfNames; TopoDS_Compound aCmp; @@ -212,11 +217,13 @@ HYDROData_SplitToZonesTool::SplitDataList BRepTools::Write(aCmp, aNameBefore.ToCString()); #endif + HYDROData_DataMapOfShapeListOfShape aDM1; + if(anInputSplitDataList.size() > 1) { HYDROData_Transform splitTool; const Standard_Integer anErr = SplitFaces(aCmp, splitTool); if(anErr) return anOutputSplitDataList; - const TopoDS_Shape& aResult = splitTool.Shape(); + aResult = splitTool.Shape(); if (aResult.IsNull()) return anOutputSplitDataList; BRepCheck_Analyzer aCheck (aResult); @@ -232,7 +239,7 @@ HYDROData_SplitToZonesTool::SplitDataList #endif // Step 3. Collect history - HYDROData_DataMapOfShapeListOfShape aDM1; + //HYDROData_DataMapOfShapeListOfShape aDM1; BOPCol_ListIteratorOfListOfShape anIt(aLS); TCollection_AsciiString aNamM ("EdgM_"); TCollection_AsciiString aNamG ("EdgG_"); @@ -293,13 +300,14 @@ HYDROData_SplitToZonesTool::SplitDataList } } } - + } else + aResult = anInputSplitDataList.at(0).Shape; // get single input shape // aDM2: NewShape ==> ListOfOldShapes HYDROData_DataMapOfShapeListOfShape aDM2; // make limiting face HYDROData_DataMapOfShapeListOfShape aDM4; Standard_Boolean hasLimits(Standard_False); - if (! thePolyline.IsNull()) { + if (! thePolyline.IsNull()) { //const TopoDS_Shape aShape = thePolyline->GetShape(); const TopoDS_Wire aBndWire = TopoDS::Wire(thePolyline->GetShape()); if(!aBndWire.IsNull()) { @@ -315,10 +323,10 @@ HYDROData_SplitToZonesTool::SplitDataList BRepTools::Write(aComResult,"CommonV.brep"); #endif - hasLimits = Standard_True; // DM2 should filled here + hasLimits = Standard_True; // DM2 should be filled here HYDROData_MapOfShape aView; TopExp_Explorer exp (aResult, TopAbs_FACE); - for (int i =1;exp.More();exp.Next(),i++) { + 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); @@ -392,9 +400,29 @@ HYDROData_SplitToZonesTool::SplitDataList } } //cout << "DM4 Ext = " <