]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Minor changes.
authoradv <adv@opencascade.com>
Fri, 31 Jan 2014 10:53:31 +0000 (10:53 +0000)
committeradv <adv@opencascade.com>
Fri, 31 Jan 2014 10:53:31 +0000 (10:53 +0000)
src/HYDROData/HYDROData_SplitToZonesTool.cxx
src/HYDROData/HYDROData_SplitToZonesTool.h

index 95c514deac9b400f8e009767f5f2ae8f788db556..ae9518b34665fe76c66e5e773a8b910b9bdd2a46 100644 (file)
@@ -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);
@@ -173,28 +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# = " <<anIndex <<" Nmb in grp = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;   
+        QString aStr = aSplitData.ObjectNames.join(" "); 
+        cout << "Group# = " <<anIndex <<" Nmb in grp = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl;   
 #endif
       }
-       }
+    }
   }
   // If only one shape is given we don't split it 
   // algorithm just returns the unpacked input data
   bool limplus1Object(false);
   if(theObjectList.Size() == 1 )  {
-       if(thePolyline.IsNull()) {
-         anOutputSplitDataList.append(anInputSplitDataList); 
-         if(!theGroupsList.IsEmpty() ) 
-           anOutputSplitDataList.append(anInputGroupList);     
+    if(thePolyline.IsNull()) {
+      anOutputSplitDataList.append(anInputSplitDataList); 
+      if(!theGroupsList.IsEmpty() ) 
+        anOutputSplitDataList.append(anInputGroupList);
       return anOutputSplitDataList;
-       } else
-               limplus1Object = true;// size =1 && hasLimits
+    } else
+        limplus1Object = true;// size =1 && hasLimits
   }
   HYDROData_DataMapOfShapeListOfString aDM3;
   if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names
@@ -216,7 +216,7 @@ HYDROData_SplitToZonesTool::SplitDataList
     const TopoDS_Shape& aSh = anInputSplitDataList.at(i).Shape;
     aDM3.Bind(aSh, anInputSplitDataList.at(i).ObjectNames);
     aLS.Append(aSh);
-       aBB.Add(aCmp,aSh);
+    aBB.Add(aCmp,aSh);
 #ifdef DEB_SPLIT_TO_ZONES
     //TCollection_AsciiString aName = aNam + i + ".brep";
     //BRepTools::Write(aSh, aName.ToCString());
@@ -229,78 +229,80 @@ HYDROData_SplitToZonesTool::SplitDataList
 
   HYDROData_DataMapOfShapeListOfShape aDM1;
   if(anInputSplitDataList.size() > 1) {
-  HYDROData_Transform splitTool; 
-  const Standard_Integer anErr = SplitFaces(aCmp, splitTool);    
-  if(anErr)
-    return anOutputSplitDataList;
-  aResult = splitTool.Shape();
-  if (aResult.IsNull()) 
-    return anOutputSplitDataList;
-  BRepCheck_Analyzer aCheck (aResult);
-  if(!aCheck.IsValid()) {
-#ifdef DEB_SPLIT_TO_ZONES
-    cout << "result is not valid" <<endl;
-    BRepTools::Write(aResult, "SplitFacesNV.brep");  
-#endif
-    return anOutputSplitDataList;
-  }
-#ifdef DEB_SPLIT_TO_ZONES
-  BRepTools::Write(aResult, "SplitFacesV.brep");
-#endif
-  
-  // Step 3. Collect history  
-  //HYDROData_DataMapOfShapeListOfShape aDM1;
-  BOPCol_ListIteratorOfListOfShape anIt(aLS); 
-#ifdef DEB_SPLIT_TO_ZONES
-  TCollection_AsciiString aNamM ("EdgM_");
-  TCollection_AsciiString aNamG ("EdgG_");
-#endif
-  for (int i =1;anIt.More();anIt.Next(),i++) {
-       Standard_Boolean foundF(Standard_False);
-    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());    
-    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() <<endl;
-               if(aListM.Extent()) foundE = Standard_True;
-               it.Initialize(aListM);    
-               for(int k=1;it.More();it.Next(),k++) {    
-             aList.Append(it.Value());
-#ifdef DEB_SPLIT_TO_ZONES
-                 //aName = aNamM + i + j +k +".brep";
-                 //BRepTools::Write(it.Value(),aName.ToCString());
-#endif
-               }
-               //cout << "NB_EDGE = " << aList.Extent() <<endl;
-               if(!foundE) {
-                 aList.Append (exp.Current());
-#ifdef DEB_SPLIT_TO_ZONES
-                 aName = aNamG + i + j +".brep";
-                 BRepTools::Write(exp.Current(),aName.ToCString());
-                 cout << aName.ToCString()<< " = " << exp.Current().TShape() <<endl;
-#endif
-               }
-               aDM1.Bind(exp.Current(), aList);
-         }
-       }
+    HYDROData_Transform splitTool; 
+    const Standard_Integer anErr = SplitFaces(aCmp, splitTool);    
+    if(anErr)
+      return anOutputSplitDataList;
+    aResult = splitTool.Shape();
+    if (aResult.IsNull()) 
+      return anOutputSplitDataList;
+    BRepCheck_Analyzer aCheck (aResult);
+    if(!aCheck.IsValid()) {
+  #ifdef DEB_SPLIT_TO_ZONES
+      cout << "result is not valid" <<endl;
+      BRepTools::Write(aResult, "SplitFacesNV.brep");  
+  #endif
+      return anOutputSplitDataList;
+    }
+  #ifdef DEB_SPLIT_TO_ZONES
+    BRepTools::Write(aResult, "SplitFacesV.brep");
+  #endif
+    
+    // Step 3. Collect history  
+    //HYDROData_DataMapOfShapeListOfShape aDM1;
+    BOPCol_ListIteratorOfListOfShape anIt(aLS); 
+  #ifdef DEB_SPLIT_TO_ZONES
+    TCollection_AsciiString aNamM ("EdgM_");
+    TCollection_AsciiString aNamG ("EdgG_");
+  #endif
+    for (int i =1;anIt.More();anIt.Next(),i++) {
+      Standard_Boolean foundF(Standard_False);
+      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());    
+      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() <<endl;
+          if(aListM.Extent()) foundE = Standard_True;
+          it.Initialize(aListM);    
+          for(int k=1;it.More();it.Next(),k++) {    
+            aList.Append(it.Value());
+  #ifdef DEB_SPLIT_TO_ZONES
+            //aName = aNamM + i + j +k +".brep";
+            //BRepTools::Write(it.Value(),aName.ToCString());
+  #endif
+          }
+          //cout << "NB_EDGE = " << aList.Extent() <<endl;
+          if(!foundE) {
+            aList.Append (exp.Current());
+  #ifdef DEB_SPLIT_TO_ZONES
+            aName = aNamG + i + j +".brep";
+            BRepTools::Write(exp.Current(),aName.ToCString());
+            cout << aName.ToCString()<< " = " << exp.Current().TShape() <<endl;
+  #endif
+          }
+          aDM1.Bind(exp.Current(), aList);
+        }
+      }
+    }
+  } else {
+      aResult = anInputSplitDataList.at(0).Shape; // get single input shape
   }
-  } else 
-         aResult = anInputSplitDataList.at(0).Shape; // get single input shape
+
   // aDM2: NewShape ==> ListOfOldShapes
   HYDROData_DataMapOfShapeListOfShape aDM2;
   // make limiting face
@@ -311,178 +313,178 @@ HYDROData_SplitToZonesTool::SplitDataList
   if (! thePolyline.IsNull()) {    
     const TopoDS_Wire aBndWire = TopoDS::Wire(thePolyline->GetShape());
     if(!aBndWire.IsNull()) {
-      TopoDS_Face limFace;       
-         if(buildLimFace(aBndWire, limFace)) {
-               TopoDS_Shape aComResult;
-           BRepAlgoAPI_Common mkCom(aResult, limFace);
-               if(mkCom.IsDone()) {
-             aComResult = mkCom.Shape();
-                 BRepCheck_Analyzer aCheck (aComResult);
+      TopoDS_Face limFace;       
+      if(buildLimFace(aBndWire, limFace)) {
+        TopoDS_Shape aComResult;
+        BRepAlgoAPI_Common mkCom(aResult, limFace);
+        if(mkCom.IsDone()) {
+          aComResult = mkCom.Shape();
+          BRepCheck_Analyzer aCheck (aComResult);
           if(aCheck.IsValid()) {
 #ifdef DEB_SPLIT_TO_ZONES
-                   BRepTools::Write(aComResult,"CommonV.brep");
-                       BRepTools::Write(limFace,"limFace.brep");
-#endif 
-                       aBndName = thePolyline->GetName();
-                   hasLimits = Standard_True; // DM2 should be filled here
-                       TopExp_Explorer exp (limFace, TopAbs_EDGE);
-                       for (int i =1;exp.More();exp.Next(),i++) {
+            BRepTools::Write(aComResult,"CommonV.brep");
+            BRepTools::Write(limFace,"limFace.brep");
+#endif    
+            aBndName = thePolyline->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++) {
+              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() <<endl;                                                       
-                           if(!aListOfNew.IsEmpty()) {
-                     aDM4.Bind(aFace, aListOfNew);
+              if(!aFace.IsNull()) {
+                const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace);
+                //cout << "Modified: " << aListOfNew.Extent() <<endl;                                    
+                if(!aListOfNew.IsEmpty()) {
+                  aDM4.Bind(aFace, aListOfNew);
 #ifdef DEB_SPLIT_TO_ZONES
-                             //TCollection_AsciiString aName = aNam + i + ".brep";
-                                 //BRepTools::Write(aListOfNew.Last(), aName.ToCString());                             
+                  //TCollection_AsciiString aName = aNam + i + ".brep";
+                  //BRepTools::Write(aListOfNew.Last(), aName.ToCString());                
 #endif
-                               }
-                               else {
-                                       if(!mkCom.IsDeleted(aFace)) {
-                                         const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);      
-                                     if(!aListOfGen.IsEmpty()) {
-                           aDM4.Bind(aFace, aListOfGen);       
+                }
+                else {
+                    if(!mkCom.IsDeleted(aFace)) {
+                      const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);    
+                      if(!aListOfGen.IsEmpty()) {
+                        aDM4.Bind(aFace, aListOfGen);    
 #ifdef DEB_SPLIT_TO_ZONES
-                                       //TCollection_AsciiString aName = aNam + i + "g.brep";
-                                       //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
+                        //TCollection_AsciiString aName = aNam + i + "g.brep";
+                        //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
 #endif
-                                         }
-                                          else {
-                                   TopTools_ListOfShape aList; 
-                                       aList.Append(aFace);
-                                       aDM4.Bind(aFace, aList); //the same face - not modified
-                                          }
-                                       }
-                        }
-                        TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
-                        for (int j =1;exp2.More();exp2.Next(),j++) {
-                          const TopoDS_Shape& anEdge = exp2.Current();
-                          if(!anEdge.IsNull()) {
-                                if(aView.Contains(anEdge)) continue;
-                                aView.Add(anEdge);
-                                const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);                              
+                      }
+                       else {
+                        TopTools_ListOfShape aList; 
+                        aList.Append(aFace);
+                        aDM4.Bind(aFace, aList); //the same face - not modified
+                       }
+                    }
+             }
+             TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
+             for (int j =1;exp2.More();exp2.Next(),j++) {
+               const TopoDS_Shape& anEdge = exp2.Current();
+               if(!anEdge.IsNull()) {
+                 if(aView.Contains(anEdge)) continue;
+                 aView.Add(anEdge);
+                 const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);                 
                  if(!aListOfNewEd.IsEmpty())
-                      aDM4.Bind(anEdge, aListOfNewEd);
-                                else {
-                                  if(!mkCom.IsDeleted(anEdge)) {
-                                        const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
-                                        if(!aListOfGenEd.IsEmpty()) {
-                                          aDM4.Bind(anEdge, aListOfGenEd);
-                                        } else {
-                                          TopTools_ListOfShape aList; 
-                                      aList.Append(anEdge);
-                                      aDM4.Bind(anEdge, aList);//the same edge - not modified
-                                        }
-                                  }
-                                }
-                          }
-                        }
-                       }
-                       } //end DM4 filling (phase 1)
-                   //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
-                // phase 2 (from tool)
+                   aDM4.Bind(anEdge, aListOfNewEd);
+                 else {
+                   if(!mkCom.IsDeleted(anEdge)) {
+                     const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
+                     if(!aListOfGenEd.IsEmpty()) {
+                       aDM4.Bind(anEdge, aListOfGenEd);
+                     } else {
+                       TopTools_ListOfShape aList; 
+                       aList.Append(anEdge);
+                       aDM4.Bind(anEdge, aList);//the same edge - not modified
+                     }
+                   }
+                 }
+               }
+             }
+            }
+            } //end DM4 filling (phase 1)
+            //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
+         // phase 2 (from tool)
 #ifdef DEB_SPLIT_TO_ZONES
-                TCollection_AsciiString aNam("BndEd_");
+         TCollection_AsciiString aNam("BndEd_");
 #endif
          TopExp_Explorer expt (limFace, TopAbs_EDGE);
-                for(int i =1;expt.More();expt.Next(),i++) {
-                  const TopoDS_Shape& anEdge = expt.Current();
-                  if(!anEdge.IsNull()) {
-             const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);        
+         for(int i =1;expt.More();expt.Next(),i++) {
+           const TopoDS_Shape& anEdge = expt.Current();
+           if(!anEdge.IsNull()) {
+             const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);    
 #ifdef DEB_SPLIT_TO_ZONES
-                        TopTools_ListIteratorOfListOfShape itl(aListOfNewEd);
-                        for(int j=1;itl.More();itl.Next(),j++) {
-                          TCollection_AsciiString aName = aNam + i + "_" + j + ".brep";
-                          BRepTools::Write(itl.Value(), aName.ToCString());
-                          cout <<aName.ToCString()<<" = "<< itl.Value().TShape() <<endl;
-                        }
+             TopTools_ListIteratorOfListOfShape itl(aListOfNewEd);
+             for(int j=1;itl.More();itl.Next(),j++) {
+               TCollection_AsciiString aName = aNam + i + "_" + j + ".brep";
+               BRepTools::Write(itl.Value(), aName.ToCString());
+               cout <<aName.ToCString()<<" = "<< itl.Value().TShape() <<endl;
+             }
 #endif
              if(!aListOfNewEd.IsEmpty())
-                  aDM4.Bind(anEdge, aListOfNewEd);
-                        else {
-                          if(!mkCom.IsDeleted(anEdge)) {
+               aDM4.Bind(anEdge, aListOfNewEd);
+             else {
+               if(!mkCom.IsDeleted(anEdge)) {
                  const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
-                                if(!aListOfGenEd.IsEmpty()) {
-                                  aDM4.Bind(anEdge, aListOfGenEd);
-                                } else {
-                                  TopTools_ListOfShape aList; 
-                              aList.Append(anEdge);
-                              aDM4.Bind(anEdge, aList);//the same edge - not modified
-                                }
-                          }
-                        }
-                  }
-                }
-                //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
-                if(limplus1Object) {
-                  // fill DM1 (old - new) and DM2 (new - old)
-                  HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape mIt(aDM4);
+                 if(!aListOfGenEd.IsEmpty()) {
+                   aDM4.Bind(anEdge, aListOfGenEd);
+                 } else {
+                   TopTools_ListOfShape aList; 
+                   aList.Append(anEdge);
+                   aDM4.Bind(anEdge, aList);//the same edge - not modified
+                 }
+               }
+             }
+           }
+         }
+         //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
+         if(limplus1Object) {
+           // fill DM1 (old - new) and DM2 (new - old)
+           HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape mIt(aDM4);
            for(;mIt.More();mIt.Next()) {
-                        const TopoDS_Shape& aKey = mIt.Key();//old
-                        TopTools_ListOfShape aList;
-                        aList.Append(aKey);
-                        const TopTools_ListOfShape& aListOfNew = mIt.Value();
-                        aDM1.Bind(aKey, aListOfNew);
-                        TopTools_ListIteratorOfListOfShape it(aListOfNew);
-                        for(;it.More();it.Next()) {
-                          if(!aDM2.IsBound(it.Value()))
-                                aDM2.Bind(it.Value(), aList);
-                          else {
-                                TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
-                                aList.Prepend(aKey);
-                          }
-                        }
-                  }
-                } else {
+             const TopoDS_Shape& aKey = mIt.Key();//old
+             TopTools_ListOfShape aList;
+             aList.Append(aKey);
+             const TopTools_ListOfShape& aListOfNew = mIt.Value();
+             aDM1.Bind(aKey, aListOfNew);
+             TopTools_ListIteratorOfListOfShape it(aListOfNew);
+             for(;it.More();it.Next()) {
+               if(!aDM2.IsBound(it.Value()))
+                 aDM2.Bind(it.Value(), aList);
+               else {
+                 TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
+                 aList.Prepend(aKey);
+               }
+             }
+           }
+         } else {
            HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1); 
-                  //DM4 contains Old - New after common op. DM1: old - new after Split op.
-                  for(;aMIt.More();aMIt.Next()) {
+           //DM4 contains Old - New after common op. DM1: old - new after Split op.
+           for(;aMIt.More();aMIt.Next()) {
              const TopoDS_Shape& aKey = aMIt.Key();
              TopTools_ListOfShape aList;
              aList.Append(aKey);
              const TopTools_ListOfShape& aListOfNew = aMIt.Value();
              TopTools_ListIteratorOfListOfShape it(aListOfNew);
              for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
-                          if(!aDM4.IsBound(it.Value())) // bi - is deleted
+               if(!aDM4.IsBound(it.Value())) // bi - is deleted
                  continue; // go to the next bi
-                          else {
-                                 const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
-                             TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
+               else {
+                  const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
+                  TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
                   for(;it4.More();it4.Next()) {
-                                   if(!aDM2.IsBound(it4.Value()))
+                    if(!aDM2.IsBound(it4.Value()))
                       aDM2.Bind(it4.Value(), aList);
-                               else {
+                    else {
                       TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
                       aList.Prepend(aKey);
-                                       }
-                                 }
-                          }
-                        }
-                  }
-                }
-                } else {
-                        hasLimits = Standard_False;
+                    }
+                  }
+               }
+             }
+           }
+         }
+         } else {
+             hasLimits = Standard_False;
 #ifdef DEB_SPLIT_TO_ZONES
-                    BRepTools::Write(aComResult,"CommonNV.brep");
-#endif 
-                 }
-          }
-         }
-       }
+             BRepTools::Write(aComResult,"CommonNV.brep");
+#endif    
+          }
+       }
+      }
+    }
   }// end limits processing
   if(!hasLimits) {
     HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
@@ -498,9 +500,9 @@ HYDROData_SplitToZonesTool::SplitDataList
         else {
           TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
           aList.Prepend(aKey);
-               }
-         }
-       }
+        }
+      }
+    }
   }
   // Step 4. Fill output structure.
 #ifdef DEB_SPLIT_TO_ZONES
@@ -513,103 +515,49 @@ HYDROData_SplitToZonesTool::SplitDataList
     aDestSplitData.Shape = aKey;
     if(aKey.ShapeType() == TopAbs_FACE)
       aDestSplitData.Type = SplitData::Data_Zone;
-       else {
+    else {
       aDestSplitData.Type = SplitData::Data_Edge;
 #ifdef DEB_SPLIT_TO_ZONES
-         TCollection_AsciiString aName = aNam4 + i + ".brep";
-         BRepTools::Write(aKey,aName.ToCString());
-#endif 
-       }
+      TCollection_AsciiString aName = aNam4 + i + ".brep";
+      BRepTools::Write(aKey,aName.ToCString());
+#endif    
+    }
 
     QStringList aListOfNames; // names processing
     const TopTools_ListOfShape& aListOfOld = aMIt.Value();
     TopTools_ListIteratorOfListOfShape it(aListOfOld);
-       for(int j =1;it.More();it.Next(),j++) { 
-         const TopoDS_Shape& aSh = it.Value(); //old
-         if(aDM3.IsBound(aSh)) {
-           const QStringList& ObjectNames = aDM3.Find(aSh);    
-               aListOfNames.append(ObjectNames);
+    for(int j =1;it.More();it.Next(),j++) {    
+      const TopoDS_Shape& aSh = it.Value(); //old
+      if(aDM3.IsBound(aSh)) {
+        const QStringList& ObjectNames = aDM3.Find(aSh);    
+        aListOfNames.append(ObjectNames);
 #ifdef DEB_SPLIT_TO_ZONES
-               TCollection_AsciiString aName = aNam4 + i +"_" + j + ".brep";
-           BRepTools::Write(aSh ,aName.ToCString());           
-#endif 
-         }     else {
+        TCollection_AsciiString aName = aNam4 + i +"_" + j + ".brep";
+        BRepTools::Write(aSh ,aName.ToCString());        
+#endif    
+      }    else {
 #ifdef DEB_SPLIT_TO_ZONES
-               TCollection_AsciiString aName = aNam4 +"__" + i +"_" + j + ".brep";
-           BRepTools::Write(aSh ,aName.ToCString());           
-               cout <<aName.ToCString()<<" = "<< aSh.TShape() <<endl;
+        TCollection_AsciiString aName = aNam4 +"__" + i +"_" + j + ".brep";
+        BRepTools::Write(aSh ,aName.ToCString());        
+        cout <<aName.ToCString()<<" = "<< aSh.TShape() <<endl;
 #endif
-                 if(aBndView.Contains(aSh) && hasLimits) {                     
-                       aListOfNames.append(aBndName);
+          if(aBndView.Contains(aSh) && hasLimits) {            
+            aListOfNames.append(aBndName);
 #ifdef DEB_SPLIT_TO_ZONES
-                       cout << " BndName = "<<aBndName.toStdString() <<endl; 
+            cout << " BndName = "<<aBndName.toStdString() <<endl; 
 #endif
-                 }
-         }
-       }
+          }
+      }
+    }
 
-       aDestSplitData.ObjectNames = aListOfNames;  
-       anOutputSplitDataList.append(aDestSplitData);   
+    aDestSplitData.ObjectNames = aListOfNames;  
+    anOutputSplitDataList.append(aDestSplitData);    
 #ifdef DEB_SPLIT_TO_ZONES
-       QString aStr = aDestSplitData.ObjectNames.join(" "); 
-       cout << "New# = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aDestSplitData.ObjectNames.size() <<endl; 
+    QString aStr = aDestSplitData.ObjectNames.join(" "); 
+    cout << "New# = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aDestSplitData.ObjectNames.size() <<endl; 
 #endif
   }
 
   return anOutputSplitDataList;
 }
 
-bool HYDROData_SplitToZonesTool::SplitTwoData( const SplitData& theData1,
-                                               const SplitData& theData2,
-                                               SplitData& theData1Subtracted,
-                                               SplitData& theData2Subtracted,
-                                               SplitData& theDataIntersected )
-{
-  const TopoDS_Shape& aShape1 = theData1.Shape;
-  const TopoDS_Shape& aShape2 = theData2.Shape;
-
-  const QStringList& anObjectNames1 = theData1.ObjectNames;
-  const QStringList& anObjectNames2 = theData2.ObjectNames;
-
-  BRepAlgoAPI_Common aCommon( aShape1, aShape2 );
-  TopoDS_Shape aCommonShape = aCommon.Shape();
-  if( aCommonShape.IsNull() )
-  {
-    theData1Subtracted = theData1;
-    theData2Subtracted = theData2;
-    return false;
-  }
-
-  BRepAlgoAPI_Cut aCut1( aShape1, aShape2 );
-  TopoDS_Shape aCut1Shape = aCut1.Shape();
-
-  BRepAlgoAPI_Cut aCut2( aShape2, aShape1 );
-  TopoDS_Shape aCut2Shape = aCut2.Shape();
-
-  theData1Subtracted = SplitData( SplitData::Data_Zone, aCut1Shape, anObjectNames1 );
-  theData2Subtracted = SplitData( SplitData::Data_Zone, aCut2Shape, anObjectNames2 );
-  theDataIntersected = SplitData( SplitData::Data_Zone, aCommonShape, anObjectNames1 + anObjectNames2 );
-
-  return true;
-}
-
-HYDROData_SplitToZonesTool::SplitDataList
-HYDROData_SplitToZonesTool::ExtractSeparateData( const SplitData& theData )
-{
-  SplitDataList aSplitDataList;
-  TopExp_Explorer anExp( theData.Shape, TopAbs_FACE );
-  for( ; anExp.More(); anExp.Next() )
-  {
-    TopoDS_Shape aShape = anExp.Current();
-    if( aShape.ShapeType() == TopAbs_FACE )
-    {
-      TopoDS_Face aFace = TopoDS::Face( aShape );
-      if( !aFace.IsNull() )
-      {
-        SplitData aSplitData( SplitData::Data_Zone, aFace, theData.ObjectNames );
-        aSplitDataList.append( aSplitData );
-      }
-    }
-  }
-  return aSplitDataList;
-}
index f2a5ad69e81964813c985bdfd245acc3e2e7676f..c80f66fe3ef6480c26c13c089214d6305d35d70d 100644 (file)
@@ -72,15 +72,7 @@ public:
 
 private:
 
-  static bool                SplitTwoData( const SplitData& theData1,
-                                           const SplitData& theData2,
-                                           SplitData& theData1Subtracted,
-                                           SplitData& theData2Subtracted,
-                                           SplitData& theDataIntersected );
-
-  static SplitDataList       ExtractSeparateData( const SplitData& theData );
-
-   /**
+  /**
    * Split input faces.
    */
   static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);