1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintSplit.h
4 // Created: 19 Mar 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_ConstraintSplit_H_
8 #define SketchPlugin_ConstraintSplit_H_
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
14 class GeomDataAPI_Point2D;
15 class ModelAPI_Feature;
17 /** \class SketchPlugin_ConstraintSplit
19 * \brief Feature for creation of a new constraint filleting two objects which have coincident point
21 * This constraint has three attributes:
22 * SketchPlugin_Constraint::VALUE() contains reference object to be splitted
23 * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() for the points of split;
25 * Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C()
26 * which contains created list objects forming the fillet
28 class SketchPlugin_ConstraintSplit : public SketchPlugin_ConstraintBase
31 /*struct FilletFeatures {
32 std::list<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
33 std::list<FeaturePtr> resultEdges; ///< list of result edges
34 std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
37 /// Split constraint kind
38 inline static const std::string& ID()
40 static const std::string MY_CONSTRAINT_SPLIT_ID("SketchConstraintSplit");
41 return MY_CONSTRAINT_SPLIT_ID;
43 /// \brief Returns the kind of a feature
44 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
46 static std::string MY_KIND = SketchPlugin_ConstraintSplit::ID();
50 /// \brief Creates a new part document if needed
51 SKETCHPLUGIN_EXPORT virtual void execute();
53 /// \brief Request for initialization of data model of the feature: adding all attributes
54 SKETCHPLUGIN_EXPORT virtual void initAttributes();
56 /// Called on change of any argument-attribute of this object
57 /// \param theID identifier of changed attribute
58 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
60 /// Returns the AIS preview
61 //SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
63 /// Reimplemented from ModelAPI_Feature::isMacro().
65 SKETCHPLUGIN_EXPORT virtual bool isMacro() const;
67 /// \brief Use plugin manager for features creation
68 SketchPlugin_ConstraintSplit();
70 /// \return map of base points and features;
71 //SKETCHPLUGIN_EXPORT const std::map<AttributePtr, FilletFeatures> pointsFeaturesMap() const {
72 // return myPointFeaturesMap;
76 /// Returns geom point attribute of the feature
77 /// \param theStartPoint
78 /// \return geometical point
79 std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(const bool& theStartPoint);
81 /// Returns cast of attribute to geometrical point if the attribute is a ref attr attribute
82 /// \param theAttribute an attribute
83 /// \param geom point 2D or NULL
84 std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(const AttributePtr& theAttribute);
86 /// Creates a new feature in the base shape type with bounding points given in parameters
87 /// \param theStartPointAttr an attribute of the start point
88 /// \param theEndPointAttr an attribute of the end point
89 std::shared_ptr<ModelAPI_Feature> createFeature(
90 const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
91 const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr);
94 //std::set<AttributePtr> myNewPoints; ///< set of new points
95 //std::map<AttributePtr, FilletFeatures> myPointFeaturesMap; ///< map of point and features for fillet
96 //bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
97 //bool myRadiusChangedByUser; ///< flag to track that radius changed by user
98 //bool myRadiusChangedInCode; ///< flag to track that radius changed in code
99 //bool myRadiusInitialized; /// < flag to track that radius initialized