]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Don't add the feature on iteration: bug fix
authormpv <mikhail.ponikarov@opencascade.com>
Fri, 4 Apr 2014 13:41:54 +0000 (17:41 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Fri, 4 Apr 2014 13:41:54 +0000 (17:41 +0400)
src/Model/Model_AttributeDouble.cxx
src/Model/Model_Document.cxx
src/Model/Model_PluginManager.cxx
src/Model/Model_PluginManager.h
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_Plugin.h
src/ModelAPI/ModelAPI_PluginManager.h
src/PartSetPlugin/PartSetPlugin_Plugin.cxx
src/PartSetPlugin/PartSetPlugin_Plugin.h

index 7e2ed83e183ddfc4c4b5a502cd7afb7864e5adf0..23e15f0e1ad9457e92570a83dec685aa67ed0314 100644 (file)
@@ -24,4 +24,3 @@ Model_AttributeDouble::Model_AttributeDouble(TDF_Label& theLabel)
     myReal = TDataStd_Real::Set(theLabel, 0.);
   }
 }
-
index d435a01277fec031419267bc3c0c494bb74928ad..8ae42585b7e73eb99630932d8d5b60f7501ba501 100644 (file)
@@ -177,7 +177,8 @@ std::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
   Handle(TDataStd_Comment) aFeatureID;
   if (theLabel.FindAttribute(TDataStd_Comment::GetID(), aFeatureID)) {
     string anID(TCollection_AsciiString(aFeatureID->Get()).ToCString());
-    std::shared_ptr<ModelAPI_Feature> aResult = Model_PluginManager::get()->createFeature(anID);
+    std::shared_ptr<ModelAPI_Feature> aResult = 
+      Model_PluginManager::get()->createFeature(anID, false);
     std::shared_ptr<Model_Object> aData(new Model_Object);
     aData->setLabel(theLabel);
     aResult->setData(aData);
index ce53ba069235590fa25c98e975f96dcbafcebf57..4c3e3da6d98bed9d746e067c366b167ac0f4480d 100644 (file)
@@ -16,7 +16,8 @@ using namespace std;
 
 static Model_PluginManager* myImpl = new Model_PluginManager();
 
-std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(
+  string theFeatureID, const bool theAddToDoc)
 {
   if (this != myImpl) return myImpl->createFeature(theFeatureID);
 
@@ -29,7 +30,7 @@ std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theF
     }
     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
       std::shared_ptr<ModelAPI_Feature> aCreated = 
-        myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
+        myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID, theAddToDoc);
       return aCreated;
     }
   }
index c0cc31e5f4232af4aecd1e076fa1d3d9d29d5eaa..64811f82f48bb751d6a7a534de40046fcde4f6cf 100644 (file)
@@ -28,7 +28,8 @@ class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
   std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
 public:
   /// Creates the feature object using plugins functionality
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+    std::string theFeatureID, const bool theAddToDoc = true);
 
   /// Returns the root document of the application (that may contains sub-documents)
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> rootDocument();
index ad58d4228849d4ab6ebe79c500a7af6f952d5e42..96d4414a9e9e37518e188fdc4dcf09f07da48c65 100644 (file)
@@ -9,6 +9,7 @@
   #include "ModelAPI_Attribute.h"
   #include "ModelAPI_AttributeDocRef.h"
   #include "ModelAPI_AttributeDouble.h"
+  #include "ModelAPI_Iterator.h"
 %}
 
 // to avoid error on this
@@ -28,6 +29,7 @@
 %shared_ptr(ModelAPI_Attribute)
 %shared_ptr(ModelAPI_AttributeDocRef)
 %shared_ptr(ModelAPI_AttributeDouble)
+%shared_ptr(ModelAPI_Iterator)
 
 // all supported interfaces
 %include "ModelAPI_Document.h"
@@ -37,3 +39,4 @@
 %include "ModelAPI_Attribute.h"
 %include "ModelAPI_AttributeDocRef.h"
 %include "ModelAPI_AttributeDouble.h"
+%include "ModelAPI_Iterator.h"
index 0605d8b6f1997c5bedc6f5a18b965ec709dc5e71..f26cab7b0d794df8c6c0a8921f065d3e94edb707 100644 (file)
@@ -20,7 +20,8 @@ class MODELAPI_EXPORT ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+    std::string theFeatureID, const bool theAddToDoc) = 0;
 
 protected:
   /// Is needed for python wrapping by swig
index 34e5cca94d86107731235dd0cc50172140ca623d..fdf8e69eb47f0c84e70c48b70c7e31da52a60c76 100644 (file)
@@ -24,7 +24,8 @@ class MODELAPI_EXPORT ModelAPI_PluginManager
 {
 public:
   /// Creates the feature object using plugins functionality
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID,
+    const bool theAddToDoc = true) = 0;
 
   /// Returns the real implementation (the alone instance per application) of the plugin manager
   static std::shared_ptr<ModelAPI_PluginManager> get();
index c1998aefa4ffe117e1eab7afbcbd663e5e8453ed..89f7084fa432843c489f66fee7f0eb7608c21687 100644 (file)
@@ -15,7 +15,8 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin()
   ModelAPI_PluginManager::get()->registerPlugin(this);
 }
 
-std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(
+  string theFeatureID, const bool theAddToDoc)
 {
   std::shared_ptr<ModelAPI_Feature> aCreated;
   bool isCurrent = true; // to create a feature in the current document
@@ -27,7 +28,7 @@ std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string the
   }
 
   // add to a root document for the current moment
-  if (aCreated) {
+  if (aCreated && theAddToDoc) {
     shared_ptr<ModelAPI_Document> aDoc = isCurrent ? 
       ModelAPI_PluginManager::get()->currentDocument() :
       ModelAPI_PluginManager::get()->rootDocument();
index 74f6e73c02d90caa136d918152b0ce52d2f5c650..a4c7e336da1c6cc755d351a9698d0b08c11f4396 100644 (file)
@@ -13,7 +13,8 @@ class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+    std::string theFeatureID, const bool theAddToDoc);
 
 public:
   /// Is needed for python wrapping by swig