1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelGeomAlgo_Point2D.h
4 // Created: 20 Jul 2016
5 // Author: Natalia ERMOLAEVA
7 #ifndef ModelGeomAlgo_Point2D_H
8 #define ModelGeomAlgo_Point2D_H
10 #include "ModelGeomAlgo.h"
12 class ModelAPI_Feature;
13 class ModelAPI_Object;
18 class GeomDataAPI_Point2D;
25 namespace ModelGeomAlgo_Point2D {
27 /// Searches Point2D attribute of reference of the attribute of given feature
28 /// \param theFeature a feature to obtain AttributeRefAttr
29 /// \param theAttribute a name of AttributeRefAttr on the given feature
30 /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
31 /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
32 /// \returns found point attribute or NULL
33 MODELGEOMALGO_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(
34 ModelAPI_Feature* theFeature,
35 const std::string& theAttribute,
36 const std::string& theObjectFeatureKind = "",
37 const std::string& theObjectFeatureAttribute = "");
39 /// Fills container of point 2D attributes, which refer to the feature through the references
40 /// features with the given kind
41 /// \param theObject an object where references should be searched (e.g. a sketch line or result)
42 /// \param theReferenceFeatureKind a kind of the feature to be processed (e.g. coincidence constraint)
43 /// \param theAttributes a container of found point 2D attributes
44 /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
45 /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
46 /// \returns found point attribute or NULL
47 MODELGEOMALGO_EXPORT void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
48 const std::string& theReferenceFeatureKind,
49 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
50 const std::string& theObjectFeatureKind = "",
51 const std::string& theObjectFeatureAttribute = "");
53 /// Removes attributes which points are out of the base shape
54 /// \param theBaseShape a shape of check
55 /// \param theAttributes a container of point 2D attributes
56 /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point
57 /// \param theDirX plane X direction to generate 3D point by 2D attribute point
58 /// \param theDirY plane X direction to generate 3D point by 2D attribute point
59 /// \param thePoints a container of 3D points belong to the shape
60 MODELGEOMALGO_EXPORT void getPointsInsideShape(
61 const std::shared_ptr<GeomAPI_Shape> theBaseShape,
62 const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
63 const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
64 const std::shared_ptr<GeomAPI_Dir>& theDirX,
65 const std::shared_ptr<GeomAPI_Dir>& theDirY,
66 std::set<std::shared_ptr<GeomAPI_Pnt> >& thePoints);
68 /// Finds projected point to the given shape line
69 /// \param theBaseShape a shape of check
70 /// \param thePoint [in] a point to project
71 /// \param theProjectedPoint [out] a projected point
72 MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
73 const std::shared_ptr<GeomAPI_Pnt>& thePoint,
74 std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);