X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Constraint.h;h=d0a76b1cfd6a7d51fb2fdad963c809d051481147;hb=7ffe38811ecbbe6c270f2153c1825fe9c510d69f;hp=632243ba608557cc11ea325f61724794fde566ce;hpb=14d3980515c46076881ff80812f2c1e151211083;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 632243ba6..d0a76b1cf 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -12,9 +12,6 @@ #include #include -const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint -const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance - /* Description: * Each constraint uses a set of parameters. In the SolveSpace library @@ -28,24 +25,9 @@ const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection toler * * Also the list of possible attributes is provided to simplify assignment. */ -/// The value parameter for the constraint -const std::string CONSTRAINT_ATTR_VALUE("ConstraintValue"); -/// The 2D value parameter for the constraint -const std::string CONSTRAINT_ATTR_FLYOUT_VALUE_PNT("ConstraintFlyoutValuePnt"); -/// First entity for the constraint -const std::string CONSTRAINT_ATTR_ENTITY_A("ConstraintEntityA"); -/// Second entity for the constraint -const std::string CONSTRAINT_ATTR_ENTITY_B("ConstraintEntityB"); -/// Third entity for the constraint -const std::string CONSTRAINT_ATTR_ENTITY_C("ConstraintEntityC"); -/// Fourth entity for the constraint -const std::string CONSTRAINT_ATTR_ENTITY_D("ConstraintEntityD"); -/// List of constraint attributes -const unsigned int CONSTRAINT_ATTR_SIZE = 4; -const std::string CONSTRAINT_ATTRIBUTES[CONSTRAINT_ATTR_SIZE] = - {CONSTRAINT_ATTR_ENTITY_A, CONSTRAINT_ATTR_ENTITY_B, - CONSTRAINT_ATTR_ENTITY_C, CONSTRAINT_ATTR_ENTITY_D}; +/// Size of the list of constraint attributes +const unsigned int CONSTRAINT_ATTR_SIZE = 4; /** \class SketchPlugin_Constraint * \ingroup DataModel @@ -55,9 +37,59 @@ const std::string CONSTRAINT_ATTRIBUTES[CONSTRAINT_ATTR_SIZE] = class SketchPlugin_Constraint: public SketchPlugin_Feature { public: + /// The value parameter for the constraint + inline static const std::string& VALUE() + { + static const std::string MY_CONSTRAINT_VALUE("ConstraintValue"); + return MY_CONSTRAINT_VALUE; + } + /// The 2D value parameter for the constraint + inline static const std::string& FLYOUT_VALUE_PNT() + { + static const std::string MY_FLYOUT_VALUE_PNT("ConstraintFlyoutValuePnt"); + return MY_FLYOUT_VALUE_PNT; + } + /// First entity for the constraint + inline static const std::string& ENTITY_A() + { + static const std::string MY_ENTITY_A("ConstraintEntityA"); + return MY_ENTITY_A; + } + /// Second entity for the constraint + inline static const std::string& ENTITY_B() + { + static const std::string MY_ENTITY_B("ConstraintEntityB"); + return MY_ENTITY_B; + } + /// Third entity for the constraint + inline static const std::string& ENTITY_C() + { + static const std::string MY_ENTITY_C("ConstraintEntityC"); + return MY_ENTITY_C; + } + /// Fourth entity for the constraint + inline static const std::string& ENTITY_D() + { + static const std::string MY_ENTITY_D("ConstraintEntityD"); + return MY_ENTITY_D; + } + + /// List of constraint attributes + inline static const std::string& ATTRIBUTE(const int theNumber) { + switch (theNumber) { + case 0: return ENTITY_A(); + case 1: return ENTITY_B(); + case 2: return ENTITY_C(); + case 3: return ENTITY_D(); + default: break; + } + static const std::string EMPTY_STRING(""); + return EMPTY_STRING; + } + /// \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_KIND; return MY_GROUP;} + {static std::string MY_GROUP = SketchPlugin_Sketch::ID(); return MY_GROUP;} /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch) * \param theFeature sub-feature @@ -65,11 +97,9 @@ public: SKETCHPLUGIN_EXPORT virtual const void addSub( const FeaturePtr& theFeature) {} - /// \brief Returns the sketch preview - SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr& preview(); - /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual Handle_AIS_InteractiveObject getAISShape(Handle_AIS_InteractiveObject thePrevious); + SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( + boost::shared_ptr thePrevious); /// Moves the feature /// \param theDeltaX the delta for X coordinate is moved