1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ConstructionPlugin_Plane.h
4 // Created: 12 Dec 2014
5 // Author: Vitaly Smetannikov
7 #ifndef ConstructionPlugin_Plane_H
8 #define ConstructionPlugin_Plane_H
10 #include "ConstructionPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13 #include <GeomAPI_ICustomPrs.h>
17 /**\class ConstructionPlugin_Plane
19 * \brief Feature for creation of the new planar surface in PartSet.
21 class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs
24 /// Returns the kind of a feature
25 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
27 static std::string MY_KIND = ConstructionPlugin_Plane::ID();
31 /// default color for a plane
32 inline static const std::string& DEFAULT_COLOR()
34 static const std::string CONSTRUCTION_PLANE_COLOR("150,150,180");
35 return CONSTRUCTION_PLANE_COLOR;
39 inline static const std::string& ID()
41 static const std::string CONSTRUCTION_PLANE_KIND("Plane");
42 return CONSTRUCTION_PLANE_KIND;
45 /// attribute name for first point
46 inline static const std::string& METHOD()
48 static const std::string METHOD_ATTR("CreationMethod");
52 /// attribute name for base face
53 inline static const std::string& FACE()
55 static const std::string FACE_ATTR("planeFace");
58 /// attribute name for distance
59 inline static const std::string& DISTANCE()
61 static const std::string DISTANCE_ATTR("distance");
65 /// the a parameter for the general equation of a plane (ax+by+cz+d=0)
66 inline static const std::string& A()
68 static const std::string PARAM_A_ATTR("A");
71 /// the b parameter for the general equation of a plane (ax+by+cz+d=0)
72 inline static const std::string& B()
74 static const std::string PARAM_B_ATTR("B");
77 /// the c parameter for the general equation of a plane (ax+by+cz+d=0)
78 inline static const std::string& C()
80 static const std::string PARAM_C_ATTR("C");
83 /// the d parameter for the general equation of a plane (ax+by+cz+d=0)
84 inline static const std::string& D()
86 static const std::string PARAM_D_ATTR("D");
90 /// Creates a new part document if needed
91 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
93 /// Request for initialization of data model of the feature: adding all attributes
94 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
96 /// Construction result is always recomputed on the fly
97 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
99 /// Use plugin manager for features creation
100 ConstructionPlugin_Plane();
102 /// Customize presentation of the feature
103 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
104 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
107 std::shared_ptr<GeomAPI_Shape> createPlaneByFaceAndDistance();
108 std::shared_ptr<GeomAPI_Shape> createPlaneByGeneralEquation();