Salome HOME
Added option to create Construction Point by distance on edge. Fixed tests.
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ConstructionPlugin_Point.h
4 // Created:     3 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ConstructionPlugin_Point_H_
8 #define ConstructionPlugin_Point_H_
9
10 #include "ConstructionPlugin.h"
11
12 #include <GeomAPI_ICustomPrs.h>
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Result.h>
15
16 /// \class ConstructionPlugin_Point
17 /// \ingroup Plugins
18 /// \brief Feature for creation of the new part in PartSet.
19 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
20 {
21 public:
22   /// Returns the kind of a feature.
23   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
24
25   /// Point kind.
26   inline static const std::string& ID()
27   {
28     static const std::string CONSTRUCTION_POINT_KIND("Point");
29     return CONSTRUCTION_POINT_KIND;
30   }
31
32   /// Attribute name for creation method.
33   inline static const std::string& CREATION_METHOD()
34   {
35     static const std::string MY_CREATION_METHOD_ID("creation_method");
36     return MY_CREATION_METHOD_ID;
37   }
38
39   /// Attribute name for creation method.
40   inline static const std::string& CREATION_METHOD_BY_XYZ()
41   {
42     static const std::string MY_CREATION_METHOD_ID("by_xyz");
43     return MY_CREATION_METHOD_ID;
44   }
45
46   /// Attribute name for creation method.
47   inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
48   {
49     static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
50     return MY_CREATION_METHOD_ID;
51   }
52
53   /// Attribute name for X coordinate.
54   inline static const std::string& X()
55   {
56     static const std::string POINT_ATTR_X("x");
57     return POINT_ATTR_X;
58   }
59
60   /// Attribute name for Y coordinate.
61   inline static const std::string& Y()
62   {
63     static const std::string POINT_ATTR_Y("y");
64     return POINT_ATTR_Y;
65   }
66
67   /// Attribute name for Z coordinate.
68   inline static const std::string& Z()
69   {
70     static const std::string POINT_ATTR_Z("z");
71     return POINT_ATTR_Z;
72   }
73
74   /// Attribute name for seleted edge.
75   inline static const std::string& EDGE()
76   {
77     static const std::string ATTR_ID("edge");
78     return ATTR_ID;
79   }
80
81   /// Attribute name for distance.
82   inline static const std::string& DISTANCE_VALUE()
83   {
84     static const std::string ATTR_ID("value");
85     return ATTR_ID;
86   }
87
88   /// Attribute name for percent flag.
89   inline static const std::string& DISTANCE_PERCENT()
90   {
91     static const std::string ATTR_ID("percent");
92     return ATTR_ID;
93   }
94
95   /// Attribute name for reverse flag.
96   inline static const std::string& REVERSE()
97   {
98     static const std::string ATTR_ID("reverse");
99     return ATTR_ID;
100   }
101
102   /// Creates a new part document if needed.
103   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
104
105   /// Request for initialization of data model of the feature: adding all attributes.
106   CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
107
108   /// Construction result is allways recomuted on the fly.
109   CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
110
111   /// Use plugin manager for features creation
112   ConstructionPlugin_Point();
113
114   /// Customize presentation of the feature
115   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
116                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
117
118 private:
119   std::shared_ptr<GeomAPI_Shape> createByXYZ();
120   std::shared_ptr<GeomAPI_Shape> createByDistanceOnEdge();
121
122 };
123
124 #endif