-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchPlugin_MacroCircle.h
-// Created: 26 May 2014
-// Author: Artem ZHIDKOV
+// Copyright (C) 2014-2019 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 <ModelAPI_IReentrant.h>
+
#include "SketchPlugin.h"
-#include "SketchPlugin_Sketch.h"
#include "SketchPlugin_SketchEntity.h"
#include <GeomAPI_IPresentable.h>
-#include <GeomAPI_Pnt2d.h>
+
+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
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()
{
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()
{
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()
{
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()
{
/// 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<Events_Message>& 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<GeomAPI_Pnt2d> myCenter;
- double myRadius;
+ double myRadius;
};
#endif