1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_Tools.h
4 // Created: 10 March 2015
5 // Author: Vitaly SMETANNIKOV
7 #ifndef SketcherPrs_Tools_H
8 #define SketcherPrs_Tools_H
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>
18 class GeomDataAPI_Point2D;
21 //#define MyTextHeight 20
23 namespace SketcherPrs_Tools {
25 /// Enumeration with modes for activation of selection custom presentations
27 /// Start of enumeration
30 /// Selection mode for all constraints exclude dimensions
33 /// Selection mode for whole dimension
36 /// Selection mode for line of dimension
39 /// Selection mode foe text of dimension
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);
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);
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);
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);
68 SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData,
69 const std::string& theAttribute);
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);
79 /// Returns value of dimension arrows size
80 SKETCHERPRS_EXPORT double getArrowSize();
82 /// Set value of dimension arrows size
83 /// \param theSize a size value
84 SKETCHERPRS_EXPORT void setArrowSize(double theSize);
86 /// Returns default value of dimension arrows size
87 SKETCHERPRS_EXPORT int getDefaultArrowSize();
89 /// Set value of dimension text height
90 /// \param theHeight a height value
91 SKETCHERPRS_EXPORT void setTextHeight(double theHeight);
93 /// Returns value of dimension text height
94 SKETCHERPRS_EXPORT double getTextHeight();
96 /// Returns default value of dimension text height
97 SKETCHERPRS_EXPORT double getDefaultTextHeight();
99 /// Get flayout distance of the dimension constraint
100 /// \param theConstraint a dimension constraint object
101 SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint);
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);
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);