Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / ModelGeomAlgo / ModelGeomAlgo_Point2D.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelGeomAlgo_Point2D.h
4 // Created:     20 Jul 2016
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef ModelGeomAlgo_Point2D_H
8 #define ModelGeomAlgo_Point2D_H
9
10 #include "ModelGeomAlgo.h"
11 #include "ModelAPI_Feature.h"
12
13 class ModelAPI_Feature;
14 class ModelAPI_Object;
15 class GeomAPI_Shape;
16 class GeomAPI_Pnt;
17 class GeomAPI_Dir;
18
19 class GeomDataAPI_Point2D;
20
21 #include <memory>
22 #include <string>
23 #include <set>
24 #include <map>
25
26
27 namespace ModelGeomAlgo_Point2D {
28
29   /// Searches Point2D attribute of reference of the attribute of given feature
30   /// \param theFeature a feature to obtain AttributeRefAttr
31   /// \param theAttribute a name of AttributeRefAttr on the given feature
32   /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
33   /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
34   /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes
35   /// \returns found point attribute or NULL
36   MODELGEOMALGO_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(
37                         ModelAPI_Feature* theFeature,
38                         const std::string& theAttribute,
39                         const std::string& theObjectFeatureKind = "",
40                         const std::string& theObjectFeatureAttribute = "");
41
42   /// Fills container of point 2D attributes, which refer to the feature through the references
43   /// features with the given kind
44   /// \param theObject an object where references should be searched (e.g. a sketch line or result)
45   /// \param theReferenceFeatureKind a kind of the feature to be processed
46   ///                                (e.g. coincidence constraint)
47   /// \param theAttributes a container of found point 2D attributes
48   /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
49   /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
50   /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes
51   /// should be skipped
52   /// \returns found point attribute or NULL
53   MODELGEOMALGO_EXPORT void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
54                                   const std::string& theReferenceFeatureKind,
55                                   std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
56                                   const std::string& theObjectFeatureKind = "",
57                                   const std::string& theObjectFeatureAttribute = "",
58                                   const bool isSkipFeatureAttributes = true);
59
60   /// Removes attributes which points are out of the base shape
61   /// \param theBaseShape a shape of check
62   /// \param theAttributes a container of point 2D attributes
63   /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point
64   /// \param theDirX plane X direction to generate 3D point by 2D attribute point
65   /// \param theDirY plane X direction to generate 3D point by 2D attribute point
66   /// \param thePoints a container of 3D points belong to the shape
67   MODELGEOMALGO_EXPORT void getPointsInsideShape(
68                               const std::shared_ptr<GeomAPI_Shape> theBaseShape,
69                               const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
70                               const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
71                               const std::shared_ptr<GeomAPI_Dir>& theDirX,
72                               const std::shared_ptr<GeomAPI_Dir>& theDirY,
73                               std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
74                               std::map<std::shared_ptr<GeomDataAPI_Point2D>,
75                                        std::shared_ptr<GeomAPI_Pnt> >& theAttributeToPoint);
76
77   /// Finds projected point to the given shape line
78   /// \param theBaseShape a shape of check
79   /// \param thePoint [in] a point to project
80   /// \param theProjectedPoint [out] a projected point
81   MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
82                                           const std::shared_ptr<GeomAPI_Pnt>& thePoint,
83                                           std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);
84
85   /// Return feature name, kind and point values united in a string info
86   /// \param theFeature an investigated feature
87   /// \param theAttributesOnly a container of necessary attributes, if empty, all
88   /// \return string value
89   MODELGEOMALGO_EXPORT std::string getPontAttributesInfo(
90                            const std::shared_ptr<ModelAPI_Feature>& theFeature,
91                            const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly);
92
93   /// Return point attribute string info
94   /// \param theAttribute an investigated attribute
95   /// \return string value
96   MODELGEOMALGO_EXPORT std::string getPointAttributeInfo(
97                                   const std::shared_ptr<ModelAPI_Attribute>& theAttribute);
98
99 }
100
101 #endif