Salome HOME
Minor corrections: coding rules
[modules/shaper.git] / src / ModelGeomAlgo / ModelGeomAlgo_Point2D.h
index 7f1e89bdf0c03e6266e41b1db7582667cac04e9a..afa13b127a1c63d1f6356eca43345e2daf6cbffc 100755 (executable)
@@ -24,8 +24,9 @@ class GeomDataAPI_Point2D;
 #include <map>
 
 
-namespace ModelGeomAlgo_Point2D {
-
+class ModelGeomAlgo_Point2D
+{
+public:
   /// Searches Point2D attribute of reference of the attribute of given feature
   /// \param theFeature a feature to obtain AttributeRefAttr
   /// \param theAttribute a name of AttributeRefAttr on the given feature
@@ -33,7 +34,7 @@ namespace ModelGeomAlgo_Point2D {
   /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
   /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes
   /// \returns found point attribute or NULL
-  MODELGEOMALGO_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(
+  static MODELGEOMALGO_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(
                         ModelAPI_Feature* theFeature,
                         const std::string& theAttribute,
                         const std::string& theObjectFeatureKind = "",
@@ -42,19 +43,39 @@ namespace ModelGeomAlgo_Point2D {
   /// Fills container of point 2D attributes, which refer to the feature through the references
   /// features with the given kind
   /// \param theObject an object where references should be searched (e.g. a sketch line or result)
-  /// \param theReferenceFeatureKind a kind of the feature to be processed (e.g. coincidence constraint)
+  /// \param theReferenceFeatureKind a kind of the feature to be processed
+  ///                                (e.g. coincidence constraint)
   /// \param theAttributes a container of found point 2D attributes
   /// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
   /// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
   /// \param isSkipFeatureAttributes a boolean value if coincidences to the feature attributes
   /// should be skipped
   /// \returns found point attribute or NULL
-  MODELGEOMALGO_EXPORT void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
-                                          const std::string& theReferenceFeatureKind,
-                                          std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
-                                          const std::string& theObjectFeatureKind = "",
-                                          const std::string& theObjectFeatureAttribute = "",
-                                          const bool isSkipFeatureAttributes = true);
+  static MODELGEOMALGO_EXPORT
+        void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
+                                  const std::string& theReferenceFeatureKind,
+                                  std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
+                                  const std::string& theObjectFeatureKind = "",
+                                  const std::string& theObjectFeatureAttribute = "",
+                                  const bool isSkipFeatureAttributes = true);
+
+  /// Find points of intersection between the shape of the feature and all features in the sketch
+  /// \param theBaseFeature a feature: line, arc or circle that will be intersected
+  /// \param theFeatures a container of features to intersect with the base feature
+  /// \param thePoints a container of 3D points belong to the shape
+  /// \param theObjectToPoint a container of object to point
+  typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
+                   std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D> >,
+                             std::list<std::shared_ptr<ModelAPI_Object> > > > PointToRefsMap;
+
+  static MODELGEOMALGO_EXPORT void getPointsIntersectedShape(
+                  const std::shared_ptr<ModelAPI_Feature>& theBaseFeature,
+                  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
+                  PointToRefsMap& thePointToAttributeOrObject);
+
+  static MODELGEOMALGO_EXPORT std::list<std::shared_ptr<GeomAPI_Pnt> > getSetOfPntIntersectedShape(
+                  const std::shared_ptr<ModelAPI_Feature>& theBaseFeature,
+                  const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
 
   /// Removes attributes which points are out of the base shape
   /// \param theBaseShape a shape of check
@@ -63,7 +84,24 @@ namespace ModelGeomAlgo_Point2D {
   /// \param theDirX plane X direction to generate 3D point by 2D attribute point
   /// \param theDirY plane X direction to generate 3D point by 2D attribute point
   /// \param thePoints a container of 3D points belong to the shape
-  MODELGEOMALGO_EXPORT void getPointsInsideShape(
+  /// \param theAttributeToPoint a container of attribute to point
+  static MODELGEOMALGO_EXPORT void getPointsInsideShape(
+                        const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                        const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
+                        const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+                        const std::shared_ptr<GeomAPI_Dir>& theDirX,
+                        const std::shared_ptr<GeomAPI_Dir>& theDirY,
+                        PointToRefsMap& thePointToAttributeOrObject);
+
+  /// Removes attributes which points are out of the base shape
+  /// \param theBaseShape a shape of check
+  /// \param theAttributes a container of point 2D attributes
+  /// \param theOrigin origin of a plane to generate 3D point by 2D attribute point
+  /// \param theDirX plane X direction to generate 3D point by 2D attribute point
+  /// \param theDirY plane X direction to generate 3D point by 2D attribute point
+  /// \param thePoints a container of 3D points belong to the shape
+  /// \param theAttributeToPoint a container of attribute to point
+  static MODELGEOMALGO_EXPORT void getPointsInsideShape_p(
                               const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                               const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
                               const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
@@ -72,29 +110,31 @@ namespace ModelGeomAlgo_Point2D {
                               std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
                               std::map<std::shared_ptr<GeomDataAPI_Point2D>,
                                        std::shared_ptr<GeomAPI_Pnt> >& theAttributeToPoint);
-
   /// Finds projected point to the given shape line
   /// \param theBaseShape a shape of check
   /// \param thePoint [in] a point to project
   /// \param theProjectedPoint [out] a projected point
-  MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+  static MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
                                           const std::shared_ptr<GeomAPI_Pnt>& thePoint,
                                           std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);
 
+
+#ifdef _DEBUG
   /// Return feature name, kind and point values united in a string info
   /// \param theFeature an investigated feature
   /// \param theAttributesOnly a container of necessary attributes, if empty, all
   /// \return string value
-  MODELGEOMALGO_EXPORT std::string getPontAttributesInfo(
-                           const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                           const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly);
+  static MODELGEOMALGO_EXPORT std::string getPontAttributesInfo(
+                      const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                      const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly);
 
   /// Return point attribute string info
   /// \param theAttribute an investigated attribute
   /// \return string value
-  MODELGEOMALGO_EXPORT std::string getPointAttributeInfo(
-                                  const std::shared_ptr<ModelAPI_Attribute>& theAttribute);
+  static MODELGEOMALGO_EXPORT std::string getPointAttributeInfo(
+                      const std::shared_ptr<ModelAPI_Attribute>& theAttribute);
 
-}
+#endif
+};
 
 #endif