Salome HOME
Default planes and origin initialization
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Plane.h
index e58dd2ec4a4e76b7b297b5adc1bfc213d08b94b5..317d6f348232239c1b4c3c5037c5f3085d23d183 100644 (file)
@@ -9,20 +9,14 @@
 
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 #include <GeomAPI_ICustomPrs.h>
 
-/// Point kind
-const std::string CONSTRUCTION_PLANE_KIND("Plane");
 
-/// attribute name for base face
-const std::string FACE_ATTR = "planeFace";
 
-/// attribute name for distance
-const std::string DISTANCE_ATTR = "distance";
-
-/**\class ConstructionPlugin_Axis
- * \ingroup DataModel
- * \brief Feature for creation of the new axis in PartSet.
+/**\class ConstructionPlugin_Plane
+ * \ingroup Plugins
+ * \brief Feature for creation of the new planar surface in PartSet.
  */
 class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs
 {
@@ -30,24 +24,88 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustom
   /// Returns the kind of a feature
   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
   {
-    static std::string MY_KIND = CONSTRUCTION_PLANE_KIND;
+    static std::string MY_KIND = ConstructionPlugin_Plane::ID();
     return MY_KIND;
   }
 
+  /// default color for a plane
+  inline static const std::string& DEFAULT_COLOR()
+  {
+    static const std::string CONSTRUCTION_PLANE_COLOR("#32FF32");
+    return CONSTRUCTION_PLANE_COLOR;
+  }
+
+  /// Plane kind
+  inline static const std::string& ID()
+  {
+    static const std::string CONSTRUCTION_PLANE_KIND("Plane");
+    return CONSTRUCTION_PLANE_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 base face
+  inline static const std::string& FACE()
+  {
+    static const std::string FACE_ATTR("planeFace");
+    return FACE_ATTR;
+  }
+  /// attribute name for distance
+  inline static const std::string& DISTANCE()
+  {
+    static const std::string DISTANCE_ATTR("distance");
+    return DISTANCE_ATTR;
+  }
+
+  /// the a parameter for the general equation of a plane (ax+by+cz+d=0)
+  inline static const std::string& A()
+  {
+    static const std::string PARAM_A_ATTR("A");
+    return PARAM_A_ATTR;
+  }
+  /// the b parameter for the general equation of a plane (ax+by+cz+d=0)
+  inline static const std::string& B()
+  {
+    static const std::string PARAM_B_ATTR("B");
+    return PARAM_B_ATTR;
+  }
+  /// the c parameter for the general equation of a plane (ax+by+cz+d=0)
+  inline static const std::string& C()
+  {
+    static const std::string PARAM_C_ATTR("C");
+    return PARAM_C_ATTR;
+  }
+  /// the d parameter for the general equation of a plane (ax+by+cz+d=0)
+  inline static const std::string& D()
+  {
+    static const std::string PARAM_D_ATTR("D");
+    return PARAM_D_ATTR;
+  }
+
   /// Creates a new part document if needed
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
 
   /// Request for initialization of data model of the feature: adding all attributes
   CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
 
-  /// Construction result is allways recomuted on the fly
+  /// Construction result is always recomputed on the fly
   CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
 
   /// Use plugin manager for features creation
   ConstructionPlugin_Plane();
 
   /// Customize presentation of the feature
-  virtual void customisePresentation(AISObjectPtr thePrs);
+  virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
+                                     std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
+
+ protected:
+  std::shared_ptr<GeomAPI_Shape> createPlaneByFaceAndDistance();
+  std::shared_ptr<GeomAPI_Shape> createPlaneByGeneralEquation();
 };
 
-#endif
\ No newline at end of file
+#endif