Salome HOME
PAL17233: Projection 2D doesn't work (bis)
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IShapesOperations.hxx
index 82a7d37e0301cb093f038950aba5ad35f52579a4..1e8cdc2c80a992099dbfac4be5e73e5cf41eae12 100644 (file)
 // License along with this library; if not, write to the Free Software 
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
+//=============================================================================
+// File      : GEOMImpl_IShapesOperations.hxx
+// Created   : 
+// Author    : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
+// Project   : SALOME
+// Copyright : CEA 2003
+// $Header$
+//=============================================================================
 #ifndef _GEOMImpl_IShapesOperations_HXX_
 #define _GEOMImpl_IShapesOperations_HXX_
 
 #include <list>
 #include <Handle_Geom_Surface.hxx>
 
+#include <gp_Pnt.hxx>
+
 class GEOM_Engine;
 class Handle(GEOM_Object);
 class Handle(TColStd_HArray1OfInteger);
 
-class GEOMImpl_IShapesOperations : public GEOM_IOperations {
+class GEOMImpl_IShapesOperations : public GEOM_IOperations
+{
  public:
   Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
   Standard_EXPORT ~GEOMImpl_IShapesOperations();
@@ -60,18 +70,35 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes);
 
   Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
-                                     const Standard_Real theTolerance);
+                                                    const Standard_Real theTolerance,
+                                                     const Standard_Boolean doKeepNonSolids);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
+                                                                    const Standard_Real theTolerance);
+
+  Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
+                                                          const Standard_Real theTolerance,
+                                                          list<Handle(GEOM_Object)> theFaces,
+                                                           const Standard_Boolean doKeepNonSolids);
 
   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object)    theShape,
-                                                    const Standard_Integer theShapeType,
-                                                    const Standard_Boolean isSorted);
+                                                                    const Standard_Integer theShapeType,
+                                                                    const Standard_Boolean isSorted);
 
   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object)    theShape,
-                                                     const Standard_Integer theShapeType,
-                                                     const Standard_Boolean isSorted);
+                                                                     const Standard_Integer theShapeType,
+                                                                     const Standard_Boolean isSorted);
 
   Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object)    theMainShape,
-                                   const Standard_Integer theID);
+                                                   const Standard_Integer theID);
+
+  Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape,
+                                                     Handle(GEOM_Object) theSubShape);
+
+  Standard_EXPORT Standard_Integer GetTopologyIndex (Handle(GEOM_Object) theMainShape,
+                                                     Handle(GEOM_Object) theSubShape);
+
+  Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
 
   Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
   Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
@@ -89,34 +116,54 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                                                          const Handle(GEOM_Object)& theAx1,
                                                          const GEOMAlgo_State       theState);
 
-  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
-                                                            const Standard_Integer     theShapeType,
-                                                            const Handle(GEOM_Object)& theAxis,
-                                                            const Standard_Real        theRadius,
-                                                            const GEOMAlgo_State       theState);
-
-  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
-                                                          const Standard_Integer     theShapeType,
-                                                          const Handle(GEOM_Object)& theCenter,
-                                                          const Standard_Real        theRadius,
-                                                          const GEOMAlgo_State       theState);
-
-  Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
-                                                          const Standard_Integer     theShapeType,
-                                                          const Handle(GEOM_Object)& theAx1,
-                                                          const GEOMAlgo_State       theState);
-
-  Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
-                                                             const Standard_Integer     theShapeType,
-                                                             const Handle(GEOM_Object)& theAxis,
-                                                             const Standard_Real        theRadius,
-                                                             const GEOMAlgo_State       theState);
-
-  Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
-                                                           const Standard_Integer     theShapeType,
-                                                           const Handle(GEOM_Object)& theCenter,
-                                                           const Standard_Real        theRadius,
-                                                           const GEOMAlgo_State       theState);
+  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+    GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape,
+                                  const Standard_Integer     theShapeType,
+                                  const Handle(GEOM_Object)& theAx1,
+                                  const Handle(GEOM_Object)& thePnt,
+                                  const GEOMAlgo_State       theState);
+
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+    GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
+                         const Standard_Integer     theShapeType,
+                         const Handle(GEOM_Object)& theAxis,
+                         const Standard_Real        theRadius,
+                         const GEOMAlgo_State       theState);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+    GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
+                       const Standard_Integer     theShapeType,
+                       const Handle(GEOM_Object)& theCenter,
+                       const Standard_Real        theRadius,
+                       const GEOMAlgo_State       theState);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+    GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
+                         const Standard_Integer     theShapeType,
+                         const Handle(GEOM_Object)& theAx1,
+                         const GEOMAlgo_State       theState);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+    GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape,
+                                     const Standard_Integer     theShapeType,
+                                     const Handle(GEOM_Object)& theAx1,
+                                     const Handle(GEOM_Object)& thePnt,
+                                     const GEOMAlgo_State       theState);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+    GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
+                            const Standard_Integer     theShapeType,
+                            const Handle(GEOM_Object)& theAxis,
+                            const Standard_Real        theRadius,
+                            const GEOMAlgo_State       theState);
+
+  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+    GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
+                          const Standard_Integer     theShapeType,
+                          const Handle(GEOM_Object)& theCenter,
+                          const Standard_Real        theRadius,
+                          const GEOMAlgo_State       theState);
 
   /*!
    * \brief Find subshapes complying with given status about quadrangle
@@ -168,11 +215,75 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                                             Handle(GEOM_Object)    theCenter,
                                             const Standard_Real    theRadius);
 
+  void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt);
+
   Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
-                                  Handle(GEOM_Object) theShapeWhat);
+                                                  Handle(GEOM_Object) theShapeWhat);
+
+  Standard_EXPORT Handle(GEOM_Object) GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere,
+                                                           Handle(GEOM_Object) theShapeWhat);
+
+  /*!
+   * \brief Searches a shape equal to theWhat in the context of theWhere
+   * \param theShapeWhere - a context shap
+   * \param theShapeWhat - a sample shape
+   * \retval Handle(GEOM_Object) - found shape
+   */
+  Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere,
+                                              const Handle(GEOM_Object)& theShapeWhat);
+
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+    * \param theBox - the box to check state of subshapes against
+    * \param theShape - the shape to explore
+    * \param theShapeType - type of subshape of theShape
+    * \param theState - required state
+    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+                              GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
+                                                const Handle(GEOM_Object)& theShape,
+                                                const Standard_Integer theShapeType,
+                                                GEOMAlgo_State theState);
 
+  /*!
+   * \brief Find subshapes complying with given status about surface
+   * \param theBox - the box to check state of subshapes against
+   * \param theShape - the shape to explore
+   * \param theShapeType - type of subshape of theShape
+   * \param theState - required state
+   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+                                GetShapesOnBox(const Handle(GEOM_Object)& theBox,
+                                               const Handle(GEOM_Object)& theShape,
+                                               const Standard_Integer theShapeType,
+                                               GEOMAlgo_State theState);
+
+ public:
+  /*!
+   * \brief Sort shapes in the list by their coordinates.
+   * \param SL The list of shapes to sort.
+   */
   Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
 
+  /*!
+   * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
+   *
+   * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
+   *
+   * \param theCompsolid The compsolid to be converted.
+   * \retval TopoDS_Shape Returns the resulting compound.
+   */
+  Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
+
+  /*!
+   * \brief Build a triangulation on \a theShape if it is absent.
+   * \param theShape The shape to check/build triangulation on.
+   * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
+   */
+  Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
+
  private:
   Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)>      theShapes,
                                  const Standard_Integer         theObjectType,
@@ -180,11 +291,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                                  const TCollection_AsciiString& theMethodName);
 
 // ----------------------------------------------------
-  // methods common for all GetShapesOnXXX() functions
+// methods common for all GetShapesOnXXX() functions
 // ----------------------------------------------------
 
-  bool CheckTriangulation (const TopoDS_Shape& aShape);
-
   /*!
    * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
     * \param theShapeType - the shape type to check
@@ -236,8 +345,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                        const Handle(GEOM_Object)&  theShape,
                        TopAbs_ShapeEnum            theShapeType,
                        GEOMAlgo_State              theState,
-                       TCollection_AsciiString &   theShapeEntries
-                       );
+                       TCollection_AsciiString &   theShapeEntries);
 
   /*!
    * \brief Find IDs of subshapes complying with given status about quadrangle
@@ -259,6 +367,19 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                               const Handle(GEOM_Object)& theBottomRigthPoint,
                               const GEOMAlgo_State       theState);
 
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+    * \param theBox - the box to check state of subshapes against
+    * \param theShape - the shape to explore
+    * \param theShapeType - type of subshape of theShape
+    * \param theState - required state
+    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+  Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
+                                                       const Handle(GEOM_Object)& theShape,
+                                                       const Standard_Integer theShapeType,
+                                                       GEOMAlgo_State theState);
+
   /*!
    * \brief Find shape objects and their entries by their ids
     * \param theShape - the main shape