From b257a1cbde5174ba5804e105d33819ed8028adc5 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 4 Jun 2014 13:48:32 +0400 Subject: [PATCH] It replaces using of direct value "SketchCircle" to SKETCH_CIRLCE_KIND, and "SketchPoint" to SKETCH_POINT_KIND --- src/SketchPlugin/SketchPlugin_Circle.h | 5 ++++- src/SketchPlugin/SketchPlugin_Plugin.cpp | 4 ++-- src/SketchPlugin/SketchPlugin_Point.h | 5 ++++- src/SketchSolver/SketchSolver_Constraint.cpp | 6 ++++-- src/SketchSolver/SketchSolver_ConstraintGroup.cpp | 4 ++-- src/SketchSolver/SketchSolver_ConstraintManager.cpp | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index 021b8adee..3e7b9ac82 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -9,6 +9,9 @@ #include #include +/// 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() diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index a1f71d285..1eec19937 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -29,13 +29,13 @@ boost::shared_ptr SketchPlugin_Plugin::createFeature(string th if (theFeatureID == SKETCH_KIND) { return boost::shared_ptr(new SketchPlugin_Sketch); } - else if (theFeatureID == "SketchPoint") { + else if (theFeatureID == SKETCH_POINT_KIND) { return boost::shared_ptr(new SketchPlugin_Point); } else if (theFeatureID == SKETCH_LINE_KIND) { return boost::shared_ptr(new SketchPlugin_Line); } - else if (theFeatureID == "SketchCircle") { + else if (theFeatureID == SKETCH_CIRCLE_KIND) { return boost::shared_ptr(new SketchPlugin_Circle); } else if (theFeatureID == "SketchConstraintCoincidence") { diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index fdad3c4b3..e791cce85 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -10,6 +10,9 @@ #include "SketchPlugin_Feature.h" #include +/// 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() diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 3766ffcae..e03c64655 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include @@ -99,7 +101,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptrisFeature() && 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_ptrisFeature()) 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; diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index e0e68a9ae..ab8e64ea2 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -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)); diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index cf93fd73c..538f5f9cf 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -256,7 +256,7 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr 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