Salome HOME
It replaces direct names of construction and partset features to the specific kind.
authornds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 11:07:56 +0000 (15:07 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 11:07:56 +0000 (15:07 +0400)
src/ConstructionPlugin/ConstructionPlugin_Extrusion.h
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/PartSetPlugin/PartSetPlugin_Part.h
src/PartSetPlugin/PartSetPlugin_Plugin.cpp
src/PartSetPlugin/PartSetPlugin_Remove.cpp
src/PartSetPlugin/PartSetPlugin_Remove.h
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index b7db8e0115bf9cbefc844c864c57b84fceade3e2..5270d2d892c6a756d489202e8e1fd5c8e718b83b 100644 (file)
@@ -8,6 +8,9 @@
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
 
+/// Extrusion kind
+const std::string CONSTRUCTION_EXTRUSION_KIND("Extrusion");
+
 /// attribute name of referenced face
 const std::string EXTRUSION_FACE = "extrusion_face";
 
@@ -23,7 +26,7 @@ class ConstructionPlugin_Extrusion: public ModelAPI_Feature
 public:
   /// Returns the kind of a feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() 
-  { static std::string MY_KIND = "Extrusion"; return MY_KIND; }
+  { static std::string MY_KIND = CONSTRUCTION_EXTRUSION_KIND; return MY_KIND; }
 
   /// Returns to which group in the document must be added feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() 
index 4e1bfd19ce1d554d0127b5ebac966731977c8f51..d420b21104827a33f6e25cf279d0ba2cb77db4c5 100644 (file)
@@ -18,9 +18,9 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
 
 FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
 {
-  if (theFeatureID == "Point") {
+  if (theFeatureID == CONSTRUCTION_POINT_KIND) {
     return FeaturePtr(new ConstructionPlugin_Point);
-  } else if (theFeatureID == "Extrusion") {
+  } else if (theFeatureID == CONSTRUCTION_EXTRUSION_KIND) {
     return FeaturePtr(new ConstructionPlugin_Extrusion);
   }
   // feature of such kind is not found
index 2b71b50fea6e88763edfaf2d7325341d12e2ee30..a0dda28dd782103e9e37f42c4a77b0b3f6d47979 100644 (file)
@@ -8,6 +8,9 @@
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
 
+/// Point kind
+const std::string CONSTRUCTION_POINT_KIND("Point");
+
 /// attribute name for X coordinate
 const std::string POINT_ATTR_X = "x";
 /// attribute name for Y coordinate
@@ -24,7 +27,7 @@ class ConstructionPlugin_Point: public ModelAPI_Feature
 public:
   /// Returns the kind of a feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "Point"; return MY_KIND;}
+  {static std::string MY_KIND = CONSTRUCTION_POINT_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() 
index eaae463ad2831260dc75a595e9c8a761f645e09c..0f921727129f03036314e6d9531f8d53df209728 100644 (file)
@@ -8,6 +8,9 @@
 #include "PartSetPlugin.h"
 #include <ModelAPI_Feature.h>
 
+/// Part kind
+const std::string PARTSET_PART_KIND("Part");
+
 /// part reference attribute
 const std::string PART_ATTR_DOC_REF = "PartDocument";
 
@@ -20,7 +23,7 @@ class PartSetPlugin_Part: public ModelAPI_Feature
 public:
   /// Returns the kind of a feature
   PARTSETPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "Part"; return MY_KIND;}
+  {static std::string MY_KIND = PARTSET_PART_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() 
index 435cc1efcbc8054a33906088bbb74c1828795ee4..4ba7fa5cac1e2e1b8193232b6f06d39cd4107486 100644 (file)
@@ -18,7 +18,7 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin()
 
 FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID)
 {
-  if (theFeatureID == "Part") {
+  if (theFeatureID == PARTSET_PART_KIND) {
     return FeaturePtr(new PartSetPlugin_Part);
   }
   if (theFeatureID == "duplicate") {
index 6c56d01f1f1c3d5dbabac5bf89c4adffc4de0891..0e09f3a607b7e440cbfe3a49fbfffd25cdbf440a 100644 (file)
@@ -16,7 +16,7 @@ void PartSetPlugin_Remove::execute()
   boost::shared_ptr<PartSetPlugin_Part> a;
   for(int a = aRoot->size(getGroup()) - 1; a >= 0; a--) {
     FeaturePtr aFeature = aRoot->feature(getGroup(), a, true);
-    if (aFeature->getKind() == "Part") {
+    if (aFeature->getKind() == PARTSET_PART_KIND) {
       boost::shared_ptr<PartSetPlugin_Part> aPart = 
         boost::static_pointer_cast<PartSetPlugin_Part>(aFeature);
       if (aPart->data()->docRef(PART_ATTR_DOC_REF)->value() == aPManager->currentDocument()) {
index f12066c3e24a6de8ba8ac71d5e816344de68f9ac..87b7e258ce768a0524cdddb9cd9caa1e50e7dcd9 100644 (file)
@@ -8,6 +8,9 @@
 #include "PartSetPlugin.h"
 #include <ModelAPI_Feature.h>
 
+/// Extrusion kind
+const std::string PARTSET_REMOVE_KIND("Remove");
+
 /**\class PartSetPlugin_Remove
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
@@ -17,7 +20,7 @@ class PartSetPlugin_Remove: public ModelAPI_Feature
 public:
   /// Returns the kind of a feature
   PARTSETPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "Remove"; return MY_KIND;}
+  {static std::string MY_KIND = PARTSET_REMOVE_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() 
index 32c961026c0723a2e74c9d24244f313d66e97416..86a5d03e806877634e0536aca1f82c85d6a2782e 100644 (file)
@@ -96,7 +96,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
     FeaturePtr aFeature = aFeatures.first();
     //Process Feature
     if (aFeature) {
-      if (aFeature->getKind() == "Part") {
+      if (aFeature->getKind() == PARTSET_PART_KIND) {
         ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
         DocumentPtr aFeaDoc = aObject->featureRef()->data()->docRef("PartDocument")->value();
         if (aMgr->currentDocument() == aFeaDoc)
index dfe77c6f82b30f1fe13b7c77b18b15ceece383dd..4847cd62d08bf2f2c189bc49198e4e643c9918f9 100644 (file)
@@ -228,7 +228,7 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
     bool aHasPart = false;
     for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
       FeaturePtr aFeature = (*aIt);
-      if (aFeature->getKind() == "Part") {
+      if (aFeature->getKind() == PARTSET_PART_KIND) {
         aHasPart = true;
         break;
       }
@@ -809,7 +809,7 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList)
     PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
     aMgr->rootDocument()->startOperation();
     foreach (FeaturePtr aFeature, theList) {
-      if (aFeature->getKind() == "Part") {
+      if (aFeature->getKind() == PARTSET_PART_KIND) {
         DocumentPtr aDoc;
         if (!XGUI_Tools::isModelObject(aFeature)) {
           aDoc = aFeature->data()->docRef("PartDocument")->value();