]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
It replaces using of direct value "SketchCircle" to SKETCH_CIRLCE_KIND, and "SketchPo...
authornds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 09:48:32 +0000 (13:48 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 4 Jun 2014 09:48:32 +0000 (13:48 +0400)
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Point.h
src/SketchSolver/SketchSolver_Constraint.cpp
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/SketchSolver/SketchSolver_ConstraintManager.cpp

index 021b8adeeab2e2e99d34417d1a61a5304f2ae4c7..3e7b9ac8295082fe6a4bff4ec82498c36d1f5bf8 100644 (file)
@@ -9,6 +9,9 @@
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
 
+/// Circle feature kind
+const std::string SKETCH_CIRCLE_KIND("SketchCircle");
+
 /// 2D point - center of the circle
 const std::string CIRCLE_ATTR_CENTER("CircleCenter");
 /// Radius of the circle
@@ -23,7 +26,7 @@ class SketchPlugin_Circle: public SketchPlugin_Feature
 public:
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "SketchCircle"; return MY_KIND;}
+  {static std::string MY_KIND = SKETCH_CIRCLE_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
index a1f71d285b8e38f46fa69d79c11dded974c913ec..1eec1993796fa34d38ebf35161b79c189b93523f 100644 (file)
@@ -29,13 +29,13 @@ boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string th
   if (theFeatureID == SKETCH_KIND) {
     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
   }
-  else if (theFeatureID == "SketchPoint") {
+  else if (theFeatureID == SKETCH_POINT_KIND) {
     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
   }
   else if (theFeatureID == SKETCH_LINE_KIND) {
     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
   }
-  else if (theFeatureID == "SketchCircle") {
+  else if (theFeatureID == SKETCH_CIRCLE_KIND) {
     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
   }
   else if (theFeatureID == "SketchConstraintCoincidence") {
index fdad3c4b3eefef6911cda6f4d59fb66911fb8101..e791cce852b360dc1d5ff0c1eeeebbf73b19b222 100644 (file)
@@ -10,6 +10,9 @@
 #include "SketchPlugin_Feature.h"
 #include <list>
 
+/// Point feature kind
+const std::string SKETCH_POINT_KIND("SketchPoint");
+
 /// Coordinates of the point
 const std::string POINT_ATTR_COORD("PointCoordindates");
 
@@ -22,7 +25,7 @@ class SketchPlugin_Point: public SketchPlugin_Feature
 public:
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "SketchPoint"; return MY_KIND;}
+  {static std::string MY_KIND = SKETCH_POINT_KIND; return MY_KIND;}
 
   /// Returns to which group in the document must be added feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
index 3766ffcae6bd2512cfdafd05f3c7795f4d9f8416..e03c64655435d1ee428e86843993110de1f3ede7 100644 (file)
@@ -6,6 +6,8 @@
 #include <SketchSolver_Solver.h>
 
 #include <SketchPlugin_Line.h>
+#include <SketchPlugin_Point.h>
+#include <SketchPlugin_Circle.h>
 
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_Data.h>
@@ -99,7 +101,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
       if (anAttr->isFeature() && anAttr->feature())
       { // verify posiible entities
         const std::string& aKind = anAttr->feature()->getKind();
-        if (aKind.compare("SketchPoint") == 0)
+        if (aKind.compare(SKETCH_POINT_KIND) == 0)
         {
           myAttributesList[aNbPoints++] = CONSTRAINT_ATTRIBUTES[indAttr];
           continue;
@@ -200,7 +202,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
         );
       if (!anAttr || !anAttr->isFeature()) continue;
       const std::string& aKind = anAttr->feature()->getKind();
-      if (aKind.compare("SketchCircle") == 0 || aKind.compare("SketchArc") == 0)
+      if (aKind.compare(SKETCH_CIRCLE_KIND) == 0 || aKind.compare("SketchArc") == 0)
       {
         myAttributesList[aNbEntities++] = CONSTRAINT_ATTRIBUTES[indAttr];
         continue;
index e0e68a9ae63914327d984427d9ef72162dc6530c..ab8e64ea20383e8f639cc236fcd05f2f01fa98aa 100644 (file)
@@ -346,7 +346,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
       return aLineEntity.h;
     }
     // Circle
-    else if (aFeatureKind.compare("SketchCircle") == 0)
+    else if (aFeatureKind.compare(SKETCH_CIRCLE_KIND) == 0)
     {
       Slvs_hEntity aCenter = changeEntity(aFeature->data()->attribute(CIRCLE_ATTR_CENTER));
       Slvs_hEntity aRadius = changeEntity(aFeature->data()->attribute(CIRCLE_ATTR_RADIUS));
@@ -378,7 +378,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
       return anArcEntity.h;
     }
     // Point (it has low probability to be an attribute of constraint, so it is checked at the end)
-    else if (aFeatureKind.compare("SketchPoint") == 0)
+    else if (aFeatureKind.compare(SKETCH_POINT_KIND) == 0)
     {
       Slvs_hEntity aPoint = changeEntity(aFeature->data()->attribute(POINT_ATTR_COORD));
 
index cf93fd73c2c6a45f4aa3042d0a469ed4f24d5ae2..538f5f9cff5a4f9b226bc06d1cbd9d41af015148 100644 (file)
@@ -256,7 +256,7 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin
   std::vector<std::string> anAttrList;
   const std::string& aFeatureKind = theFeature->getKind();
   // Point
-  if (aFeatureKind.compare("SketchPoint") == 0)
+  if (aFeatureKind.compare(SKETCH_POINT_KIND) == 0)
     anAttrList.push_back(POINT_ATTR_COORD);
   // Line
   else if (aFeatureKind.compare(SKETCH_LINE_KIND) == 0)
@@ -265,7 +265,7 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin
     anAttrList.push_back(LINE_ATTR_END);
   }
   // Circle
-  else if (aFeatureKind.compare("SketchCircle") == 0)
+  else if (aFeatureKind.compare(SKETCH_CIRCLE_KIND) == 0)
   {
     anAttrList.push_back(CIRCLE_ATTR_CENTER);
     anAttrList.push_back(CIRCLE_ATTR_RADIUS);