]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
It replaces using of direct value "Sketch" to SKETCH_KIND, which is defined in the...
authornds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 09:21:51 +0000 (13:21 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 09:21:51 +0000 (13:21 +0400)
19 files changed:
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_Presentation.cpp
src/SketchPlugin/SketchPlugin_Arc.h
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_Constraint.h
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h
src/SketchPlugin/SketchPlugin_ConstraintDistance.h
src/SketchPlugin/SketchPlugin_ConstraintLength.h
src/SketchPlugin/SketchPlugin_ConstraintParallel.h
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h
src/SketchPlugin/SketchPlugin_ConstraintRadius.h
src/SketchPlugin/SketchPlugin_Line.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Point.h
src/SketchPlugin/SketchPlugin_Sketch.h
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/SketchSolver/SketchSolver_ConstraintManager.cpp

index e27fb725d7a4707081cc54b0dd01545387299931..183a2459bb70de2e7e4289f148912e8d3968e143 100644 (file)
@@ -11,6 +11,8 @@
 #include <Events_Loop.h>
 #include <Model_Events.h>
 
+#include <SketchPlugin_Sketch.h>
+
 #ifdef _DEBUG
 #include <QDebug>
 #endif
@@ -62,7 +64,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
     std::set<std::string>::const_iterator anIt = aGroups.begin(), aLast = aGroups.end();
     for (; anIt != aLast; anIt++) {
       std::string aGroup = *anIt;
-      if (aGroup.compare("Sketch") == 0) { // Update only Sketch group
+      if (aGroup.compare(SKETCH_KIND) == 0) { // Update only Sketch group
         myModule->workshop()->displayer()->eraseDeletedFeatures();
         myModule->updateCurrentPreview(aGroup);
       }
index a7b2f6dd91ec48005ba122a2b3da97e8c6d32c09..149c5d8e8acfee249ccac3bfa1ed843b505252c5 100644 (file)
@@ -468,7 +468,7 @@ void PartSet_Module::editFeature(FeaturePtr theFeature)
   if (!theFeature)
     return;
 
-//  if (theFeature->getKind() == "Sketch") {
+//  if (theFeature->getKind() == SKETCH_KIND) {
     FeaturePtr aFeature = theFeature;
     if (XGUI_Tools::isModelObject(aFeature)) {
       ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
index dd117daf2aaa8768f8cad50783de8911def2b783..3f5a1c622f2fcf5a7c46e644edfcdbeaea39fcf9 100644 (file)
@@ -8,6 +8,9 @@
 #include "PartSet.h"
 
 #include <PartSet_OperationSketchBase.h>
+
+#include <SketchPlugin_Sketch.h>
+
 #include <QObject>
 
 class Handle_AIS_InteractiveObject;
@@ -21,7 +24,7 @@ class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBas
   Q_OBJECT
 public:
   /// Returns the operation type key
-  static std::string Type() { return "Sketch"; }
+  static std::string Type() { return SKETCH_KIND; }
 
 public:
   /// Constructor
index 7c4de78d0006c14498b7d832218a0cfcfbd84330..8ec2901597db8b503eddb12ef5a54beef09bbbff 100644 (file)
@@ -38,7 +38,7 @@ Handle(AIS_InteractiveObject) PartSet_Presentation::createPresentation(
     anAIS = createSketchConstraintLength(theFeature, theSketch, thePrevPrs);
   else {
     anAIS = createFeature(theFeature, theShape, thePrevPrs);
-    if (theFeature->getKind() == "Sketch")
+    if (theFeature->getKind() == SKETCH_KIND)
     {
       Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
       aShapeAIS->SetColor(Quantity_Color(SKETCH_PLANE_COLOR));
index f22e92b4cd82222fcd87a9872af74f5b63f0c33a..f5f2fa23abaf1e234001286f331970cf3d2574c0 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
 
 /// Central 2D point of the circle which contains the arc
 const std::string ARC_ATTR_CENTER("ArcCenter");
@@ -28,7 +29,7 @@ public:
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 18fa1e71f94ce1db6a85076d2e68ef1fbfcd7faf..021b8adeeab2e2e99d34417d1a61a5304f2ae4c7 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
 
 /// 2D point - center of the circle
 const std::string CIRCLE_ATTR_CENTER("CircleCenter");
@@ -26,7 +27,7 @@ public:
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 98680830ae87b92b2152e7d2cb45b0ad72d4fd29..bfa5db79e61597ffb19171d5ad34f41ac40a9862 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include "SketchPlugin_Feature.h"
+#include <SketchPlugin_Sketch.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <list>
@@ -54,7 +55,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
    *  \param theFeature sub-feature
index 1c5f2adf37c7f437c787c343f7826df9b416adbd..ac075b770349d380f819e58e30685ccb2ad1a62c 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
 #include <list>
 
 
@@ -26,7 +27,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 4295e8c2dee1d9dba731c92d9d00c33a5276d342..9e9874400a39f365e57059d7440e08049126a6b9 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
 #include <list>
 
 
@@ -27,7 +28,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 3e4cde4a0ad980e395bcb843592daf4a8aef9d21..8bd6eb8f2bdf39c1d386da56e0b0e0802e5d79e5 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include "SketchPlugin_Constraint.h"
+#include <SketchPlugin_Sketch.h>
 #include <list>
 
 
@@ -26,7 +27,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index dfc894d364a6e6f92f96d80643c4857d231d96f8..ed45ba7bf20f5c9f823643feaa15ea55852cde5e 100644 (file)
@@ -6,6 +6,7 @@
 #define SketchPlugin_ConstraintParallel_HeaderFile
 
 #include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_Constraint.h"
 
 
@@ -25,7 +26,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 6c5074a90cd62c1ec2b4205011d03af5cf1aba62..b5cc31ccb66554c73c628120ac0c592bf9362f25 100644 (file)
@@ -6,6 +6,7 @@
 #define SketchPlugin_ConstraintPerpendicular_HeaderFile
 
 #include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_Constraint.h"
 
 
@@ -25,7 +26,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 26a0ecbdc0dfebb7842851bdfde34c8022563c48..d292712b8f57177f8570bf07a2ed11815c58bb24 100644 (file)
@@ -6,6 +6,7 @@
 #define SketchPlugin_ConstraintRadius_HeaderFile
 
 #include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_Constraint.h"
 
 
@@ -26,7 +27,7 @@ public:
 
   /// \brief Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 62dc6cfa971182255e968814247646764a89cb74..72050ac8780e0d8a8144415684002d216ca70462 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Sketch.h>
 #include <list>
 
 /// Start 2D point of the line
@@ -27,7 +28,7 @@ public:
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 23a6cf05a17cc3fb364a10d7f616943df9d71c6b..be1c3f581aacc784beb6593d418fadef19019a4f 100644 (file)
@@ -26,7 +26,7 @@ SketchPlugin_Plugin::SketchPlugin_Plugin()
 
 boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
 {
-  if (theFeatureID == "Sketch") {
+  if (theFeatureID == SKETCH_KIND) {
     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
   }
   else if (theFeatureID == "SketchPoint") {
index b18bffb08646be9264dbec3f9f26fe01bd22664f..fdad3c4b3eefef6911cda6f4d59fb66911fb8101 100644 (file)
@@ -6,6 +6,7 @@
 #define SketchPlugin_Point_HeaderFile
 
 #include "SketchPlugin.h"
+#include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_Feature.h"
 #include <list>
 
@@ -25,7 +26,7 @@ public:
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+  {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 7c0894995afb358733a1aaf8b90be271f04b398c..a9a1c8fd147bb628005db126e5e5e9a10bc26d1b 100644 (file)
@@ -10,6 +10,9 @@
 #include <GeomAPI_Pnt.h>
 #include <list>
 
+/// All features of this sketch (list of references)
+const std::string SKETCH_KIND("Sketch");
+
 /// Origin point of the sketcher in 3D space
 const std::string SKETCH_ATTR_ORIGIN("Origin");
 /// Vector X inside of the sketch plane
@@ -30,7 +33,7 @@ class SketchPlugin_Sketch: public SketchPlugin_Feature
 public:
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "Sketch"; return MY_KIND;}
+  {static std::string MY_KIND = SKETCH_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
index 7c0bd37845879ea5df3015d550a1645a013eefdb..1a3f1b104803a316ce5a0d29fb10e6fdfb48576d 100644 (file)
@@ -461,7 +461,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeNormal(
 bool SketchSolver_ConstraintGroup::addWorkplane(
                 boost::shared_ptr<SketchPlugin_Feature> theSketch)
 {
-  if (myWorkplane.h || theSketch->getKind().compare("Sketch") != 0)
+  if (myWorkplane.h || theSketch->getKind().compare(SKETCH_KIND) != 0)
     return false; // the workplane already exists or the function parameter is not Sketch
 
   mySketch = theSketch;
index dd502982ba736bf0ef4ac9892ccb323957fe15ea..36d26d59b27fd5cae50fdfd715c8d6910b7b9f79 100644 (file)
@@ -74,7 +74,7 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
       {
         // Only sketches and constraints can be added by Create event
         const std::string& aFeatureKind = (*aFeatIter)->getKind();
-        if (aFeatureKind.compare("Sketch") == 0)
+        if (aFeatureKind.compare(SKETCH_KIND) == 0)
         {
           boost::shared_ptr<SketchPlugin_Feature> aSketch =
             boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
@@ -105,10 +105,10 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
     const Model_FeatureDeletedMessage* aDeleteMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
     const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
 
-    // Find "Sketch" in groups. The constraint groups should be updated when an object removed from Sketch
+    // Find SKETCH_KIND in groups. The constraint groups should be updated when an object removed from Sketch
     std::set<std::string>::const_iterator aFGrIter;
     for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++)
-      if (aFGrIter->compare("Sketch") == 0)
+      if (aFGrIter->compare(SKETCH_KIND) == 0)
         break;
     
     if (aFGrIter != aFeatureGroups.end())