]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_SplitToZonesTool.cxx
Salome HOME
Debug code commented.
[modules/hydro.git] / src / HYDROData / HYDROData_SplitToZonesTool.cxx
1
2 #include "HYDROData_SplitToZonesTool.h"
3
4 #include "HYDROData_PolylineXY.h"
5 #include "HYDROData_ShapesGroup.h"
6 #include <HYDROData_Transform.h>
7 #include <BRepAlgoAPI_Cut.hxx>
8 #include <BRepAlgoAPI_Common.hxx>
9 #include <BRepBuilderAPI_MakeFace.hxx>
10 #include <BRep_Builder.hxx>
11 #include <TopExp_Explorer.hxx>
12 #include <TopoDS.hxx>
13 #include <TopoDS_Shape.hxx>
14 #include <TopoDS_Compound.hxx>
15 #include <TopoDS_Wire.hxx>
16 #include <TopoDS_Edge.hxx>
17 #include <BRepCheck_Analyzer.hxx>
18 #include <TopTools_ListOfShape.hxx>
19 #include <TopTools_ListIteratorOfListOfShape.hxx>
20 #include <gp_Pln.hxx>
21 #include <BRepGProp.hxx>
22 #include <GProp_GProps.hxx>
23 #include <Geom_Plane.hxx>
24 #include <BRepBuilderAPI_FindPlane.hxx>
25
26 //#define DEB_SPLIT_TO_ZONES 1
27 //#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1
28 #if (defined (DEB_SPLIT_TO_ZONES) || defined(DEB_SPLIT_TO_ZONES_CHECK_PARTITION))
29 #include <BRepTools.hxx>
30 static TCollection_AsciiString fileNameBefore("BeforeTranslation");
31 #endif
32
33 TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const
34 {
35   TopoDS_Face aResFace;
36
37   if( !Shape.IsNull() )
38   {
39     if ( Shape.ShapeType() == TopAbs_FACE )
40     {
41       aResFace = TopoDS::Face( Shape );
42     }
43     else if ( Shape.ShapeType() == TopAbs_WIRE )
44     {
45       BRepBuilderAPI_MakeFace aMakeFace( TopoDS::Wire( Shape ), Standard_True );
46       aMakeFace.Build();
47       if( aMakeFace.IsDone() )
48         aResFace = aMakeFace.Face();
49     }
50   }
51
52   return aResFace;
53 }
54
55 Standard_Boolean buildLimFace(const TopoDS_Wire& theBndWire, TopoDS_Face& outFace) 
56 {
57   GProp_GProps G;
58   BRepGProp::LinearProperties(theBndWire,G);
59   const gp_Pnt& aCPnt = G.CentreOfMass();
60   gp_Pln aPln;
61   BRepBuilderAPI_FindPlane fndPlane (theBndWire, Precision::Confusion());  
62   if(fndPlane.Found())
63     aPln = fndPlane.Plane()->Pln();
64   else
65     aPln = gp_Pln(aCPnt, gp::OZ().Direction());
66   BRepBuilderAPI_MakeFace  aMkFace(aPln, theBndWire);
67   if(aMkFace.IsDone()) {
68     outFace = aMkFace.Face();     
69     if(!outFace.IsNull()) {
70 #ifdef DEB_SPLIT_TO_ZONES
71 //        BRepTools::Write(limFace,"FL.brep");
72 #endif
73       return Standard_True;
74         }
75   }
76   return Standard_False;
77 }
78 //======================================================================================
79
80 void HYDROData_SplitToZonesTool::SetFileNames(const QString& theNameBefore, const QString& theNameAfter)
81 {
82 #ifdef DEB_SPLIT_TO_ZONES_CHECK_PARTITION
83   if(!theNameBefore.isNull() && !theNameBefore.isEmpty())
84   {
85     TCollection_AsciiString aName (theNameBefore.toStdString().data());
86         fileNameBefore = aName;
87   }
88   if(!theNameAfter.isNull() && !theNameAfter.isEmpty())
89   {
90     TCollection_AsciiString aName (theNameAfter.toStdString().data());
91     HYDROData_Transform::SetFileName (aName);
92   }
93 #endif
94 }
95 //======================================================================================
96 Standard_Integer HYDROData_SplitToZonesTool::SplitFaces(const TopoDS_Compound& theComp, 
97                                                                                                                 HYDROData_Transform& theTool)
98 {
99   theTool.Clear();
100   theTool.SetArgument(theComp);
101   theTool.Detect();
102   const Standard_Boolean bToTransform = theTool.ToTransform();  
103   theTool.SetToTransform(bToTransform);  
104   theTool.Perform();
105   Standard_Integer anErr = theTool.ErrorStatus();
106   return anErr;
107 }
108
109 //======================================================================================
110 HYDROData_SplitToZonesTool::SplitDataList
111   HYDROData_SplitToZonesTool::Split( const HYDROData_SequenceOfObjects&  theObjectList,
112                                      const HYDROData_SequenceOfObjects&  theGroupsList,
113                                      const Handle(HYDROData_PolylineXY)& thePolyline )
114 {
115   SplitDataList anOutputSplitDataList;
116   if(theObjectList.IsEmpty()) return anOutputSplitDataList;
117   // Preparation. 
118   // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
119   SplitDataList anInputSplitDataList;
120   TCollection_AsciiString aNam("Faces_");
121   for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
122   {
123     Handle(HYDROData_Object) aGeomObj = 
124       Handle(HYDROData_Object)::DownCast( theObjectList.Value( anIndex ) );
125     if( aGeomObj.IsNull() )
126       continue;
127
128     TopoDS_Shape aShape = aGeomObj->GetTopShape();
129     if ( aShape.IsNull() )
130       continue;  
131    //TCollection_AsciiString aName = aNam + anIndex + ".brep";
132    //BRepTools::Write(aShape, aName.ToCString());
133
134     if ( aShape.ShapeType() == TopAbs_COMPOUND ) {
135       // Create split data for each face contained in the compound
136       TopExp_Explorer anExp( aShape, TopAbs_FACE );
137       for ( ; anExp.More(); anExp.Next() ) {
138         const TopoDS_Face& aFace = TopoDS::Face( anExp.Current() );
139         if ( !aFace.IsNull() ) {
140           SplitData aSplitData( SplitData::Data_Zone, aFace, aGeomObj->GetName() );
141           anInputSplitDataList.append( aSplitData );
142         }
143       }
144     } else {
145       SplitData aSplitData( SplitData::Data_Zone, aShape, aGeomObj->GetName() );
146       anInputSplitDataList.append( aSplitData );
147     }
148   }
149   //
150   SplitDataList anInputGroupList;
151   for( int anIndex = 1; anIndex <= theGroupsList.Length(); anIndex++ )
152   {
153     Handle(HYDROData_ShapesGroup) aGeomGroup = 
154       Handle(HYDROData_ShapesGroup)::DownCast( theGroupsList.Value( anIndex ) );
155     if( aGeomGroup.IsNull() )
156       continue;
157       
158     TopTools_SequenceOfShape aGroupShapes;
159     aGeomGroup->GetShapes( aGroupShapes );
160     for( int i = 1, aNbShapes = aGroupShapes.Length(); i <= aNbShapes; i++ ) {
161       const TopoDS_Shape& aGroupShape = aGroupShapes.Value( i );
162       if ( aGroupShape.IsNull() )
163         continue;  
164
165       if ( aGroupShape.ShapeType() == TopAbs_COMPOUND ) {    
166         TopExp_Explorer anExp( aGroupShape, TopAbs_EDGE );
167         for ( ; anExp.More(); anExp.Next() ) {
168           const TopoDS_Edge& anEdge = TopoDS::Edge( anExp.Current() );
169           if ( !anEdge.IsNull() ) {
170             SplitData aSplitData( SplitData::Data_Edge, anEdge, aGeomGroup->GetName() );
171             anInputGroupList.append( aSplitData );
172           }
173           }
174       } else {
175         SplitData aSplitData( SplitData::Data_Edge, aGroupShape, aGeomGroup->GetName() );
176         anInputGroupList.append( aSplitData );
177       }
178     }
179   }
180   // If only one shape is given we don't split it 
181   // algorithm just returns the unpacked input data
182   if(theObjectList.Size() == 1)  {
183         anOutputSplitDataList.append(anInputSplitDataList); 
184         if(!theGroupsList.IsEmpty() ) 
185           anOutputSplitDataList.append(anInputGroupList);       
186     return anOutputSplitDataList;
187   }
188   HYDROData_DataMapOfShapeListOfString aDM3;
189   if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names
190     QStringList aListOfNames;
191     for (int i=0;i < anInputGroupList.size() ;i++) {
192       const TopoDS_Shape& aSh = anInputGroupList.at(i).Shape;
193       aDM3.Bind(aSh, anInputGroupList.at(i).ObjectNames);
194     }
195   }
196   // Step 1. Prepare Partition structures. 
197   BOPCol_ListOfShape aLS;  
198   QStringList aListOfNames;
199   TopoDS_Compound aCmp;
200   BRep_Builder aBB;
201   aBB.MakeCompound(aCmp);
202   for (int i=0;i < anInputSplitDataList.size() ;i++) {
203     const TopoDS_Shape& aSh = anInputSplitDataList.at(i).Shape;
204     aDM3.Bind(aSh, anInputSplitDataList.at(i).ObjectNames);
205     aLS.Append(aSh);
206         aBB.Add(aCmp,aSh);
207     //TCollection_AsciiString aName = aNam + i + ".brep";
208     //BRepTools::Write(aSh, aName.ToCString());
209   }
210 #ifdef DEB_SPLIT_TO_ZONES_CHECK_PARTITION
211   TCollection_AsciiString aNameBefore = fileNameBefore + ".brep";
212   BRepTools::Write(aCmp, aNameBefore.ToCString());
213 #endif
214
215   HYDROData_Transform splitTool; 
216   const Standard_Integer anErr = SplitFaces(aCmp, splitTool);    
217   if(anErr)
218     return anOutputSplitDataList;
219   const TopoDS_Shape& aResult = splitTool.Shape();
220   if (aResult.IsNull()) 
221     return anOutputSplitDataList;
222   BRepCheck_Analyzer aCheck (aResult);
223   if(!aCheck.IsValid()) {
224 #ifdef DEB_SPLIT_TO_ZONES
225     cout << "result is not valid" <<endl;
226     BRepTools::Write(aResult, "SplitFacesNV.brep");  
227 #endif
228     return anOutputSplitDataList;
229   }
230 #ifdef DEB_SPLIT_TO_ZONES
231   BRepTools::Write(aResult, "SplitFacesV.brep");
232 #endif
233   
234   // Step 3. Collect history  
235   HYDROData_DataMapOfShapeListOfShape aDM1;
236   BOPCol_ListIteratorOfListOfShape anIt(aLS); 
237   TCollection_AsciiString aNamM ("EdgM_");
238   TCollection_AsciiString aNamG ("EdgG_");
239   for (int i =1;anIt.More();anIt.Next(),i++) {
240         Standard_Boolean foundF(Standard_False);
241     const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value());
242         if(!aListOfNew.IsEmpty())
243           foundF = Standard_True;
244     TopTools_ListOfShape aList;
245     TopTools_ListIteratorOfListOfShape it(aListOfNew);
246     for(;it.More();it.Next())       
247       aList.Append(it.Value());
248     // Bug in History: partition should give only modified entities! => temporary solution is used
249     const TopTools_ListOfShape& aListOfGen = splitTool.Generated(anIt.Value());
250         if(!aListOfGen.IsEmpty())
251           foundF = Standard_True;
252         it.Initialize(aListOfGen);    
253         for(;it.More();it.Next())     
254           aList.Append(it.Value());
255     if(!foundF) // face is not modified
256           aList.Append (anIt.Value());
257         aDM1.Bind(anIt.Value(), aList);
258 #ifdef DEB_SPLIT_TO_ZONES
259         TCollection_AsciiString aName;
260 #endif
261         if(!anInputGroupList.isEmpty() ) { // 1
262       aList.Clear();
263           TopExp_Explorer exp (anIt.Value(), TopAbs_EDGE);
264           for (int j =1;exp.More();exp.Next(),j++) {
265             Standard_Boolean foundE(Standard_False);
266             const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current());     
267                 //cout << "NB_EDGE_M = " << aListM.Extent() <<endl;
268                 if(aListM.Extent()) foundE = Standard_True;
269                 it.Initialize(aListM);    
270                 for(int k=1;it.More();it.Next(),k++) {    
271               aList.Append(it.Value());
272                   //aName = aNamM + i + j +k +".brep";
273                   //BRepTools::Write(it.Value(),aName.ToCString());
274                 }
275                 const TopTools_ListOfShape& aListG = splitTool.Generated(exp.Current());
276                 if(aListG.Extent()) foundE = Standard_True;
277                 it.Initialize(aListG);    
278                 for(int k=1;it.More();it.Next(),k++)   {  
279               aList.Append(it.Value());
280                   //aName = aNamG + i + j +k +".brep";
281                   //BRepTools::Write(it.Value(),aName.ToCString());
282                 }
283                 //cout << "NB_EDGE = " << aList.Extent() <<endl;
284                 if(!foundE) {
285                   aList.Append (exp.Current());
286 #ifdef DEB_SPLIT_TO_ZONES
287                   aName = aNamG + i + j +".brep";
288                   //BRepTools::Write(exp.Current(),aName.ToCString());
289                   cout << aName.ToCString()<< " = " << exp.Current().TShape() <<endl;
290 #endif
291                 }
292                 aDM1.Bind(exp.Current(), aList);
293           }      
294         }
295   }
296
297   // aDM2: NewShape ==> ListOfOldShapes
298   HYDROData_DataMapOfShapeListOfShape aDM2;
299   // make limiting face
300   HYDROData_DataMapOfShapeListOfShape aDM4;
301   Standard_Boolean hasLimits(Standard_False);
302   if (! thePolyline.IsNull()) {  
303     //const TopoDS_Shape aShape = thePolyline->GetShape();      
304     const TopoDS_Wire aBndWire = TopoDS::Wire(thePolyline->GetShape());
305     if(!aBndWire.IsNull()) {
306       TopoDS_Face limFace;        
307           if(buildLimFace(aBndWire, limFace)) {
308                 TopoDS_Shape aComResult;
309             BRepAlgoAPI_Common mkCom(aResult, limFace);
310                 if(mkCom.IsDone()) {
311               aComResult = mkCom.Shape();
312                   BRepCheck_Analyzer aCheck (aComResult);
313           if(aCheck.IsValid()) {
314 #ifdef DEB_SPLIT_TO_ZONES
315                     BRepTools::Write(aComResult,"CommonV.brep");
316 #endif  
317
318                     hasLimits = Standard_True; // DM2 should filled here
319                     HYDROData_MapOfShape aView;
320                     TopExp_Explorer exp (aResult, TopAbs_FACE);
321                     for (int i =1;exp.More();exp.Next(),i++) {
322               const TopoDS_Shape& aFace = exp.Current();
323                       if(!aFace.IsNull()) {
324                         const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace);
325                           //cout << "Modified: " << aListOfNew.Extent() <<endl;                 
326                 const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);                        
327                             if(!aListOfNew.IsEmpty()) {
328                       aDM4.Bind(aFace, aListOfNew);
329                               //TCollection_AsciiString aName = aNam + i + ".brep";
330                                   //BRepTools::Write(aListOfNew.Last(), aName.ToCString());                             
331                                 }
332                                 else {
333                               if(!mkCom.IsDeleted(aFace)) {
334                                     if(!aListOfGen.IsEmpty()) {
335                           aDM4.Bind(aFace, aListOfGen);                        
336                                       //TCollection_AsciiString aName = aNam + i + "g.brep";
337                                       //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
338                                         }
339                                          else {
340                                     TopTools_ListOfShape aList; 
341                                         aList.Append(aFace);
342                                         aDM4.Bind(aFace, aList); //the same face - not modified
343                                          }
344                                   }
345                          }
346                          TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
347                          for (int j =1;exp2.More();exp2.Next(),j++) {
348                            const TopoDS_Shape& anEdge = exp2.Current();
349                            if(!anEdge.IsNull()) {
350                                  if(aView.Contains(anEdge)) continue;
351                                  aView.Add(anEdge);
352                                  const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);
353                                  const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
354                  if(!aListOfNewEd.IsEmpty())
355                        aDM4.Bind(anEdge, aListOfNewEd);
356                                  else {
357                                    if(!mkCom.IsDeleted(anEdge)) {
358                                          if(!aListOfGenEd.IsEmpty()) {
359                                            aDM4.Bind(anEdge, aListOfGenEd);
360                                          } else {
361                                            TopTools_ListOfShape aList; 
362                                        aList.Append(anEdge);
363                                        aDM4.Bind(anEdge, aList);//the same edge - not modified
364                                          }
365                                    }
366                                  }
367                            }
368                          }
369                         }
370                   } //end DM4 filling (phase 1)
371                     //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
372                  // phase 2 (from tool)
373          TopExp_Explorer expt (limFace, TopAbs_EDGE);
374                  for(;expt.More();expt.Next()) {
375                    const TopoDS_Shape& anEdge = expt.Current();
376                    if(!anEdge.IsNull()) {
377              const TopTools_ListOfShape& aListOfNewEd = mkCom.Modified(anEdge);
378                          const TopTools_ListOfShape& aListOfGenEd = mkCom.Generated(anEdge);
379              if(!aListOfNewEd.IsEmpty())
380                    aDM4.Bind(anEdge, aListOfNewEd);
381                          else {
382                            if(!mkCom.IsDeleted(anEdge)) {
383                                  if(!aListOfGenEd.IsEmpty()) {
384                                    aDM4.Bind(anEdge, aListOfGenEd);
385                                  } else {
386                                    TopTools_ListOfShape aList; 
387                                aList.Append(anEdge);
388                                aDM4.Bind(anEdge, aList);//the same edge - not modified
389                                  }
390                            }
391                          }
392                    }
393                  }
394                  //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
395          HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1); 
396                  //DM4 contains Old - New after common op. DM1: old - new after Split op.
397          for(;aMIt.More();aMIt.Next()) {
398            const TopoDS_Shape& aKey = aMIt.Key();
399            TopTools_ListOfShape aList;
400            aList.Append(aKey);
401            const TopTools_ListOfShape& aListOfNew = aMIt.Value();
402            TopTools_ListIteratorOfListOfShape it(aListOfNew);
403            for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
404                          if(!aDM4.IsBound(it.Value())) // bi - is deleted
405                continue; // go to the next bi
406                          else {
407                                 const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
408                             TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
409                 for(;it4.More();it4.Next()) {
410                                   if(!aDM2.IsBound(it4.Value()))
411                     aDM2.Bind(it4.Value(), aList);
412                               else {
413                     TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
414                     aList.Prepend(aKey);
415                                   }
416                                 }
417                          }
418                    }//
419                   }
420                  } else {
421                          hasLimits = Standard_False;
422 #ifdef DEB_SPLIT_TO_ZONES
423                      BRepTools::Write(aComResult,"CommonNV.brep");
424 #endif  
425                   }
426            }
427           }
428         }
429   }
430   if(!hasLimits) {
431     HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1);
432     for(;aMIt.More();aMIt.Next()) {
433       const TopoDS_Shape& aKey = aMIt.Key();
434       TopTools_ListOfShape aList;
435       aList.Append(aKey);
436       const TopTools_ListOfShape& aListOfNew = aMIt.Value();
437       TopTools_ListIteratorOfListOfShape it(aListOfNew);
438       for(;it.More();it.Next()) {
439         if(!aDM2.IsBound(it.Value()))
440           aDM2.Bind(it.Value(), aList);
441         else {
442           TopTools_ListOfShape& aList = aDM2.ChangeFind(it.Value());
443           aList.Prepend(aKey);
444                 }
445           }
446         }
447   }
448   // Step 4. Fill output structure.
449 #ifdef DEB_SPLIT_TO_ZONES
450   TCollection_AsciiString aNam4 ("SC_");
451 #endif  
452   HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM2);
453   for(int i =1;aMIt.More();aMIt.Next(),i++) {
454     SplitData aDestSplitData;
455     const TopoDS_Shape& aKey = aMIt.Key(); //new
456     aDestSplitData.Shape = aKey;
457     if(aKey.ShapeType() == TopAbs_FACE)
458       aDestSplitData.Type = SplitData::Data_Zone;
459         else {
460       aDestSplitData.Type = SplitData::Data_Edge;
461 #ifdef DEB_SPLIT_TO_ZONES
462           TCollection_AsciiString aName = aNam4 + i + ".brep";
463           BRepTools::Write(aKey,aName.ToCString());
464 #endif  
465         }
466
467     QStringList aListOfNames; // names processing
468     const TopTools_ListOfShape& aListOfOld = aMIt.Value();
469     TopTools_ListIteratorOfListOfShape it(aListOfOld);
470         for(;it.More();it.Next()) {     
471           const TopoDS_Shape& aSh = it.Value(); //old
472           if(aDM3.IsBound(aSh)) {
473             const QStringList& ObjectNames = aDM3.Find(aSh);
474                 aListOfNames.append(ObjectNames);
475 #ifdef DEB_SPLIT_TO_ZONES
476
477                 for ( int k = 1;k <= ObjectNames.length(); ++k ) {
478                         QString aStr = ObjectNames.last(); 
479                         cout << "Indx = " << i<< " k = " << k << " size = " <<ObjectNames.size() << " Name = "<<aStr.toStdString() <<endl;   
480                 }       
481 #endif  
482           }      
483         }
484
485         aDestSplitData.ObjectNames = aListOfNames;  
486         anOutputSplitDataList.append(aDestSplitData);
487   }
488  
489   return anOutputSplitDataList;
490 }
491
492 bool HYDROData_SplitToZonesTool::SplitTwoData( const SplitData& theData1,
493                                                const SplitData& theData2,
494                                                SplitData& theData1Subtracted,
495                                                SplitData& theData2Subtracted,
496                                                SplitData& theDataIntersected )
497 {
498   const TopoDS_Shape& aShape1 = theData1.Shape;
499   const TopoDS_Shape& aShape2 = theData2.Shape;
500
501   const QStringList& anObjectNames1 = theData1.ObjectNames;
502   const QStringList& anObjectNames2 = theData2.ObjectNames;
503
504   BRepAlgoAPI_Common aCommon( aShape1, aShape2 );
505   TopoDS_Shape aCommonShape = aCommon.Shape();
506   if( aCommonShape.IsNull() )
507   {
508     theData1Subtracted = theData1;
509     theData2Subtracted = theData2;
510     return false;
511   }
512
513   BRepAlgoAPI_Cut aCut1( aShape1, aShape2 );
514   TopoDS_Shape aCut1Shape = aCut1.Shape();
515
516   BRepAlgoAPI_Cut aCut2( aShape2, aShape1 );
517   TopoDS_Shape aCut2Shape = aCut2.Shape();
518
519   theData1Subtracted = SplitData( SplitData::Data_Zone, aCut1Shape, anObjectNames1 );
520   theData2Subtracted = SplitData( SplitData::Data_Zone, aCut2Shape, anObjectNames2 );
521   theDataIntersected = SplitData( SplitData::Data_Zone, aCommonShape, anObjectNames1 + anObjectNames2 );
522
523   return true;
524 }
525
526 HYDROData_SplitToZonesTool::SplitDataList
527 HYDROData_SplitToZonesTool::ExtractSeparateData( const SplitData& theData )
528 {
529   SplitDataList aSplitDataList;
530   TopExp_Explorer anExp( theData.Shape, TopAbs_FACE );
531   for( ; anExp.More(); anExp.Next() )
532   {
533     TopoDS_Shape aShape = anExp.Current();
534     if( aShape.ShapeType() == TopAbs_FACE )
535     {
536       TopoDS_Face aFace = TopoDS::Face( aShape );
537       if( !aFace.IsNull() )
538       {
539         SplitData aSplitData( SplitData::Data_Zone, aFace, theData.ObjectNames );
540         aSplitDataList.append( aSplitData );
541       }
542     }
543   }
544   return aSplitDataList;
545 }