Salome HOME
Bug #846 Color modification in preferences is applyed to the visualized objects after...
[modules/shaper.git] / src / PartSet / PartSet_MenuMgr.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_MenuMgr.cpp
4 // Created:     03 April 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #include "PartSet_MenuMgr.h"
8 #include "PartSet_Module.h"
9 #include "PartSet_SketcherMgr.h"
10 #include "PartSet_Tools.h"
11
12 #include <PartSetPlugin_Part.h>
13
14 #include <GeomAPI_Pnt2d.h>
15 #include <GeomDataAPI_Point2D.h>
16
17 #include <SketchPlugin_ConstraintCoincidence.h>
18 #include <SketchPlugin_Line.h>
19 #include <SketchPlugin_Circle.h>
20 #include <SketchPlugin_Point.h>
21 #include <SketchPlugin_Sketch.h>
22
23 #include <ModuleBase_ISelection.h>
24 #include <ModuleBase_Operation.h>
25 #include <ModuleBase_OperationAction.h>
26 #include <ModuleBase_OperationFeature.h>
27
28 #include <XGUI_ModuleConnector.h>
29 #include <XGUI_Workshop.h>
30 #include <XGUI_Displayer.h>
31 #include <XGUI_DataModel.h>
32 #include <XGUI_ObjectsBrowser.h>
33 #include <XGUI_OperationMgr.h>
34
35 #include <Events_Loop.h>
36 #include <ModelAPI_Events.h>
37 #include <ModelAPI_Session.h>
38 #include <ModelAPI_ResultPart.h>
39 #include <ModelAPI_ResultParameter.h>
40
41 #include <QAction>
42 #include <QMenu>
43
44 #include <TopoDS.hxx>
45 #include <BRep_Tool.hxx>
46
47 PartSet_MenuMgr::PartSet_MenuMgr(PartSet_Module* theModule)
48   : QObject(theModule), myModule(theModule), myPrevId(-1)
49 {
50   createActions();
51 }
52
53
54 QAction* PartSet_MenuMgr::action(const QString& theId) const
55 {
56   if (myActions.contains(theId))
57     return myActions[theId];
58   return 0;
59 }
60
61 void PartSet_MenuMgr::addAction(const QString& theId, QAction* theAction)
62 {
63   if (myActions.contains(theId))
64     qCritical("A command with Id = '%s' already defined!", qPrintable(theId));
65   theAction->setData(theId);
66   connect(theAction, SIGNAL(triggered(bool)), this, SLOT(onAction(bool)));
67   myActions[theId] = theAction;
68 }
69
70 void PartSet_MenuMgr::createActions()
71 {
72   QAction* aAction;
73
74   aAction = new QAction(tr("Auxiliary"), this);
75   aAction->setCheckable(true);
76   addAction("AUXILIARY_CMD", aAction);
77
78   aAction = new QAction(QIcon(":icons/activate.png"), tr("Activate"), this);
79   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePart(bool)));
80   myActions["ACTIVATE_PART_CMD"] = aAction;
81
82   aAction = new QAction(QIcon(":icons/deactivate.png"), tr("Deactivate"), this);
83   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
84   myActions["DEACTIVATE_PART_CMD"] = aAction;
85
86   // Activate PartSet
87   aAction = new QAction(QIcon(":icons/activate.png"), tr("Activate"), this);
88   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
89   myActions["ACTIVATE_PARTSET_CMD"] = aAction;
90
91   aAction = new QAction(QIcon(":icons/edit.png"), tr("Edit..."), this);
92   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onEdit(bool)));
93   myActions["EDIT_CMD"] = aAction;
94
95   aAction = new QAction(QIcon(), tr("Select parent feature"), this);
96   aAction->setCheckable(false);
97   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSelectParentFeature()));
98   myActions["SELECT_PARENT_CMD"] = aAction;
99 }
100
101
102 void PartSet_MenuMgr::onAction(bool isChecked)
103 {
104   QAction* aAction = static_cast<QAction*>(sender());
105   QString anId = aAction->data().toString();
106
107   if (anId == "AUXILIARY_CMD") {
108     setAuxiliary(isChecked);
109   }
110 }
111
112 bool PartSet_MenuMgr::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
113 {
114   ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
115   if (!PartSet_SketcherMgr::isSketchOperation(anOperation) &&
116       !PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
117     return false;
118
119   myCoinsideLines.clear();
120   ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
121
122   bool aIsDetach = false;
123   bool hasAttribute = false;
124   bool hasFeature = false;
125
126   QList<ModuleBase_ViewerPrs> aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
127   TopoDS_Shape aShape;
128   ResultPtr aResult;
129   FeaturePtr aFeature;
130   foreach(ModuleBase_ViewerPrs aPrs, aPrsList) {
131     aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
132     if (aResult.get() != NULL) {
133       aShape = aPrs.shape();
134       if (aShape.IsEqual(aResult->shape()->impl<TopoDS_Shape>()))
135         hasFeature = true;
136       else
137         hasAttribute = true;
138     } else {
139       aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aPrs.object());
140       hasFeature = (aFeature.get() != NULL);
141     }
142   }
143
144   if (aPrsList.size() == 1) {
145     TopoDS_Shape aShape = aPrsList.first().shape();
146     if ((!aShape.IsNull()) && aShape.ShapeType() == TopAbs_VERTEX) {
147       // Find 2d coordinates
148       FeaturePtr aSketchFea = myModule->sketchMgr()->activeSketch();
149       if (aSketchFea->getKind() == SketchPlugin_Sketch::ID()) {
150         gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
151         std::shared_ptr<GeomAPI_Pnt> aPnt3d(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z()));
152         std::shared_ptr<GeomAPI_Pnt2d> aSelPnt = PartSet_Tools::convertTo2D(aSketchFea, aPnt3d);
153
154         // Find coincident in these coordinates
155         ObjectPtr aObj = aPrsList.first().object();
156         FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
157         const std::set<AttributePtr>& aRefsList = aFeature->data()->refsToMe();
158         std::set<AttributePtr>::const_iterator aIt;
159         FeaturePtr aCoincident;
160         for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
161           std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
162           FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
163           if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { 
164             std::shared_ptr<GeomAPI_Pnt2d> a2dPnt = 
165               PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A());
166             if (a2dPnt.get() && aSelPnt->isEqual(a2dPnt)) { 
167               aCoincident = aConstrFeature;
168               break;
169             } else {
170               a2dPnt = PartSet_Tools::getPoint(aConstrFeature,
171                                                SketchPlugin_ConstraintCoincidence::ENTITY_B());
172               if (a2dPnt.get() && aSelPnt->isEqual(a2dPnt)) { 
173                 aCoincident = aConstrFeature;
174                 break;
175               }
176             }
177           }
178         }
179         // If we have coincidence then add Detach menu
180         if (aCoincident.get() != NULL) {
181           mySelectedFeature = aCoincident;
182           PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines,
183                                           SketchPlugin_ConstraintCoincidence::ENTITY_A());
184           PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines,
185                                           SketchPlugin_ConstraintCoincidence::ENTITY_B());
186           if (myCoinsideLines.size() > 0) {
187             aIsDetach = true;
188             QMenu* aSubMenu = theMenu->addMenu(tr("Detach"));
189             QAction* aAction;
190             int i = 0;
191             foreach (FeaturePtr aCoins, myCoinsideLines) {
192               aAction = aSubMenu->addAction(aCoins->data()->name().c_str());
193               aAction->setData(QVariant(i));
194               i++;
195             }
196             connect(aSubMenu, SIGNAL(hovered(QAction*)), SLOT(onLineHighlighted(QAction*)));
197             connect(aSubMenu, SIGNAL(aboutToHide()), SLOT(onDetachMenuHide()));
198             connect(aSubMenu, SIGNAL(triggered(QAction*)), SLOT(onLineDetach(QAction*)));
199           } 
200         }
201       }
202     }
203   }
204   if ((!aIsDetach) && hasFeature) {
205     theMenu->addAction(theStdActions["DELETE_CMD"]);
206   }
207   if (hasAttribute)
208     return true;
209   bool isAuxiliary;
210   if (canSetAuxiliary(isAuxiliary)) {
211     QAction* anAction = action("AUXILIARY_CMD");
212     theMenu->addAction(anAction);
213     anAction->setChecked(isAuxiliary);
214   }
215   return true;
216 }
217
218 void PartSet_MenuMgr::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
219 {
220   ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
221
222   bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
223                         PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
224   if (isActiveSketch) {
225     theStdActions["WIREFRAME_CMD"]->setEnabled(false);
226     theStdActions["SHADING_CMD"]->setEnabled(false);
227     theStdActions["SHOW_ONLY_CMD"]->setEnabled(false);
228     theStdActions["SHOW_CMD"]->setEnabled(false);
229     theStdActions["HIDE_CMD"]->setEnabled(false);
230     theStdActions["HIDEALL_CMD"]->setEnabled(false);
231   }
232 }
233
234
235 void PartSet_MenuMgr::onLineHighlighted(QAction* theAction)
236 {
237   if (myPrevId != -1) {
238     // Restore color for previous object
239     setLineColor(myPrevId, myColor, false);
240   }
241   myPrevId = theAction->data().toInt();
242   myColor = setLineColor(myPrevId, Qt::white, true);
243 }
244
245 QColor PartSet_MenuMgr::setLineColor(int theId, const QColor theColor, bool theUpdate)
246 {
247   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
248   XGUI_Workshop* aWorkshop = aConnector->workshop();
249   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
250
251   FeaturePtr aLine = myCoinsideLines.at(myPrevId);
252   std::list<ResultPtr>::const_iterator aIt;
253   const std::list<ResultPtr>& aResults = aLine->results();
254   QColor aColor;
255   for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
256     aColor = aDisplayer->setObjectColor((*aIt), theColor, false);
257   }
258   if (theUpdate)
259     aDisplayer->updateViewer();
260   return aColor;
261 }
262
263
264 void PartSet_MenuMgr::onLineDetach(QAction* theAction)
265 {
266   int aId = theAction->data().toInt();
267   FeaturePtr aLine = myCoinsideLines.at(aId);
268   std::shared_ptr<GeomAPI_Pnt2d> aOrig = PartSet_Tools::getPoint(mySelectedFeature,
269                                                         SketchPlugin_ConstraintCoincidence::ENTITY_A());
270   if (aOrig.get() == NULL)
271     aOrig = PartSet_Tools::getPoint(mySelectedFeature,
272                                     SketchPlugin_ConstraintCoincidence::ENTITY_B());
273   
274   gp_Pnt aOr = aOrig->impl<gp_Pnt>();
275   const std::set<AttributePtr>& aRefsList = aLine->data()->refsToMe();
276
277   QObjectPtrList aToDelFeatures;
278   std::set<AttributePtr>::const_iterator aIt;
279   // Find all coincedences corresponded to the selected line in the selected point
280   for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
281     std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
282     FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
283     if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { 
284       std::shared_ptr<GeomAPI_Pnt2d> aPnt = PartSet_Tools::getPoint(aConstrFeature,
285                                             SketchPlugin_ConstraintCoincidence::ENTITY_A());
286       if (aPnt.get() == NULL)
287         aPnt = PartSet_Tools::getPoint(aConstrFeature,
288                                        SketchPlugin_ConstraintCoincidence::ENTITY_B());
289       if (aPnt.get() == NULL)
290         return;
291       gp_Pnt aP = aPnt->impl<gp_Pnt>();
292       if (aOrig->isEqual(aPnt)) {
293         aToDelFeatures.append(aConstrFeature);
294       } else {
295         aPnt = PartSet_Tools::getPoint(aConstrFeature,
296                                        SketchPlugin_ConstraintCoincidence::ENTITY_B());
297         if (aPnt.get() == NULL)
298           return;
299         aP = aPnt->impl<gp_Pnt>();
300         if (aOrig->isEqual(aPnt)) {
301           aToDelFeatures.append(aConstrFeature);
302           break;
303         }
304       }
305     }
306   }
307   if (aToDelFeatures.size() > 0) {
308     XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
309     XGUI_Workshop* aWorkshop = aConnector->workshop();
310     ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
311
312     ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(
313                                    tr("Detach %1").arg(aLine->data()->name().c_str()), myModule);
314     bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
315     XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
316     // the active nested sketch operation should be aborted unconditionally
317     // the Delete action should be additionally granted for the Sketch operation
318     // in order to do not abort/commit it
319     if (!anOpMgr->canStartOperation(anOpAction->id(), isSketchOp/*granted*/))
320       return; // the objects are processed but can not be deleted
321
322     anOpMgr->startOperation(anOpAction);
323     aWorkshop->deleteFeatures(aToDelFeatures);
324     
325     anOpMgr->commitOperation();
326   }
327   myCoinsideLines.clear();
328 }
329
330
331 void PartSet_MenuMgr::onDetachMenuHide()
332 {
333   if (myPrevId != -1) {
334     // Restore color for previous object
335     setLineColor(myPrevId, myColor, false);
336   }
337   // Clear previous definitions
338   myPrevId = -1;
339 }
340
341   
342 void PartSet_MenuMgr::setAuxiliary(const bool isChecked)
343 {
344   ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
345
346   bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
347                         PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
348   if (!isActiveSketch)
349     return;
350
351   QObjectPtrList anObjects;
352   bool isUseTransaction = false;
353   // 1. change auxiliary type of a created feature
354   if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
355       PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) {
356       ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
357                                                                (anOperation);
358       if (aFOperation)
359         anObjects.append(aFOperation->feature());
360   }
361   else {
362     isUseTransaction = true;
363     // 2. change auxiliary type of selected sketch entities
364     ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
365     anObjects = aSelection->selectedPresentations();
366   }
367
368   QAction* anAction = action("AUXILIARY_CMD");
369   //SessionPtr aMgr = ModelAPI_Session::get();
370   ModuleBase_OperationAction* anOpAction = 0;
371   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
372   XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
373   if (isUseTransaction) {
374     anOpAction = new ModuleBase_OperationAction(anAction->text(), myModule);
375     bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
376
377     if (!anOpMgr->canStartOperation(anOpAction->id(), isSketchOp/*granted*/))
378       return; // the objects are processed but can not be deleted
379
380     anOpMgr->startOperation(anOpAction);
381   }
382   myModule->sketchMgr()->storeSelection();
383
384   if (anObjects.size() > 0) {
385     QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
386     for (; anIt != aLast; anIt++) {
387       FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
388       if (aFeature.get() != NULL) {
389         std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
390                             std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
391         if (aSketchFeature.get() != NULL) {
392           std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
393
394           std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr = 
395             std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
396           if (anAuxiliaryAttr)
397             anAuxiliaryAttr->setValue(isChecked);
398         }
399       }
400     }
401   }
402   if (isUseTransaction)
403     anOpMgr->commitOperation();
404
405   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
406   myModule->sketchMgr()->restoreSelection();
407 }
408
409 bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const
410 {
411   bool anEnabled = false;
412   ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
413
414   bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
415                         PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
416   if (!isActiveSketch)
417     return anEnabled;
418
419   QObjectPtrList anObjects;
420   // 1. change auxiliary type of a created feature
421   if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
422     PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) {
423     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
424     if (aFOperation)
425       anObjects.append(aFOperation->feature());
426   }
427   else {
428     /// The operation should not be aborted here, because the method does not changed
429     /// the auxilliary state, but checks the possibility to perform this
430     ///if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
431     ///  anOperation->abort();
432     // 2. change auxiliary type of selected sketch entities
433     ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
434     anObjects = aSelection->selectedPresentations();
435   }
436
437   bool isNotAuxiliaryFound = false;
438   if (anObjects.size() > 0) {
439     QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
440     for (; anIt != aLast && !isNotAuxiliaryFound; anIt++) {
441       FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
442       if ((aFeature.get() != NULL) && PartSet_SketcherMgr::isEntity(aFeature->getKind())) {
443         anEnabled = true;
444         std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
445                             std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
446         if (aSketchFeature.get() != NULL) {
447           std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
448
449           std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr = 
450             std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
451           if (anAuxiliaryAttr)
452             isNotAuxiliaryFound = !anAuxiliaryAttr->value();
453         }
454       }
455     }
456   }
457   theValue = anObjects.size() && !isNotAuxiliaryFound;
458   return anEnabled;
459 }
460
461 void PartSet_MenuMgr::onActivatePart(bool)
462 {
463   if (myModule->workshop()->currentOperation())
464     return;
465   QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
466   if (aObjects.size() > 0) {
467     ObjectPtr aObj = aObjects.first();
468     ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
469     if (!aPart.get()) {
470       FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
471       if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) {
472         aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
473       }
474     }
475     if (aPart.get())
476       aPart->activate();
477   }
478 }
479
480 void PartSet_MenuMgr::onActivatePartSet(bool)
481 {
482   if (myModule->workshop()->currentOperation())
483     return;
484   SessionPtr aMgr = ModelAPI_Session::get();
485   bool isNewTransaction = !aMgr->isOperation();
486   // activation may cause changes in current features in document, so it must be in transaction
487   if (isNewTransaction) {
488     aMgr->startOperation("Activation");
489   }
490   aMgr->setActiveDocument(aMgr->moduleDocument());
491   if (isNewTransaction) {
492     aMgr->finishOperation();
493   }
494 }
495
496 void PartSet_MenuMgr::onEdit(bool)
497 {
498   QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
499   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjects.first());
500   if (aFeature == NULL) {
501     ResultParameterPtr aParam = 
502       std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObjects.first());
503     if (aParam.get() != NULL) {
504       aFeature = ModelAPI_Feature::feature(aParam);
505     }
506   }
507   if (aFeature.get() != NULL)
508     myModule->editFeature(aFeature);
509 }
510
511 void PartSet_MenuMgr::onSelectParentFeature()
512 {
513   QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
514   if (aObjects.size() != 1)
515     return;
516
517   SessionPtr aMgr = ModelAPI_Session::get();
518   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>( aObjects.first() );
519   if( !aResult.get() )
520     return;
521
522   FeaturePtr aParentFeature = aResult->document()->feature( aResult );
523   QObjectPtrList aSelection;
524   aSelection.append( aParentFeature );
525   myModule->workshop()->selection()->setSelectedObjects( aSelection );
526 }