#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_IViewer.h>
#include <ModuleBase_Tools.h>
+#include <ModuleBase_Definitions.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
myIsActive = true;
activateShapeSelection();
+
+ QObjectPtrList anObjects;
+ // Restore selection in the viewer by the attribute selection list
+ if(myFeature) {
+ DataPtr aData = myFeature->data();
+ AttributeSelectionListPtr aListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
+ if (aListAttr) {
+ for (int i = 0; i < aListAttr->size(); i++) {
+ AttributeSelectionPtr anAttr = aListAttr->value(i);
+ ResultPtr anObject = anAttr->context();
+ if (anObject.get())
+ anObjects.append(anObject);
+ }
+ }
+ }
+ myWorkshop->setSelected(anObjects);
}
//********************************************************************
virtual ~PartSet_WidgetMultiSelector();
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return true; }
+
/// Set sketcher
/// \param theSketch a sketcher object
void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
if (isVisible(aResult)) {
AISObjectPtr anObj = myResult2AISObjectMap[aResult];
Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
- if (!anAIS.IsNull())
- aContext->SetSelected(anAIS, false);
+ if (!anAIS.IsNull()) {
+ // The methods are replaced in order to provide multi-selection, e.g. restore selection
+ // by activating multi selector widget. It also gives an advantage that the multi
+ // selection in OB gives multi-selection in the viewer
+ //aContext->SetSelected(anAIS, false);
+ aContext->AddOrRemoveSelected(anAIS, false);
+ }
}
}
} else {