Salome HOME
9b17629dbd50b7abd8085f3800cccc7aee602b27
[modules/geom.git] / src / MeasureGUI / MeasureGUI_CheckShapeDlg.cxx
1 // Copyright (C) 2007-2023  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 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : MeasureGUI_CheckShapeDlg.cxx
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
26 //
27 #include "MeasureGUI.h"
28 #include "MeasureGUI_CheckShapeDlg.h"
29 #include "MeasureGUI_Widgets.h"
30 #include <DlgRef.h>
31 #include <GeometryGUI.h>
32 #include <GEOMBase.h>
33 #include <GEOMImpl_Types.hxx>
34
35 #include <SUIT_Session.h>
36 #include <SUIT_ResourceMgr.h>
37 #include <SalomeApp_Tools.h>
38 #include <SalomeApp_Application.h>
39 #include <LightApp_SelectionMgr.h>
40
41 #include <TColStd_IndexedMapOfInteger.hxx>
42 #include <TColStd_MapOfInteger.hxx>
43 #include <TopTools_IndexedMapOfShape.hxx>
44 #include <TopExp.hxx>
45
46 #define TEXTEDIT_FONT_FAMILY "Courier"
47 #define TEXTEDIT_FONT_SIZE 11
48
49 //=================================================================================
50 // class    : MeasureGUI_CheckShapeDlg()
51 // purpose  : Constructs a MeasureGUI_CheckShapeDlg which is a child of 'parent', with the
52 //            name 'name' and widget flags set to 'f'.
53 //            The dialog will by default be modeless, unless you set 'modal' to
54 //            true to construct a modal dialog.
55 //=================================================================================
56 MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( GeometryGUI* GUI, QWidget* parent )
57   : GEOMBase_Skeleton( GUI, parent, false )
58 {
59   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
60     "GEOM", tr( "ICON_DLG_CHECKSHAPE" ) ) );
61   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
62     "GEOM", tr( "ICON_SELECT" ) ) );
63
64   setWindowTitle( tr( "GEOM_CHECK_TITLE" ) );
65
66   /***************************************************************/
67
68   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHECK_SHAPE" ) );
69   mainFrame()->RadioButton1->setIcon( image0 );
70   mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
71   mainFrame()->RadioButton2->close();
72   mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
73   mainFrame()->RadioButton3->close();
74
75   myGrp = new MeasureGUI_1Sel1Check1TextView2ListBox( centralWidget() );
76   myGrp->GroupBox1->setTitle( tr( "GEOM_CHECK_INFOS" ) );
77   myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
78   myGrp->TextView1->setReadOnly( true );
79
80   QFont aFont( TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE );
81   aFont.setStyleHint( QFont::TypeWriter, QFont::PreferAntialias );
82   myGrp->TextView1->setFont( aFont );
83   myGrp->PushButton1->setIcon( image1 );
84   myGrp->LineEdit1->setReadOnly( true );
85
86   myGrp->TextLabel2->setText( tr( "GEOM_CHECK_BLOCKS_COMPOUND_ERRORS" ) );
87   myGrp->TextLabel3->setText( tr( "GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES" ) );
88
89   myGrp->ListBox2->setSelectionMode( QAbstractItemView::ExtendedSelection );
90
91   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
92   layout->setMargin( 0 ); layout->setSpacing( 6 );
93   layout->addWidget( myGrp );
94
95   connect( myGrp->ListBox1, SIGNAL( itemSelectionChanged() ), SLOT( onErrorsListSelectionChanged() ) );
96   connect( myGrp->ListBox2, SIGNAL( itemSelectionChanged() ), SLOT( onSubShapesListSelectionChanged() ) );
97
98   /***************************************************************/
99
100   myHelpFileName = "check_shape_page.html";
101
102   /* Initialisation */
103   Init();
104 }
105
106 //=================================================================================
107 // function : ~MeasureGUI_CheckShapeDlg()
108 // purpose  : Destroys the object and frees any allocated resources
109 //=================================================================================
110 MeasureGUI_CheckShapeDlg::~MeasureGUI_CheckShapeDlg()
111 {
112 }
113
114
115 //=================================================================================
116 // function : Init()
117 // purpose  :
118 //=================================================================================
119 void MeasureGUI_CheckShapeDlg::Init()
120 {
121   // signals and slots connections
122   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
123   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
124
125   connect( myGrp->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
126
127   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
128            this, SLOT( SelectionIntoArgument() ) );
129
130   connect( myGrp->CheckBox1, SIGNAL( toggled( bool) ), 
131            this, SLOT( SelectionIntoArgument() ) );
132
133   initName( tr( "GEOM_CHECK_SHAPE_NAME") );
134   buttonOk()->setEnabled( false );
135   buttonApply()->setEnabled( false );
136   activateSelection();
137   SelectionIntoArgument();
138 }
139
140 //=================================================================================
141 // function : ClickOnOk()
142 // purpose  :
143 //=================================================================================
144 void MeasureGUI_CheckShapeDlg::ClickOnOk()
145 {
146   if ( ClickOnApply() )
147     ClickOnCancel();
148 }
149
150 //=================================================================================
151 // function : ClickOnApply()
152 // purpose  :
153 //=================================================================================
154 bool MeasureGUI_CheckShapeDlg::ClickOnApply()
155 {
156   if ( !onAccept() )
157     return false;
158
159   initName();
160   return true;
161 }
162
163 //=================================================================================
164 // function : SelectionIntoArgument
165 // purpose  :
166 //=================================================================================
167 bool MeasureGUI_CheckShapeDlg::extractPrefix() const
168 {
169   return true;
170 }
171
172 //=================================================================================
173 // function : SelectionIntoArgument
174 // purpose  :
175 //=================================================================================
176 void MeasureGUI_CheckShapeDlg::SelectionIntoArgument()
177 {
178   erasePreview();
179   myObj = GEOM::GEOM_Object::_nil();
180
181   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
182   SALOME_ListIO aSelList;
183   aSelMgr->selectedObjects(aSelList);
184
185   if (aSelList.Extent() != 1) {
186     myGrp->LineEdit1->setText( "" );
187     processObject();
188     return;
189   }
190
191   GEOM::GEOM_Object_var aSelectedObject =
192     GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
193
194   if ( aSelectedObject->_is_nil() ) {
195     myGrp->LineEdit1->setText( "" );
196     processObject();
197     return;
198   }
199
200   myObj = aSelectedObject;
201   myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
202   processObject();
203   DISPLAY_PREVIEW_MACRO;
204 }
205
206 //=================================================================================
207 // function : SetEditCurrentArgument
208 // purpose  :
209 //=================================================================================
210 void MeasureGUI_CheckShapeDlg::SetEditCurrentArgument()
211 {
212   myGrp->LineEdit1->setFocus();
213   SelectionIntoArgument();
214 }
215
216 //=================================================================================
217 // function : ActivateThisDialog()
218 // purpose  :
219 //=================================================================================
220 void MeasureGUI_CheckShapeDlg::ActivateThisDialog()
221 {
222   GEOMBase_Skeleton::ActivateThisDialog();
223
224   LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
225   if ( aSel )
226     connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
227
228   activateSelection();
229   DISPLAY_PREVIEW_MACRO
230 }
231
232 //=================================================================================
233 // function : activateSelection
234 // purpose  : activate selection of faces, shells, and solids
235 //=================================================================================
236 void MeasureGUI_CheckShapeDlg::activateSelection()
237 {
238   globalSelection( GEOM_ALLSHAPES );
239 }
240
241 //=================================================================================
242 // function : enterEvent()
243 // purpose  :
244 //=================================================================================
245 void MeasureGUI_CheckShapeDlg::enterEvent( QEvent* )
246 {
247   if ( !mainFrame()->GroupConstructors->isEnabled() )
248     ActivateThisDialog();
249 }
250
251 //=================================================================================
252 // function : isValid
253 // purpose  :
254 //=================================================================================
255 bool MeasureGUI_CheckShapeDlg::isValid( QString& )
256 {
257   return !myObj->_is_nil();
258 }
259
260 //=================================================================================
261 // function : getErrors
262 // purpose  :
263 //=================================================================================
264 bool MeasureGUI_CheckShapeDlg::getErrors
265                     ( bool& theIsValid,
266                       GEOM::GEOM_IMeasureOperations::ShapeErrors& theErrors )
267 {
268   if ( myObj->_is_nil() ) {
269     return false;
270   } else {
271     GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
272     try {
273       GEOM::GEOM_IMeasureOperations::ShapeErrors_var aErrs;
274       bool isCheckGeometry = myGrp->CheckBox1->isChecked();
275       if ( isCheckGeometry )
276         theIsValid = anOper->CheckShapeWithGeometry( myObj, aErrs );
277       else
278         theIsValid = anOper->CheckShape( myObj, aErrs );
279
280       if (anOper->IsDone() && aErrs->length() > 0)
281         theErrors = aErrs;
282     }
283     catch( const SALOME::SALOME_Exception& e ) {
284       SalomeApp_Tools::QtCatchCorbaException( e );
285       return false;
286     }
287
288     return anOper->IsDone();
289   }
290 }
291
292
293 //=================================================================================
294 // function : processObject
295 // purpose  :
296 //=================================================================================
297 void MeasureGUI_CheckShapeDlg::processObject()
298 {
299   bool isShapeValid;
300   GEOM::GEOM_IMeasureOperations::ShapeErrors aErrs;
301
302   if ( !getErrors( isShapeValid, aErrs ) ) {
303     myGrp->TextView1->setText( "" );
304     myGrp->ListBox1->clear();
305     myGrp->ListBox2->clear();
306     erasePreview();
307
308     return;
309   }
310
311   if ( isShapeValid ) {
312     myGrp->TextView1->setText(tr("GEOM_CHECK_SHAPE_VALID"));
313     buttonOk()->setEnabled( false );
314     buttonApply()->setEnabled( false );
315   } else {
316     myGrp->TextView1->setText(tr("GEOM_CHECK_SHAPE_NOT_VALID"));
317     buttonOk()->setEnabled( true );
318     buttonApply()->setEnabled( true );
319   }
320
321   // Add Error groups
322   QStringList aErrList;
323
324   for ( int i = 0, n = aErrs.length(); i < n; i++ ) {
325     QString aErrStr("CHECK_ERROR_");
326
327     switch ( aErrs[i].error ) {
328       case GEOM::GEOM_IMeasureOperations::InvalidPointOnCurve:
329         aErrStr += "INVALID_POINT_ON_CURVE";
330         break;
331       case GEOM::GEOM_IMeasureOperations::InvalidPointOnCurveOnSurface:
332         aErrStr += "INVALID_POINT_ON_CURVE_ON_SURFACE";
333         break;
334       case GEOM::GEOM_IMeasureOperations::InvalidPointOnSurface:
335         aErrStr += "INVALID_POINT_ON_SURFACE";
336         break;
337       case GEOM::GEOM_IMeasureOperations::No3DCurve:
338         aErrStr += "NO_3D_CURVE";
339         break;
340       case GEOM::GEOM_IMeasureOperations::Multiple3DCurve:
341         aErrStr += "MULTIPLE_3D_CURVE";
342         break;
343       case GEOM::GEOM_IMeasureOperations::Invalid3DCurve:
344         aErrStr += "INVALID_3D_CURVE";
345         break;
346       case GEOM::GEOM_IMeasureOperations::NoCurveOnSurface:
347         aErrStr += "NO_CURVE_ON_SURFACE";
348         break;
349       case GEOM::GEOM_IMeasureOperations::InvalidCurveOnSurface:
350         aErrStr += "INVALID_CURVE_ON_SURFACE";
351         break;
352       case GEOM::GEOM_IMeasureOperations::InvalidCurveOnClosedSurface:
353         aErrStr += "INVALID_CURVE_ON_CLOSED_SURFACE";
354         break;
355       case GEOM::GEOM_IMeasureOperations::InvalidSameRangeFlag:
356         aErrStr += "INVALID_SAME_RANGE_FLAG";
357         break;
358       case GEOM::GEOM_IMeasureOperations::InvalidSameParameterFlag:
359         aErrStr += "INVALID_SAME_PARAMETER_FLAG";
360         break;
361       case GEOM::GEOM_IMeasureOperations::InvalidDegeneratedFlag:
362         aErrStr += "INVALID_DEGENERATED_FLAG";
363         break;
364       case GEOM::GEOM_IMeasureOperations::FreeEdge:
365         aErrStr += "FREE_EDGE";
366         break;
367       case GEOM::GEOM_IMeasureOperations::InvalidMultiConnexity:
368         aErrStr += "INVALID_MULTI_CONNEXITY";
369         break;
370       case GEOM::GEOM_IMeasureOperations::InvalidRange:
371         aErrStr += "INVALID_RANGE";
372         break;
373       case GEOM::GEOM_IMeasureOperations::EmptyWire:
374         aErrStr += "EMPTY_WIRE";
375         break;
376       case GEOM::GEOM_IMeasureOperations::RedundantEdge:
377         aErrStr += "REDUNDANT_EDGE";
378         break;
379       case GEOM::GEOM_IMeasureOperations::SelfIntersectingWire:
380         aErrStr += "SELF_INTERSECTING_WIRE";
381         break;
382       case GEOM::GEOM_IMeasureOperations::NoSurface:
383         aErrStr += "NO_SURFACE";
384         break;
385       case GEOM::GEOM_IMeasureOperations::InvalidWire:
386         aErrStr += "INVALID_WIRE";
387         break;
388       case GEOM::GEOM_IMeasureOperations::RedundantWire:
389         aErrStr += "REDUNDANT_WIRE";
390         break;
391       case GEOM::GEOM_IMeasureOperations::IntersectingWires:
392         aErrStr += "INTERSECTING_WIRES";
393         break;
394       case GEOM::GEOM_IMeasureOperations::InvalidImbricationOfWires:
395         aErrStr += "INVALID_IMBRICATION_OF_WIRES";
396         break;
397       case GEOM::GEOM_IMeasureOperations::EmptyShell:
398         aErrStr += "EMPTY_SHELL";
399         break;
400       case GEOM::GEOM_IMeasureOperations::RedundantFace:
401         aErrStr += "REDUNDANT_FACE";
402         break;
403       case GEOM::GEOM_IMeasureOperations::UnorientableShape:
404         aErrStr += "UNORIENTABLE_SHAPE";
405         break;
406       case GEOM::GEOM_IMeasureOperations::NotClosed:
407         aErrStr += "NOT_CLOSED";
408         break;
409       case GEOM::GEOM_IMeasureOperations::NotConnected:
410         aErrStr += "NOT_CONNECTED";
411         break;
412       case GEOM::GEOM_IMeasureOperations::SubshapeNotInShape:
413         aErrStr += "SUBSHAPE_NOT_IN_SHAPE";
414         break;
415       case GEOM::GEOM_IMeasureOperations::BadOrientation:
416         aErrStr += "BAD_ORIENTATION";
417         break;
418       case GEOM::GEOM_IMeasureOperations::BadOrientationOfSubshape:
419         aErrStr += "BAD_ORIENTATION_OF_SUBSHAPE";
420         break;
421       case GEOM::GEOM_IMeasureOperations::InvalidToleranceValue:
422         aErrStr += "INVALID_TOLERANCE_VALUE";
423         break;
424       case GEOM::GEOM_IMeasureOperations::CheckFail:
425         aErrStr += "CHECK_FAIL";
426         break;
427       default:
428         aErrStr.clear();
429         break;
430     }
431
432     if (!aErrStr.isEmpty()) {
433       aErrList.append(tr(aErrStr.toLatin1().constData()));
434     }
435   }
436
437   myGrp->ListBox1->clear();
438   myGrp->ListBox2->clear();
439   myGrp->ListBox1->addItems( aErrList );
440 }
441
442 //=================================================================================
443 // function : createOperation
444 // purpose  :
445 //=================================================================================
446 GEOM::GEOM_IOperations_ptr MeasureGUI_CheckShapeDlg::createOperation()
447 {
448   return getGeomEngine()->GetIMeasureOperations();
449 }
450
451 //=================================================================================
452 // function : onErrorsListSelectionChanged
453 // purpose  :
454 //=================================================================================
455 void MeasureGUI_CheckShapeDlg::onErrorsListSelectionChanged()
456 {
457   erasePreview();
458
459   int aCurItem = myGrp->ListBox1->currentRow();
460
461   if ( aCurItem < 0 ) {
462     return;
463   }
464
465   bool isShapeValid;
466   GEOM::GEOM_IMeasureOperations::ShapeErrors aErrs;
467
468   if ( !getErrors( isShapeValid, aErrs ) ) {
469     myGrp->TextView1->setText( "" );
470     myGrp->ListBox1->clear();
471     myGrp->ListBox2->clear();
472
473     return;
474   }
475
476   myGrp->ListBox2->clear();
477
478   if (aCurItem < (int)aErrs.length()) {
479     GEOM::GEOM_IMeasureOperations::ShapeError aErr = aErrs[aCurItem];
480     GEOM::ListOfLong aObjLst = aErr.incriminated;
481     QStringList aSubShapeList;
482     TopoDS_Shape aSelShape;
483
484     if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
485       TopTools_IndexedMapOfShape anIndices;
486
487       TopExp::MapShapes( aSelShape, anIndices );
488
489       for ( int i = 0, n = aObjLst.length(); i < n; i++ ) {
490         TopoDS_Shape aSubShape = anIndices.FindKey( aObjLst[i] );
491         QString aType = GEOMBase::GetShapeTypeString( aSubShape );
492
493         if ( !aType.isEmpty() ) {
494           aSubShapeList.append( QString( "%1_%2" ).arg( aType ).arg( aObjLst[i] ) );
495         }
496       }
497     }
498
499     myGrp->ListBox2->addItems( aSubShapeList );
500   }
501 }
502
503 //=================================================================================
504 // function : onSubShapesListSelectionChanged
505 // purpose  :
506 //=================================================================================
507 void MeasureGUI_CheckShapeDlg::onSubShapesListSelectionChanged()
508 {
509   erasePreview();
510
511   int aErrCurItem = myGrp->ListBox1->currentRow();
512
513   if (aErrCurItem < 0) {
514     return;
515   }
516
517   QList<int> aIds;
518
519   for (int i = 0, n = myGrp->ListBox2->count(); i < n; i++) {
520     if (myGrp->ListBox2->item( i )->isSelected()) {
521       aIds.append(i);
522     }
523   }
524
525   if (aIds.count() < 1) {
526     return;
527   }
528
529   bool isShapeValid;
530   GEOM::GEOM_IMeasureOperations::ShapeErrors aErrs;
531
532   if (!getErrors(isShapeValid, aErrs)) {
533     myGrp->TextView1->setText("");
534     myGrp->ListBox1->clear();
535     myGrp->ListBox2->clear();
536
537     return;
538   }
539
540   GEOM::GEOM_IMeasureOperations::ShapeError aErr = aErrs[aErrCurItem];
541   GEOM::ListOfLong aObjLst = aErr.incriminated;
542   TopoDS_Shape aSelShape;
543   TopoDS_Shape aSubShape;
544   TopTools_IndexedMapOfShape anIndices;
545
546   if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
547     QString aMess;
548
549     if (!isValid(aMess)) {
550       return;
551     }
552
553     SALOME_Prs* aPrs = 0;
554     QList<int>::iterator it;
555
556     TopExp::MapShapes(aSelShape, anIndices);
557
558     for (it = aIds.begin(); it != aIds.end(); ++it) {
559       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
560       int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
561
562       aSubShape = anIndices.FindKey(aObjLst[(*it)]);
563
564       try {
565         getDisplayer()->SetColor( Quantity_NOC_RED );
566         getDisplayer()->SetWidth( w );
567         getDisplayer()->SetToActivate( false );
568         aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
569
570         if (aPrs) {
571           displayPreview(aPrs, true);
572         }
573       }
574       catch (const SALOME::SALOME_Exception& e) {
575         SalomeApp_Tools::QtCatchCorbaException(e);
576       }
577     }
578   }
579 }
580
581 //=================================================================================
582 // function : execute
583 // purpose  :
584 //=================================================================================
585 bool MeasureGUI_CheckShapeDlg::execute( ObjectList& objects )
586 {
587   bool isShapeValid;
588   GEOM::GEOM_IMeasureOperations::ShapeErrors aErrs;
589
590   if (!getErrors(isShapeValid, aErrs)) {
591     return false;
592   }
593
594   const int  aNbErrsSelected    = myGrp->ListBox1->selectedItems().size();
595   const bool isPublishAllErrors = (aNbErrsSelected < 1);
596   const bool isPublishAllShapes =
597     (aNbErrsSelected != 1 || myGrp->ListBox2->selectedItems().empty());
598   TColStd_IndexedMapOfInteger aMapIndex;
599   const int aNbErrs = aErrs.length();
600   int i;
601
602   // Collect indices of shapes to be published.
603   for (i = 0; i < aNbErrs; i++) {
604     if (isPublishAllErrors || myGrp->ListBox1->item(i)->isSelected()) {
605       GEOM::ListOfLong aObjLst = aErrs[i].incriminated;
606       const int aNbShapes = aObjLst.length();
607       int j;
608
609       for (j = 0; j < aNbShapes; j++) {
610         if (isPublishAllShapes || myGrp->ListBox2->item(j)->isSelected()) {
611           aMapIndex.Add(aObjLst[j]);
612         }
613       }
614     }
615   }
616
617   // Create objects.
618   GEOM::ListOfLong_var anArray   = new GEOM::ListOfLong;
619   const int            aNbShapes = aMapIndex.Extent();
620
621   anArray->length(aNbShapes);
622
623   for (i = 1; i <= aNbShapes; i++) {
624     anArray[i - 1] = aMapIndex.FindKey(i);
625   }
626
627   if (myShapesOper->_is_nil()) {
628     myShapesOper = getGeomEngine()->GetIShapesOperations();
629   }
630
631   GEOM::ListOfGO_var aList = myShapesOper->MakeSubShapes(myObj, anArray);
632   const int aNbObj = aList->length();
633
634   for (i = 0; i < aNbObj; i++) {
635     objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
636   }
637
638   return true;
639 }