return;
myRefsToMe.insert(theFeature->data()->attribute(theAttrID));
- if (theApplyConcealment &&
+ if (theApplyConcealment && theFeature->isStable() &&
ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {
std::shared_ptr<ModelAPI_Result> aRes =
std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
aLoop->registerListener(this, kOpAbortEvent);
static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation");
aLoop->registerListener(this, kOpStartEvent);
+ static const Events_ID kStabilityEvent = aLoop->eventByName(EVENT_STABILITY_CHANGED);
+ aLoop->registerListener(this, kStabilityEvent);
/* not needed now with history line
Config_PropManager::registerProp("Model update", "automatic_rebuild", "Rebuild immediately",
static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation");
static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation");
static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation");
+ static const Events_ID kStabilityEvent = aLoop->eventByName(EVENT_STABILITY_CHANGED);
#ifdef DEB_UPDATE
std::cout<<"****** Event "<<theMessage->eventID().eventText()<<std::endl;
#endif
+ if (theMessage->eventID() == kStabilityEvent)
+ updateStability(theMessage->sender());
if (theMessage->eventID() == kChangedEvent) { // automatic and manual rebuild flag is changed
/*bool aPropVal =
Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
redisplayWithResults(theFeature, aState);
}
+void Model_Update::updateStability(void* theSender)
+{
+ ModelAPI_Object* aSender = static_cast<ModelAPI_Object*>(theSender);
+ if (aSender && aSender->document()) {
+ Model_Objects* aDocObjects =
+ std::dynamic_pointer_cast<Model_Document>(aSender->document())->objects();
+ if (aDocObjects) {
+ aDocObjects->synchronizeBackRefs();
+ }
+ }
+}
+
///////////////// Updated items iterator ////////////////////////
Model_Update::IterationItem::IterationItem(std::shared_ptr<ModelAPI_CompositeFeature> theFeature)
{
/// Returns true if the feature is older that the argument and it must be updated
bool isOlder(std::shared_ptr<ModelAPI_Feature> theFeature,
std::shared_ptr<ModelAPI_Object> theArgument);
+ /// Updates the properties of object because of stability state changes
+ void updateStability(void* theSender);
};
#endif
/// Event ID that order of objects in group is changed, so, tree must be fully rectreated (movement of feature)
static const char * EVENT_ORDER_UPDATED = "OrderUpdated";
+/// Event ID that informs that some object has changed the stability
+static const char * EVENT_STABILITY_CHANGED = "StabilityChanged";
+
/// Message that feature was changed (used for Object Browser update): moved, updated and deleted
class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
{
{
if (myIsStable != theFlag) {
myIsStable = theFlag;
+ // send an event about the stability change (editing is started/finished)
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID EVENT_STAB = aLoop->eventByName(EVENT_STABILITY_CHANGED);
+ std::shared_ptr<Events_Message> aMessage(new Events_Message(EVENT_STAB, this));
+ aLoop->send(aMessage, false);
return true;
}
return false;