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