1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetMultiSelector.cpp
6 * Created on: Aug 28, 2014
10 #include <ModuleBase_WidgetMultiSelector.h>
11 #include <ModuleBase_WidgetShapeSelector.h>
12 #include <ModuleBase_ISelection.h>
13 #include <ModuleBase_IWorkshop.h>
14 #include <ModuleBase_IViewer.h>
15 #include <ModuleBase_Tools.h>
16 #include <ModuleBase_Definitions.h>
17 #include <ModuleBase_IModule.h>
19 #include <ModelAPI_Data.h>
20 #include <ModelAPI_Object.h>
21 #include <ModelAPI_AttributeSelectionList.h>
22 #include <ModelAPI_AttributeRefList.h>
23 #include <ModelAPI_AttributeRefAttrList.h>
25 #include <Config_WidgetAPI.h>
27 #include <QGridLayout>
29 #include <QListWidget>
35 #include <QApplication>
42 const int ATTRIBUTE_SELECTION_INDEX_ROLE = Qt::UserRole + 1;
45 * Customization of a List Widget to make it to be placed on full width of container
47 class CustomListWidget : public QListWidget
51 /// \param theParent a parent widget
52 CustomListWidget( QWidget* theParent )
53 : QListWidget( theParent )
57 /// Redefinition of virtual method
58 virtual QSize sizeHint() const
60 int aHeight = 2*QFontMetrics( font() ).height();
61 QSize aSize = QListWidget::sizeHint();
62 return QSize( aSize.width(), aHeight );
65 /// Redefinition of virtual method
66 virtual QSize minimumSizeHint() const
68 int aHeight = 4/*2*/*QFontMetrics( font() ).height();
69 QSize aSize = QListWidget::minimumSizeHint();
70 return QSize( aSize.width(), aHeight );
74 // The code is necessary only for Linux because
75 //it can not update viewport on widget resize
77 void resizeEvent(QResizeEvent* theEvent)
79 QListWidget::resizeEvent(theEvent);
80 QTimer::singleShot(5, viewport(), SLOT(repaint()));
85 ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent,
86 ModuleBase_IWorkshop* theWorkshop,
87 const Config_WidgetAPI* theData,
88 const std::string& theParentId)
89 : ModuleBase_WidgetSelector(theParent, theWorkshop, theData, theParentId),
92 QGridLayout* aMainLay = new QGridLayout(this);
93 ModuleBase_Tools::adjustMargins(aMainLay);
95 QLabel* aTypeLabel = new QLabel(tr("Type"), this);
96 aMainLay->addWidget(aTypeLabel, 0, 0);
98 myTypeCombo = new QComboBox(this);
99 // There is no sense to parameterize list of types while we can not parameterize selection mode
101 std::string aPropertyTypes = theData->getProperty("type_choice");
102 QString aTypesStr = aPropertyTypes.c_str();
103 QStringList aShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
105 myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
107 if (!aShapeTypes.empty())
108 myTypeCombo->addItems(aShapeTypes);
109 aMainLay->addWidget(myTypeCombo, 0, 1);
110 // if the xml definition contains one type, the controls to select a type should not be shown
111 if (aShapeTypes.size() <= 1 || !myIsUseChoice) {
112 aTypeLabel->setVisible(false);
113 myTypeCombo->setVisible(false);
116 std::string aLabelText = theData->getProperty("label");
117 QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
118 : tr("Selected objects:"), this);
119 aMainLay->addWidget(aListLabel, 1, 0);
120 // if the xml definition contains one type, an information label should be shown near to the latest
121 if (aShapeTypes.size() <= 1) {
122 QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
123 if (!aLabelIcon.isEmpty()) {
124 QLabel* aSelectedLabel = new QLabel("", this);
125 aSelectedLabel->setPixmap(QPixmap(aLabelIcon));
126 aMainLay->addWidget(aSelectedLabel, 1, 1);
128 aMainLay->setColumnStretch(2, 1);
131 QString aToolTip = QString::fromStdString(theData->widgetTooltip());
132 myListControl = new CustomListWidget(this);
133 QString anObjName = QString::fromStdString(attributeID());
134 myListControl->setObjectName(anObjName);
135 myListControl->setToolTip(aToolTip);
136 myListControl->setSelectionMode(QAbstractItemView::ExtendedSelection);
138 aMainLay->addWidget(myListControl, 2, 0, 1, -1);
139 aMainLay->setRowStretch(2, 1);
140 //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
141 //aMainLay->setRowMinimumHeight(3, 20);
142 //this->setLayout(aMainLay);
143 connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
145 myCopyAction = new QAction(QIcon(":pictures/copy.png"), tr("Copy"), this);
146 myCopyAction->setShortcut(QKeySequence::Copy);
147 myCopyAction->setEnabled(false);
148 connect(myCopyAction, SIGNAL(triggered(bool)), SLOT(onCopyItem()));
149 myListControl->addAction(myCopyAction);
151 myDeleteAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
152 myDeleteAction->setEnabled(false);
153 connect(myDeleteAction, SIGNAL(triggered(bool)), SLOT(onDeleteItem()));
154 myListControl->addAction(myDeleteAction);
156 myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
157 connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
160 ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
164 //********************************************************************
165 void ModuleBase_WidgetMultiSelector::activateCustom()
167 ModuleBase_WidgetSelector::activateCustom();
169 myWorkshop->module()->activateCustomPrs(myFeature,
170 ModuleBase_IModule::CustomizeHighlightedObjects, true);
173 //********************************************************************
174 void ModuleBase_WidgetMultiSelector::deactivate()
176 ModuleBase_WidgetSelector::deactivate();
178 myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true);
181 //********************************************************************
182 bool ModuleBase_WidgetMultiSelector::storeValueCustom() const
184 // the value is stored on the selection changed signal processing
185 // A rare case when plugin was not loaded.
189 AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
190 std::string aType = anAttribute->attributeType();
191 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
192 AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
193 aSelectionListAttr->setSelectionType(myTypeCombo->currentText().toStdString());
198 //********************************************************************
199 bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
201 // A rare case when plugin was not loaded.
205 AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
206 std::string aType = anAttribute->attributeType();
207 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
208 AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
209 // Restore shape type
210 std::string aSelectionType = aSelectionListAttr->selectionType().c_str();
211 if (!aSelectionType.empty())
212 setCurrentShapeType(ModuleBase_Tools::shapeType(aSelectionType.c_str()));
214 updateSelectionList();
218 //********************************************************************
219 void ModuleBase_WidgetMultiSelector::storeAttributeValue()
221 ModuleBase_WidgetValidated::storeAttributeValue();
223 DataPtr aData = myFeature->data();
224 AttributePtr anAttribute = aData->attribute(attributeID());
225 std::string aType = anAttribute->attributeType();
226 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
227 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
228 mySelectionType = aSelectionListAttr->selectionType();
229 mySelectionCount = aSelectionListAttr->size();
231 else if (aType == ModelAPI_AttributeRefList::typeId()) {
232 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
233 mySelectionCount = aRefListAttr->size();
235 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
236 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
237 mySelectionCount = aRefAttrListAttr->size();
241 //********************************************************************
242 void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool theValid)
244 ModuleBase_WidgetValidated::restoreAttributeValue(theValid);
246 DataPtr aData = myFeature->data();
247 AttributePtr anAttribute = aData->attribute(attributeID());
248 std::string aType = anAttribute->attributeType();
249 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
250 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
251 aSelectionListAttr->setSelectionType(mySelectionType);
253 // restore selection in the attribute. Indeed there is only one stored object
254 int aCountAppened = aSelectionListAttr->size() - mySelectionCount;
255 for (int i = 0; i < aCountAppened; i++)
256 aSelectionListAttr->removeLast();
258 else if (aType == ModelAPI_AttributeRefList::typeId()) {
259 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
260 // restore objects in the attribute. Indeed there is only one stored object
261 int aCountAppened = aRefListAttr->size() - mySelectionCount;
262 for (int i = 0; i < aCountAppened; i++)
263 aRefListAttr->removeLast();
265 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
266 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
267 // restore objects in the attribute. Indeed there is only one stored object
268 int aCountAppened = aRefAttrListAttr->size() - mySelectionCount;
269 for (int i = 0; i < aCountAppened; i++)
270 aRefAttrListAttr->removeLast();
274 //********************************************************************
275 void ModuleBase_WidgetMultiSelector::clearAttribute()
277 DataPtr aData = myFeature->data();
278 AttributePtr anAttribute = aData->attribute(attributeID());
279 std::string aType = anAttribute->attributeType();
280 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
281 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
282 aSelectionListAttr->clear();
284 else if (aType == ModelAPI_AttributeRefList::typeId()) {
285 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
286 aRefListAttr->clear();
288 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
289 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
290 aRefAttrListAttr->clear();
294 //********************************************************************
295 void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject,
296 GeomShapePtr theShape)
298 DataPtr aData = myFeature->data();
299 AttributePtr anAttribute = aData->attribute(attributeID());
300 std::string aType = anAttribute->attributeType();
301 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
302 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
303 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theSelectedObject);
304 aSelectionListAttr->append(aResult, theShape, myIsInValidate);
306 else if (aType == ModelAPI_AttributeRefList::typeId()) {
307 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
308 aRefListAttr->append(theSelectedObject);
310 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
311 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
313 AttributePtr anAttribute = myWorkshop->module()->findAttribute(theSelectedObject, theShape);
314 if (anAttribute.get())
315 aRefAttrListAttr->append(anAttribute);
317 aRefAttrListAttr->append(theSelectedObject);
321 //********************************************************************
322 bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
323 const bool theToValidate)
325 QList<ModuleBase_ViewerPrs> aSkippedValues;
327 QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
329 for (; anIt != aLast; anIt++) {
330 ModuleBase_ViewerPrs aValue = *anIt;
331 bool aProcessed = false;
332 if (!theToValidate || isValidInFilters(aValue)) {
333 aProcessed = setSelectionCustom(aValue);
336 aSkippedValues.append(aValue);
337 // if there is at least one set, the result is true
338 isDone = isDone || aProcessed;
340 // updateObject - to update/redisplay feature
341 // it is commented in order to perfom it outside the method
343 //updateObject(myFeature);
344 // this emit is necessary to call store/restore method an restore type of selection
345 //emit valuesChanged();
348 if (!aSkippedValues.empty())
349 theValues.append(aSkippedValues);
354 //********************************************************************
355 void ModuleBase_WidgetMultiSelector::getHighlighted(QList<ModuleBase_ViewerPrs>& theValues)
357 std::set<int> anAttributeIds;
358 getSelectedAttributeIndices(anAttributeIds);
359 if (!anAttributeIds.empty())
360 convertIndicesToViewerSelection(anAttributeIds, theValues);
363 //********************************************************************
364 bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
366 bool aValid = ModuleBase_WidgetSelector::isValidSelectionCustom(thePrs);
368 ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
369 aValid = aResult.get() != NULL;
372 // We can not select a result of our feature
373 const std::list<ResultPtr>& aResList = myFeature->results();
374 std::list<ResultPtr>::const_iterator aIt;
375 bool isSkipSelf = false;
376 for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) {
377 if ((*aIt) == aResult) {
390 //********************************************************************
391 bool ModuleBase_WidgetMultiSelector::processDelete()
393 // find attribute indices to delete
394 std::set<int> anAttributeIds;
395 getSelectedAttributeIndices(anAttributeIds);
397 // refill attribute by the items which indices are not in the list of ids
399 DataPtr aData = myFeature->data();
400 AttributePtr anAttribute = aData->attribute(attributeID());
401 std::string aType = anAttribute->attributeType();
402 aDone = !anAttributeIds.empty();
403 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
404 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
405 aSelectionListAttr->remove(anAttributeIds);
408 else if (aType == ModelAPI_AttributeRefList::typeId()) {
409 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
410 aRefListAttr->remove(anAttributeIds);
412 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
413 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
414 aRefAttrListAttr->remove(anAttributeIds);
418 // update object is necessary to flush update signal. It leads to objects references map update
419 // and the operation presentation will not contain deleted items visualized as parameters of
421 updateObject(myFeature);
424 myWorkshop->setSelected(getAttributeSelection());
429 //********************************************************************
430 QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
432 QList<QWidget*> result;
433 //result << myTypeCombo;
434 result << myListControl;
438 //********************************************************************
439 void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
441 activateSelectionAndFilters(true);
442 QList<ModuleBase_ViewerPrs> anEmptyList;
443 // This method will call Selection changed event which will call onSelectionChanged
444 // To clear mySelection, myListControl and storeValue()
445 // So, we don't need to call it
446 myWorkshop->setSelected(anEmptyList);
449 void ModuleBase_WidgetMultiSelector::updateFocus()
451 // Set focus to List control in order to make possible
452 // to use Tab key for transfer the focus to next widgets
453 myListControl->setCurrentRow(myListControl->model()->rowCount() - 1);
454 ModuleBase_Tools::setFocus(myListControl,
455 "ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()");
458 //********************************************************************
459 void ModuleBase_WidgetMultiSelector::updateSelectionName()
463 //********************************************************************
464 QIntList ModuleBase_WidgetMultiSelector::getShapeTypes() const
466 QIntList aShapeTypes;
468 if (myTypeCombo->count() > 1 && myIsUseChoice) {
469 aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->currentText()));
472 for (int i = 0, aCount = myTypeCombo->count(); i < aCount; i++) {
473 TopAbs_ShapeEnum aType = ModuleBase_Tools::shapeType(myTypeCombo->itemText(i));
474 aShapeTypes.append(aType);
475 if (aType == TopAbs_SOLID)
476 aShapeTypes.append(TopAbs_COMPSOLID);
482 //********************************************************************
483 void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const TopAbs_ShapeEnum theShapeType)
485 QString aShapeTypeName;
487 for (int idx = 0; idx < myTypeCombo->count(); ++idx) {
488 aShapeTypeName = myTypeCombo->itemText(idx);
489 TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
490 if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
491 activateSelectionAndFilters(false);
492 bool isBlocked = myTypeCombo->blockSignals(true);
493 myTypeCombo->setCurrentIndex(idx);
494 myTypeCombo->blockSignals(isBlocked);
496 activateSelectionAndFilters(true);
502 QList<ModuleBase_ViewerPrs> ModuleBase_WidgetMultiSelector::getAttributeSelection() const
504 QList<ModuleBase_ViewerPrs> aSelected;
505 convertIndicesToViewerSelection(std::set<int>(), aSelected);
509 //********************************************************************
510 void ModuleBase_WidgetMultiSelector::updateSelectionList()
512 myListControl->clear();
514 DataPtr aData = myFeature->data();
515 AttributePtr anAttribute = aData->attribute(attributeID());
516 std::string aType = anAttribute->attributeType();
517 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
518 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
519 for (int i = 0; i < aSelectionListAttr->size(); i++) {
520 AttributeSelectionPtr aAttr = aSelectionListAttr->value(i);
521 QListWidgetItem* anItem = new QListWidgetItem(aAttr->namingName().c_str(), myListControl);
522 anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
523 myListControl->addItem(anItem);
526 else if (aType == ModelAPI_AttributeRefList::typeId()) {
527 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
528 for (int i = 0; i < aRefListAttr->size(); i++) {
529 ObjectPtr anObject = aRefListAttr->object(i);
530 if (anObject.get()) {
531 QListWidgetItem* anItem = new QListWidgetItem(anObject->data()->name().c_str(),
533 anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
534 myListControl->addItem(anItem);
538 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
539 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
540 for (int i = 0; i < aRefAttrListAttr->size(); i++) {
541 AttributePtr anAttribute = aRefAttrListAttr->attribute(i);
543 if (anAttribute.get()) {
544 std::string anAttrName = generateName(anAttribute, myWorkshop);
545 aName = QString::fromStdString(anAttrName);
548 ObjectPtr anObject = aRefAttrListAttr->object(i);
549 if (anObject.get()) {
550 aName = anObject->data()->name().c_str();
553 QListWidgetItem* anItem = new QListWidgetItem(aName, myListControl);
554 anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
555 myListControl->addItem(anItem);
559 // We have to call repaint because sometimes the List control is not updated
560 myListControl->repaint();
563 //********************************************************************
564 std::string ModuleBase_WidgetMultiSelector::validatorType(const QString& theType) const
568 if (theType == "Vertices")
570 else if (theType == "Edges")
572 else if (theType == "Faces")
574 else if (theType == "Solids")
580 //********************************************************************
581 void ModuleBase_WidgetMultiSelector::onCopyItem()
583 QList<QListWidgetItem*> aItems = myListControl->selectedItems();
585 foreach(QListWidgetItem* aItem, aItems) {
588 aRes += aItem->text();
590 if (!aRes.isEmpty()) {
591 QClipboard *clipboard = QApplication::clipboard();
592 clipboard->setText(aRes);
596 //********************************************************************
597 void ModuleBase_WidgetMultiSelector::onDeleteItem()
602 //********************************************************************
603 void ModuleBase_WidgetMultiSelector::onListSelection()
605 QList<QListWidgetItem*> aItems = myListControl->selectedItems();
606 myCopyAction->setEnabled(!aItems.isEmpty());
607 myDeleteAction->setEnabled(!aItems.isEmpty());
609 myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeHighlightedObjects,
613 //********************************************************************
614 void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices(std::set<int>& theAttributeIds)
616 QList<QListWidgetItem*> aItems = myListControl->selectedItems();
617 foreach(QListWidgetItem* anItem, aItems) {
618 int anIndex = anItem->data(ATTRIBUTE_SELECTION_INDEX_ROLE).toInt();
619 if (theAttributeIds.find(anIndex) == theAttributeIds.end())
620 theAttributeIds.insert(anIndex);
624 void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<int> theAttributeIds,
625 QList<ModuleBase_ViewerPrs>& theValues) const
627 if(myFeature.get() == NULL)
630 DataPtr aData = myFeature->data();
631 AttributePtr anAttribute = aData->attribute(attributeID());
632 std::string aType = anAttribute->attributeType();
633 if (aType == ModelAPI_AttributeSelectionList::typeId()) {
634 AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
635 for (int i = 0; i < aSelectionListAttr->size(); i++) {
636 // filter by attribute indices only if the container is not empty otherwise return all items
637 if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end())
639 AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
640 ResultPtr anObject = anAttr->context();
641 if (anObject.get()) {
643 std::shared_ptr<GeomAPI_Shape> aShapePtr = anAttr->value();
644 if (aShapePtr.get()) {
645 aShape = aShapePtr->impl<TopoDS_Shape>();
647 theValues.append(ModuleBase_ViewerPrs(anObject, aShape, NULL));
651 else if (aType == ModelAPI_AttributeRefList::typeId()) {
652 AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
653 for (int i = 0; i < aRefListAttr->size(); i++) {
654 // filter by attribute indices only if the container is not empty otherwise return all items
655 if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end())
657 ObjectPtr anObject = aRefListAttr->object(i);
658 if (anObject.get()) {
659 theValues.append(ModuleBase_ViewerPrs(anObject, TopoDS_Shape(), NULL));
663 else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
664 AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID());
665 for (int i = 0; i < aRefAttrListAttr->size(); i++) {
666 // filter by attribute indices only if the container is not empty otherwise return all items
667 if (!theAttributeIds.empty() && theAttributeIds.find(i) == theAttributeIds.end())
669 ObjectPtr anObject = aRefAttrListAttr->object(i);
673 AttributePtr anAttribute = aRefAttrListAttr->attribute(i);
674 if (anAttribute.get()) {
675 GeomShapePtr aGeomShape = myWorkshop->module()->findShape(anAttribute);
676 if (aGeomShape.get()) {
677 aShape = aGeomShape->impl<TopoDS_Shape>();
679 theValues.append(ModuleBase_ViewerPrs(anObject, aShape, NULL));