1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintCoincidence.h
4 // Created: 08 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_ConstraintCoincidence_H_
8 #define SketchPlugin_ConstraintCoincidence_H_
10 #include "SketchPlugin.h"
11 #include "SketchPlugin_ConstraintBase.h"
12 #include <SketchPlugin_Sketch.h>
15 class GeomDataAPI_Point2D;
17 /** \class SketchPlugin_ConstraintCoincidence
19 * \brief Feature for creation of a new constraint which defines equivalence of two points
21 * This constraint has two attributes:
22 * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
24 class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase
27 /// Coincidence constraint kind
28 inline static const std::string& ID()
30 static const std::string MY_CONSTRAINT_COINCIDENCE_ID("SketchConstraintCoincidence");
31 return MY_CONSTRAINT_COINCIDENCE_ID;
33 /// \brief Returns the kind of a feature
34 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
36 static std::string MY_KIND = SketchPlugin_ConstraintCoincidence::ID();
40 /// Returns the AIS preview
41 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
43 /// \brief Creates a new part document if needed
44 SKETCHPLUGIN_EXPORT virtual void execute();
46 /// \brief Request for initialization of data model of the feature: adding all attributes
47 SKETCHPLUGIN_EXPORT virtual void initAttributes();
49 /// Returns coincident feature if there is a coincidence built on the given features
50 /// \param theFeature1 the first feature
51 /// \param theFeature2 the second feature
52 static FeaturePtr findCoincidenceFeature(const FeaturePtr& theFeature1,
53 const FeaturePtr& theFeature2);
55 /// Returns point of coincidence feature
56 /// \param theFeature a coincidence feature
57 /// \return point 2d attribute. Coincidence always has at least one point 2d attribute
58 static std::shared_ptr<GeomDataAPI_Point2D> getPoint(const FeaturePtr& theFeature);
60 /// \brief Use plugin manager for features creation
61 SketchPlugin_ConstraintCoincidence();