Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeTools.h
index 3d62588f7360ec40e5719e5109c761fba4226f96..49aaef252d44938c9e40279d3a05d486f01fd381 100644 (file)
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Vertex.h>
 
+#include <set>
+
+class GeomAPI_Edge;
 class GeomAPI_Dir;
+class GeomAPI_Face;
 class GeomAPI_PlanarEdges;
 class GeomAPI_Pln;
 class GeomAPI_Pnt;
@@ -26,40 +30,49 @@ public:
   /// \return the total volume of the solids of the current shape or 0.0 if it can be computed.
   GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr<GeomAPI_Shape> theShape);
 
-  /// \return the centre of mass of the current face. The coordinates returned for the center of mass
-  /// are expressed in the absolute Cartesian coordinate system. (This function works only for surfaces).
-  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Pnt> centreOfMass(const std::shared_ptr<GeomAPI_Shape> theShape);
+  /// \return the centre of mass of the current face. 
+  /// The coordinates returned for the center of mass
+  /// are expressed in the absolute Cartesian coordinate system. 
+  /// (This function works only for surfaces).
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Pnt> 
+    centreOfMass(const std::shared_ptr<GeomAPI_Shape> theShape);
 
   /// \brief Combines faces with common edges to shells, or solids to compsolids.
   /// \param[in] theCompound compound of shapes.
   /// \param[in] theType type of combine.
   /// \param[out] theCombinedShapes resulting shapes.
   /// \param[out] theFreeShapes shapes that does not have common subshapes.
-  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> combineShapes(const std::shared_ptr<GeomAPI_Shape> theCompound,
-                                                                         const GeomAPI_Shape::ShapeType theType,
-                                                                         ListOfShape& theCombinedShapes,
-                                                                         ListOfShape& theFreeShapes);
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> combineShapes(
+    const std::shared_ptr<GeomAPI_Shape> theCompound,
+    const GeomAPI_Shape::ShapeType theType,
+    ListOfShape& theCombinedShapes,
+    ListOfShape& theFreeShapes);
 
   /// \brief Groups shapes with shared topology to compounds.
   /// \param[in] theCompound compound of shapes.
   /// \return compound of compounds with shared topology.
-  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> groupSharedTopology(const std::shared_ptr<GeomAPI_Shape> theCompound);
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> 
+    groupSharedTopology(const std::shared_ptr<GeomAPI_Shape> theCompound);
 
   /// \brief Calculates bounding box for theShapes
   /// \return list of eight points.
   /// \param[in] theShapes list of shapes.
   /// \param[in] theEnlarge enlarges bounding box size.
-  GEOMALGOAPI_EXPORT static std::list<std::shared_ptr<GeomAPI_Pnt> > getBoundingBox(const ListOfShape& theShapes, const double theEnlarge = 0.0);
+  GEOMALGOAPI_EXPORT static 
+    std::list<std::shared_ptr<GeomAPI_Pnt> > getBoundingBox(const ListOfShape& theShapes, 
+                                                            const double theEnlarge = 0.0);
 
   /// \return infinite plane received from theFace plane.
-  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape> theFace);
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> 
+    faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape> theFace);
 
   /// \brief Enlarges or reduces plane to fit bounding box.
   /// \return plane that fits to bounding box.
   /// \param[in] thePlane base plane.
   /// \param[in] thePoints bounding box points (shoud be eight).
-  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> fitPlaneToBox(const std::shared_ptr<GeomAPI_Shape> thePlane,
-                                                                         const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints);
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Face> fitPlaneToBox(
+    const std::shared_ptr<GeomAPI_Shape> thePlane,
+    const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints);
 
   /// \brief Finds the start and end vertices of theShape. theShape can be of the following type:\n
   /// Vertex: theV1 and theV2 are the same and equal to theShape;\n
@@ -75,9 +88,9 @@ public:
   /// \param[in] theWires base wires.
   /// \param[out] theFaces resulting faces.
   GEOMALGOAPI_EXPORT static void makeFacesWithHoles(const std::shared_ptr<GeomAPI_Pnt> theOrigin,
-                                                    const std::shared_ptr<GeomAPI_Dir> theDirection,
-                                                    const ListOfShape& theWires,
-                                                    ListOfShape& theFaces);
+                                                const std::shared_ptr<GeomAPI_Dir> theDirection,
+                                                const ListOfShape& theWires,
+                                                ListOfShape& theFaces);
 
   /// \brief Return a plane for list of shapes if they are all planar.
   /// \param[in] theShapes shapes to find plane.
@@ -88,8 +101,34 @@ public:
   /// \param[in] theSubShape shape that should be inside.
   /// \param[in] theBaseShape base shape.
   /// \return true if edge inside the face.
-  GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape(const std::shared_ptr<GeomAPI_Shape> theSubShape,
-                                                       const std::shared_ptr<GeomAPI_Shape> theBaseShape);
+  GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape(
+    const std::shared_ptr<GeomAPI_Shape> theSubShape,
+    const std::shared_ptr<GeomAPI_Shape> theBaseShape);
+
+  /// \return true if theShape is valid.
+  GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape);
+
+  /// \return outer wire for face. If theShape has different type returns empty pointer.
+  GEOMALGOAPI_EXPORT static 
+    std::shared_ptr<GeomAPI_Shape> getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace);
+
+  /// \return true if edge is parallel to face.
+  GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr<GeomAPI_Edge> theEdge,
+                                            const std::shared_ptr<GeomAPI_Face> theFace);
+
+  /// \brief Performs the split of the shape by points.
+  /// \param[in] theBaseShape shape that should be splitted.
+  /// \param[in] thePoints container of points to split
+  /// \param[out] theShapes container of shapes after split
+  GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
+                                      const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
+                                      std::set<std::shared_ptr<GeomAPI_Shape> >& theShapes);
+
+
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> findShape(
+                                    const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
+                                    const std::set<std::shared_ptr<GeomAPI_Shape> >& theShapes);
+
 };
 
 #endif