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"
11 #include "ModelAPI_Feature.h"
13 class ModelAPI_Feature;
14 class ModelAPI_Object;
19 class GeomDataAPI_Point2D;
27 namespace ModelGeomAlgo_Point2D {
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 = "");
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
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);
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);
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);
86 /// Return feature name, kind and point values united in a string info
87 /// \param theFeature an investigated feature
88 /// \param theAttributesOnly a container of necessary attributes, if empty, all
89 /// \return string value
90 MODELGEOMALGO_EXPORT std::string getPontAttributesInfo(
91 const std::shared_ptr<ModelAPI_Feature>& theFeature,
92 const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly);
94 /// Return point attribute string info
95 /// \param theAttribute an investigated attribute
96 /// \return string value
97 MODELGEOMALGO_EXPORT std::string getPointAttributeInfo(
98 const std::shared_ptr<ModelAPI_Attribute>& theAttribute);