X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_MacroCircle.h;h=4e1bfeb22e049df6f5d63c5efa375095abccd5ab;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=4ea0ecc50262dc3b15accd2d5e8083a2be4567f7;hpb=bd953380ed26bbef84337e8b2148d930969b5abe;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h index 4ea0ecc50..4e1bfeb22 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.h +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -7,20 +7,24 @@ #ifndef SketchPlugin_MacroCircle_H_ #define SketchPlugin_MacroCircle_H_ +#include + #include "SketchPlugin.h" -#include "SketchPlugin_Sketch.h" #include "SketchPlugin_SketchEntity.h" #include -#include + +class GeomAPI_Circ2d; +class GeomAPI_Pnt2d; /**\class SketchPlugin_MacroCircle * \ingroup Plugins * \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 @@ -36,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() { @@ -85,6 +95,13 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, return ID; } + /// Reference for first point selection. + inline static const std::string& FIRST_POINT_REF_ID() + { + static const std::string ID("first_point_ref"); + return ID; + } + /// Second point id. inline static const std::string& SECOND_POINT_ID() { @@ -92,6 +109,13 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, return ID; } + /// Reference for second point selection. + inline static const std::string& SECOND_POINT_REF_ID() + { + static const std::string ID("second_point_ref"); + return ID; + } + /// Third point id. inline static const std::string& THIRD_POINT_ID() { @@ -99,6 +123,13 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, return ID; } + /// Reference for third point selection. + inline static const std::string& THIRD_POINT_REF_ID() + { + static const std::string ID("third_point_ref"); + return ID; + } + /// Radius of the circle inline static const std::string& CIRCLE_RADIUS_ID() { @@ -137,15 +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& theMessage); + /// Use plugin manager for features creation SketchPlugin_MacroCircle(); private: - void resetAttribute(const std::string& theId); + 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(); private: std::shared_ptr myCenter; - double myRadius; + double myRadius; }; #endif