]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
24.01.2014. Fix for bug of group edges history.
authorszy <szy@opencascade.com>
Fri, 24 Jan 2014 13:17:55 +0000 (13:17 +0000)
committerszy <szy@opencascade.com>
Fri, 24 Jan 2014 13:17:55 +0000 (13:17 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_SplitToZonesTool.cxx

index 5fbcba7784d31df85e8ec227b41b94b87c4e3d27..12b146a048d913cd2eaadbb4465c59f6f52b5aee 100644 (file)
@@ -267,7 +267,10 @@ void HYDROData_CalculationCase::Update()
       QString anObjName = aSplitData.ObjectNames.first();
       if ( anObjName.isEmpty() )
         continue;
-
+#ifdef DEB_CALCULATION
+      QString aStr = aSplitData.ObjectNames.join(" "); 
+         cout << " CCase: Names = "<<aStr.toStdString() << " size = " <<aSplitData.ObjectNames.size() <<endl; 
+#endif
       Handle(HYDROData_SplittedShapesGroup) aSplittedGroup;
       if ( !aSplittedEdgesGroupsMap.contains( anObjName ) )
       {
index c85539b2508d9babc7b281ea1cb030a1f240a57c..e4015d4a7aa54afbd97d260effea48ba50eb6a3a 100644 (file)
@@ -117,7 +117,7 @@ HYDROData_SplitToZonesTool::SplitDataList
   // Preparation. 
   // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
   SplitDataList anInputSplitDataList;
-  TCollection_AsciiString aNam("Faces_");
+  //TCollection_AsciiString aNam("Faces_");
   for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Object) aGeomObj = 
@@ -148,7 +148,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,12 +170,16 @@ 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;   
+#endif
       }
-    }
+       }
   }
   // If only one shape is given we don't split it 
   // algorithm just returns the unpacked input data
@@ -241,8 +245,8 @@ HYDROData_SplitToZonesTool::SplitDataList
   // Step 3. Collect history  
   //HYDROData_DataMapOfShapeListOfShape aDM1;
   BOPCol_ListIteratorOfListOfShape anIt(aLS); 
-  TCollection_AsciiString aNamM ("EdgM_");
-  TCollection_AsciiString aNamG ("EdgG_");
+  //TCollection_AsciiString aNamM ("EdgM_");
+  //TCollection_AsciiString aNamG ("EdgG_");
   for (int i =1;anIt.More();anIt.Next(),i++) {
        Standard_Boolean foundF(Standard_False);
     const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value());
@@ -266,9 +270,9 @@ HYDROData_SplitToZonesTool::SplitDataList
        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++) {
+        aList.Clear();
            Standard_Boolean foundE(Standard_False);
            const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current());     
                //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
@@ -292,12 +296,12 @@ HYDROData_SplitToZonesTool::SplitDataList
                  aList.Append (exp.Current());
 #ifdef DEB_SPLIT_TO_ZONES
                  aName = aNamG + i + j +".brep";
-                 //BRepTools::Write(exp.Current(),aName.ToCString());
+                 BRepTools::Write(exp.Current(),aName.ToCString());
                  cout << aName.ToCString()<< " = " << exp.Current().TShape() <<endl;
 #endif
                }
                aDM1.Bind(exp.Current(), aList);
-         }      
+         }
        }
   }
   } else 
@@ -307,8 +311,7 @@ HYDROData_SplitToZonesTool::SplitDataList
   // make limiting face
   HYDROData_DataMapOfShapeListOfShape aDM4;
   Standard_Boolean hasLimits(Standard_False);
-  if (! thePolyline.IsNull()) {
-    //const TopoDS_Shape aShape = thePolyline->GetShape();     
+  if (! thePolyline.IsNull()) {    
     const TopoDS_Wire aBndWire = TopoDS::Wire(thePolyline->GetShape());
     if(!aBndWire.IsNull()) {
       TopoDS_Face limFace;       
@@ -330,7 +333,7 @@ HYDROData_SplitToZonesTool::SplitDataList
               const TopoDS_Shape& aFace = exp.Current();
                      if(!aFace.IsNull()) {
                        const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace);
-                         //cout << "Modified: " << aListOfNew.Extent() <<endl;                 
+                           //cout << "Modified: " << aListOfNew.Extent() <<endl;                       
                 const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);                       
                            if(!aListOfNew.IsEmpty()) {
                      aDM4.Bind(aFace, aListOfNew);
@@ -443,7 +446,7 @@ HYDROData_SplitToZonesTool::SplitDataList
                                  }
                                }
                         }
-                  }//
+                  }
                 }
                 }
                 } else {
@@ -496,23 +499,24 @@ HYDROData_SplitToZonesTool::SplitDataList
     QStringList aListOfNames; // names processing
     const TopTools_ListOfShape& aListOfOld = aMIt.Value();
     TopTools_ListIteratorOfListOfShape it(aListOfOld);
-       for(;it.More();it.Next()) {     
+       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
-
-               for ( int k = 1;k <= ObjectNames.length(); ++k ) {
-                       QString aStr = ObjectNames.last(); 
-                       cout << "Indx = " << i<< " k = " << k << " size = " <<ObjectNames.size() << " Name = "<<aStr.toStdString() <<endl;   
-               }       
+               TCollection_AsciiString aName = aNam4 + i +"_" + j + ".brep";
+           BRepTools::Write(aSh ,aName.ToCString());           
 #endif 
          }      
        }
 
        aDestSplitData.ObjectNames = aListOfNames;  
-       anOutputSplitDataList.append(aDestSplitData);
+       anOutputSplitDataList.append(aDestSplitData);   
+#ifdef DEB_SPLIT_TO_ZONES
+       QString aStr = aDestSplitData.ObjectNames.join(" "); 
+       cout << "New# = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aDestSplitData.ObjectNames.size() <<endl; 
+#endif
   }
  
   return anOutputSplitDataList;