]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/SketchPlugin_ConstraintMiddle.h
Salome HOME
Test1967: Update tolerance ratio for moving vs creating.
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintMiddle.h
index 148942a5bf9224d782795cbe7953f3b604726b29..686e60b159f9151363e1d9e4d7c847ca257d04a1 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File:    SketchPlugin_ConstraintMiddle.h
-// Created: 27 Jan 2016
-// Author:  Artem ZHIDKOV
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// 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_ConstraintMiddle_H_
 #define SketchPlugin_ConstraintMiddle_H_
@@ -11,6 +24,8 @@
 #include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_ConstraintBase.h"
 
+class ModelAPI_Feature;
+
 /** \class SketchPlugin_ConstraintMiddle
  *  \ingroup Plugins
  *  \brief Feature for creation of a new constraint which places a point in the middle of a line
@@ -27,6 +42,35 @@ class SketchPlugin_ConstraintMiddle : public SketchPlugin_ConstraintBase
     static const std::string MY_CONSTRAINT_MIDDLE_ID("SketchConstraintMiddle");
     return MY_CONSTRAINT_MIDDLE_ID;
   }
+
+  /// Middle constraint kind
+  inline static const std::string& MIDDLE_TYPE()
+  {
+    static const std::string MY_TYPE_ID("middle_type");
+    return MY_TYPE_ID;
+  }
+
+  /// Middle constraint type by line and point
+  inline static const std::string& MIDDLE_TYPE_BY_LINE_AND_POINT()
+  {
+    static const std::string MY_TYPE_ID("middle_type_by_line_and_point");
+    return MY_TYPE_ID;
+  }
+
+  /// Middle constraint type by line
+  inline static const std::string& MIDDLE_TYPE_BY_LINE()
+  {
+    static const std::string MY_TYPE_ID("middle_type_by_line");
+    return MY_TYPE_ID;
+  }
+
+  /// Created points for middle type by line
+  inline static const std::string& POINT_REF_ID()
+  {
+    static const std::string MY_POINT_REF("point");
+    return MY_POINT_REF;
+  }
+
   /// \brief Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
   {
@@ -34,6 +78,9 @@ class SketchPlugin_ConstraintMiddle : public SketchPlugin_ConstraintBase
     return MY_KIND;
   }
 
+  /// Called on change of any argument-attribute of this object
+  SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
 
@@ -45,6 +92,12 @@ class SketchPlugin_ConstraintMiddle : public SketchPlugin_ConstraintBase
 
   /// \brief Use plugin manager for features creation
   SketchPlugin_ConstraintMiddle();
+
+private:
+  void CreatePoint();
+
+  std::shared_ptr<ModelAPI_Feature> myPoint;
+  bool  myBlockAttribInit;
 };
 
 #endif