- synchronizeRegistered();
-}
-
-void FeaturesPlugin_Recover::attributeChanged(const std::string& theID)
-{
- synchronizeRegistered();
-}
-
-void FeaturesPlugin_Recover::synchronizeRegistered()
-{
- FeaturePtr aBase = baseFeature();
- bool aNewPersistent = boolean(PERSISTENT())->value();
- if (aNewPersistent != myPersistent || myCurrentBase != aBase)
- clearRegistered();
-
- std::set<ObjectPtr> aRecoveredInList;
- // add unconcealed which are not in the myRegistered map
- if (isStable() && !isDisabled()) { // if unstable, clear any unconcealment effect
- AttributeRefListPtr aRecovered = reflist(RECOVERED_ENTITIES());
- for(int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) {
- ObjectPtr anObj = aRecovered->object(anIndex);
- aRecoveredInList.insert(anObj);
- if (myRegistered.find(anObj) == myRegistered.end()) {
- // not found, so register a new
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aRes.get()) { // this may be on first update after "open"
- ModelAPI_Session::get()->validators()->registerUnconcealment(
- aRes, aNewPersistent ? FeaturePtr() : aBase);
- myRegistered.insert(anObj);
- }
- }
+ int aResultIndex = 0;
+ AttributeRefListPtr aRecovered = reflist(RECOVERED_ENTITIES());
+ for(int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) {
+ ObjectPtr anObj = aRecovered->object(anIndex);
+ if (!anObj.get())
+ continue;
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+ if (!aResult.get())
+ continue;
+ GeomShapePtr aShape = aResult->shape();
+ if (!aShape.get())
+ continue;
+
+ // Copy shape.
+ GeomAlgoAPI_Copy aCopyAlgo(aShape);
+ // Check that algo is done.
+ if(!aCopyAlgo.isDone()) {
+ setError("Error: recover algorithm failed.");
+ return;