From: nds Date: Wed, 4 Jun 2014 09:21:51 +0000 (+0400) Subject: It replaces using of direct value "Sketch" to SKETCH_KIND, which is defined in the... X-Git-Tag: V_0.4.4~326 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78ee6c26e0b4e8a14ef4b2beedf6e7f83479bd7f;p=modules%2Fshaper.git It replaces using of direct value "Sketch" to SKETCH_KIND, which is defined in the SketchPlugin_Sketch header --- diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index e27fb725d..183a2459b 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -11,6 +11,8 @@ #include #include +#include + #ifdef _DEBUG #include #endif @@ -62,7 +64,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage) std::set::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); } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index a7b2f6dd9..149c5d8e8 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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(aFeature); diff --git a/src/PartSet/PartSet_OperationSketch.h b/src/PartSet/PartSet_OperationSketch.h index dd117daf2..3f5a1c622 100644 --- a/src/PartSet/PartSet_OperationSketch.h +++ b/src/PartSet/PartSet_OperationSketch.h @@ -8,6 +8,9 @@ #include "PartSet.h" #include + +#include + #include 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 diff --git a/src/PartSet/PartSet_Presentation.cpp b/src/PartSet/PartSet_Presentation.cpp index 7c4de78d0..8ec290159 100644 --- a/src/PartSet/PartSet_Presentation.cpp +++ b/src/PartSet/PartSet_Presentation.cpp @@ -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)); diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index f22e92b4c..f5f2fa23a 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include +#include /// 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(); diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index 18fa1e71f..021b8adee 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include +#include /// 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(); diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 98680830a..bfa5db79e 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include "SketchPlugin_Feature.h" +#include #include #include #include @@ -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 diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h index 1c5f2adf3..ac075b770 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include "SketchPlugin_Constraint.h" +#include #include @@ -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(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index 4295e8c2d..9e9874400 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include "SketchPlugin_Constraint.h" +#include #include @@ -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(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index 3e4cde4a0..8bd6eb8f2 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include "SketchPlugin_Constraint.h" +#include #include @@ -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(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h index dfc894d36..ed45ba7bf 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h @@ -6,6 +6,7 @@ #define SketchPlugin_ConstraintParallel_HeaderFile #include "SketchPlugin.h" +#include #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(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h index 6c5074a90..b5cc31ccb 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h @@ -6,6 +6,7 @@ #define SketchPlugin_ConstraintPerpendicular_HeaderFile #include "SketchPlugin.h" +#include #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(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index 26a0ecbdc..d292712b8 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -6,6 +6,7 @@ #define SketchPlugin_ConstraintRadius_HeaderFile #include "SketchPlugin.h" +#include #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(); diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 62dc6cfa9..72050ac87 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -7,6 +7,7 @@ #include "SketchPlugin.h" #include +#include #include /// 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(); diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 23a6cf05a..be1c3f581 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -26,7 +26,7 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() boost::shared_ptr SketchPlugin_Plugin::createFeature(string theFeatureID) { - if (theFeatureID == "Sketch") { + if (theFeatureID == SKETCH_KIND) { return boost::shared_ptr(new SketchPlugin_Sketch); } else if (theFeatureID == "SketchPoint") { diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index b18bffb08..fdad3c4b3 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -6,6 +6,7 @@ #define SketchPlugin_Point_HeaderFile #include "SketchPlugin.h" +#include #include "SketchPlugin_Feature.h" #include @@ -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(); diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index 7c0894995..a9a1c8fd1 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -10,6 +10,9 @@ #include #include +/// 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() diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 7c0bd3784..1a3f1b104 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -461,7 +461,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeNormal( bool SketchSolver_ConstraintGroup::addWorkplane( boost::shared_ptr 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; diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index dd502982b..36d26d59b 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -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 aSketch = boost::dynamic_pointer_cast(*aFeatIter); @@ -105,10 +105,10 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa const Model_FeatureDeletedMessage* aDeleteMsg = dynamic_cast(theMessage); const std::set& 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::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())