Salome HOME
Merge remote-tracking branch 'origin/master' into rnc/t_shape_plugin
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_PipeTShapeDriver.hxx
1 // Copyright (C) 2007-2014  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(TFunction_Logbook& log) const; 
40   virtual void Validate(TFunction_Logbook&) const {}
41   Standard_Boolean MustExecute(const TFunction_Logbook&) const
42   {
43     return Standard_True;
44   }
45   static const Standard_GUID& GetID();
46   ~AdvancedEngine_PipeTShapeDriver() {};
47   
48   virtual bool GetCreationInformation(std::string&             theOperationName,
49                                       std::vector<GEOM_Param>& params);
50   // Type management
51   //
52 DEFINE_STANDARD_RTTI( AdvancedEngine_PipeTShapeDriver )
53
54 private:
55
56   /*!
57    * \brief Create a T-Shape based on pipes
58    * \param r1 - the internal radius of main pipe
59    * \param w1 - the thickness of main pipe
60    * \param l1 - the half-length of main pipe
61    * \param r2 - the internal radius of incident pipe
62    * \param w2 - the thickness of incident pipe
63    * \param l2 - the half-length of main pipe
64    * \retval TopoDS_Shape - Resulting shape
65    */
66   TopoDS_Shape MakePipeTShape(double r1, double w1, double l1,
67                               double r2, double w2, double l2) const;
68
69   /*!
70    * \brief Create a quarter of a T-Shape based on pipes
71    * \param r1 - the internal radius of main pipe
72    * \param w1 - the thickness of main pipe
73    * \param l1 - the half-length of main pipe
74    * \param r2 - the internal radius of incident pipe
75    * \param w2 - the thickness of incident pipe
76    * \param l2 - the half-length of main pipe
77    * \retval TopoDS_Shape - Resulting shape
78    */
79   TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1,
80                                      double r2, double w2, double l2) const;
81
82   /*!
83    * \brief Find IDs of sub-shapes complying with given status about surface
84    * \param theSurface - the surface to check state of sub-shapes against
85    * \param theShape - the shape to explore
86    * \param theShapeType - type of sub-shape of theShape
87    * \param theState - required state
88    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
89    */
90   Handle(TColStd_HSequenceOfInteger)
91     GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
92                           const TopoDS_Shape&         theShape,
93                           TopAbs_ShapeEnum            theShapeType,
94                           GEOMAlgo_State              theState) const;
95
96   /*!
97    * \brief Find IDs of sub-shapes complying with given status about surface
98     * \param theBox - the box to check state of sub-shapes against
99     * \param theShape - the shape to explore
100     * \param theShapeType - type of sub-shape of theShape
101     * \param theState - required state
102     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
103    */
104   Handle(TColStd_HSequenceOfInteger)
105   GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
106                  const TopoDS_Shape& aShape,
107                  const Standard_Integer theShapeType,
108                  GEOMAlgo_State theState) const;
109
110   //=======================================================================
111   //function : getCommonShapesOnCylinders
112   //purpose  : return the common edge between 2 cylindrical surfaces
113   //           along OX and OZ
114   //=======================================================================
115   void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
116                                   TopAbs_ShapeEnum theShapeType,
117                                   double r, double r2,
118                                   Handle(TopTools_HSequenceOfShape)& commonShapes) const;
119
120 };
121
122 #endif // _AdvancedEngine_PipeTShapeDriver_HXX