Salome HOME
EDF 2281 : code refactoring and first steps for a second constructor of the divided...
[modules/geom.git] / src / GEOMImpl / GEOMImpl_DividedDiskDriver.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22 #ifndef _GEOMImpl_DividedDiskDriver_HXX
23 #define _GEOMImpl_DividedDiskDriver_HXX
24
25 #include <TFunction_Driver.hxx>
26
27 class Handle_Standard_Type;
28 class GEOMImpl_DividedDiskDriver;
29 class TopoDS_Shape;
30 class TopoDS_Shell;
31 class gp_Pnt;
32 class gp_Dir;
33 class gp_Ax3;
34
35 Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver);
36
37 class Handle(GEOMImpl_DividedDiskDriver) : public Handle(TFunction_Driver) {
38 public:
39   inline void* operator new(size_t,void* anAddress) 
40   {
41     return anAddress;
42   }
43   inline void* operator new(size_t size) 
44   { 
45     return Standard::Allocate(size); 
46   }
47   inline void  operator delete(void *anAddress) 
48   { 
49     if (anAddress) Standard::Free((Standard_Address&)anAddress); 
50   }
51   
52   Handle(GEOMImpl_DividedDiskDriver)():Handle(TFunction_Driver)() {} 
53   Handle(GEOMImpl_DividedDiskDriver)(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) 
54   {}
55
56   Handle(GEOMImpl_DividedDiskDriver)(const GEOMImpl_DividedDiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) 
57   {}
58
59   Handle(GEOMImpl_DividedDiskDriver)& operator=(const Handle(GEOMImpl_DividedDiskDriver)& aHandle)
60   {
61     Assign(aHandle.Access());
62     return *this;
63   }
64   
65   Handle(GEOMImpl_DividedDiskDriver)& operator=(const GEOMImpl_DividedDiskDriver* anItem)
66   {
67     Assign((Standard_Transient *)anItem);
68     return *this;
69   }
70   
71   GEOMImpl_DividedDiskDriver* operator->() 
72   {
73     return (GEOMImpl_DividedDiskDriver *)ControlAccess();
74   }
75   
76   GEOMImpl_DividedDiskDriver* operator->() const 
77   {
78     return (GEOMImpl_DividedDiskDriver *)ControlAccess();
79   }
80   
81   Standard_EXPORT ~Handle(GEOMImpl_DividedDiskDriver)() {};
82   
83   Standard_EXPORT static const Handle(GEOMImpl_DividedDiskDriver) DownCast(const Handle(Standard_Transient)& AnObject);
84 };
85
86 class GEOMImpl_DividedDiskDriver : public TFunction_Driver {
87 public:
88   inline void* operator new(size_t,void* anAddress) 
89   {
90     return anAddress;
91   }
92   inline void* operator new(size_t size) 
93   { 
94     return Standard::Allocate(size); 
95   }
96   inline void  operator delete(void *anAddress) 
97   { 
98     if (anAddress) Standard::Free((Standard_Address&)anAddress); 
99   }
100   
101   // Methods PUBLIC
102   // 
103   Standard_EXPORT GEOMImpl_DividedDiskDriver();
104   Standard_EXPORT virtual  Standard_Integer Execute(TFunction_Logbook& log) const; 
105   Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
106   Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
107   {
108     return Standard_True;
109   }
110   Standard_EXPORT static const Standard_GUID& GetID();
111   Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {};
112   
113   // Type management
114   //
115   Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_();
116   Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
117   {
118     return STANDARD_TYPE(GEOMImpl_DividedDiskDriver);
119   }
120   Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
121   {
122     return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType));
123   } 
124   
125 private:
126   TopoDS_Shape TransformShape  (TopoDS_Shape aShape, int theOrientation) const;
127   TopoDS_Shape TransformShape  (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const;
128   TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const;
129   TopoDS_Shell MakeDisk (double R, double Ratio) const;
130 };
131
132 #endif // _GEOMImpl_DividedDiskDriver_HXX