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