Salome HOME
Issue #294 : remove dependency between the copied part and the original one
authormpv <mikhail.ponikarov@opencascade.com>
Tue, 23 Dec 2014 08:54:12 +0000 (11:54 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Tue, 23 Dec 2014 08:54:12 +0000 (11:54 +0300)
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
src/PartSetPlugin/PartSetPlugin_Duplicate.h

index 37ff14adda0865bf2aeae1e5087d5044c27ae6b7..35134c64b7aa2a43603aebea9975e7d6bc8f2b5c 100644 (file)
@@ -21,7 +21,6 @@ PartSetPlugin_Duplicate::PartSetPlugin_Duplicate()
 void PartSetPlugin_Duplicate::initAttributes()
 {
   PartSetPlugin_Part::initAttributes();
-  data()->addAttribute(ORIGIN_REF(), ModelAPI_AttributeRefAttr::type());
 
   std::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
   std::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
@@ -37,12 +36,13 @@ void PartSetPlugin_Duplicate::initAttributes()
   if (aSource) {
     std::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
         aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), data()->name());
-    data()->refattr(ORIGIN_REF())->setObject(aSource);
+  } else { // invalid part copy: do nothing, keep this in empty name
+    data()->setName("");
   }
 }
 
 void PartSetPlugin_Duplicate::execute()
 {
-  if (data()->refattr(ORIGIN_REF())->object())
+  if (!data()->name().empty())
     PartSetPlugin_Part::execute();
 }
index 9ace34a5c8270f11cb4dad6b42a5b40e5c418858..8217ed87453d30b375ad9b15f88f16469e4535a0 100644 (file)
@@ -23,12 +23,6 @@ class PartSetPlugin_Duplicate : public PartSetPlugin_Part
     return MY_DUPLICATE_KIND;
   }
 
-  /// the reference to copy: reference to the attribute
-  inline static const std::string& ORIGIN_REF()
-  {
-    static const std::string MY_DUPLICATE_ID("Origin");
-    return MY_DUPLICATE_ID;
-  }
   /// Makes a new part, copy of active
   PartSetPlugin_Duplicate();