]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp
Salome HOME
Use filters for all objects of a current document
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelectionFilter.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "ModuleBase_WidgetSelectionFilter.h"
21 #include "ModuleBase_Tools.h"
22 #include "ModuleBase_IWorkshop.h"
23 #include "ModuleBase_ISelectionActivate.h"
24 #include "ModuleBase_IModule.h"
25 #include "ModuleBase_IViewer.h"
26 #include "ModuleBase_IPropertyPanel.h"
27 #include "ModuleBase_PageWidget.h"
28 #include "ModuleBase_WidgetMultiSelector.h"
29 #include "ModuleBase_ResultPrs.h"
30 #include "ModuleBase_WidgetFactory.h"
31
32 #include <ModelAPI_Session.h>
33 #include <ModelAPI_AttributeSelectionList.h>
34 #include <ModelAPI_Events.h>
35 #include <ModelAPI_ResultBody.h>
36 #include <GeomAPI_ShapeExplorer.h>
37
38 #include <Events_Loop.h>
39 #include <Config_ValidatorReader.h>
40
41 #include <AIS_InteractiveContext.hxx>
42 #include <StdSelect_BRepOwner.hxx>
43 #include <TopoDS_Compound.hxx>
44 #include <BRep_Builder.hxx>
45
46 #include <QLayout>
47 #include <QPushButton>
48 #include <QLabel>
49 #include <QComboBox>
50 #include <QGroupBox>
51 #include <QDialog>
52 #include <QToolButton>
53 #include <QCheckBox>
54
55 static FeaturePtr SelectorFeature;
56 static std::string AttributeId;
57
58
59 GeomAPI_Shape::ShapeType selectionType(const QString& theType)
60 {
61   QString aType = theType.toUpper();
62   if ((aType == "VERTEX") || (aType == "VERTICES"))
63     return GeomAPI_Shape::VERTEX;
64   else if ((aType == "EDGE") || (aType == "EDGES"))
65     return GeomAPI_Shape::EDGE;
66   else if ((aType == "WIRE") || (aType == "WIRES"))
67     return GeomAPI_Shape::WIRE;
68   else if ((aType == "FACE") || (aType == "FACES"))
69     return GeomAPI_Shape::FACE;
70   else if ((aType == "SHELL") || (aType == "SHELLS"))
71     return GeomAPI_Shape::SHELL;
72   else if ((aType == "SOLID") || (aType == "SOLIDS"))
73     return GeomAPI_Shape::SOLID;
74   else if ((aType == "COMPSOLID") || (aType == "COMPSOLIDS"))
75     return GeomAPI_Shape::COMPSOLID;
76   else if ((aType == "COMPOUND") || (aType == "COMPOUNDS"))
77     return GeomAPI_Shape::COMPOUND;
78   else
79     return GeomAPI_Shape::SHAPE;
80 }
81
82
83 ModuleBase_FilterStarter::ModuleBase_FilterStarter(const std::string& theFeature,
84   QWidget* theParent, ModuleBase_IWorkshop* theWorkshop)
85   : QWidget(theParent),
86   myFeatureName(theFeature),
87   myWorkshop(theWorkshop)
88 {
89   QHBoxLayout* aMainLayout = new QHBoxLayout(this);
90   ModuleBase_Tools::adjustMargins(aMainLayout);
91
92   aMainLayout->addStretch(1);
93   QPushButton* aLaunchBtn = new QPushButton(tr("Selection by filters"), this);
94   connect(aLaunchBtn, SIGNAL(clicked()), SLOT(onFiltersLaunch()));
95   aMainLayout->addWidget(aLaunchBtn);
96
97   myFilterLbl = new QLabel(this);
98   myFilterLbl->setPixmap(QPixmap(":pictures/filter.png"));
99   aMainLayout->addWidget(myFilterLbl);
100
101   myModifyLbl = new QLabel(this);
102   myModifyLbl->setPixmap(QPixmap(":pictures/plus_minus.png"));
103   aMainLayout->addWidget(myModifyLbl);
104   aMainLayout->addStretch(1);
105
106   myFilterLbl->hide();
107   myModifyLbl->hide();
108 }
109
110 void ModuleBase_FilterStarter::onFiltersLaunch()
111 {
112   ModuleBase_Operation* aParentOp = myWorkshop->currentOperation();
113   ModuleBase_OperationFeature* aFeatureOp = dynamic_cast<ModuleBase_OperationFeature*>(aParentOp);
114   if (aFeatureOp)
115     // Open transaction on filters operation finish
116     aFeatureOp->openTransactionOnResume();
117
118   QWidget* aParent = parentWidget();
119   ModuleBase_WidgetMultiSelector* aSelector =
120     dynamic_cast<ModuleBase_WidgetMultiSelector*>(aParent);
121   while (!aSelector) {
122     aParent = aParent->parentWidget();
123     aSelector = dynamic_cast<ModuleBase_WidgetMultiSelector*>(aParent);
124   }
125   if (!aSelector)
126     return;
127   SelectorFeature = aSelector->feature();
128   AttributeId = aSelector->attributeID();
129
130   // Launch Filters operation
131   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
132     (myWorkshop->module()->createOperation(myFeatureName));
133   myWorkshop->processLaunchOperation(aFOperation);
134 }
135
136 //*****************************************************************************
137 //*****************************************************************************
138 //*****************************************************************************
139 ModuleBase_FilterItem::ModuleBase_FilterItem(
140   const std::string& theFilter, ModuleBase_WidgetSelectionFilter* theParent)
141   : QWidget(theParent->filtersWidget()), myFilterID(theFilter),
142     mySelection(std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(theParent->feature()))
143 {
144   std::string aXmlString = ModelAPI_Session::get()->filters()->filter(theFilter)->xmlRepresentation();
145   if (aXmlString.length() == 0)
146     addItemRow(this);
147   else {
148     ModuleBase_WidgetFactory aFactory(aXmlString, theParent->workshop());
149     Config_ValidatorReader aValidatorReader(aXmlString, true);
150     aValidatorReader.setFeatureId(mySelection->getKind());
151     aValidatorReader.readAll();
152
153     QVBoxLayout* aLayout = new QVBoxLayout(this);
154     ModuleBase_Tools::zeroMargins(aLayout);
155
156     QWidget* aItemRow = new QWidget(this);
157     addItemRow(aItemRow);
158     aLayout->addWidget(aItemRow);
159
160     ModuleBase_PageWidget* aParamsWgt = new ModuleBase_PageWidget(this);
161     aParamsWgt->setFrameStyle(QFrame::Box | QFrame::Raised);
162     aFactory.createWidget(aParamsWgt);
163     ModuleBase_Tools::zeroMargins(aParamsWgt->layout());
164     myWidgets = aFactory.getModelWidgets();
165     foreach(ModuleBase_ModelWidget* aWidget, myWidgets) {
166       aWidget->setFeature(theParent->feature());
167       connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)),
168         theParent, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)));
169       connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
170         theParent, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)));
171     }
172     aLayout->addWidget(aParamsWgt);
173   }
174 }
175
176 void ModuleBase_FilterItem::addItemRow(QWidget* theParent)
177 {
178   QHBoxLayout* aLayout = new QHBoxLayout(theParent);
179   ModuleBase_Tools::zeroMargins(aLayout);
180
181   // Reverse filter button
182   myRevBtn = new QToolButton(theParent);
183   myRevBtn->setCheckable(true);
184   myRevBtn->setChecked(false);
185   myRevBtn->setAutoRaise(true);
186   myRevBtn->setIcon(QIcon(":pictures/add.png"));
187   myRevBtn->setToolTip(tr("Reverse the filter"));
188   connect(myRevBtn, SIGNAL(toggled(bool)), SLOT(onReverse(bool)));
189   aLayout->addWidget(myRevBtn);
190
191   const std::string& aFilterName = ModelAPI_Session::get()->filters()->filter(myFilterID)->name();
192   aLayout->addWidget(new QLabel(aFilterName.c_str(), theParent), 1);
193
194   QToolButton* aDelBtn = new QToolButton(theParent);
195   aDelBtn->setIcon(QIcon(":pictures/delete.png"));
196   aDelBtn->setAutoRaise(true);
197   aDelBtn->setToolTip(tr("Delete the filter"));
198   connect(aDelBtn, SIGNAL(clicked(bool)), SLOT(onDelete()));
199   aLayout->addWidget(aDelBtn);
200 }
201
202 void ModuleBase_FilterItem::onReverse(bool theCheck)
203 {
204   mySelection->setReversed(myFilterID, theCheck);
205   if (theCheck)
206     myRevBtn->setIcon(QIcon(":pictures/reverce.png"));
207   else
208     myRevBtn->setIcon(QIcon(":pictures/add.png"));
209   emit reversedItem(this);
210 }
211
212 void ModuleBase_FilterItem::onDelete()
213 {
214   emit deleteItem(this);
215 }
216
217 QList<QWidget*> ModuleBase_FilterItem::getControls() const
218 {
219   QList<QWidget*> aWidgetsList;
220   foreach(ModuleBase_ModelWidget* aWgt, myWidgets) {
221     QList<QWidget*> aSubList = aWgt->getControls();
222     foreach(QWidget* aSub, aSubList) {
223       aWidgetsList.append(aSub);
224     }
225   }
226   return aWidgetsList;
227 }
228
229
230 //*****************************************************************************
231 //*****************************************************************************
232 //*****************************************************************************
233 ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theParent,
234   ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData)
235   : ModuleBase_ModelWidget(theParent, theData),
236   myWorkshop(theWorkshop),
237   mySelectorFeature(SelectorFeature),
238   mySelectorAttribute(AttributeId)
239 {
240   // Clear Old selection
241   AttributePtr aAttr = SelectorFeature->attribute(AttributeId);
242   AttributeSelectionListPtr aSelListAttr =
243     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aAttr);
244   mySelectionType = selectionType(aSelListAttr->selectionType().c_str());
245   aSelListAttr->clear();
246
247   // Define widgets
248   QVBoxLayout* aMainLayout = new QVBoxLayout(this);
249   ModuleBase_Tools::adjustMargins(aMainLayout);
250
251   QGroupBox* aFiltersGroup = new QGroupBox(tr("Filters"), this);
252   QVBoxLayout* aGroupLayout = new QVBoxLayout(aFiltersGroup);
253   aGroupLayout->setContentsMargins(0, 0, 0, 0);
254   aGroupLayout->setSpacing(0);
255
256   myFiltersWgt = new QWidget();
257   myFiltersLayout = new QVBoxLayout(myFiltersWgt);
258   myFiltersLayout->setContentsMargins(0, 0, 0, 0);
259   aGroupLayout->addWidget(myFiltersWgt);
260
261   myFiltersCombo = new QComboBox(aFiltersGroup);
262   myFiltersCombo->addItem(tr("Add new filter..."));
263   SessionPtr aSession = ModelAPI_Session::get();
264   std::list<FilterPtr> allFilters =
265     aSession->filters()->filters((GeomAPI_Shape::ShapeType) mySelectionType);
266   QStringList aItems;
267   std::list<FilterPtr>::const_iterator aIt;
268   for (aIt = allFilters.cbegin(); aIt != allFilters.cend(); aIt++) {
269     aItems.push_back((*aIt)->name().c_str());
270     myFilters.push_back(aSession->filters()->id(*aIt));
271   }
272   myFiltersCombo->addItems(aItems);
273   connect(myFiltersCombo, SIGNAL(currentIndexChanged(int)), SLOT(onAddFilter(int)));
274
275   aGroupLayout->addWidget(myFiltersCombo);
276   aMainLayout->addWidget(aFiltersGroup);
277
278   // Select Button
279   QWidget* aBtnWgt = new QWidget(this);
280   QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnWgt);
281   ModuleBase_Tools::adjustMargins(aBtnLayout);
282
283   aBtnLayout->addStretch(1);
284
285   mySelectBtn = new QPushButton(tr("Select"), aBtnWgt);
286   connect(mySelectBtn, SIGNAL(clicked()), SLOT(onSelect()));
287   aBtnLayout->addWidget(mySelectBtn);
288
289   aMainLayout->addWidget(aBtnWgt);
290
291   // Label widgets
292   QWidget* aLblWgt = new QWidget(this);
293   QHBoxLayout* aLblLayout = new QHBoxLayout(aLblWgt);
294   ModuleBase_Tools::zeroMargins(aLblLayout);
295
296   aLblLayout->addWidget(new QLabel(tr("Number of selected objects:"), aLblWgt));
297
298   myNbLbl = new QLabel("0", aLblWgt);
299   aLblLayout->addWidget(myNbLbl);
300
301   // Show only button
302   myShowBtn = new QCheckBox(tr("Show only"), this);
303   connect(myShowBtn, SIGNAL(toggled(bool)), SLOT(onShowOnly(bool)));
304   aLblLayout->addWidget(myShowBtn);
305
306   aMainLayout->addWidget(aLblWgt);
307
308   aMainLayout->addStretch(1);
309
310   updateSelectBtn();
311 }
312
313 ModuleBase_WidgetSelectionFilter::~ModuleBase_WidgetSelectionFilter()
314 {
315   myValues.clear();
316   if (!myPreview.IsNull()) {
317     Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
318     aCtx->Remove(myPreview, false);
319     myPreview.Nullify();
320     if (myShowBtn->isChecked()) {
321       AIS_ListOfInteractive::const_iterator aIt;
322       Handle(AIS_Shape) aShapeIO;
323       for (aIt = myListIO.cbegin(); aIt != myListIO.cend(); aIt++) {
324         aShapeIO = Handle(AIS_Shape)::DownCast(*aIt);
325         if (!aShapeIO.IsNull()) {
326           aCtx->Display(aShapeIO, false);
327         }
328       }
329     }
330     aCtx->UpdateCurrentViewer();
331   }
332   SelectorFeature = FeaturePtr();
333   AttributeId = "";
334 }
335
336 void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex)
337 {
338   if (theIndex == 0)
339     return;
340
341   std::list<std::string>::iterator aIt;
342   int i;
343   std::string aFilter;
344   for (aIt = myFilters.begin(), i = 0; aIt != myFilters.cend(); i++, aIt++) {
345     if (i == (theIndex - 1)) {
346       aFilter = (*aIt);
347       myFilters.erase(aIt);
348       break;
349     }
350   }
351   if (!aFilter.empty()) {
352     myUseFilters.push_back(aFilter);
353     ModuleBase_FilterItem* aItem = new ModuleBase_FilterItem(aFilter, this);
354     connect(aItem, SIGNAL(deleteItem(ModuleBase_FilterItem*)),
355       SLOT(onDeleteItem(ModuleBase_FilterItem*)));
356     connect(aItem, SIGNAL(reversedItem(ModuleBase_FilterItem*)),
357       SLOT(onReverseItem(ModuleBase_FilterItem*)));
358     myFiltersLayout->addWidget(aItem);
359
360     FiltersFeaturePtr aFiltersFeature =
361       std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(myFeature);
362     aFiltersFeature->addFilter(aFilter);
363   }
364   updateSelectBtn();
365   clearCurrentSelection(true);
366   updateNumberSelected();
367   myFiltersCombo->setCurrentIndex(0);
368   myFiltersCombo->removeItem(theIndex);
369 }
370
371 void ModuleBase_WidgetSelectionFilter::onDeleteItem(ModuleBase_FilterItem* theItem)
372 {
373   std::string aFilter = theItem->filter();
374   QList<ModuleBase_ModelWidget*> aWidgets = theItem->widgets();
375   foreach(ModuleBase_ModelWidget* aWgt, aWidgets) {
376     aWgt->deactivate();
377   }
378   myFiltersLayout->removeWidget(theItem);
379   theItem->deleteLater();
380
381   myUseFilters.remove(aFilter);
382   myFilters.push_back(aFilter);
383   myFiltersCombo->addItem(ModelAPI_Session::get()->filters()->filter(aFilter)->name().c_str());
384
385   FiltersFeaturePtr aFiltersFeature =
386     std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(myFeature);
387   aFiltersFeature->removeFilter(aFilter);
388
389   updateSelectBtn();
390   clearCurrentSelection(true);
391   updateNumberSelected();
392
393   myWorkshop->deactivateCurrentSelector();
394   myWorkshop->selectionActivate()->updateSelectionModes();
395   myWorkshop->selectionActivate()->updateSelectionFilters();
396   redisplayFeature();
397 }
398
399
400 void ModuleBase_WidgetSelectionFilter::redisplayFeature()
401 {
402   static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
403   ModelAPI_EventCreator::get()->sendUpdated(myFeature, aDispEvent);
404   Events_Loop::loop()->flush(aDispEvent);
405 }
406
407 void ModuleBase_WidgetSelectionFilter::onReverseItem(ModuleBase_FilterItem* theItem)
408 {
409   updateSelectBtn();
410   clearCurrentSelection(true);
411   updateNumberSelected();
412 }
413
414 void ModuleBase_WidgetSelectionFilter::onSelect()
415 {
416   if (myUseFilters.size() == 0)
417     return;
418   Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
419   if (aCtx.IsNull())
420     return;
421
422   clearCurrentSelection();
423
424   BRep_Builder aBuilder;
425   TopoDS_Compound aComp;
426   aBuilder.MakeCompound(aComp);
427
428   DocumentPtr aDoc = myFeature->document();
429   int aNb = aDoc->size(ModelAPI_ResultBody::group());
430   ObjectPtr aObj;
431   ResultBodyPtr aBody;
432   GeomShapePtr aShape;
433   for (int i = 0; i < aNb; i++) {
434     aObj = aDoc->object(ModelAPI_ResultBody::group(), i);
435     aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObj);
436     GeomShapePtr aShape = aBody->shape();
437     std::list<GeomShapePtr> aSubShapes =
438       aShape->subShapes((GeomAPI_Shape::ShapeType)mySelectionType);
439     std::list<GeomShapePtr>::const_iterator aShapesIt;
440     for (aShapesIt = aSubShapes.cbegin(); aShapesIt != aSubShapes.cend(); aShapesIt++) {
441       GeomShapePtr aShape = (*aShapesIt);
442       SessionPtr aSession = ModelAPI_Session::get();
443       bool isValid = aSession->filters()->isValid(myFeature, aShape);
444       if (isValid) {
445         TopoDS_Shape aTShape = aShape->impl<TopoDS_Shape>();
446         aBuilder.Add(aComp, aTShape);
447         ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aObj, aShape));
448         myValues.append(aValue);
449       }
450     }
451   }
452
453   if (myValues.size() > 0)
454     updatePreview(aComp);
455   updateNumberSelected();
456 }
457
458 void ModuleBase_WidgetSelectionFilter::updatePreview(const TopoDS_Shape& theShape)
459 {
460   Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
461   if (aCtx.IsNull())
462     return;
463
464   if (myPreview.IsNull()) {
465     myPreview = new AIS_Shape(theShape);
466     myPreview->SetDisplayMode(AIS_Shaded);
467     myPreview->SetColor(Quantity_NOC_BLUE1);
468     Handle(Prs3d_Drawer) aDrawer = myPreview->Attributes();
469     if (aDrawer->HasOwnPointAspect()) {
470       aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR);
471       aDrawer->PointAspect()->SetColor(Quantity_NOC_BLUE1);
472       aDrawer->PointAspect()->SetScale(2.);
473     }
474     else
475       aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_O_STAR, Quantity_NOC_BLUE1, 2.));
476     myPreview->SetTransparency();
477     aCtx->Display(myPreview, true);
478     aCtx->Deactivate(myPreview);
479   }
480   else {
481     myPreview->Set(theShape);
482     aCtx->Redisplay(myPreview, true);
483   }
484 }
485
486
487 void ModuleBase_WidgetSelectionFilter::onShowOnly(bool theShow)
488 {
489   if (myPreview.IsNull())
490     return;
491   Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
492
493   if (theShow) {
494     myListIO.Clear();
495     aCtx->DisplayedObjects(AIS_KOI_Shape, -1, myListIO);
496     myListIO.Remove(myPreview);
497   }
498   AIS_ListOfInteractive::const_iterator aIt;
499   Handle(AIS_Shape) aShapeIO;
500   for (aIt = myListIO.cbegin(); aIt != myListIO.cend(); aIt++) {
501     aShapeIO = Handle(AIS_Shape)::DownCast(*aIt);
502     if (!aShapeIO.IsNull()) {
503       if (theShow)
504         aCtx->Erase(aShapeIO, false);
505       else
506         aCtx->Display(aShapeIO, false);
507     }
508   }
509   aCtx->UpdateCurrentViewer();
510 }
511
512 void ModuleBase_WidgetSelectionFilter::updateSelectBtn()
513 {
514   mySelectBtn->setEnabled(myUseFilters.size() > 0);
515 }
516
517 void ModuleBase_WidgetSelectionFilter::updateNumberSelected()
518 {
519   myNbLbl->setText(QString::number(myValues.size()));
520 }
521 QList<QWidget*> ModuleBase_WidgetSelectionFilter::getControls() const
522 {
523   QList<QWidget*> aWidgets;
524   QList<ModuleBase_FilterItem*> aItems = myFiltersWgt->findChildren<ModuleBase_FilterItem*>();
525   foreach(ModuleBase_FilterItem* aItem, aItems) {
526     QList<QWidget*> aSubList = aItem->getControls();
527     foreach(QWidget* aWgt, aSubList) {
528       aWidgets.append(aWgt);
529     }
530   }
531   return aWidgets;
532 }
533
534 void ModuleBase_WidgetSelectionFilter::clearCurrentSelection(bool toUpdate)
535 {
536   myValues.clear();
537   if (!myPreview.IsNull()) {
538     Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
539     aCtx->Remove(myPreview, toUpdate);
540     myPreview.Nullify();
541   }
542 }
543
544 void ModuleBase_WidgetSelectionFilter::onFeatureAccepted()
545 {
546   AttributePtr aAttr = mySelectorFeature->attribute(mySelectorAttribute);
547   AttributeSelectionListPtr aSelListAttr =
548     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aAttr);
549   aSelListAttr->clear();
550   foreach(ModuleBase_ViewerPrsPtr aPrs, myValues) {
551     aSelListAttr->append(aPrs->object(), aPrs->shape());
552   }
553 }
554
555 bool ModuleBase_WidgetSelectionFilter::storeValueCustom()
556 {
557   return true;
558 }
559
560 bool ModuleBase_WidgetSelectionFilter::restoreValueCustom()
561 {
562   ModuleBase_ModelWidget* aActive = myWorkshop->propertyPanel()->activeWidget();
563   if (aActive)
564     return aActive->restoreValue();
565   return true;
566 }