Salome HOME
Issue #1664: In the Sketcher, add the function Split a segment:
[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 (e.g. coincidence constraint)
46   /// \param theAttributes a container of found point 2D attributes
47   /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
48   /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
49   /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes
50   /// should be skipped
51   /// \returns found point attribute or NULL
52   MODELGEOMALGO_EXPORT void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
53                                           const std::string& theReferenceFeatureKind,
54                                           std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
55                                           const std::string& theObjectFeatureKind = "",
56                                           const std::string& theObjectFeatureAttribute = "",
57                                           const bool isSkipFeatureAttributes = true);
58
59   /// Removes attributes which points are out of the base shape
60   /// \param theBaseShape a shape of check
61   /// \param theAttributes a container of point 2D attributes
62   /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point
63   /// \param theDirX plane X direction to generate 3D point by 2D attribute point
64   /// \param theDirY plane X direction to generate 3D point by 2D attribute point
65   /// \param thePoints a container of 3D points belong to the shape
66   MODELGEOMALGO_EXPORT void getPointsInsideShape(
67                               const std::shared_ptr<GeomAPI_Shape> theBaseShape,
68                               const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
69                               const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
70                               const std::shared_ptr<GeomAPI_Dir>& theDirX,
71                               const std::shared_ptr<GeomAPI_Dir>& theDirY,
72                               std::set<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
73                               std::map<std::shared_ptr<GeomDataAPI_Point2D>,
74                                        std::shared_ptr<GeomAPI_Pnt> >& theAttributeToPoint);
75
76   /// Finds projected point to the given shape line
77   /// \param theBaseShape a shape of check
78   /// \param thePoint [in] a point to project
79   /// \param theProjectedPoint [out] a projected point
80   MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
81                                           const std::shared_ptr<GeomAPI_Pnt>& thePoint,
82                                           std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);
83 }
84
85 #endif