Salome HOME
Update copyright: 2016
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBooleanOperations.cxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 <Standard_Stream.hxx>
24
25 #include <GEOMImpl_IBooleanOperations.hxx>
26
27 #include <GEOM_Function.hxx>
28 #include <GEOM_PythonDump.hxx>
29
30 #include <GEOMImpl_Types.hxx>
31
32 #include <GEOMImpl_BooleanDriver.hxx>
33 #include <GEOMImpl_IBoolean.hxx>
34
35 #include <GEOMImpl_PartitionDriver.hxx>
36 #include <GEOMImpl_IPartition.hxx>
37
38 #include <Basics_OCCTVersion.hxx>
39
40 #include <TDF_Tool.hxx>
41
42 #include "utilities.h"
43
44 #include <Standard_Failure.hxx>
45 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
46
47 //=============================================================================
48 /*!
49  *   constructor:
50  */
51 //=============================================================================
52 GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations (GEOM_Engine* theEngine, int theDocID)
53 : GEOM_IOperations(theEngine, theDocID)
54 {
55   MESSAGE("GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations");
56 }
57
58 //=============================================================================
59 /*!
60  *  destructor
61  */
62 //=============================================================================
63 GEOMImpl_IBooleanOperations::~GEOMImpl_IBooleanOperations()
64 {
65   MESSAGE("GEOMImpl_IBooleanOperations::~GEOMImpl_IBooleanOperations");
66 }
67
68
69 //=============================================================================
70 /*!
71  *  MakeBoolean
72  */
73 //=============================================================================
74 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
75                                   (Handle(GEOM_Object)    theShape1,
76                                    Handle(GEOM_Object)    theShape2,
77                                    const Standard_Integer theOp,
78                                    const Standard_Boolean IsCheckSelfInte)
79 {
80   SetErrorCode(KO);
81
82   if (theShape1.IsNull() || theShape2.IsNull()) return NULL;
83
84   //Add a new Boolean object
85   Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
86
87   //Add a new Boolean function
88   Handle(GEOM_Function) aFunction;
89   if (theOp == 1) {
90     aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_COMMON);
91   } else if (theOp == 2) {
92     aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_CUT);
93   } else if (theOp == 3) {
94     aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE);
95   } else if (theOp == 4) {
96     aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_SECTION);
97   } else {
98   }
99   if (aFunction.IsNull()) return NULL;
100
101   //Check if the function is set correctly
102   if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
103
104   GEOMImpl_IBoolean aCI (aFunction);
105
106   Handle(GEOM_Function) aRef1 = theShape1->GetLastFunction();
107   Handle(GEOM_Function) aRef2 = theShape2->GetLastFunction();
108
109   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
110
111   aCI.SetShape1(aRef1);
112   aCI.SetShape2(aRef2);
113   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
114
115   //Compute the Boolean value
116   try {
117     OCC_CATCH_SIGNALS;
118     if (!GetSolver()->ComputeFunction(aFunction)) {
119       SetErrorCode("Boolean driver failed");
120       return NULL;
121     }
122   }
123   catch (Standard_Failure) {
124     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
125     SetErrorCode(aFail->GetMessageString());
126     return NULL;
127   }
128
129   //Make a Python command
130   GEOM::TPythonDump pd (aFunction);
131   pd << aBool;
132   if      (theOp == 1) pd << " = geompy.MakeCommon(";
133   else if (theOp == 2) pd << " = geompy.MakeCut(";
134   else if (theOp == 3) pd << " = geompy.MakeFuse(";
135   else if (theOp == 4) pd << " = geompy.MakeSection(";
136   else {}
137   pd << theShape1 << ", " << theShape2;
138
139   if (IsCheckSelfInte) {
140     pd << ", True";
141   }
142
143   pd << ")";
144
145   SetErrorCode(OK);
146   return aBool;
147 }
148
149 //=============================================================================
150 /*!
151  *  MakeFuse
152  */
153 //=============================================================================
154 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
155                                   (Handle(GEOM_Object)    theShape1,
156                                    Handle(GEOM_Object)    theShape2,
157                                    const bool             IsCheckSelfInte,
158                                    const bool             IsRmExtraEdges)
159 {
160   SetErrorCode(KO);
161
162   if (theShape1.IsNull() || theShape2.IsNull()) return NULL;
163
164   //Add a new Boolean object
165   Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
166
167   //Add a new Boolean function
168   Handle(GEOM_Function) aFunction =
169     aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE);
170
171   if (aFunction.IsNull()) return NULL;
172
173   //Check if the function is set correctly
174   if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
175
176   GEOMImpl_IBoolean aCI (aFunction);
177
178   Handle(GEOM_Function) aRef1 = theShape1->GetLastFunction();
179   Handle(GEOM_Function) aRef2 = theShape2->GetLastFunction();
180
181   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
182
183   aCI.SetShape1(aRef1);
184   aCI.SetShape2(aRef2);
185   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
186   aCI.SetRmExtraEdges(IsRmExtraEdges);
187
188   //Compute the Boolean value
189   try {
190     OCC_CATCH_SIGNALS;
191     if (!GetSolver()->ComputeFunction(aFunction)) {
192       SetErrorCode("Boolean driver failed");
193       return NULL;
194     }
195   }
196   catch (Standard_Failure) {
197     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
198     SetErrorCode(aFail->GetMessageString());
199     return NULL;
200   }
201
202   //Make a Python command
203   GEOM::TPythonDump pd (aFunction);
204
205   pd << aBool << " = geompy.MakeFuse(";
206   pd << theShape1 << ", " << theShape2 << ", "
207      << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
208
209   SetErrorCode(OK);
210   return aBool;
211 }
212
213 //=============================================================================
214 /*!
215  *  MakeFuseList
216  */
217 //=============================================================================
218 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
219                   (const Handle(TColStd_HSequenceOfTransient)& theShapes,
220                    const bool                                  IsCheckSelfInte,
221                    const bool                                  IsRmExtraEdges)
222 {
223   SetErrorCode(KO);
224
225   if (theShapes.IsNull()) return NULL;
226
227   //Add a new Boolean object
228   Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
229
230   //Add a new Boolean function
231   Handle(GEOM_Function) aFunction =
232     aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE_LIST);
233
234   if (aFunction.IsNull()) return NULL;
235
236   //Check if the function is set correctly
237   if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
238
239   GEOMImpl_IBoolean aCI (aFunction);
240
241   TCollection_AsciiString aDescription;
242   Handle(TColStd_HSequenceOfTransient) aShapesSeq =
243     getShapeFunctions(theShapes, aDescription);
244
245   if (aShapesSeq.IsNull()) return NULL;
246
247   aCI.SetShapes(aShapesSeq);
248   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
249   aCI.SetRmExtraEdges(IsRmExtraEdges);
250
251   //Compute the Boolean value
252   try {
253     OCC_CATCH_SIGNALS;
254     if (!GetSolver()->ComputeFunction(aFunction)) {
255       SetErrorCode("Boolean driver failed");
256       return NULL;
257     }
258   }
259   catch (Standard_Failure) {
260     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
261     SetErrorCode(aFail->GetMessageString());
262     return NULL;
263   }
264
265   //Make a Python command
266   GEOM::TPythonDump pd (aFunction);
267
268   pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], "
269      << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
270
271   SetErrorCode(OK);
272   return aBool;
273 }
274
275 //=============================================================================
276 /*!
277  *  MakeCommonList
278  */
279 //=============================================================================
280 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
281                   (const Handle(TColStd_HSequenceOfTransient)& theShapes,
282                    const Standard_Boolean IsCheckSelfInte)
283 {
284   SetErrorCode(KO);
285
286   if (theShapes.IsNull()) return NULL;
287
288   //Add a new Boolean object
289   Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
290
291   //Add a new Boolean function
292   Handle(GEOM_Function) aFunction =
293     aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_COMMON_LIST);
294
295   if (aFunction.IsNull()) return NULL;
296
297   //Check if the function is set correctly
298   if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
299
300   GEOMImpl_IBoolean aCI (aFunction);
301
302   TCollection_AsciiString aDescription;
303   Handle(TColStd_HSequenceOfTransient) aShapesSeq =
304     getShapeFunctions(theShapes, aDescription);
305
306   if (aShapesSeq.IsNull()) return NULL;
307
308   aCI.SetShapes(aShapesSeq);
309   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
310
311   //Compute the Boolean value
312   try {
313     OCC_CATCH_SIGNALS;
314     if (!GetSolver()->ComputeFunction(aFunction)) {
315       SetErrorCode("Boolean driver failed");
316       return NULL;
317     }
318   }
319   catch (Standard_Failure) {
320     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
321     SetErrorCode(aFail->GetMessageString());
322     return NULL;
323   }
324
325   //Make a Python command
326   GEOM::TPythonDump pd (aFunction);
327
328   pd << aBool <<
329     " = geompy.MakeCommonList([" << aDescription.ToCString() << "]";
330
331   if (IsCheckSelfInte) {
332     pd << ", True";
333   }
334
335   pd << ")";
336
337   SetErrorCode(OK);
338   return aBool;
339 }
340
341 //=============================================================================
342 /*!
343  *  MakeCutList
344  */
345 //=============================================================================
346 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
347                   (Handle(GEOM_Object) theMainShape,
348                    const Handle(TColStd_HSequenceOfTransient)& theShapes,
349                    const Standard_Boolean IsCheckSelfInte)
350 {
351   SetErrorCode(KO);
352
353   if (theShapes.IsNull()) return NULL;
354
355   //Add a new Boolean object
356   Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN);
357
358   //Add a new Boolean function
359   Handle(GEOM_Function) aFunction =
360     aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_CUT_LIST);
361
362   if (aFunction.IsNull()) return NULL;
363
364   //Check if the function is set correctly
365   if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
366
367   GEOMImpl_IBoolean aCI (aFunction);
368   Handle(GEOM_Function) aMainRef = theMainShape->GetLastFunction();
369
370   if (aMainRef.IsNull()) return NULL;
371
372   TCollection_AsciiString aDescription;
373   Handle(TColStd_HSequenceOfTransient) aShapesSeq =
374     getShapeFunctions(theShapes, aDescription);
375
376   if (aShapesSeq.IsNull()) return NULL;
377
378   aCI.SetShape1(aMainRef);
379   aCI.SetShapes(aShapesSeq);
380   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
381
382   //Compute the Boolean value
383   try {
384     OCC_CATCH_SIGNALS;
385     if (!GetSolver()->ComputeFunction(aFunction)) {
386       SetErrorCode("Boolean driver failed");
387       return NULL;
388     }
389   }
390   catch (Standard_Failure) {
391     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
392     SetErrorCode(aFail->GetMessageString());
393     return NULL;
394   }
395
396   //Make a Python command
397   GEOM::TPythonDump pd (aFunction);
398
399   pd << aBool << " = geompy.MakeCutList("
400     << theMainShape << ", [" << aDescription.ToCString() << "]";
401
402   if (IsCheckSelfInte) {
403     pd << ", True";
404   }
405
406   pd << ")";
407
408   SetErrorCode(OK);
409   return aBool;
410 }
411
412 //=============================================================================
413 /*!
414  *  MakePartition
415  */
416 //=============================================================================
417 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
418                              (const Handle(TColStd_HSequenceOfTransient)& theShapes,
419                               const Handle(TColStd_HSequenceOfTransient)& theTools,
420                               const Handle(TColStd_HSequenceOfTransient)& theKeepIns,
421                               const Handle(TColStd_HSequenceOfTransient)& theRemoveIns,
422                               const Standard_Integer                      theLimit,
423                               const Standard_Boolean                      theRemoveWebs,
424                               const Handle(TColStd_HArray1OfInteger)&     theMaterials,
425                               const Standard_Integer theKeepNonlimitShapes,
426                               const Standard_Boolean thePerformSelfIntersections,
427                               const Standard_Boolean IsCheckSelfInte)
428 {
429   SetErrorCode(KO);
430
431   //Add a new Partition object
432   Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
433
434   //Add a new Partition function
435   Handle(GEOM_Function) aFunction;
436   if (thePerformSelfIntersections)
437     aFunction = aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_PARTITION);
438   else
439     aFunction = aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_NO_SELF_INTERSECTIONS);
440   if (aFunction.IsNull()) return NULL;
441
442   //Check if the function is set correctly
443   if (aFunction->GetDriverGUID() != GEOMImpl_PartitionDriver::GetID()) return NULL;
444
445   GEOMImpl_IPartition aCI (aFunction);
446
447   Handle(TColStd_HSequenceOfTransient) aShapesSeq;
448   Handle(TColStd_HSequenceOfTransient) aToolsSeq;
449   Handle(TColStd_HSequenceOfTransient) aKeepInsSeq;
450   Handle(TColStd_HSequenceOfTransient) aRemInsSeq;
451   TCollection_AsciiString aShapesDescr, aToolsDescr, aKeepInsDescr, aRemoveInsDescr;
452
453   // Shapes
454   aShapesSeq = getShapeFunctions(theShapes, aShapesDescr);
455
456   if (aShapesSeq.IsNull()) {
457     SetErrorCode("NULL shape for Partition");
458     return NULL;
459   }
460
461   // Tools
462   aToolsSeq = getShapeFunctions(theTools, aToolsDescr);
463
464   if (aToolsSeq.IsNull()) {
465     SetErrorCode("NULL tool shape for Partition");
466     return NULL;
467   }
468
469   // Keep Inside
470   aKeepInsSeq = getShapeFunctions(theKeepIns, aKeepInsDescr);
471
472   if (aKeepInsSeq.IsNull()) {
473     SetErrorCode("NULL <keep inside> shape for Partition");
474     return NULL;
475   }
476
477   // Remove Inside
478   aRemInsSeq  = getShapeFunctions(theRemoveIns, aRemoveInsDescr);
479
480   if (aRemInsSeq.IsNull()) {
481     SetErrorCode("NULL <remove inside> shape for Partition");
482     return NULL;
483   }
484
485   aCI.SetShapes(aShapesSeq);
486   aCI.SetTools(aToolsSeq);
487   aCI.SetKeepIns(aKeepInsSeq);
488   aCI.SetRemoveIns(aRemInsSeq);
489
490   // Limit
491   aCI.SetLimit(theLimit);
492   aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes);
493   aCI.SetCheckSelfIntersection(IsCheckSelfInte);
494
495   // Materials
496   if (theRemoveWebs) {
497     if (theMaterials.IsNull()) {
498       Handle(TColStd_HArray1OfInteger) aMaterials =
499         new TColStd_HArray1OfInteger (1, aShapesSeq->Length());
500       aMaterials->Init(0);
501       aCI.SetMaterials(aMaterials);
502     } else {
503       aCI.SetMaterials(theMaterials);
504     }
505   }
506
507   //Compute the Partition
508   try {
509     OCC_CATCH_SIGNALS;
510     if (!GetSolver()->ComputeFunction(aFunction)) {
511       SetErrorCode("Partition driver failed");
512       return NULL;
513     }
514   }
515   catch (Standard_Failure) {
516     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
517     SetErrorCode(aFail->GetMessageString());
518     return NULL;
519   }
520
521   //Make a Python command
522   GEOM::TPythonDump pd (aFunction);
523   if (thePerformSelfIntersections)
524     pd << aPartition << " = geompy.MakePartition([";
525   else
526     pd << aPartition << " = geompy.MakePartitionNonSelfIntersectedShape([";
527
528   // Shapes, Tools
529   pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], [";
530   // Keep Ins, Remove Ins
531   pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], ";
532   // Limit, Remove Webs
533   pd << TopAbs_ShapeEnum(theLimit) << ", " << (int)theRemoveWebs << ", [";
534   // Materials
535   if (!theMaterials.IsNull() && theMaterials->Length() > 0) {
536     int i = theMaterials->Lower();
537     pd << theMaterials->Value(i);
538     i++;
539     for (; i <= theMaterials->Upper(); i++) {
540       pd << ", " << theMaterials->Value(i);
541     }
542   }
543   pd << "], " << theKeepNonlimitShapes;
544
545   if (IsCheckSelfInte && !thePerformSelfIntersections) {
546     pd << ", True";
547   }
548
549   pd << ")";
550
551   SetErrorCode(OK);
552   return aPartition;
553 }
554
555 //=============================================================================
556 /*!
557  *  MakeHalfPartition
558  */
559 //=============================================================================
560 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
561        (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane)
562 {
563   SetErrorCode(KO);
564
565   if (theShape.IsNull() || thePlane.IsNull()) return NULL;
566
567   //Add a new Boolean object
568   Handle(GEOM_Object) aPart = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
569
570   //Add a new Partition function
571   Handle(GEOM_Function) aFunction =
572     aPart->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_HALF);
573   if (aFunction.IsNull()) return NULL;
574
575   //Check if the function is set correctly
576   if (aFunction->GetDriverGUID() != GEOMImpl_PartitionDriver::GetID()) return NULL;
577
578   GEOMImpl_IPartition aCI (aFunction);
579
580   Handle(GEOM_Function) aRef1 = theShape->GetLastFunction();
581   Handle(GEOM_Function) aRef2 = thePlane->GetLastFunction();
582
583   if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
584
585   aCI.SetShape(aRef1);
586   aCI.SetPlane(aRef2);
587
588   //Compute the Partition value
589   try {
590     OCC_CATCH_SIGNALS;
591     if (!GetSolver()->ComputeFunction(aFunction)) {
592       SetErrorCode("Partition driver failed");
593       return NULL;
594     }
595   }
596   catch (Standard_Failure) {
597     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
598     SetErrorCode(aFail->GetMessageString());
599     return NULL;
600   }
601
602   //Make a Python command
603   GEOM::TPythonDump pd (aFunction);
604   pd << aPart << " = geompy.MakeHalfPartition("
605      << theShape << ", " << thePlane << ")";
606
607   SetErrorCode(OK);
608   return aPart;
609 }
610
611 //=============================================================================
612 /*!
613  *  getShapeFunctions
614  */
615 //=============================================================================
616 Handle(TColStd_HSequenceOfTransient)
617   GEOMImpl_IBooleanOperations::getShapeFunctions
618                   (const Handle(TColStd_HSequenceOfTransient)& theObjects,
619                          TCollection_AsciiString &theDescription)
620 {
621   Handle(TColStd_HSequenceOfTransient) aResult =
622     new TColStd_HSequenceOfTransient;
623   Standard_Integer aNbObjects = theObjects->Length();
624   Standard_Integer i;
625   TCollection_AsciiString anEntry;
626   Handle(GEOM_Object) anObj;
627   Handle(GEOM_Function) aRefObj;
628
629   // Shapes
630   for (i = 1; i <= aNbObjects; i++) {
631     anObj = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
632     aRefObj = anObj->GetLastFunction();
633
634     if (aRefObj.IsNull()) {
635       aResult.Nullify();
636       break;
637     }
638
639     aResult->Append(aRefObj);
640
641     // For Python command
642     TDF_Tool::Entry(anObj->GetEntry(), anEntry);
643
644     if (i > 1) {
645       theDescription += ", ";
646     }
647
648     theDescription += anEntry;
649   }
650
651   return aResult;
652 }