From: mpv Date: Fri, 19 Sep 2014 12:40:10 +0000 (+0400) Subject: No automatic rebuild: only on preview. Update of visualization behavior due to the... X-Git-Tag: V_0.4.4~41^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=85a3a34f6b8a9e925f4055e874c1e7f8833f0ac3;p=modules%2Fshaper.git No automatic rebuild: only on preview. Update of visualization behavior due to the rebuilding mechanism. --- diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index 4e14efc0a..134516972 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -20,7 +20,7 @@ void Model_AttributeReference::setValue(ObjectPtr theObject) boost::shared_ptr aDoc = boost::dynamic_pointer_cast(owner()->document()); - if (aDoc) aDoc->objectIsNotReferenced(aDoc->object(myRef->Label())); + if (aDoc) aDoc->objectIsNotReferenced(aDoc->object(myRef->Get())); myRef->Set(aData->label().Father()); // references to the feature label boost::shared_dynamic_cast(owner()->document())->objectIsReferenced(theObject); @@ -48,9 +48,21 @@ Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel) if (!myIsInitialized) { myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized references to itself } else { + if (owner()) { + boost::shared_ptr aDoc = + boost::dynamic_pointer_cast(owner()->document()); + if (aDoc) aDoc->objectIsReferenced(aDoc->object(myRef->Get())); + } + } +} + +void Model_AttributeReference::setObject(const boost::shared_ptr& theObject) +{ + if (owner() != theObject) { + ModelAPI_AttributeReference::setObject(theObject); boost::shared_ptr aDoc = boost::dynamic_pointer_cast(owner()->document()); - if (aDoc) aDoc->objectIsReferenced(aDoc->object(myRef->Label())); + if (aDoc) aDoc->objectIsReferenced(aDoc->object(myRef->Get())); } } @@ -58,5 +70,6 @@ Model_AttributeReference::~Model_AttributeReference() { boost::shared_ptr aDoc = boost::dynamic_pointer_cast(owner()->document()); - if (aDoc) aDoc->objectIsNotReferenced(aDoc->object(myRef->Label())); + TDF_Label aLab = myRef->Get(); + if (aDoc && !aLab.IsNull()) aDoc->objectIsNotReferenced(aDoc->object(myRef->Get())); } diff --git a/src/Model/Model_AttributeReference.h b/src/Model/Model_AttributeReference.h index e8f9c9997..d9993f99a 100644 --- a/src/Model/Model_AttributeReference.h +++ b/src/Model/Model_AttributeReference.h @@ -28,6 +28,8 @@ class Model_AttributeReference : public ModelAPI_AttributeReference MODEL_EXPORT ~Model_AttributeReference(); + MODEL_EXPORT virtual void setObject(const boost::shared_ptr& theObject); + protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel); diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 4adcc0aa6..57241b6b5 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -461,13 +461,22 @@ static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced, co void Model_Document::removeFeature(FeaturePtr theFeature) { + // check the feature: it must have no depended objects on it + std::list::const_iterator aResIter = theFeature->results().cbegin(); + for(; aResIter != theFeature->results().cend(); aResIter++) { + if (myConcealedResults.find(*aResIter) != myConcealedResults.end()) { + Events_Error::send("Feature '" + theFeature->data()->name() + "' is used and can not be deleted"); + return; + } + } boost::shared_ptr aData = boost::static_pointer_cast(theFeature->data()); TDF_Label aFeatureLabel = aData->label().Father(); if (myObjs.IsBound(aFeatureLabel)) myObjs.UnBind(aFeatureLabel); else return; // not found feature => do not remove - + // erase fields + theFeature->erase(); // erase all attributes under the label of feature aFeatureLabel.ForgetAllAttributes(); // remove it from the references array @@ -475,6 +484,7 @@ void Model_Document::removeFeature(FeaturePtr theFeature) // event: feature is deleted ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), ModelAPI_Feature::group()); + /* this is in "erase" // results of this feature must be redisplayed static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); const std::list >& aResults = theFeature->results(); @@ -485,6 +495,7 @@ void Model_Document::removeFeature(FeaturePtr theFeature) ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP); ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), aRes->groupName()); } + */ } FeaturePtr Model_Document::feature(TDF_Label& theLabel) @@ -745,14 +756,17 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); const std::list >& aResults = aFeature->results(); std::list >::const_iterator aRIter = aResults.begin(); + /* for (; aRIter != aResults.cend(); aRIter++) { boost::shared_ptr aRes = *aRIter; //aRes->setData(boost::shared_ptr()); // deleted flag ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP); ModelAPI_EventCreator::get()->sendDeleted(aThis, aRes->groupName()); } + */ // redisplay also removed feature (used for sketch and AISObject) ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP); + aFeature->erase(); } else aFIter.Next(); } @@ -913,6 +927,11 @@ void Model_Document::objectIsReferenced(const ObjectPtr& theObject) boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_ResultBody::group()); + + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + aECreator->sendUpdated(aResult, EVENT_DISP); } } } @@ -924,11 +943,12 @@ void Model_Document::objectIsNotReferenced(const ObjectPtr& theObject) if (aResult) { std::set::iterator aFind = myConcealedResults.find(aResult); if (aFind != myConcealedResults.end()) { + ResultPtr aFeature = *aFind; myConcealedResults.erase(aFind); boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); - ModelAPI_EventCreator::get()->sendUpdated(*aFind, anEvent, false); + ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent, false); } else { Events_Error::send(std::string("The object '") + aResult->data()->name() + "' was not referenced '"); diff --git a/src/Model/Model_Events.cpp b/src/Model/Model_Events.cpp index 0d421704b..421c493e2 100644 --- a/src/Model/Model_Events.cpp +++ b/src/Model/Model_Events.cpp @@ -39,7 +39,7 @@ Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage(const ObjectPtr& theObjec myObjects.insert(theObject); } -std::set Model_ObjectUpdatedMessage::objects() const +const std::set& Model_ObjectUpdatedMessage::objects() const { return myObjects; } diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 74d38a7fd..f30c44790 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -36,7 +36,7 @@ class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage public: /// Returns the feature that has been updated - virtual std::set objects() const; + virtual const std::set& objects() const; //! Creates a new empty group (to store it in the loop before flush) virtual boost::shared_ptr newEmpty(); diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index d6503ee76..51f97e0f7 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -46,11 +46,17 @@ void Model_Session::startOperation() void Model_Session::finishOperation() { ROOT_DOC->finishOperation(); + static boost::shared_ptr aFinishMsg + (new Events_Message(Events_Loop::eventByName("FinishOperation"))); + Events_Loop::loop()->send(aFinishMsg); } void Model_Session::abortOperation() { ROOT_DOC->abortOperation(); + static boost::shared_ptr anAbortMsg + (new Events_Message(Events_Loop::eventByName("AbortOperation"))); + Events_Loop::loop()->send(anAbortMsg); } bool Model_Session::isOperation() diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 70d977330..34637a08c 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -22,14 +22,22 @@ using namespace std; Model_Update MY_INSTANCE; /// the only one instance initialized on load of the library -Model_Update::Model_Update() : isCreated(false) +Model_Update::Model_Update() { - static const Events_ID kChangedEvent = Events_Loop::loop()->eventByName("PreferenceChanged"); - Events_Loop::loop()->registerListener(this, kChangedEvent); - static const Events_ID kRebuildEvent = Events_Loop::loop()->eventByName("Rebuild"); - Events_Loop::loop()->registerListener(this, kRebuildEvent); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop* aLoop = Events_Loop::loop(); + static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged"); + aLoop->registerListener(this, kChangedEvent); + static const Events_ID kRebuildEvent = aLoop->eventByName("Rebuild"); + aLoop->registerListener(this, kRebuildEvent); + static const Events_ID kCreatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED); + aLoop->registerListener(this, kCreatedEvent); + static const Events_ID kUpdatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED); + aLoop->registerListener(this, kUpdatedEvent); + static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation"); + aLoop->registerListener(this, kOpFinishEvent); + static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation"); + aLoop->registerListener(this, kOpAbortEvent); + Config_PropManager::registerProp("Model update", "automatic_rebuild", "Rebuild automatically", Config_Prop::Bool, "false"); isAutomatic = Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true"; @@ -37,8 +45,13 @@ Model_Update::Model_Update() : isCreated(false) void Model_Update::processEvent(const boost::shared_ptr& theMessage) { - static const Events_ID kChangedEvent = Events_Loop::loop()->eventByName("PreferenceChanged"); - static const Events_ID kRebuildEvent = Events_Loop::loop()->eventByName("Rebuild"); + static Events_Loop* aLoop = Events_Loop::loop(); + static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged"); + static const Events_ID kRebuildEvent = aLoop->eventByName("Rebuild"); + static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); + static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); + static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation"); + static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation"); bool isAutomaticChanged = false; if (theMessage->eventID() == kChangedEvent) { // automatic and manual rebuild flag is changed isAutomatic = @@ -48,12 +61,20 @@ void Model_Update::processEvent(const boost::shared_ptr& theMess isAutomaticChanged = true; isAutomatic = true; } + } else if (theMessage->eventID() == kCreatedEvent || theMessage->eventID() == kUpdatedEvent) { + boost::shared_ptr aMsg = + boost::dynamic_pointer_cast(theMessage); + const std::set& anObjs = aMsg->objects(); + std::set::const_iterator anObjIter = anObjs.cbegin(); + for(; anObjIter != anObjs.cend(); anObjIter++) + myJustCreatedOrUpdated.insert(*anObjIter); + } else if (theMessage->eventID() == kOpFinishEvent || theMessage->eventID() == kOpAbortEvent) { + myJustCreatedOrUpdated.clear(); + return; } if (isExecuted) return; // nothing to do: it is executed now - // execute just created features anyway - isCreated = theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_CREATED); //Events_LongOp::start(this); isExecuted = true; @@ -86,11 +107,10 @@ void Model_Update::processEvent(const boost::shared_ptr& theMess } myUpdated.clear(); // flush - static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - Events_Loop::loop()->flush(EVENT_DISP); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + aLoop->flush(EVENT_DISP); //Events_LongOp::end(this); if (isAutomaticChanged) isAutomatic = false; - isCreated = false; isExecuted = false; } @@ -153,18 +173,30 @@ bool Model_Update::updateFeature(FeaturePtr theFeature) !theFeature->isPersistentResult()) { ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); if (aFactory->validate(theFeature)) { - if (isAutomatic || (isCreated && myInitial.find(theFeature) != myInitial.end()) || + if (isAutomatic || (myJustCreatedOrUpdated.find(theFeature) != myJustCreatedOrUpdated.end()) || !theFeature->isPersistentResult() /* execute quick, not persistent results */) { try { theFeature->execute(); - theFeature->data()->mustBeUpdated(false); } catch(...) { Events_Error::send( "Feature " + theFeature->getKind() + " has failed during the execution"); theFeature->eraseResults(); } + theFeature->data()->mustBeUpdated(false); + const std::list >& aResults = theFeature->results(); + std::list >::const_iterator aRIter = aResults.begin(); + for (; aRIter != aResults.cend(); aRIter++) { + boost::shared_ptr aRes = *aRIter; + aRes->data()->mustBeUpdated(false); + } } else { theFeature->data()->mustBeUpdated(true); + const std::list >& aResults = theFeature->results(); + std::list >::const_iterator aRIter = aResults.begin(); + for (; aRIter != aResults.cend(); aRIter++) { + boost::shared_ptr aRes = *aRIter; + aRes->data()->mustBeUpdated(true); + } aMustbeUpdated = false; } } else { diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index ff3e67660..f73378580 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -28,8 +28,9 @@ class Model_Update : public Events_Listener bool isExecuted; /// to know execute or not automatically all update bool isAutomatic; - /// execute just created features for sure - bool isCreated; + /// just created features: they must be updated immideately even in not-automatic mode for + /// preview; cleared on commit operations + std::set > myJustCreatedOrUpdated; public: /// Is called only once, on startup of the application diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index a73044d4a..c54b39556 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -34,7 +34,7 @@ class ModelAPI_Attribute } /// Sets the owner of this attribute - MODELAPI_EXPORT void setObject(const boost::shared_ptr& theObject) + MODELAPI_EXPORT virtual void setObject(const boost::shared_ptr& theObject) { myObject = theObject; } diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index b2b9add75..7345815e2 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -41,7 +41,7 @@ class ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup public: /// Returns the feature that has been updated - virtual std::set objects() const = 0; + virtual const std::set& objects() const = 0; //! Creates a new empty group (to store it in the loop before flush) virtual boost::shared_ptr newEmpty() = 0; diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index aec952e79..b3dc06045 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -64,12 +64,18 @@ void ModelAPI_Feature::removeResult(const boost::shared_ptr& th { std::list >::iterator aResIter = myResults.begin(); for(; aResIter != myResults.end(); aResIter++) { - if (*aResIter == theResult) { - std::string aGroup = (*aResIter)->groupName(); - (*aResIter)->data()->erase(); + ResultPtr aRes = *aResIter; + if (aRes == theResult) { + std::string aGroup = aRes->groupName(); + aRes->data()->erase(); myResults.erase(aResIter); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); ModelAPI_EventCreator::get()->sendDeleted(document(), aGroup); + aECreator->sendUpdated(aRes, EVENT_DISP); break; } } @@ -78,14 +84,19 @@ void ModelAPI_Feature::removeResult(const boost::shared_ptr& th void ModelAPI_Feature::eraseResults() { if (!myResults.empty()) { - static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + std::list >::iterator aResIter = myResults.begin(); for(; aResIter != myResults.end(); aResIter++) { - (*aResIter)->data()->erase(); - ModelAPI_EventCreator::get()->sendDeleted(document(), (*aResIter)->groupName()); + (*aResIter)->data()->erase(); + ModelAPI_EventCreator::get()->sendDeleted(document(), (*aResIter)->groupName()); + aECreator->sendUpdated(*aResIter, EVENT_DISP); } myResults.clear(); // flush it to avoid left presentations after input of invalid arguments (radius=0) + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); Events_Loop::loop()->flush(anEvent); } } @@ -95,13 +106,24 @@ boost::shared_ptr ModelAPI_Feature::documentToAdd() return ModelAPI_Session::get()->activeDocument(); } -ModelAPI_Feature::~ModelAPI_Feature() +void ModelAPI_Feature::erase() { + static Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + while (!myResults.empty()) { // remove one by one with messages boost::shared_ptr aRes = *(myResults.begin()); myResults.erase(myResults.begin()); - ModelAPI_EventCreator::get()->sendDeleted(aRes->document(), aRes->groupName()); + aECreator->sendDeleted(aRes->document(), aRes->groupName()); + aECreator->sendUpdated(aRes, EVENT_DISP); } + ModelAPI_Object::erase(); +} + +ModelAPI_Feature::~ModelAPI_Feature() +{ + erase(); } FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject) diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 2c252429d..a6c51d040 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -61,6 +61,8 @@ class ModelAPI_Feature : public ModelAPI_Object MODELAPI_EXPORT void removeResult(const boost::shared_ptr& theResult); /// removes all results from the feature MODELAPI_EXPORT void eraseResults(); + /// removes all fields from this feature: results, data, etc + MODELAPI_EXPORT virtual void erase(); /// Returns true if result is persistent (stored in document) and on undo-redo, save-open /// it is not needed to recompute it. diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 2d4838c17..9241d9b65 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -6,6 +6,7 @@ #define ModelAPI_Object_H_ #include "ModelAPI.h" +#include "ModelAPI_Data.h" #include @@ -66,7 +67,14 @@ class ModelAPI_Object myDoc = theDoc; } + /// removes all fields from this feature + MODELAPI_EXPORT virtual void erase() { + if (myData) myData->erase(); + setData(DataPtr()); + } + friend class Model_Document; + }; typedef boost::shared_ptr ObjectPtr; diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 53a16851c..81a812ca5 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -798,7 +798,7 @@ bool SketchSolver_ConstraintGroup::updateGroup() bool isAllValid = true; bool isCCRemoved = false; // indicates that at least one of coincidence constraints was removed while (isAllValid && aConstrIter != myConstraintMap.rend()) { - if (!aConstrIter->first->data()->isValid()) { + if (!aConstrIter->first->data() || !aConstrIter->first->data()->isValid()) { if (aConstrIter->first->getKind().compare(SketchPlugin_ConstraintCoincidence::ID()) == 0) isCCRemoved = true; std::map, Slvs_hConstraint>::reverse_iterator aCopyIter = diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.h b/src/SketchSolver/SketchSolver_ConstraintGroup.h index 26b577201..42ce8ddd5 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.h +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.h @@ -46,7 +46,7 @@ class SketchSolver_ConstraintGroup /// \brief Check for valid sketch data inline bool isWorkplaneValid() const { - return mySketch->data()->isValid(); + return mySketch->data() && mySketch->data()->isValid(); } /** \brief Adds or updates a constraint in the group diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index e0692fc0b..58260b79c 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -114,6 +114,7 @@ bool XGUI_OperationMgr::validateOperation(ModuleBase_Operation* theOperation) { //Get operation feature to validate FeaturePtr aFeature = theOperation->feature(); + if (!aFeature) return true; // rename operation //Get validators for the Id SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); diff --git a/src/XGUI/XGUI_PartDataModel.cpp b/src/XGUI/XGUI_PartDataModel.cpp index c492229c9..66f8d8b96 100644 --- a/src/XGUI/XGUI_PartDataModel.cpp +++ b/src/XGUI/XGUI_PartDataModel.cpp @@ -78,8 +78,16 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const case ConstructFolder: return QIcon(":pictures/constr_folder.png"); case ConstructObject: - case BodiesObject: + case BodiesObject: { + DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); + std::string aGroup = theIndex.internalId() == ConstructObject ? + ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group(); + ObjectPtr anObject = aRootDoc->object(aGroup, theIndex.row()); + if (anObject && anObject->data() && anObject->data()->mustBeUpdated()) { + return QIcon(":pictures/constr_object_modified.png"); + } return QIcon(":pictures/constr_object.png"); + } } break; @@ -297,8 +305,15 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons case BodiesFolder: return QIcon(":pictures/constr_folder.png"); case ConstructObject: - case BodiesObject: + case BodiesObject: { + std::string aGroup = theIndex.internalId() == ConstructObject ? + ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group(); + ObjectPtr anObject = partDocument()->object(aGroup, theIndex.row()); + if (anObject && anObject->data() && anObject->data()->mustBeUpdated()) { + return QIcon(":pictures/constr_object_modified.png"); + } return QIcon(":pictures/constr_object.png"); + } case HistoryObject: { ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3); FeaturePtr aFeature = boost::dynamic_pointer_cast(aObject); diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index 07c5f4c92..dd4aa4808 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -34,6 +34,7 @@ pictures/params_folder.png pictures/constr_folder.png pictures/constr_object.png + pictures/constr_object_modified.png pictures/part_ico.png pictures/properties.png pictures/features.png diff --git a/src/XGUI/pictures/constr_object_modified.png b/src/XGUI/pictures/constr_object_modified.png new file mode 100644 index 000000000..966a6c967 Binary files /dev/null and b/src/XGUI/pictures/constr_object_modified.png differ