1 // Copyright (C) 2007-2012 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
19 #ifndef _GEOMImpl_PipeTShapeDriver_HXX
20 #define _GEOMImpl_PipeTShapeDriver_HXX
22 #include <TFunction_Driver.hxx>
24 #include "GEOMAlgo_State.hxx"
26 #include <TopAbs_ShapeEnum.hxx>
27 #include <TopTools_ListOfShape.hxx>
28 #include <TopTools_HSequenceOfShape.hxx>
29 #include <TopTools_IndexedMapOfShape.hxx>
30 #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));
130 * \brief Create a T-Shape based on pipes
131 * \param r1 - the internal radius of main pipe
132 * \param w1 - the thickness of main pipe
133 * \param l1 - the half-length of main pipe
134 * \param r2 - the internal radius of incident pipe
135 * \param w2 - the thickness of incident pipe
136 * \param l2 - the half-length of main pipe
137 * \retval TopoDS_Shape - Resulting shape
139 TopoDS_Shape MakePipeTShape(double r1, double w1, double l1,
140 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 of 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 of 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,
153 double r2, double w2, double l2) const;
156 * \brief Find IDs of sub-shapes complying with given status about surface
157 * \param theSurface - the surface to check state of sub-shapes against
158 * \param theShape - the shape to explore
159 * \param theShapeType - type of sub-shape of theShape
160 * \param theState - required state
161 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
163 Handle(TColStd_HSequenceOfInteger)
164 GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
165 const TopoDS_Shape& theShape,
166 TopAbs_ShapeEnum theShapeType,
167 GEOMAlgo_State theState) const;
170 * \brief Find IDs of sub-shapes complying with given status about surface
171 * \param theBox - the box to check state of sub-shapes against
172 * \param theShape - the shape to explore
173 * \param theShapeType - type of sub-shape of theShape
174 * \param theState - required state
175 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
177 Handle(TColStd_HSequenceOfInteger)
178 GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
179 const TopoDS_Shape& aShape,
180 const Standard_Integer theShapeType,
181 GEOMAlgo_State theState) const;
183 //=======================================================================
184 //function : getCommonShapesOnCylinders
185 //purpose : return the common edge between 2 cylindrical surfaces
187 //=======================================================================
188 void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
189 TopAbs_ShapeEnum theShapeType,
191 Handle(TopTools_HSequenceOfShape)& commonShapes) const;
195 #endif // _GEOMImpl_PipeTShapeDriver_HXX