Salome HOME
e80eada99b1f72c3f691a75254e5c6524fc60987
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_PipeTShapeDriver.hxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _AdvancedEngine_PipeTShapeDriver_HXX
21 #define _AdvancedEngine_PipeTShapeDriver_HXX
22
23 #include "GEOM_BaseDriver.hxx"
24 #include "GEOMAlgo_State.hxx"
25
26 #include <TopAbs_ShapeEnum.hxx>
27 #include <TopTools_HSequenceOfShape.hxx>
28 #include <TColStd_HSequenceOfInteger.hxx>
29 #include <Geom_Surface.hxx>
30
31 DEFINE_STANDARD_HANDLE( AdvancedEngine_PipeTShapeDriver, GEOM_BaseDriver )
32
33 class AdvancedEngine_PipeTShapeDriver : public GEOM_BaseDriver
34 {
35 public:
36  // Methods PUBLIC
37   // 
38   AdvancedEngine_PipeTShapeDriver();
39   virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
40   virtual void Validate(Handle(TFunction_Logbook)&) const {}
41   Standard_Boolean MustExecute(const Handle(TFunction_Logbook)&) const { return Standard_True; }
42
43   static const Standard_GUID& GetID();
44   ~AdvancedEngine_PipeTShapeDriver() {};
45   
46   virtual bool GetCreationInformation(std::string&             theOperationName,
47                                       std::vector<GEOM_Param>& params);
48   // Type management
49   //
50   DEFINE_STANDARD_RTTIEXT(AdvancedEngine_PipeTShapeDriver,GEOM_BaseDriver)
51 private:
52
53   /*!
54    * \brief Create a T-Shape based on pipes
55    * \param r1 - the internal radius of main pipe
56    * \param w1 - the thickness of main pipe
57    * \param l1 - the half-length of main pipe
58    * \param r2 - the internal radius of incident pipe
59    * \param w2 - the thickness of incident pipe
60    * \param l2 - the half-length of main pipe
61    * \retval TopoDS_Shape - Resulting shape
62    */
63   TopoDS_Shape MakePipeTShape(double r1, double w1, double l1,
64                               double r2, double w2, double l2) const;
65
66   /*!
67    * \brief Create a quarter of a T-Shape based on pipes
68    * \param r1 - the internal radius of main pipe
69    * \param w1 - the thickness of main pipe
70    * \param l1 - the half-length of main pipe
71    * \param r2 - the internal radius of incident pipe
72    * \param w2 - the thickness of incident pipe
73    * \param l2 - the half-length of main pipe
74    * \retval TopoDS_Shape - Resulting shape
75    */
76   TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1,
77                                      double r2, double w2, double l2) const;
78
79   /*!
80    * \brief Find IDs of sub-shapes complying with given status about surface
81    * \param theSurface - the surface to check state of sub-shapes against
82    * \param theShape - the shape to explore
83    * \param theShapeType - type of sub-shape of theShape
84    * \param theState - required state
85    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
86    */
87   Handle(TColStd_HSequenceOfInteger)
88     GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
89                           const TopoDS_Shape&         theShape,
90                           TopAbs_ShapeEnum            theShapeType,
91                           GEOMAlgo_State              theState) const;
92
93   /*!
94    * \brief Find IDs of sub-shapes complying with given status about surface
95     * \param theBox - the box to check state of sub-shapes against
96     * \param theShape - the shape to explore
97     * \param theShapeType - type of sub-shape of theShape
98     * \param theState - required state
99     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
100    */
101   Handle(TColStd_HSequenceOfInteger)
102   GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
103                  const TopoDS_Shape& aShape,
104                  const Standard_Integer theShapeType,
105                  GEOMAlgo_State theState) const;
106
107   //=======================================================================
108   //function : getCommonShapesOnCylinders
109   //purpose  : return the common edge between 2 cylindrical surfaces
110   //           along OX and OZ
111   //=======================================================================
112   void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
113                                   TopAbs_ShapeEnum theShapeType,
114                                   double r, double r2,
115                                   Handle(TopTools_HSequenceOfShape)& commonShapes) const;
116
117 };
118
119 #endif // _AdvancedEngine_PipeTShapeDriver_HXX