Salome HOME
Meet the coding style (line length <= 100)
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_MacroCircle.h
index 974a0eeb6c529dde433e03d7e9ef50901f76c964..4e1bfeb22e049df6f5d63c5efa375095abccd5ab 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef SketchPlugin_MacroCircle_H_
 #define SketchPlugin_MacroCircle_H_
 
+#include <ModelAPI_IReentrant.h>
+
 #include "SketchPlugin.h"
 
 #include "SketchPlugin_SketchEntity.h"
@@ -21,7 +23,8 @@ class GeomAPI_Pnt2d;
  * \brief Feature for creation of the new circle in Sketch.
  */
 class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity,
-                                public GeomAPI_IPresentable
+                                public GeomAPI_IPresentable,
+                                public ModelAPI_IReentrant
 {
  public:
   /// Circle feature kind
@@ -37,6 +40,12 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  inline static const std::string& EDIT_CIRCLE_TYPE()
+  {
+    static const std::string ID("edit_circle_type");
+    return ID;
+  }
+
   /// Creation method by center and passed point.
   inline static const std::string& CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS()
   {
@@ -159,18 +168,27 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity,
 
   SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;};
 
+  /// Apply information of the message to current object. It fills reference object,
+  /// tangent type and tangent point refence in case of tangent arc
+  virtual std::string processEvent(const std::shared_ptr<Events_Message>& theMessage);
+
   /// Use plugin manager for features creation
   SketchPlugin_MacroCircle();
 
 private:
-  void createCircleByCenterAndPassed();
-  void createCircleByThreePoints();
+  void fillByCenterAndPassed();
+  void fillByThreePoints();
+  /// set fields if only two of three points is initialized
+  void fillByTwoPassedPoints();
+
+  void constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature);
+  void constraintsForCircleByThreePoints(FeaturePtr theCircleFeature);
 
-  FeaturePtr createCircleFeature(const std::shared_ptr<GeomAPI_Circ2d>& theCircle);
+  FeaturePtr createCircleFeature();
 
 private:
   std::shared_ptr<GeomAPI_Pnt2d> myCenter;
-  double myRadius;
+  double                         myRadius;
 };
 
 #endif