* The "entityA" and "entityB" represents any other object (and a point too).
* And the "valA" represents a real value.
*
- * The attributes below are named corresponding to the SolveSpace,
- * some of them may be unused. The list of used attributes is defined
- * inside the certain constraint.
+ * The attributes below are named independent of the SolveSpace.
+ * Some of them may be unused.
+ *
+ * Also the list of possible attributes is provided to simplify assignment.
*/
/// The value parameter for the constraint
-const std::string CONSTRAINT_ATTR_VALUE("ConstraintValueA");
-/// First point for the constraint
-const std::string CONSTRAINT_ATTR_POINT_A("ConstraintPointA");
-/// Second point for the constraint
-const std::string CONSTRAINT_ATTR_POINT_B("ConstraintPointB");
+const std::string CONSTRAINT_ATTR_VALUE("ConstraintValue");
/// 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};
/** \class SketchPlugin_Constraint
* \ingroup DataModel
* \brief Feature for creation of a new constraint between other features.
+ * Base class for all constraints.
*/
class SketchPlugin_Constraint: public SketchPlugin_Feature
{
SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
{static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
- /// Returns the sketch preview
- /// \param theSketch the owner of this feature
- /// \return the built preview
- SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
-
/** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
* \param theFeature sub-feature
*/
SKETCHPLUGIN_EXPORT virtual const void addSub(
const boost::shared_ptr<ModelAPI_Feature>& theFeature) {}
- /** \brief Adds an object of the constraint. The object added by the reference.
- * \param[in] theAttrID identifier of the attribute
- * \param[in] theReference reference to the feature, which will be constrained
- */
- SKETCHPLUGIN_EXPORT virtual void addConstrainedObject(
- const std::string& theAttrID,
- const boost::shared_ptr<ModelAPI_AttributeReference>& theReference);
-
- /** \brief Adds an object of the constraint. The object added by the reference to its attribute.
- * \param[in] theAttrID identifier of the attribute
- * \param[in] theReference reference to the attribute feature, which will be constrained
- */
- SKETCHPLUGIN_EXPORT virtual void addConstrainedObject(
- const std::string& theAttrID,
- const boost::shared_ptr<ModelAPI_AttributeRefAttr>& theReference);
-
- /** \brief Prepares list of attributes of current sketch workplane
- * \param[out] theParams list of attributes
- */
- SKETCHPLUGIN_EXPORT void getSketchParameters(
- std::list< boost::shared_ptr<ModelAPI_Attribute> >& theParams);
-
/// \brief Use plugin manager for features creation
SketchPlugin_Constraint() {}
-
-protected:
- /** \brief Returns the list of attributes for the certain type of constraint.
- * \return names of attributes
- */
- virtual const std::list<std::string>& getAttributesList() const = 0;
};
#endif