UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zq_curve_inline.hpp
1 /* zq_curve_inline.hpp */
2 /* $Id: zq_curve_inline.hpp,v 1.7 2008/04/24 11:29:50 vlad Exp $ */
3 #ifndef __zq_curve_inline_hpp
4 #define __zq_curve_inline_hpp
5 
6 #ifdef __zq_curve_hpp
7 #define INLINE inline
8 #else
9 #define INLINE
10 #endif /* __zq_curve_hpp */
11 
12 
13 /*
14  * Run-time type identification facility
15  */
16 
22 INLINE bool
24 {
25  return findTypeAmong(pDoc, "ZdFunction", NULL);
26 }
27 
28 
29 /*
30  * Properties
31  */
32 
37 INLINE void
38 ZqCurve::setPen (const QPen& pen)
39 {
40  m_qPen = pen;
41 }
42 
43 
48 INLINE const QPen&
50 {
51  return m_qPen;
52 }
53 
54 
59 INLINE QPen&
61 {
62  return m_qPen;
63 }
64 
65 
73 INLINE void
75 {
76  if(interp < -1)
77  m_iInterpolation = 0;
78  else if(interp > 1)
79  m_iInterpolation = 1;
80  else
81  m_iInterpolation = interp;
82 }
83 
84 
89 INLINE int
91 {
92  return m_iInterpolation;
93 }
94 
95 
100 INLINE void
101 ZqCurve::setAutoSort (bool bSortFlag)
102 {
103  m_bAutoSort = bSortFlag;
104  if(!m_bAutoSort && NULL != m_zdFuncSorted)
105  {
106  delete m_zdFuncSorted;
107  m_zdFuncSorted = NULL;
108  }
109 }
110 
111 
116 INLINE bool
118 {
119  return m_bAutoSort;
120 }
121 
122 
123 
124 /*
125  * Data access
126  */
127 
133 INLINE ZdFunction*
135 {
136  if(m_bAutoSort && NULL != m_zdFuncSorted)
137  return (ZdFunction*)m_zdFuncSorted;
138  return (ZdFunction*)doc();
139 }
140 
141 
147 INLINE ZdFuncArgDir
149 {
150  return m_eArgDir;
151 }
152 
153 
158 INLINE double
159 ZqCurve::x (int i)
160 {
161  if(NULL == data())
162  return 0.0;
163 
164  switch(argDir())
165  {
166  case Z_F_ARG_HOR:
167  return data()->arg(i);
168  case Z_F_ARG_VER:
169  return data()->func(i);
170  }
171  return 0.0;
172 }
173 
174 
179 INLINE double
180 ZqCurve::y (int i)
181 {
182  if(NULL == data())
183  return 0.0;
184 
185  switch(argDir())
186  {
187  case Z_F_ARG_HOR:
188  return data()->func(i);
189  case Z_F_ARG_VER:
190  return data()->arg(i);
191  }
192  return 0.0;
193 }
194 
195 
201 INLINE void
202 ZqCurve::xMinMax (double mm[2])
203 {
204  if(NULL == data() || NULL == mm)
205  return;
206 
207  switch(argDir())
208  {
209  case Z_F_ARG_HOR:
210  mm[0] = data()->minArg();
211  mm[1] = data()->maxArg();
212  break;
213  case Z_F_ARG_VER:
214  mm[0] = data()->minFunc();
215  mm[1] = data()->maxFunc();
216  break;
217  }
218 }
219 
220 
226 INLINE void
227 ZqCurve::yMinMax (double mm[2])
228 {
229  if(NULL == data() || NULL == mm)
230  return;
231 
232  switch(argDir())
233  {
234  case Z_F_ARG_HOR:
235  mm[0] = data()->minFunc();
236  mm[1] = data()->maxFunc();
237  break;
238  case Z_F_ARG_VER:
239  mm[0] = data()->minArg();
240  mm[1] = data()->maxArg();
241  break;
242  }
243 }
244 
245 
251 INLINE void
252 ZqCurve::setBaseLevel (double fBase)
253 {
254  m_fBaseFuncLevel = fBase;
255 }
256 
257 
262 INLINE double
264 {
265  return m_fBaseFuncLevel;
266 }
267 
268 
274 INLINE void
275 ZqCurve::setBarSpace (double fArgDelta)
276 {
277  m_fSpaceBetweenBars = fArgDelta;
278 }
279 
280 
285 INLINE double
287 {
288  return m_fSpaceBetweenBars;
289 }
290 
291 
292 #undef INLINE
293 
294 #endif /* zq_curve_inline.hpp */
virtual double maxFunc()
Definition: zd_function.hpp:120
virtual double arg(int i)=0
static bool findTypeAmong(const ZdDocument *pDoc, const char *szExpectedType1,...)
virtual void yMinMax(double mm[2])
Definition: zq_curve_inline.hpp:227
virtual const QPen & getPen() const
Definition: zq_curve_inline.hpp:49
virtual double getBarSpace() const
Definition: zq_curve_inline.hpp:286
virtual ZdFuncArgDir argDir() const
Definition: zq_curve_inline.hpp:148
double m_fBaseFuncLevel
Definition: zq_curve.hpp:209
virtual double maxArg()
Definition: zd_function.hpp:100
virtual void setBarSpace(double fArgDelta)
Definition: zq_curve_inline.hpp:275
virtual double func(int i)=0
ZdRealFunc * m_zdFuncSorted
Definition: zq_curve.hpp:206
virtual double x(int i)
Definition: zq_curve_inline.hpp:159
virtual void setInterpolation(int interp)
Definition: zq_curve_inline.hpp:74
virtual int getInterpolation() const
Definition: zq_curve_inline.hpp:90
Definition: zd_function.hpp:27
virtual ZdFunction * data()
Definition: zq_curve_inline.hpp:134
virtual void setBaseLevel(double fBase)
Definition: zq_curve_inline.hpp:252
double m_fSpaceBetweenBars
Definition: zq_curve.hpp:215
Definition: zd_document.hpp:16
virtual double getBaseLevel() const
Definition: zq_curve_inline.hpp:263
virtual double minArg()
Definition: zd_function.hpp:93
virtual bool compatibleDoc(const ZdDocument *pDoc) const
Definition: zq_curve_inline.hpp:23
virtual bool getAutoSort() const
Definition: zq_curve_inline.hpp:117
virtual void setAutoSort(bool bSortFlag)
Definition: zq_curve_inline.hpp:101
bool m_bAutoSort
Definition: zq_curve.hpp:189
virtual double y(int i)
Definition: zq_curve_inline.hpp:180
QPen m_qPen
Definition: zq_curve.hpp:177
virtual ZdDocument * doc()
virtual void xMinMax(double mm[2])
Definition: zq_curve_inline.hpp:202
virtual void setPen(const QPen &pen)
Definition: zq_curve_inline.hpp:38
ZdFuncArgDir m_eArgDir
Definition: zq_curve.hpp:192
int m_iInterpolation
Definition: zq_curve.hpp:184
virtual QPen & pen()
Definition: zq_curve_inline.hpp:60
double minFunc()
Definition: zd_function.hpp:113