UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtCurve.H
1 /* ZtCurve.H */
2 /* $Id: ZtCurve.H,v 1.12 2004/02/17 13:53:36 vlad Exp $ */
3 #ifndef __ZtCurve_H
4 #define __ZtCurve_H
5 
6 #include <mix/FloatAr.H>
7 #include <ldb/dbtools.h>
8 #include <zm/ZtObject.H>
9 #include <zm/ZtPointMark.H>
10 
11 
12 /*************************************************************
13  * Object for curve drawing in linear or stairs interpolation.
14  *************************************************************/
15 class ZtCurve : public ZtObject
16 {
17 protected:
18 
19  Logic detached; /* flag of absence of data */
20  ZDimension arg_orient; /* zdVertical: x(y); zdHorizontal: y(x). */
21  FloatAr arg; /* stored argument: main array */
22  FloatAr func; /* stored function */
23  int interpolation; /* 0< - no curve but nodes only;
24  0 - stairs;
25  1 - line interpolation;
26  >1 - N/A */
27 
28  /* Next fields are actual just after redraw() until changes() will
29  be made */
30  XSegmentAr lines; /* temporal buffer for segments being drawn */
31  XSegment outer; /* boundary rectangle for the whole curve */
32  Logic visible;/* TRUE in case of at least one point of curve
33  is visible */
34 
35  /* Proceed one segment of a curve in rectangle (xr,xr+wr)-(yr,yr+hr). */
36  void add_segment (float x[2], float y[2],
37  float xr, float yr, float wr, float hr);
38 
39 public:
40 
44 
45  /* Curve constructor. Argument zdVertical means nyid is arg and
46  nxid is function; zdHorizontal means another orientation. */
47  ZtCurve (ZtMain* pManager,
48  ZGroupId pxid, ZGroupId pyid,
49  ZGroupId nxid, ZGroupId nyid,
50  ZDimension argument);
51 
52  /* Attach data */
53  void attach_data (unsigned cnt, float* pArg, float* pFunc);
54  void attach_data (unsigned cnt, double* pArg, double* pFunc);
55  void attach_data (dbHandle dbh, const char* ArgColumn,
56  const char* ValColumn);
57 
58  void attach_func (float* pFunc);
59  void attach_func (double* pFunc);
60 
61  void detach_data ();
62  Logic get_status_of_data ();
63 
64  /* Colour control */
65  void set_curve_color (const char* szColorName)
66  {
67  set_foreground(szColorName);
68  changes();
69  }
70  void set_curve_color (ColorPixel cpixel)
71  {
72  set_foreground(cpixel);
73  changes();
74  }
75  ColorPixel get_curve_color () const
76  {
77  return get_foreground();
78  }
79 
80  /* Line parameters control */
81  void set_interpolation (int base);
82  int get_interpolation () const;
83  /* + set/get_line_width(), 0 by default */
84 
85  /* Direct draw procedure: if size, place or parameters are changed */
86  virtual void redraw ();
87 
88  /* Insert point */
89  virtual void insert (unsigned index, double fArg, double fFunc);
90 
91  /* Remove point */
92  virtual void remove (unsigned index);
93 
94  /* Self-location: returns TRUE if point belongs to object and FALSE
95  otherwise. */
96  virtual Logic belong (int px, int py) const;
97 
99  virtual const char* class_id () const;
100 
101 };
102 
103 
104 #endif /* ZtCurve.H */
Definition: ZtMain.H:32
virtual Logic belong(int px, int py) const
void changes()
ZtPointMark node
Definition: ZtCurve.H:43
virtual const char * class_id() const
Definition: FloatAr.H:15
Definition: ZtObject.H:57
Definition: ZtPointMark.H:28
virtual void redraw()
Definition: ZtCurve.H:15
ZPCoordSlave px
Definition: ZtObject.H:203
ZPCoordSlave py
Definition: ZtObject.H:204