Salome HOME
21e8adde73a8bcdb2c78cbec75cd7308696d5349
[modules/geom.git] / src / GEOMImpl / GEOMImpl_ITransferData.hxx
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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
23 //NOTE: This is an interface to a function for the Transfer Data functionality.
24 //
25
26
27 #ifndef _GEOMImpl_ITransferData_HXX_
28 #define _GEOMImpl_ITransferData_HXX_
29
30
31 #include "GEOM_GEOMImpl.hxx"
32 #include "GEOM_Function.hxx"
33
34 #include <TColStd_HArray1OfInteger.hxx>
35
36
37 #define TD_ARG_REF1            1
38 #define TD_ARG_REF2            2
39 #define TD_ARG_METHOD          3
40 #define TD_ARG_DATUM_NAME      4
41 #define TD_ARG_DATUM_MAX_VALUE 5
42 #define TD_ARG_DATUM_VALUE     6
43
44 class GEOMImpl_ITransferData
45 {
46  public:
47
48   GEOMImpl_ITransferData(const Handle(GEOM_Function) &theFunction)
49     : _func(theFunction) {}
50
51   void SetRef1(const Handle(GEOM_Function) &theRefPoint1)
52   { _func->SetReference(TD_ARG_REF1, theRefPoint1); }
53
54   Handle(GEOM_Function) GetRef1() { return _func->GetReference(TD_ARG_REF1); }
55
56   void SetRef2(const Handle(GEOM_Function) &theRefPoint2)
57   { _func->SetReference(TD_ARG_REF2, theRefPoint2); }
58
59   Handle(GEOM_Function) GetRef2() { return _func->GetReference(TD_ARG_REF2); }
60
61   void SetFindMethod(const int theFindMethod)
62   { _func->SetInteger(TD_ARG_METHOD, theFindMethod); }
63
64   int GetFindMethod() { return _func->GetInteger(TD_ARG_METHOD); }
65
66   void SetDatumName(const Handle(TColStd_HArray1OfExtendedString) &theDatumName)
67   { _func->SetStringArray(TD_ARG_DATUM_NAME, theDatumName); }
68
69   Handle(TColStd_HArray1OfExtendedString) GetDatumName()
70   { return _func->GetStringArray(TD_ARG_DATUM_NAME); }
71
72   void SetDatumMaxVal(const Handle(TColStd_HArray1OfInteger) &theDatumMaxVal)
73   { _func->SetIntegerArray(TD_ARG_DATUM_MAX_VALUE, theDatumMaxVal); }
74
75   Handle(TColStd_HArray1OfInteger) GetDatumMaxVal()
76   { return _func->GetIntegerArray(TD_ARG_DATUM_MAX_VALUE); }
77
78   void SetDatumVal(const Handle(TColStd_HArray1OfInteger) &theDatumVal)
79   { _func->SetIntegerArray(TD_ARG_DATUM_VALUE, theDatumVal); }
80
81   Handle(TColStd_HArray1OfInteger) GetDatumVal()
82   { return _func->GetIntegerArray(TD_ARG_DATUM_VALUE); }
83
84   GEOMIMPL_EXPORT void SetName(const TopoDS_Shape            &theSubShape,
85                                 const TCollection_AsciiString &theName)
86   { SetStringData(theSubShape, theName, Standard_True); }
87
88   GEOMIMPL_EXPORT TCollection_AsciiString GetName
89                                (const TopoDS_Shape &theSubShape)
90   { return GetStringData(theSubShape, Standard_True); }
91
92   GEOMIMPL_EXPORT void SetMaterial(const TopoDS_Shape         &theSubShape,
93                                    const TCollection_AsciiString &theName)
94   { SetStringData(theSubShape, theName, Standard_False); }
95
96   GEOMIMPL_EXPORT TCollection_AsciiString GetMaterial
97                                (const TopoDS_Shape &theSubShape)
98   { return GetStringData(theSubShape, Standard_False); }
99
100  private:
101
102   TCollection_AsciiString GetStringData(const TopoDS_Shape     &theSubShape,
103                                         const Standard_Boolean  IsName);
104
105   void SetStringData(const TopoDS_Shape            &theSubShape,
106                      const TCollection_AsciiString &theData,
107                      const Standard_Boolean         IsName);
108
109  private:
110
111   Handle(GEOM_Function) _func;
112 };
113
114 #endif