Salome HOME
bos #20661 EDF 22847 - Move to the end
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_MacroArc.h
index 0a191342c251fcb4bd9ccd306bee2d84e839475d..6bf909dec8ec58ce8ce6433d65d185488a8afec2 100644 (file)
@@ -1,14 +1,28 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:        SketchPlugin_MacroArc.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_MacroArc_H_
 #define SketchPlugin_MacroArc_H_
 
-#include "SketchPlugin.h"
+#include <ModelAPI_IReentrant.h>
 
+#include "SketchPlugin.h"
 #include "SketchPlugin_SketchEntity.h"
 
 #include <GeomAPI_IPresentable.h>
@@ -24,7 +38,8 @@ class GeomAPI_Pnt2d;
  * it is calculated if all attributes are initialized.
  */
 class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
-                             public GeomAPI_IPresentable
+                             public GeomAPI_IPresentable,
+                             public ModelAPI_IReentrant
 {
  public:
   /// Arc feature kind
@@ -57,6 +72,12 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  inline static const std::string& ARC_TYPE_BY_TRANSVERSAL_LINE()
+  {
+    static const std::string ID("by_transversal_line");
+    return ID;
+  }
+
   /// Central 2D point of the circle which contains the arc
   inline static const std::string& CENTER_POINT_ID()
   {
@@ -71,9 +92,16 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
   }
 
   /// Start 2D point of the arc
-  inline static const std::string& START_POINT_ID()
+  inline static const std::string& START_POINT_1_ID()
+  {
+    static const std::string ID = "start_point_1";
+    return ID;
+  }
+
+  /// Start 2D point of the arc
+  inline static const std::string& START_POINT_2_ID()
   {
-    static const std::string ID = "start_point";
+    static const std::string ID = "start_point_2";
     return ID;
   }
 
@@ -84,9 +112,30 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
   }
 
   /// End 2D point of the arc
-  inline static const std::string& END_POINT_ID()
+  inline static const std::string& END_POINT_1_ID()
+  {
+    static const std::string ID = "end_point_1";
+    return ID;
+  }
+
+  /// End 2D point of the arc
+  inline static const std::string& END_POINT_2_ID()
+  {
+    static const std::string ID = "end_point_2";
+    return ID;
+  }
+
+  /// End 2D point of the arc
+  inline static const std::string& END_POINT_3_ID()
+  {
+    static const std::string ID = "end_point_3";
+    return ID;
+  }
+
+  /// End 2D point of the arc
+  inline static const std::string& END_POINT_4_ID()
   {
-    static const std::string ID = "end_point";
+    static const std::string ID = "end_point_4";
     return ID;
   }
 
@@ -115,6 +164,12 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  static const std::string& TRANSVERSAL_POINT_ID()
+  {
+    static const std::string ID("transversal_point");
+    return ID;
+  }
+
   /// Reversed flag
   inline static const std::string& REVERSED_ID()
   {
@@ -136,6 +191,13 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
     return ID;
   }
 
+  /// Arc angle.
+  static const std::string& EDIT_ARC_TYPE_ID()
+  {
+    static const std::string ID("edit_arc_type");
+    return ID;
+  }
+
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
   {
@@ -156,28 +218,30 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
   /// Creates an arc-shape
   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().
   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_MacroArc();
 
+  /// Returns shape of arc.
+  /// \param isBound  if true prepare arc, otherwice create circle containing this arc
+  GeomShapePtr getArcShape(bool isBound = true);
+
 private:
   /// Set fields for center, start and end points
   void fillByCenterAndTwoPassed();
   /// Set fields for center, start and end points by selected passed points
   void fillByThreePassedPoints();
-  /// Set fields for center, start and end points by selected tangent edge
-  void fillByTangentEdge();
+  /// Set fields for center, start and end points by selected tangent or transversal edge
+  /// \param theTransversal if \c true, builds transversal arc, otherwise builds tangential arc.
+  void fillByEdge(bool theTransversal);
 
   FeaturePtr createArcFeature();