From: mpv Date: Mon, 7 Apr 2014 07:36:12 +0000 (+0400) Subject: Bugfix and set Point to the Construction groups X-Git-Tag: V_0.1~31^2~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a9c07049e97c5253bd92bc0bb4f2a1dcdd5dd7c4;p=modules%2Fshaper.git Bugfix and set Point to the Construction groups --- diff --git a/src/Model/Model_Document.cxx b/src/Model/Model_Document.cxx index 8ae42585b..38f05c85f 100644 --- a/src/Model/Model_Document.cxx +++ b/src/Model/Model_Document.cxx @@ -207,6 +207,11 @@ shared_ptr Model_Document::feature(const string& theGroupID, c return anIter->current(); } +const vector& Model_Document::getGroups() const +{ + return myGroupsNames; +} + Model_Document::Model_Document(const std::string theID) : myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format { @@ -218,6 +223,7 @@ TDF_Label Model_Document::groupLabel(const string theGroup) { if (myGroups.find(theGroup) == myGroups.end()) { myGroups[theGroup] = myDoc->Main().FindChild(TAG_OBJECTS).NewChild(); + myGroupsNames.push_back(theGroup); } return myGroups[theGroup]; } diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index d96aa15dd..b1e863e3f 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -82,6 +82,9 @@ public: MODEL_EXPORT virtual std::shared_ptr feature(const std::string& theGroupID, const int theIndex); + ///! Returns the vector of groups already added to the document + MODEL_EXPORT virtual const std::vector& getGroups() const; + protected: //! Returns (creates if needed) the group label @@ -102,6 +105,7 @@ private: Handle_TDocStd_Document myDoc; ///< OCAF document int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method std::map myGroups; ///< root labels of the features groups identified by names + std::vector myGroupsNames; ///< names of added groups to the document }; #endif diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index b06dd8899..e2be71f9e 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -8,6 +8,7 @@ #include #include #include +#include class ModelAPI_Feature; class ModelAPI_Iterator; @@ -89,6 +90,9 @@ public: MODELAPI_EXPORT virtual std::shared_ptr feature(const std::string& theGroupID, const int theIndex) = 0; + ///! Returns the vector of groups already added to the document + MODELAPI_EXPORT virtual const std::vector& getGroups() const = 0; + protected: /// Only for SWIG wrapping it is here MODELAPI_EXPORT ModelAPI_Document() diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx index 89f7084fa..7992ef085 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx @@ -20,11 +20,14 @@ std::shared_ptr PartSetPlugin_Plugin::createFeature( { std::shared_ptr aCreated; bool isCurrent = true; // to create a feature in the current document + std::string aGroup; if (theFeatureID == "Part") { aCreated = std::shared_ptr(new PartSetPlugin_Part); isCurrent = false; // allways create in the root document + aGroup = PARTS_GROUP; } else if (theFeatureID == "Point") { aCreated = std::shared_ptr(new PartSetPlugin_Point); + aGroup = CONSTRUCTIONS_GROUP; } // add to a root document for the current moment @@ -32,7 +35,7 @@ std::shared_ptr PartSetPlugin_Plugin::createFeature( shared_ptr aDoc = isCurrent ? ModelAPI_PluginManager::get()->currentDocument() : ModelAPI_PluginManager::get()->rootDocument(); - aDoc->addFeature(aCreated, PARTS_GROUP); + aDoc->addFeature(aCreated, aGroup); } // feature of such kind is not found return aCreated;