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_Attribute.h>
16 #include <ModelAPI_Feature.h>
19 class GeomDataAPI_Point2D;
22 //#define MyTextHeight 20
24 namespace SketcherPrs_Tools {
26 /// Enumeration with modes for activation of selection custom presentations
28 /// Start of enumeration
31 /// Selection mode for all constraints exclude dimensions
34 /// Selection mode for whole dimension
37 /// Selection mode for line of dimension
40 /// Selection mode foe text of dimension
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);
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);
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);
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);
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);
75 SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData,
76 const std::string& theAttribute);
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);
86 /// Returns value of dimension arrows size
87 SKETCHERPRS_EXPORT double getArrowSize();
89 /// Set value of dimension arrows size
90 /// \param theSize a size value
91 SKETCHERPRS_EXPORT void setArrowSize(double theSize);
93 /// Returns default value of dimension arrows size
94 SKETCHERPRS_EXPORT int getDefaultArrowSize();
96 /// Set value of dimension text height
97 /// \param theHeight a height value
98 SKETCHERPRS_EXPORT void setTextHeight(double theHeight);
100 /// Returns value of dimension text height
101 SKETCHERPRS_EXPORT double getTextHeight();
103 /// Returns default value of dimension text height
104 SKETCHERPRS_EXPORT double getDefaultTextHeight();
106 /// Get flayout distance of the dimension constraint
107 /// \param theConstraint a dimension constraint object
108 SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint);
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);
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);