1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _GEOMImpl_PipeTShapeDriver_HXX
21 #define _GEOMImpl_PipeTShapeDriver_HXX
23 #include <TFunction_Driver.hxx>
25 #include "GEOMAlgo_State.hxx"
27 #include <TopTools_ListOfShape.hxx>
28 #include <TopTools_HSequenceOfShape.hxx>
29 #include <TopTools_IndexedMapOfShape.hxx>
30 #include <TopAbs_ShapeEnum.hxx>
31 #include <TColStd_HSequenceOfInteger.hxx>
33 #include <Handle_Geom_Surface.hxx>
35 class Handle_Standard_Type;
36 class GEOMImpl_PipeTShapeDriver;
38 Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
40 class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) {
42 inline void* operator new(size_t,void* anAddress)
46 inline void* operator new(size_t size)
48 return Standard::Allocate(size);
50 inline void operator delete(void *anAddress)
52 if (anAddress) Standard::Free((Standard_Address&)anAddress);
55 Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {}
56 Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
59 Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
62 Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle)
64 Assign(aHandle.Access());
68 Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem)
70 Assign((Standard_Transient *)anItem);
74 GEOMImpl_PipeTShapeDriver* operator->()
76 return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
79 GEOMImpl_PipeTShapeDriver* operator->() const
81 return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
84 Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {};
86 Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject);
89 class GEOMImpl_PipeTShapeDriver : public TFunction_Driver {
91 inline void* operator new(size_t,void* anAddress)
95 inline void* operator new(size_t size)
97 return Standard::Allocate(size);
99 inline void operator delete(void *anAddress)
101 if (anAddress) Standard::Free((Standard_Address&)anAddress);
106 Standard_EXPORT GEOMImpl_PipeTShapeDriver();
107 Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
108 Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
109 Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
111 return Standard_True;
113 Standard_EXPORT static const Standard_GUID& GetID();
114 Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
118 Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_();
119 Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
121 return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
123 Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
125 return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType));
129 * \brief Create a T-Shape based on pipes
130 * \param r1 - the internal radius of main pipe
131 * \param w1 - the thickness main pipe
132 * \param l1 - the half-length of main pipe
133 * \param r2 - the internal radius of incident pipe
134 * \param w2 - the thickness incident pipe
135 * \param l2 - the half-length of main pipe
136 * \retval TopoDS_Shape - Resulting shape
138 TopoDS_Shape MakePipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
141 * \brief Create a quarter of a T-Shape based on pipes
142 * \param r1 - the internal radius of main pipe
143 * \param w1 - the thickness main pipe
144 * \param l1 - the half-length of main pipe
145 * \param r2 - the internal radius of incident pipe
146 * \param w2 - the thickness incident pipe
147 * \param l2 - the half-length of main pipe
148 * \retval TopoDS_Shape - Resulting shape
150 TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
152 //=======================================================================
153 //function : GetShapesOnSurfaceIDs
155 * \brief Find IDs of subshapes complying with given status about surface
156 * \param theSurface - the surface to check state of subshapes against
157 * \param theShape - the shape to explore
158 * \param theShapeType - type of subshape of theShape
159 * \param theState - required state
160 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
162 Handle(TColStd_HSequenceOfInteger)
163 GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
164 const TopoDS_Shape& theShape,
165 TopAbs_ShapeEnum theShapeType,
166 GEOMAlgo_State theState) const;
167 //=======================================================================
168 //function : getShapesOnBoxIDs
170 * \brief Find IDs of subshapes complying with given status about surface
171 * \param theBox - the box to check state of subshapes against
172 * \param theShape - the shape to explore
173 * \param theShapeType - type of subshape of theShape
174 * \param theState - required state
175 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
177 //=======================================================================
178 Handle(TColStd_HSequenceOfInteger)
179 GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
180 const TopoDS_Shape& aShape,
181 const Standard_Integer theShapeType,
182 GEOMAlgo_State theState) const;
184 //=======================================================================
185 //function : getCommonShapesOnCylinders
186 //purpose : return the common edge between 2 cylindrical surfaces
188 //=======================================================================
189 void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
190 TopAbs_ShapeEnum theShapeType,
192 Handle(TopTools_HSequenceOfShape)& commonShapes) const;
196 #endif // _GEOMImpl_PipeTShapeDriver_HXX