From: nds Date: Wed, 4 Jun 2014 09:41:17 +0000 (+0400) Subject: It replaces using of direct value "SketchLine" to SKETCH_LINE_KIND, which is defined... X-Git-Tag: V_0.4.4~325 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3693d9d6895f68f9df22b54d46059125e9b009ef;p=modules%2Fshaper.git It replaces using of direct value "SketchLine" to SKETCH_LINE_KIND, which is defined in the SketchPlugin_Line header --- diff --git a/src/PartSet/PartSet_OperationConstraint.cpp b/src/PartSet/PartSet_OperationConstraint.cpp index 76c7db50e..99e167d41 100644 --- a/src/PartSet/PartSet_OperationConstraint.cpp +++ b/src/PartSet/PartSet_OperationConstraint.cpp @@ -63,7 +63,7 @@ void PartSet_OperationConstraint::init(boost::shared_ptr theFe const std::list& /*theSelected*/, const std::list& /*theHighlighted*/) { - //if (!theFeature || theFeature->getKind() != "SketchLine") + //if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) // return; // use the last point of the previous feature as the first of the new one //boost::shared_ptr aData = theFeature->data(); @@ -253,7 +253,7 @@ boost::shared_ptr PartSet_OperationConstraint::createFeature(c void PartSet_OperationConstraint::setFeature(boost::shared_ptr theFeature) { - if (!theFeature || theFeature->getKind() != "SketchLine") + if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return; boost::shared_ptr aData = feature()->data(); diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 7b1a92884..7b34c8f8f 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -215,7 +215,7 @@ void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptrgetKind() != "SketchLine") + if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return; boost::shared_ptr aData = theFeature->data(); diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp index 9a971ac48..46534645d 100644 --- a/src/PartSet/PartSet_OperationSketchLine.cpp +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -76,7 +76,7 @@ void PartSet_OperationSketchLine::init(boost::shared_ptr theFe const std::list& /*theSelected*/, const std::list& /*theHighlighted*/) { - if (!theFeature || theFeature->getKind() != "SketchLine") + if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return; // use the last point of the previous feature as the first of the new one boost::shared_ptr aData = theFeature->data(); @@ -364,7 +364,7 @@ void PartSet_OperationSketchLine::getLinePoint(boost::shared_ptrgetKind() != "SketchLine") + if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return; boost::shared_ptr aData = theFeature->data(); boost::shared_ptr aPoint = @@ -378,7 +378,7 @@ boost::shared_ptr PartSet_OperationSketchLine::findLinePoin double theX, double theY) { boost::shared_ptr aPoint2D; - if (!theFeature || theFeature->getKind() != "SketchLine") + if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return aPoint2D; boost::shared_ptr aData = theFeature->data(); diff --git a/src/PartSet/PartSet_OperationSketchLine.h b/src/PartSet/PartSet_OperationSketchLine.h index cda1781c4..9dd5dc6cc 100644 --- a/src/PartSet/PartSet_OperationSketchLine.h +++ b/src/PartSet/PartSet_OperationSketchLine.h @@ -8,6 +8,9 @@ #include "PartSet.h" #include + +#include + #include class GeomDataAPI_Point2D; @@ -24,7 +27,7 @@ class PARTSET_EXPORT PartSet_OperationSketchLine : public PartSet_OperationSketc public: /// Returns the operation type key - static std::string Type() { return "SketchLine"; } + static std::string Type() { return SKETCH_LINE_KIND; } public: /// Constructor diff --git a/src/PartSet/PartSet_Presentation.cpp b/src/PartSet/PartSet_Presentation.cpp index 8ec290159..e37e869d9 100644 --- a/src/PartSet/PartSet_Presentation.cpp +++ b/src/PartSet/PartSet_Presentation.cpp @@ -97,7 +97,7 @@ Handle(AIS_InteractiveObject) PartSet_Presentation::createSketchConstraintLength if (!anAttr) return thePrevPrs; boost::shared_ptr aFeature = anAttr->feature(); - if (!aFeature || aFeature->getKind() != "SketchLine") + if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND) return thePrevPrs; aData = aFeature->data(); diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index b526342b6..4713f2cda 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -199,7 +199,7 @@ double PartSet_Tools::distanceToPoint(boost::shared_ptr theFea double theX, double theY) { double aDelta = 0; - if (theFeature->getKind() != "SketchLine") + if (theFeature->getKind() != SKETCH_LINE_KIND) return aDelta; boost::shared_ptr aData = theFeature->data(); diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 72050ac87..b22f551b7 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -10,6 +10,9 @@ #include #include +/// Line feature kind +const std::string SKETCH_LINE_KIND("SketchLine"); + /// Start 2D point of the line const std::string LINE_ATTR_START("StartPoint"); /// End 2D point of the line @@ -24,7 +27,7 @@ class SketchPlugin_Line: public SketchPlugin_Feature public: /// Returns the kind of a feature SKETCHPLUGIN_EXPORT virtual const std::string& getKind() - {static std::string MY_KIND = "SketchLine"; return MY_KIND;} + {static std::string MY_KIND = SKETCH_LINE_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 be1c3f581..a1f71d285 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -32,7 +32,7 @@ boost::shared_ptr SketchPlugin_Plugin::createFeature(string th else if (theFeatureID == "SketchPoint") { return boost::shared_ptr(new SketchPlugin_Point); } - else if (theFeatureID == "SketchLine") { + else if (theFeatureID == SKETCH_LINE_KIND) { return boost::shared_ptr(new SketchPlugin_Line); } else if (theFeatureID == "SketchCircle") { diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index a9a1c8fd1..b5a46830a 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -10,7 +10,7 @@ #include #include -/// All features of this sketch (list of references) +/// Sketch feature kind const std::string SKETCH_KIND("Sketch"); /// Origin point of the sketcher in 3D space diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 83bc31671..3766ffcae 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -5,6 +5,8 @@ #include "SketchSolver_Constraint.h" #include +#include + #include #include @@ -102,7 +104,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptrisFeature() && anAttr->feature() && - anAttr->feature()->getKind().compare("SketchLine") == 0) + anAttr->feature()->getKind().compare(SKETCH_LINE_KIND) == 0) { myAttributesList[aNbLines++] = CONSTRAINT_ATTRIBUTES[indAttr]; break; @@ -175,7 +177,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptrisFeature()) continue; const std::string& aKind = anAttr->feature()->getKind(); - if (aKind.compare("SketchLine") == 0) + if (aKind.compare(SKETCH_LINE_KIND) == 0) { myAttributesList[aNbEntities++] = CONSTRAINT_ATTRIBUTES[indAttr]; continue; diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 1a3f1b104..e0e68a9ae 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -331,7 +331,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity( const std::string& aFeatureKind = aFeature->getKind(); // Line - if (aFeatureKind.compare("SketchLine") == 0) + if (aFeatureKind.compare(SKETCH_LINE_KIND) == 0) { Slvs_hEntity aStart = changeEntity(aFeature->data()->attribute(LINE_ATTR_START)); Slvs_hEntity aEnd = changeEntity(aFeature->data()->attribute(LINE_ATTR_END)); diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 36d26d59b..cf93fd73c 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -259,7 +259,7 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr