Salome HOME
Merge Dev_2.1.0 with PythonAPI branch
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Tools.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_Tools.h
4 // Created:     10 March 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef SketcherPrs_Tools_H
8 #define SketcherPrs_Tools_H
9
10 #include "SketcherPrs.h"
11 #include <GeomAPI_Shape.h>
12 #include <GeomAPI_Pnt2d.h>
13 #include <GeomAPI_Ax3.h>
14 #include <ModelAPI_Object.h>
15 #include <ModelAPI_Feature.h>
16 #include <string>
17
18 class GeomDataAPI_Point2D;
19
20 //#define MyTextHeight 20
21
22 namespace SketcherPrs_Tools {
23
24   /// Enumeration with modes for activation of selection custom presentations
25   enum SelectionModes {
26     /// Start of enumeration
27     Sel_Mode_First = 100, 
28   
29     /// Selection mode for all constraints exclude dimensions
30     Sel_Constraint,
31   
32     /// Selection mode for whole dimension
33     Sel_Dimension_All,
34   
35     /// Selection mode for line of dimension
36     Sel_Dimension_Line,
37
38     /// Selection mode foe text of dimension
39     Sel_Dimension_Text
40   };
41
42   /// Returns result object referenced by feature
43   /// \param theFeature a feature
44   /// \param theAttrName an attribute name
45   SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature,
46                                          const std::string& theAttrName);
47
48   /// Returns shape from result object (or NULL)
49   /// \param theObject a result object
50   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
51
52
53   /// Returns point from a line feature
54   /// \param theFeature a line feature
55   /// \param theAttrName an attribute of the point
56   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
57                                           const std::string& theAttrName);
58
59
60   /// Returns point projected on a line
61   /// \param theLine  a line
62   /// \param thePoint a projecting point
63   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
64                         const FeaturePtr theLine,
65                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
66
67   SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData,
68                                                const std::string& theAttribute);
69
70   /// Obtain the point object from specified constraint parameter
71   /// \param theData a data object
72   /// \param theAttribute an attribute name
73   /// \param thePlane a projection plane (sketcher plane)
74   SKETCHERPRS_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
75                                                        const std::string& theAttribute,
76                                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
77
78   /// Returns value of dimension arrows size
79   SKETCHERPRS_EXPORT double getArrowSize();
80
81   /// Set value of dimension arrows size
82   /// \param theSize a size value
83   SKETCHERPRS_EXPORT void setArrowSize(double theSize);
84
85   /// Set value of dimension text height
86   /// \param theHeight a height value
87   SKETCHERPRS_EXPORT void setTextHeight(double theHeight);
88
89   /// Returns value of dimension text height
90   SKETCHERPRS_EXPORT double getTextHeight();
91
92   /// Returns default value of dimension text height
93   SKETCHERPRS_EXPORT double getDefaultTextHeight();
94
95   /// Get flayout distance of the dimension constraint
96   /// \param theConstraint a dimension constraint object
97   SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint);
98
99   /// Compute anchor pint for radius dimension
100   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt> getAnchorPoint(
101                                               const ModelAPI_Feature* theConstraint,
102                                               const std::shared_ptr<GeomAPI_Ax3>& thePlane);
103 };
104
105 #endif