+ std::string aValidatorID;
+ Events_InfoMessage anError;
+ return aFactory->validate(theAttribute, aValidatorID, anError);
+}
+
+//********************************************************************
+bool ModuleBase_WidgetValidated::isFilterActivated() const
+{
+ bool isActivated = false;
+
+ Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter();
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+
+ return aViewer->hasSelectionFilter(aSelFilter);
+}
+
+//********************************************************************
+void ModuleBase_WidgetValidated::selectionFilters(QIntList& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
+{
+ theSelectionFilters.Append(myWorkshop->validatorFilter());
+}
+
+//********************************************************************
+void ModuleBase_WidgetValidated::blockAttribute(const AttributePtr& theAttribute,
+ const bool& theToBlock,
+ bool& isFlushesActived,
+ bool& isAttributeSetInitializedBlocked,
+ bool& isAttributeSendUpdatedBlocked)
+{
+ blockFeatureAttribute(theAttribute, myFeature, theToBlock, isFlushesActived,
+ isAttributeSetInitializedBlocked, isAttributeSendUpdatedBlocked);
+}
+
+//********************************************************************
+void ModuleBase_WidgetValidated::blockFeatureAttribute(const AttributePtr& theAttribute,
+ const FeaturePtr& theFeature,
+ const bool& theToBlock,
+ bool& isFlushesActived,
+ bool& isAttributeSetInitializedBlocked,
+ bool& isAttributeSendUpdatedBlocked)
+{
+ Events_Loop* aLoop = Events_Loop::loop();
+ DataPtr aData = theFeature->data();
+ if (theToBlock) {
+ // blocks the flush signals to avoid the temporary objects visualization in the viewer
+ // they should not be shown in order to do not lose highlight by erasing them
+ isFlushesActived = aLoop->activateFlushes(false);
+
+ isAttributeSendUpdatedBlocked = aData->blockSendAttributeUpdated(true);
+ isAttributeSetInitializedBlocked = theAttribute->blockSetInitialized(true);
+ }
+ else {
+ aData->blockSendAttributeUpdated(isAttributeSendUpdatedBlocked, false);
+ theAttribute->blockSetInitialized(isAttributeSetInitializedBlocked);
+ aLoop->activateFlushes(isFlushesActived);
+ }
+}
+
+//********************************************************************
+void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
+ const bool theValid)
+{
+ GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr();
+ if (aShape.get()) {
+ if (theValid) {
+ const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
+ bool aValidPrsContains = myValidPrs.IsBound(aTDShape) &&
+ theValue.get()->isEqual(myValidPrs.Find(aTDShape).get());
+ if (!aValidPrsContains) {
+ #ifdef LIST_OF_VALID_PRS
+ myValidPrs.append(theValue);
+ #else
+ myValidPrs.Bind(aTDShape, theValue);
+ #endif
+ // the commented code will be useful when the valid state of the presentation
+ // will be changable between activate/deactivate. Currently it does not happen.
+ //if (anInvalidPrs)
+ // myInvalidPrs.removeOne(theValue);
+ }
+ }
+ else { // !theValid
+ if (aShape.get()) {
+ const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
+ bool anIValidPrsContains = myInvalidPrs.IsBound(aTDShape) &&
+ theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get());
+ if (!anIValidPrsContains) {
+ #ifdef LIST_OF_VALID_PRS
+ myInvalidPrs.append(theValue);
+ #else
+ myInvalidPrs.Bind(aTDShape, theValue);
+ #endif
+ //if (!aValidPrs)
+ // myValidPrs.removeOne(theValue);
+ }