Salome HOME
Fix the problem with multi-coincidence of points (issue #1143)
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Axis.h
index 099d547e35016bf482d28698ac12c1bd4d9903a9..ffaa95d04ed0614e0a1de31334fdd197250b9544 100644 (file)
@@ -9,20 +9,11 @@
 
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 #include <GeomAPI_ICustomPrs.h>
 
-
-/// Point kind
-const std::string CONSTRUCTION_AXIS_KIND("Axis");
-
-/// attribute name for first point
-const std::string POINT_ATTR_FIRST = "firstPoint";
-
-/// attribute name for second point
-const std::string POINT_ATTR_SECOND = "secondPoint";
-
 /**\class ConstructionPlugin_Axis
- * \ingroup DataModel
+ * \ingroup Plugins
  * \brief Feature for creation of the new axis in PartSet.
  */
 class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs
@@ -31,10 +22,45 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP
   /// Returns the kind of a feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
   {
-    static std::string MY_KIND = CONSTRUCTION_AXIS_KIND;
+    static std::string MY_KIND = ConstructionPlugin_Axis::ID();
     return MY_KIND;
   }
 
+  /// Axis kind
+  inline static const std::string& ID()
+  {
+    static const std::string CONSTRUCTION_AXIS_KIND("Axis");
+    return CONSTRUCTION_AXIS_KIND;
+  }
+
+  /// attribute name for first point
+  inline static const std::string& METHOD()
+  {
+    static const std::string METHOD_ATTR("CreationMethod");
+    return METHOD_ATTR;
+  }
+  /// attribute name for first point
+  inline static const std::string& POINT_FIRST()
+  {
+    static const std::string POINT_ATTR_FIRST("FirstPoint");
+    return POINT_ATTR_FIRST;
+  }
+  /// attribute name for second point
+  inline static const std::string& POINT_SECOND()
+  {
+    static const std::string POINT_ATTR_SECOND("SecondPoint");
+    return POINT_ATTR_SECOND;
+  }
+  /// attribute name for second point
+  inline static const std::string& CYLINDRICAL_FACE()
+  {
+    static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
+    return CYLINDRICAL_FACE_ATTR;
+  }
+
+  /// Returns a minimal length for axis
+  inline static const double MINIMAL_LENGTH() { return 1.e-5; }
+
   /// Creates a new part document if needed
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
 
@@ -48,8 +74,15 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP
   ConstructionPlugin_Axis();
 
   /// Customize presentation of the feature
-  virtual void customisePresentation(AISObjectPtr thePrs);
+  virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
+                                     std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
+
+ protected:
+  /// Creates a new axis by two defined points
+  void createAxisByTwoPoints();
+  /// Creates a new axis as copy of cylindrical face axis
+  void createAxisByCylindricalFace();
 };
 
 
-#endif
\ No newline at end of file
+#endif