]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_BooleanDriver.cxx
Salome HOME
0022258: [CEA 897] Bug in boolean operations on spheres external layer
[modules/geom.git] / src / GEOMImpl / GEOMImpl_BooleanDriver.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include <GEOMImpl_BooleanDriver.hxx>
24 #include <GEOMImpl_IBoolean.hxx>
25 #include <GEOMImpl_Types.hxx>
26 #include <GEOMImpl_GlueDriver.hxx>
27 #include <GEOM_Function.hxx>
28 #include <GEOMUtils.hxx>
29
30 #include <TNaming_CopyShape.hxx>
31
32 #include <ShapeFix_ShapeTolerance.hxx>
33 #include <ShapeFix_Shape.hxx>
34
35 #include <BRep_Builder.hxx>
36 #include <BRepAlgo.hxx>
37 #include <BRepAlgoAPI_Common.hxx>
38 #include <BRepAlgoAPI_Cut.hxx>
39 #include <BRepAlgoAPI_Fuse.hxx>
40 #include <BRepAlgoAPI_Section.hxx>
41 #include <BRepCheck_Analyzer.hxx>
42 #include <BOPAlgo_CheckerSI.hxx>
43 #include <BOPDS_DS.hxx>
44
45 #include <TopExp_Explorer.hxx>
46 #include <TopoDS_Compound.hxx>
47 #include <TopoDS_Iterator.hxx>
48 #include <TopTools_MapOfShape.hxx>
49 #include <TopTools_ListOfShape.hxx>
50 #include <TopTools_ListIteratorOfListOfShape.hxx>
51
52 #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
53
54 #include <Precision.hxx>
55
56 #include <Standard_ConstructionError.hxx>
57 #include <StdFail_NotDone.hxx>
58
59 // Comment next macro in order to avoid check of boolean operations arguments for self-intersections
60 #define BOP_CHECK_SELF_INTERSECTIONS
61 // Depth of self-intersection check (see BOPAlgo_CheckerSI::SetLevelOfCheck() for more details)
62 // Default value for BOPAlgo_CheckerSI gives very long computation when checking face-to-face intersections;
63 // here check level is decreased to more appropriate value to avoid problems with performance).
64 #define BOP_SELF_INTERSECTIONS_LEVEL 4
65
66 //=======================================================================
67 //function : GetID
68 //purpose  :
69 //=======================================================================
70 const Standard_GUID& GEOMImpl_BooleanDriver::GetID()
71 {
72   static Standard_GUID aBooleanDriver("FF1BBB21-5D14-4df2-980B-3A668264EA16");
73   return aBooleanDriver;
74 }
75
76 //=======================================================================
77 //function : GEOMImpl_BooleanDriver
78 //purpose  :
79 //=======================================================================
80 GEOMImpl_BooleanDriver::GEOMImpl_BooleanDriver()
81 {
82 }
83
84 //=======================================================================
85 //function : Execute
86 //purpose  :
87 //=======================================================================
88 Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
89 {
90   if (Label().IsNull()) return 0;
91   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
92
93   GEOMImpl_IBoolean aCI (aFunction);
94   Standard_Integer aType = aFunction->GetType();
95
96   TopoDS_Shape aShape;
97
98   switch (aType) {
99   case BOOLEAN_COMMON:
100   case BOOLEAN_CUT:
101   case BOOLEAN_FUSE:
102   case BOOLEAN_SECTION:
103     {
104       Handle(GEOM_Function) aRefShape1 = aCI.GetShape1();
105       Handle(GEOM_Function) aRefShape2 = aCI.GetShape2();
106       TopoDS_Shape aShape1 = aRefShape1->GetValue();
107       TopoDS_Shape aShape2 = aRefShape2->GetValue();
108
109       if (!aShape1.IsNull() && !aShape2.IsNull()) {
110         // check arguments for Mantis issue 0021019
111         BRepCheck_Analyzer ana (aShape1, Standard_True);
112         if (!ana.IsValid())
113           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
114         ana.Init(aShape2);
115         if (!ana.IsValid())
116           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
117
118 #ifdef BOP_CHECK_SELF_INTERSECTIONS
119         BOPAlgo_CheckerSI aCSI;  // checker of self-interferences
120         aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
121         BOPCol_ListOfShape aList1, aList2;
122         aList1.Append(aShape1);
123         aList2.Append(aShape2);
124         aCSI.SetArguments(aList1);
125         aCSI.Perform();
126         if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0)
127           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
128         aCSI.SetArguments(aList2);
129         aCSI.Perform();
130         if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0)
131           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
132 #endif
133
134         aShape = performOperation (aShape1, aShape2, aType);
135
136         if (aShape.IsNull())
137           return 0;
138       }
139     }
140     break;
141   case BOOLEAN_COMMON_LIST:
142   case BOOLEAN_FUSE_LIST:
143     {
144       Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
145       const Standard_Integer nbShapes = aShapes->Length();
146       Standard_Integer i;
147       Handle(GEOM_Function) aRefShape;
148       TopoDS_Shape aShape2;
149       Standard_Integer aSimpleType =
150         (aType == BOOLEAN_FUSE_LIST ? BOOLEAN_FUSE : BOOLEAN_COMMON);
151
152       if (nbShapes > 0) {
153         aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
154         aShape = aRefShape->GetValue();
155         
156         if (!aShape.IsNull()) {
157           BRepCheck_Analyzer anAna (aShape, Standard_True);
158 #ifdef BOP_CHECK_SELF_INTERSECTIONS
159           BOPAlgo_CheckerSI aCSI;  // checker of self-interferences
160           aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
161 #endif    
162           if (!anAna.IsValid()) {
163             StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
164           }
165
166 #ifdef BOP_CHECK_SELF_INTERSECTIONS
167           BOPCol_ListOfShape aList1;
168           aList1.Append(aShape);
169           aCSI.SetArguments(aList1);
170           aCSI.Perform();
171           if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
172             StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
173           }
174 #endif    
175           for (i = 2; i <= nbShapes; i++) {
176             aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(i));
177             aShape2 = aRefShape->GetValue();
178             anAna.Init(aShape2);
179             
180             if (!anAna.IsValid()) {
181               StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
182             }
183             
184 #ifdef BOP_CHECK_SELF_INTERSECTIONS
185             BOPCol_ListOfShape aList2;
186             aList2.Append(aShape2);
187             aCSI.SetArguments(aList2);
188             aCSI.Perform();
189             if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
190               StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
191             }
192 #endif      
193             aShape = performOperation (aShape, aShape2, aSimpleType);
194             
195             if (aShape.IsNull()) {
196               return 0;
197             }
198           }
199         }
200       }
201     }
202     break;
203   case BOOLEAN_CUT_LIST:
204     {
205       Handle(GEOM_Function) aRefObject = aCI.GetShape1();
206
207       aShape = aRefObject->GetValue();
208
209       if (!aShape.IsNull()) {
210         // check arguments for Mantis issue 0021019
211         BRepCheck_Analyzer anAna (aShape, Standard_True);
212 #ifdef BOP_CHECK_SELF_INTERSECTIONS
213         BOPAlgo_CheckerSI aCSI;  // checker of self-interferences
214         aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
215 #endif
216         if (!anAna.IsValid()) {
217           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
218         }
219
220 #ifdef BOP_CHECK_SELF_INTERSECTIONS
221         BOPCol_ListOfShape aList1;
222         aList1.Append(aShape);
223         aCSI.SetArguments(aList1);
224         aCSI.Perform();
225         if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
226           StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
227         }
228 #endif
229         
230         Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetShapes();
231         const Standard_Integer nbShapes = aTools->Length();
232         Standard_Integer i;
233         Handle(GEOM_Function) aRefTool;
234         TopoDS_Shape aTool;
235
236         for (i = 1; i <= nbShapes; i++) {
237           aRefTool = Handle(GEOM_Function)::DownCast(aTools->Value(i));
238           aTool = aRefTool->GetValue();
239           anAna.Init(aTool);
240
241           if (!anAna.IsValid()) {
242             StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
243           }
244
245 #ifdef BOP_CHECK_SELF_INTERSECTIONS
246           BOPCol_ListOfShape aList2;
247           aList2.Append(aTool);
248           aCSI.SetArguments(aList2);
249           aCSI.Perform();
250           if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
251             StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
252           }
253 #endif
254
255           aShape = performOperation (aShape, aTool, BOOLEAN_CUT);
256
257           if (aShape.IsNull()) {
258             return 0;
259           }
260         }
261       }
262     }
263     break;
264   default:
265     break;
266   }
267
268   aFunction->SetValue(aShape);
269
270   log.SetTouched(Label());
271
272   return 1;
273 }
274
275 //=======================================================================
276 //function : performOperation
277 //purpose  :
278 //=======================================================================
279 TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
280                                (const TopoDS_Shape theShape1,
281                                 const TopoDS_Shape theShape2,
282                                 const Standard_Integer theType)const
283 {
284   TopoDS_Shape aShape;
285
286   // perform COMMON operation
287   if (theType == BOOLEAN_COMMON) {
288     BRep_Builder B;
289     TopoDS_Compound C;
290     B.MakeCompound(C);
291
292     TopTools_ListOfShape listShape1, listShape2;
293     GEOMUtils::AddSimpleShapes(theShape1, listShape1);
294     GEOMUtils::AddSimpleShapes(theShape2, listShape2);
295
296     Standard_Boolean isCompound =
297       (listShape1.Extent() > 1 || listShape2.Extent() > 1);
298
299     TopTools_ListIteratorOfListOfShape itSub1 (listShape1);
300     for (; itSub1.More(); itSub1.Next()) {
301       TopoDS_Shape aValue1 = itSub1.Value();
302       TopTools_ListIteratorOfListOfShape itSub2 (listShape2);
303       for (; itSub2.More(); itSub2.Next()) {
304         TopoDS_Shape aValue2 = itSub2.Value();
305         BRepAlgoAPI_Common BO (aValue1, aValue2);
306         if (!BO.IsDone()) {
307           StdFail_NotDone::Raise("Common operation can not be performed on the given shapes");
308         }
309         if (isCompound) {
310           TopoDS_Shape aStepResult = BO.Shape();
311
312           // check result of this step: if it is a compound (boolean operations
313           // allways return a compound), we add all sub-shapes of it.
314           // This allows to avoid adding empty compounds,
315           // resulting from COMMON on two non-intersecting shapes.
316           if (aStepResult.ShapeType() == TopAbs_COMPOUND) {
317             TopoDS_Iterator aCompIter (aStepResult);
318             for (; aCompIter.More(); aCompIter.Next()) {
319               // add shape in a result
320               B.Add(C, aCompIter.Value());
321             }
322           }
323           else {
324             // add shape in a result
325             B.Add(C, aStepResult);
326           }
327         }
328         else
329           aShape = BO.Shape();
330       }
331     }
332
333     if (isCompound) {
334       // As GlueFaces has been improved to keep all kind of shapes
335       TopExp_Explorer anExp (C, TopAbs_VERTEX);
336       if (anExp.More())
337         aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
338       else
339         aShape = C;
340     }
341   }
342
343   // perform CUT operation
344   else if (theType == BOOLEAN_CUT) {
345     BRep_Builder B;
346     TopoDS_Compound C;
347     B.MakeCompound(C);
348
349     TopTools_ListOfShape listShapes, listTools;
350     GEOMUtils::AddSimpleShapes(theShape1, listShapes);
351     GEOMUtils::AddSimpleShapes(theShape2, listTools);
352
353     Standard_Boolean isCompound = (listShapes.Extent() > 1);
354
355     TopTools_ListIteratorOfListOfShape itSub1 (listShapes);
356     for (; itSub1.More(); itSub1.Next()) {
357       TopoDS_Shape aCut = itSub1.Value();
358       // tools
359       TopTools_ListIteratorOfListOfShape itSub2 (listTools);
360       for (; itSub2.More(); itSub2.Next()) {
361         TopoDS_Shape aTool = itSub2.Value();
362         BRepAlgoAPI_Cut BO (aCut, aTool);
363         if (!BO.IsDone()) {
364           StdFail_NotDone::Raise("Cut operation can not be performed on the given shapes");
365         }
366         aCut = BO.Shape();
367       }
368       if (isCompound) {
369         // check result of this step: if it is a compound (boolean operations
370         // allways return a compound), we add all sub-shapes of it.
371         // This allows to avoid adding empty compounds,
372         // resulting from CUT of parts
373         if (aCut.ShapeType() == TopAbs_COMPOUND) {
374           TopoDS_Iterator aCompIter (aCut);
375           for (; aCompIter.More(); aCompIter.Next()) {
376             // add shape in a result
377             B.Add(C, aCompIter.Value());
378           }
379         }
380         else {
381           // add shape in a result
382           B.Add(C, aCut);
383         }
384       }
385       else
386         aShape = aCut;
387     }
388
389     if (isCompound) {
390       // As GlueFaces has been improved to keep all kind of shapes
391       TopExp_Explorer anExp (C, TopAbs_VERTEX);
392       if (anExp.More())
393         aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
394       else
395         aShape = C;
396     }
397   }
398
399   // perform FUSE operation
400   else if (theType == BOOLEAN_FUSE) {
401     // Perform
402     BRepAlgoAPI_Fuse BO (theShape1, theShape2);
403     if (!BO.IsDone()) {
404       StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes");
405     }
406     aShape = BO.Shape();
407   }
408
409   // perform SECTION operation
410   else if (theType == BOOLEAN_SECTION) {
411     BRep_Builder B;
412     TopoDS_Compound C;
413     B.MakeCompound(C);
414
415     TopTools_ListOfShape listShape1, listShape2;
416     GEOMUtils::AddSimpleShapes(theShape1, listShape1);
417     GEOMUtils::AddSimpleShapes(theShape2, listShape2);
418
419     Standard_Boolean isCompound =
420       (listShape1.Extent() > 1 || listShape2.Extent() > 1);
421
422     TopTools_ListIteratorOfListOfShape itSub1 (listShape1);
423     for (; itSub1.More(); itSub1.Next()) {
424       TopoDS_Shape aValue1 = itSub1.Value();
425       TopTools_ListIteratorOfListOfShape itSub2 (listShape2);
426       for (; itSub2.More(); itSub2.Next()) {
427         TopoDS_Shape aValue2 = itSub2.Value();
428         BRepAlgoAPI_Section BO (aValue1, aValue2, Standard_False);
429         // Set approximation to have an attached 3D BSpline geometry to each edge,
430         // where analytic curve is not possible. Without this flag in some cases
431         // we obtain BSpline curve of degree 1 (C0), which is slowly
432         // processed by some algorithms (Partition for example).
433         BO.Approximation(Standard_True);
434         //modified by NIZNHY-PKV Tue Oct 18 14:34:16 2011f
435         BO.ComputePCurveOn1(Standard_True);
436         BO.ComputePCurveOn2(Standard_True);
437         //modified by NIZNHY-PKV Tue Oct 18 14:34:18 2011t
438   
439         BO.Build();
440         if (!BO.IsDone()) {
441           StdFail_NotDone::Raise("Section operation can not be performed on the given shapes");
442         }
443         if (isCompound) {
444           TopoDS_Shape aStepResult = BO.Shape();
445
446           // check result of this step: if it is a compound (boolean operations
447           // allways return a compound), we add all sub-shapes of it.
448           // This allows to avoid adding empty compounds,
449           // resulting from SECTION on two non-intersecting shapes.
450           if (aStepResult.ShapeType() == TopAbs_COMPOUND) {
451             TopoDS_Iterator aCompIter (aStepResult);
452             for (; aCompIter.More(); aCompIter.Next()) {
453               // add shape in a result
454               B.Add(C, aCompIter.Value());
455             }
456           }
457           else {
458             // add shape in a result
459             B.Add(C, aStepResult);
460           }
461         }
462         else
463           aShape = BO.Shape();
464       }
465     }
466
467     if (isCompound) {
468       // As GlueFaces has been improved to keep all kind of shapes
469       TopExp_Explorer anExp (C, TopAbs_VERTEX);
470       if (anExp.More())
471         aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
472       else
473         aShape = C;
474     }
475   }
476
477   // UNKNOWN operation
478   else {
479   }
480
481   if (aShape.IsNull()) return aShape;
482
483   // as boolean operations always produce compound, lets simplify it
484   // for the case, if it contains only one sub-shape
485   TopTools_ListOfShape listShapeRes;
486   GEOMUtils::AddSimpleShapes(aShape, listShapeRes);
487   if (listShapeRes.Extent() == 1) {
488     aShape = listShapeRes.First();
489     if (aShape.IsNull()) return aShape;
490   }
491
492   // 08.07.2008 skl for bug 19761 from Mantis
493   BRepCheck_Analyzer ana (aShape, Standard_True);
494   ana.Init(aShape);
495   if (!ana.IsValid()) {
496     ShapeFix_ShapeTolerance aSFT;
497     aSFT.LimitTolerance(aShape, Precision::Confusion(),
498                         Precision::Confusion(), TopAbs_SHAPE);
499     Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
500     aSfs->Perform();
501     aShape = aSfs->Shape();
502     ana.Init(aShape);
503     if (!ana.IsValid())
504       Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
505   }
506
507   // BEGIN: Mantis issue 0021060: always limit tolerance of BOP result
508   // 1. Get shape parameters for comparison
509   int nbTypes [TopAbs_SHAPE];
510   {
511     for (int iType = 0; iType < TopAbs_SHAPE; ++iType)
512       nbTypes[iType] = 0;
513     nbTypes[aShape.ShapeType()]++;
514
515     TopTools_MapOfShape aMapOfShape;
516     aMapOfShape.Add(aShape);
517     TopTools_ListOfShape aListOfShape;
518     aListOfShape.Append(aShape);
519
520     TopTools_ListIteratorOfListOfShape itL (aListOfShape);
521     for (; itL.More(); itL.Next()) {
522       TopoDS_Iterator it (itL.Value());
523       for (; it.More(); it.Next()) {
524         TopoDS_Shape s = it.Value();
525         if (aMapOfShape.Add(s)) {
526           aListOfShape.Append(s);
527           nbTypes[s.ShapeType()]++;
528         }
529       }
530     }
531   }
532
533   // 2. Limit tolerance
534   TopoDS_Shape aShapeCopy;
535   TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
536   TNaming_CopyShape::CopyTool(aShape, aMapTShapes, aShapeCopy);
537   ShapeFix_ShapeTolerance aSFT;
538   aSFT.LimitTolerance(aShapeCopy, Precision::Confusion(), Precision::Confusion(), TopAbs_SHAPE);
539   Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
540   aSfs->Perform();
541   aShapeCopy = aSfs->Shape();
542
543   // 3. Check parameters
544   ana.Init(aShapeCopy);
545   if (ana.IsValid()) {
546     int iType, nbTypesCopy [TopAbs_SHAPE];
547
548     for (iType = 0; iType < TopAbs_SHAPE; ++iType)
549       nbTypesCopy[iType] = 0;
550     nbTypesCopy[aShapeCopy.ShapeType()]++;
551
552     TopTools_MapOfShape aMapOfShape;
553     aMapOfShape.Add(aShapeCopy);
554     TopTools_ListOfShape aListOfShape;
555     aListOfShape.Append(aShapeCopy);
556
557     TopTools_ListIteratorOfListOfShape itL (aListOfShape);
558     for (; itL.More(); itL.Next()) {
559       TopoDS_Iterator it (itL.Value());
560       for (; it.More(); it.Next()) {
561         TopoDS_Shape s = it.Value();
562         if (aMapOfShape.Add(s)) {
563           aListOfShape.Append(s);
564           nbTypesCopy[s.ShapeType()]++;
565         }
566       }
567     }
568
569     bool isEqual = true;
570     for (iType = 0; iType < TopAbs_SHAPE && isEqual; ++iType) {
571       if (nbTypes[iType] != nbTypesCopy[iType])
572         isEqual = false;
573     }
574     if (isEqual)
575       aShape = aShapeCopy;
576   }
577   // END: Mantis issue 0021060
578
579   return aShape;
580 }
581
582 //================================================================================
583 /*!
584  * \brief Returns a name of creation operation and names and values of creation parameters
585  */
586 //================================================================================
587
588 bool GEOMImpl_BooleanDriver::
589 GetCreationInformation(std::string&             theOperationName,
590                        std::vector<GEOM_Param>& theParams)
591 {
592   if (Label().IsNull()) return 0;
593   Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
594
595   GEOMImpl_IBoolean aCI (function);
596   Standard_Integer aType = function->GetType();
597
598   switch ( aType ) {
599   case BOOLEAN_COMMON:
600     theOperationName = "COMMON";
601     AddParam( theParams, "Object 1", aCI.GetShape1() );
602     AddParam( theParams, "Object 2", aCI.GetShape2() );
603     break;
604   case BOOLEAN_CUT:
605     theOperationName = "CUT";
606     AddParam( theParams, "Main Object", aCI.GetShape1() );
607     AddParam( theParams, "Tool Object", aCI.GetShape2() );
608     break;
609   case BOOLEAN_FUSE:
610     theOperationName = "FUSE";
611     AddParam( theParams, "Object 1", aCI.GetShape1() );
612     AddParam( theParams, "Object 2", aCI.GetShape2() );
613     break;
614   case BOOLEAN_SECTION:
615     theOperationName = "SECTION";
616     AddParam( theParams, "Object 1", aCI.GetShape1() );
617     AddParam( theParams, "Object 2", aCI.GetShape2() );
618     break;
619   case BOOLEAN_COMMON_LIST:
620     theOperationName = "COMMON";
621     AddParam( theParams, "Selected objects", aCI.GetShapes() );
622     break;
623   case BOOLEAN_FUSE_LIST:
624     theOperationName = "FUSE";
625     AddParam( theParams, "Selected objects", aCI.GetShapes() );
626     break;
627   case BOOLEAN_CUT_LIST:
628     theOperationName = "CUT";
629     AddParam( theParams, "Main Object", aCI.GetShape1() );
630     AddParam( theParams, "Tool Objects", aCI.GetShapes() );
631     break;
632   default:
633     return false;
634   }
635
636   return true;
637 }
638
639 IMPLEMENT_STANDARD_HANDLE (GEOMImpl_BooleanDriver,GEOM_BaseDriver);
640
641 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_BooleanDriver,GEOM_BaseDriver);