Salome HOME
9d02a38c7eb77fe482c205277b286ce60a25d289
[modules/geom.git] / src / GEOMImpl / GEOMImpl_ICurveParametric.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 // File      : GEOMImpl_ICurveParametric.hxx
23 // Created   : Mon Jun 17 14:14:08 2013
24 // Author    : Edward AGAPOV (eap)
25
26 #ifndef __GEOMImpl_ICurveParametric_HXX__
27 #define __GEOMImpl_ICurveParametric_HXX__
28
29 #include "GEOM_Function.hxx"
30
31 /*!
32  * \brief Interface to data of analytically defined curve
33  *
34  * WARNING: this data co-exists with data of either GEOMImpl_IPolyline
35  *          or GEOMImpl_ISpline
36  *
37  * GEOMImpl_IPolyline data scheme:
38  * -  POLY_ARG_LENG    1 (int)
39  * -  POLY_ARG_LAST    1 (GEOM_Function)
40  * -  POLY_ARG_CLOS    2 (int)
41  * -  POLY_CONSTRUCTOR 3 (int)
42  * -  POLY_ARG_ARRAY   4 (HArray1OfReal)
43  *
44  * GEOMImpl_ISpline data scheme:
45  * -  ARG_POINTS  = 1, (HSequenceOfTransient)
46  * -  ARG_CLOSED  = 2, (int)
47  * -  ARG_REORDER = 3, (int)
48  * -  CONSTRUCTOR = 4, (int)
49  * -  ARG_ARRAY   = 5, (HArray1OfReal)
50  * -  ARG_VEC_1   = 6, (GEOM_Function)
51  * -  ARG_VEC_2   = 7  (GEOM_Function)
52  */
53 struct GEOMImpl_ICurveParametric
54 {
55   enum {
56     CP_ARG_EXPR_X = 1,
57     CP_ARG_EXPR_Y = 2,
58     CP_ARG_EXPR_Z = 3,
59     CP_ARG_MIN    = 1,
60     CP_ARG_MAX    = 2,
61     CP_ARG_STEP   = 3,
62     CP_ARG_NBSTEP = 4
63   };
64   GEOMImpl_ICurveParametric(Handle(GEOM_Function) theFunction): _func(theFunction) {}
65
66   bool HasData() const { return !GetExprZ().IsEmpty(); }
67
68   void SetExprX (const char* theExpr) { _func->SetString( CP_ARG_EXPR_X, theExpr ) ; }
69   void SetExprY (const char* theExpr) { _func->SetString( CP_ARG_EXPR_Y, theExpr ) ; }
70   void SetExprZ (const char* theExpr) { _func->SetString( CP_ARG_EXPR_Z, theExpr ) ; }
71   void SetParamMin   (double theMin   ) { _func->SetReal( CP_ARG_MIN   , theMin   ) ; }
72   void SetParamMax   (double theMax   ) { _func->SetReal( CP_ARG_MAX   , theMax   ) ; }
73   void SetParamStep  (double theStep  ) { _func->SetReal( CP_ARG_STEP  , theStep  ) ; }
74   void SetParamNbStep(double theNbStep) { _func->SetReal( CP_ARG_NBSTEP, theNbStep) ; }
75
76   TCollection_AsciiString GetExprX() const { return _func->GetString( CP_ARG_EXPR_X ) ; }
77   TCollection_AsciiString GetExprY() const { return _func->GetString( CP_ARG_EXPR_Y ) ; }
78   TCollection_AsciiString GetExprZ() const { return _func->GetString( CP_ARG_EXPR_Z ) ; }
79   double GetParamMin   () const { return _func->GetReal( CP_ARG_MIN    ) ; }
80   double GetParamMax   () const { return _func->GetReal( CP_ARG_MAX    ) ; }
81   double GetParamStep  () const { return _func->GetReal( CP_ARG_STEP   ) ; }
82   double GetParamNbStep() const { return _func->GetReal( CP_ARG_NBSTEP ) ; }
83
84   Handle(GEOM_Function) _func;
85 };
86
87 #endif