From: mpv Date: Tue, 15 Jul 2014 12:00:26 +0000 (+0400) Subject: Part debug X-Git-Tag: V_0.4.4~189 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=738202d71d28481246783cb71437b837c633a608;p=modules%2Fshaper.git Part debug --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 091e70c63..79406ba8c 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -358,13 +358,13 @@ FeaturePtr Model_Document::addFeature(std::string theID) initData(aFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS); // keep the feature ID to restore document later correctly TDataStd_Comment::Set(aFeatureLab, aFeature->getKind().c_str()); + setUniqueName(aFeature); myObjs[ModelAPI_Feature::group()].push_back(aFeature); // store feature in the history of features array if (aFeature->isInHistory()) { AddToRefArray(aFeaturesLab, aFeatureLab); } } - setUniqueName(aFeature); if (!aFeature->isAction()) {// do not add action to the data model // event: feature is added static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); @@ -698,7 +698,11 @@ void Model_Document::storeResult(boost::shared_ptr theFeatureData theResult->setDoc(aThis); initData(theResult, boost::dynamic_pointer_cast(theFeatureData)-> label().Father().FindChild(TAG_FEATURE_RESULTS), theResultIndex); - theResult->data()->setName(theFeatureData->name()); + if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); + ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent); + theResult->data()->setName(theFeatureData->name()); + } } boost::shared_ptr Model_Document::createConstruction( diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 0a1a7f5b0..2aebf34d9 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -97,10 +97,6 @@ public: virtual boost::shared_ptr createPart( const boost::shared_ptr& theFeatureData, const int theIndex = 0) = 0; - //! Allows to store the result in the data tree of the document (attaches 'data' of result to tree) - virtual void storeResult(boost::shared_ptr theFeatureData, - boost::shared_ptr theResult, const int theResultIndex = 0) = 0; - //! Returns a feature by result (owner of result) virtual boost::shared_ptr feature( const boost::shared_ptr& theResult) = 0; diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index 4c0d0dc11..362841fb7 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -31,9 +31,7 @@ void PartSetPlugin_Part::execute() // create a result only once if (results().empty()) { boost::shared_ptr aResult = document()->createPart(data()); - document()->storeResult(data(), aResult); - if (aResult->data()->name().empty()) - aResult->data()->setName(data()->name()); + setResult(aResult); } }