1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef _GEOMImpl_PipeTShapeDriver_HXX
23 #define _GEOMImpl_PipeTShapeDriver_HXX
25 #include <TFunction_Driver.hxx>
27 #include "GEOMAlgo_State.hxx"
29 #include <TopTools_ListOfShape.hxx>
30 #include <TopTools_HSequenceOfShape.hxx>
31 #include <TopTools_IndexedMapOfShape.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TColStd_HSequenceOfInteger.hxx>
35 #include <Handle_Geom_Surface.hxx>
37 class Handle_Standard_Type;
38 class GEOMImpl_PipeTShapeDriver;
40 Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
42 class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) {
44 inline void* operator new(size_t,void* anAddress)
48 inline void* operator new(size_t size)
50 return Standard::Allocate(size);
52 inline void operator delete(void *anAddress)
54 if (anAddress) Standard::Free((Standard_Address&)anAddress);
57 Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {}
58 Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
61 Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
64 Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle)
66 Assign(aHandle.Access());
70 Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem)
72 Assign((Standard_Transient *)anItem);
76 GEOMImpl_PipeTShapeDriver* operator->()
78 return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
81 GEOMImpl_PipeTShapeDriver* operator->() const
83 return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
86 Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {};
88 Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject);
91 class GEOMImpl_PipeTShapeDriver : public TFunction_Driver {
93 inline void* operator new(size_t,void* anAddress)
97 inline void* operator new(size_t size)
99 return Standard::Allocate(size);
101 inline void operator delete(void *anAddress)
103 if (anAddress) Standard::Free((Standard_Address&)anAddress);
108 Standard_EXPORT GEOMImpl_PipeTShapeDriver();
109 Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
110 Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
111 Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
113 return Standard_True;
115 Standard_EXPORT static const Standard_GUID& GetID();
116 Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
120 Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_();
121 Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
123 return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
125 Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
127 return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType));
131 * \brief Create a T-Shape based on pipes
132 * \param r1 - the internal radius of main pipe
133 * \param w1 - the thickness main pipe
134 * \param l1 - the half-length of main pipe
135 * \param r2 - the internal radius of incident pipe
136 * \param w2 - the thickness incident pipe
137 * \param l2 - the half-length of main pipe
138 * \retval TopoDS_Shape - Resulting shape
140 TopoDS_Shape MakePipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
143 * \brief Create a quarter of a T-Shape based on pipes
144 * \param r1 - the internal radius of main pipe
145 * \param w1 - the thickness main pipe
146 * \param l1 - the half-length of main pipe
147 * \param r2 - the internal radius of incident pipe
148 * \param w2 - the thickness incident pipe
149 * \param l2 - the half-length of main pipe
150 * \retval TopoDS_Shape - Resulting shape
152 TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
154 //=======================================================================
155 //function : GetShapesOnSurfaceIDs
157 * \brief Find IDs of subshapes complying with given status about surface
158 * \param theSurface - the surface to check state of subshapes against
159 * \param theShape - the shape to explore
160 * \param theShapeType - type of subshape of theShape
161 * \param theState - required state
162 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
164 Handle(TColStd_HSequenceOfInteger)
165 GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
166 const TopoDS_Shape& theShape,
167 TopAbs_ShapeEnum theShapeType,
168 GEOMAlgo_State theState) const;
169 //=======================================================================
170 //function : getShapesOnBoxIDs
172 * \brief Find IDs of subshapes complying with given status about surface
173 * \param theBox - the box to check state of subshapes against
174 * \param theShape - the shape to explore
175 * \param theShapeType - type of subshape of theShape
176 * \param theState - required state
177 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
179 //=======================================================================
180 Handle(TColStd_HSequenceOfInteger)
181 GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
182 const TopoDS_Shape& aShape,
183 const Standard_Integer theShapeType,
184 GEOMAlgo_State theState) const;
186 //=======================================================================
187 //function : getCommonShapesOnCylinders
188 //purpose : return the common edge between 2 cylindrical surfaces
190 //=======================================================================
191 void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
192 TopAbs_ShapeEnum theShapeType,
194 Handle(TopTools_HSequenceOfShape)& commonShapes) const;
198 #endif // _GEOMImpl_PipeTShapeDriver_HXX