X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_MacroCircle.h;h=0ef428b4e31f5086bedcfc7b4985046f20684201;hb=f51f8ab55887ac6eff49fb9937a460abe1956517;hp=27130a4e7bc63f6e7b26a00731c7be3384197209;hpb=d58fe13200f3fc72c246e2d4b9670a4a8460de4e;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h index 27130a4e7..0ef428b4e 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.h +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -1,12 +1,27 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_MacroCircle.h -// Created: 26 May 2014 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef SketchPlugin_MacroCircle_H_ #define SketchPlugin_MacroCircle_H_ +#include + #include "SketchPlugin.h" #include "SketchPlugin_SketchEntity.h" @@ -21,7 +36,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 +53,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() { @@ -147,31 +169,33 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) - {}; - /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; 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: - std::shared_ptr shapeByCenterAndPassed(); - std::shared_ptr shapeByThreePoints(); - /// Creates shape if only two of three points is initialized - std::shared_ptr shapeByTwoPassedPoints(); + void fillByCenterAndPassed(); + void fillByThreePoints(); + /// set fields if only two of three points is initialized + void fillByTwoPassedPoints(); - void createCircleByCenterAndPassed(); - void createCircleByThreePoints(); + void constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature); + void constraintsForCircleByThreePoints(FeaturePtr theCircleFeature); - FeaturePtr createCircleFeature(const std::shared_ptr& theCircle); + FeaturePtr createCircleFeature(); + +private: + std::shared_ptr myCenter; + double myRadius; }; #endif