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;
16 /** \class SketchPlugin_ConstraintSplit
18 * \brief Feature for creation of a new constraint filleting two objects which have coincident point
20 * This constraint has three attributes:
21 * SketchPlugin_Constraint::VALUE() contains reference object to be splitted
22 * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() for the points of split;
24 * Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C()
25 * which contains created list objects forming the fillet
27 class SketchPlugin_ConstraintSplit : public SketchPlugin_ConstraintBase
30 /*struct FilletFeatures {
31 std::list<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
32 std::list<FeaturePtr> resultEdges; ///< list of result edges
33 std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
36 /// Split constraint kind
37 inline static const std::string& ID()
39 static const std::string MY_CONSTRAINT_SPLIT_ID("SketchConstraintSplit");
40 return MY_CONSTRAINT_SPLIT_ID;
42 /// \brief Returns the kind of a feature
43 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
45 static std::string MY_KIND = SketchPlugin_ConstraintSplit::ID();
49 /// \brief Creates a new part document if needed
50 SKETCHPLUGIN_EXPORT virtual void execute();
52 /// \brief Request for initialization of data model of the feature: adding all attributes
53 SKETCHPLUGIN_EXPORT virtual void initAttributes();
55 /// Called on change of any argument-attribute of this object
56 /// \param theID identifier of changed attribute
57 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
59 /// Returns the AIS preview
60 //SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
62 /// Reimplemented from ModelAPI_Feature::isMacro().
64 SKETCHPLUGIN_EXPORT virtual bool isMacro() const;
66 /// \brief Use plugin manager for features creation
67 SketchPlugin_ConstraintSplit();
69 /// \return map of base points and features;
70 //SKETCHPLUGIN_EXPORT const std::map<AttributePtr, FilletFeatures> pointsFeaturesMap() const {
71 // return myPointFeaturesMap;
75 /// Returns geom point attribute of the feature
76 /// \param theStartPoint
77 /// \return geometical point
78 std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(const bool& theStartPoint);
80 /// Returns cast of attribute to geometrical point if the attribute is a ref attr attribute
81 /// \param theAttribute an attribute
82 /// \param geom point 2D or NULL
83 std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(const AttributePtr& theAttribute);
85 /// Creates a new feature in the base shape type with bounding points given in parameters
86 /// \param theStartPointAttr an attribute of the start point
87 /// \param theEndPointAttr an attribute of the end point
88 FeaturePtr SketchPlugin_ConstraintSplit::createFeature(
89 const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
90 const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr);
93 //std::set<AttributePtr> myNewPoints; ///< set of new points
94 //std::map<AttributePtr, FilletFeatures> myPointFeaturesMap; ///< map of point and features for fillet
95 //bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
96 //bool myRadiusChangedByUser; ///< flag to track that radius changed by user
97 //bool myRadiusChangedInCode; ///< flag to track that radius changed in code
98 //bool myRadiusInitialized; /// < flag to track that radius initialized