- else {
- FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get()) {
- std::list<AttributePtr> anAttributes = aFeature->data()->attributes("");
- std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
- for (; anIt != aLast; anIt++) {
- AttributePtr anAttribute = *anIt;
- ObjectPtr anObject = GeomValidators_Tools::getObject(anAttribute);
- if (anObject.get()) {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- if (aResult.get())
- aNewCustomized[aResult] = aShapeList;
- }
- else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
- std::shared_ptr<ModelAPI_AttributeSelectionList> aCurSelList =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
- for(int i = 0; i < aCurSelList->size(); i++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
- ObjectPtr anObject = GeomValidators_Tools::getObject(aSelAttribute);
- if (anObject.get()) {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- if (aResult.get())
- aNewCustomized[aResult] = aShapeList;
- }
- }
- }
- }
- }
+ return isModified;
+}
+
+bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
+{
+ myIsActive[theFlag] = false;
+ erasePresentation(theFlag, theUpdateViewer);
+ return true;
+}
+
+bool PartSet_CustomPrs::displayPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
+{
+ bool isModified = false;
+
+ if (myDisabledMode == theFlag)
+ return isModified;
+
+ // update the AIS objects content
+ AISObjectPtr aPresentation = getPresentation(theFlag, true);
+ Handle(AIS_InteractiveObject) anAISIO = aPresentation->impl<Handle(AIS_InteractiveObject)>();
+ Handle(PartSet_OperationPrs) anOperationPrs = Handle(PartSet_OperationPrs)::DownCast(anAISIO);
+
+ // do nothing if the feature can not be displayed [is moved from presentation, to be checked]
+ if (!myFeature.get())
+ return isModified;
+
+ QMap<ObjectPtr, QList<GeomShapePtr> > aFeatureShapes;
+ switch (theFlag) {
+ case ModuleBase_IModule::CustomizeArguments:
+ PartSet_OperationPrs::getFeatureShapes(myFeature, myWorkshop, aFeatureShapes);
+ break;
+ case ModuleBase_IModule::CustomizeResults:
+ PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, aFeatureShapes);
+ PartSet_OperationPrs::getPresentationShapes(myFeature, myWorkshop, aFeatureShapes, false);
+ break;
+ case ModuleBase_IModule::CustomizeHighlightedObjects:
+ PartSet_OperationPrs::getHighlightedShapes(myWorkshop, aFeatureShapes);
+ break;
+ default:
+ return isModified;