* \ingroup DataModel
* \brief Feature for creation of a new constraint which defines equivalence of two points
*
- * These constraint has two attributes: CONSTRAINT_ATTR_POINT_A and CONSTRAINT_ATTR_POINT_B
+ * These constraint has two attributes:
+ * CONSTRAINT_ATTR_ENTITY_A and CONSTRAINT_ATTR_ENTITY_B
*/
class SketchPlugin_ConstraintCoincidence: public SketchPlugin_Constraint
{
--- /dev/null
+// File: SketchPlugin_ConstraintDistance.cpp
+// Created: 23 May 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintDistance.h"
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Data.h>
+#include <SketchPlugin_Point.h>
+
+SketchPlugin_ConstraintDistance::SketchPlugin_ConstraintDistance()
+{
+}
+
+void SketchPlugin_ConstraintDistance::initAttributes()
+{
+ data()->addAttribute(CONSTRAINT_ATTR_VALUE, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
+ data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintDistance::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_ConstraintDistance::preview()
+{
+ /// \todo Preview for distance constraint
+ return getPreview();
+}
+
--- /dev/null
+// File: SketchPlugin_ConstraintDistance.h
+// Created: 23 May 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintDistance_HeaderFile
+#define SketchPlugin_ConstraintDistance_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Constraint.h"
+#include <list>
+
+
+/** \class SketchPlugin_ConstraintDistance
+ * \ingroup DataModel
+ * \brief Feature for creation of a new constraint which defines a distance
+ * between a point and another feature (point, line, plane or face)
+ *
+ * These constraint has three attributes:
+ * CONSTRAINT_ATTR_VALUE, CONSTRAINT_ATTR_ENTITY_A and CONSTRAINT_ATTR_ENTITY_B
+ */
+class SketchPlugin_ConstraintDistance: public SketchPlugin_Constraint
+{
+public:
+ /// \brief Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {static std::string MY_KIND = "SketchConstraintDistance"; return MY_KIND;}
+
+ /// \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;}
+
+ /// \brief Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// \brief Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// \brief Returns the sketch preview
+ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+ /// \brief Use plugin manager for features creation
+ SketchPlugin_ConstraintDistance();
+};
+
+#endif