]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketcherPrs/SketcherPrs_Tools.h
Salome HOME
1af656aee3f2bc19dffa01065e6787bf0e1c26c9
[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_Attribute.h>
16 #include <ModelAPI_Feature.h>
17 #include <string>
18
19 class GeomDataAPI_Point2D;
20 class AIS_Dimension;
21
22 //#define MyTextHeight 20
23
24 namespace SketcherPrs_Tools {
25
26   /// Enumeration with modes for activation of selection custom presentations
27   enum SelectionModes {
28     /// Start of enumeration
29     Sel_Mode_First = 100, 
30   
31     /// Selection mode for all constraints exclude dimensions
32     Sel_Constraint,
33   
34     /// Selection mode for whole dimension
35     Sel_Dimension_All,
36   
37     /// Selection mode for line of dimension
38     Sel_Dimension_Line,
39
40     /// Selection mode foe text of dimension
41     Sel_Dimension_Text
42   };
43
44   /// Returns attribute object referenced by feature
45   /// \param theFeature a feature
46   /// \param theAttrName an attribute name
47   SKETCHERPRS_EXPORT AttributePtr getAttribute(ModelAPI_Feature* theFeature,
48                                                const std::string& theAttrName);
49
50   /// Returns result object referenced by feature
51   /// \param theFeature a feature
52   /// \param theAttrName an attribute name
53   SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature,
54                                          const std::string& theAttrName);
55
56   /// Returns shape from result object (or NULL)
57   /// \param theObject a result object
58   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
59
60
61   /// Returns point from a line feature
62   /// \param theFeature a line feature
63   /// \param theAttrName an attribute of the point
64   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
65                                           const std::string& theAttrName);
66
67
68   /// Returns point projected on a line
69   /// \param theLine  a line
70   /// \param thePoint a projecting point
71   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
72                         const FeaturePtr theLine,
73                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
74
75   SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData,
76                                                const std::string& theAttribute);
77
78   /// Obtain the point object from specified constraint parameter
79   /// \param theData a data object
80   /// \param theAttribute an attribute name
81   /// \param thePlane a projection plane (sketcher plane)
82   SKETCHERPRS_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
83                                                        const std::string& theAttribute,
84                                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
85
86   /// Returns value of dimension arrows size
87   SKETCHERPRS_EXPORT double getArrowSize();
88
89   /// Set value of dimension arrows size
90   /// \param theSize a size value
91   SKETCHERPRS_EXPORT void setArrowSize(double theSize);
92
93   /// Returns default value of dimension arrows size
94   SKETCHERPRS_EXPORT int getDefaultArrowSize();
95
96   /// Set value of dimension text height
97   /// \param theHeight a height value
98   SKETCHERPRS_EXPORT void setTextHeight(double theHeight);
99
100   /// Returns value of dimension text height
101   SKETCHERPRS_EXPORT double getTextHeight();
102
103   /// Returns default value of dimension text height
104   SKETCHERPRS_EXPORT double getDefaultTextHeight();
105
106   /// Get flayout distance of the dimension constraint
107   /// \param theConstraint a dimension constraint object
108   SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint);
109
110   /// Compute anchor pint for radius dimension
111   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt> getAnchorPoint(
112                                               const ModelAPI_Feature* theConstraint,
113                                               const std::shared_ptr<GeomAPI_Ax3>& thePlane);
114
115   /// Display/hide sigma symbol in the dimension presentation
116   /// \param theDimension a dimension constraint
117   /// \param theToDisplay a boolean value
118   SKETCHERPRS_EXPORT void setDisplaySpecialSymbol(AIS_Dimension* theDimension,
119                                                   const bool& theToDisplay);
120 };
121
122 #endif