UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtColoredMatrix.H
1 /* ZtColoredMatrix.H */
2 /* $Id: ZtColoredMatrix.H,v 3.10 2004/02/17 13:53:36 vlad Exp $ */
3 #ifndef __ZtColoredMatrix_H
4 #define __ZtColoredMatrix_H
5 
6 #include <mix/IntAr.H>
7 #include <mix/FloatAr.H>
8 #include <ldb/dbtools.h>
9 
10 #include <zm/ZtObject.H>
11 #include <zm/ZScaledPalette.H>
12 #include <zm/ZBarBuffer.H>
13 #include <zm/ZtvTypes.h>
14 
19 typedef struct
20 {
22  int p;
23 
27  unsigned ic_beg, ic_end;
28 
30  double k;
31 
33  float c;
34 
36  float c_plus, c_minus;
37 
39 
40 #define AnyAr ZtCMPixelItemAr
41 #define AnyType ZtCMPixelItem
42 #define AnyFormatSpec "\np[%d]=%d: ic=%u:%u k=%g c=%g (+=%g -=%g)"
43 #define AnyPrintList i, item.p, item.ic_beg, item.ic_end, \
44  item.k, item.c, item.c_plus, item.c_minus
45 #include <mix/AnyAr.H>
46 
47 
49 typedef float (*ZCMatixAccess)(unsigned xi, unsigned yi, void* ptr);
50 
51 
57 class ZtColoredMatrix : public ZtObject, public ZScaledPalette
58 {
59 public:
60 
62  ZtColoredMatrix (ZtMain* pManager,
63  ZGroupId pxid, ZGroupId pyid,
64  ZGroupId nxid, ZGroupId nyid);
65 
67  virtual ~ZtColoredMatrix ();
68 
70  void attach_xc (unsigned xc_n, float* pXC);
71 
73  void attach_xc (unsigned xc_n, float x0, float dx);
74 
76  void attach_yc (unsigned yc_n, float* pYC);
77 
79  void attach_yc (unsigned yc_n, float y0, float dy);
80 
84  void attach_matrix (ZDimension storage_policy, float* pMatrix);
85 
87  void attach_matrix (ZCMatixAccess pFunc, void* pCustomData = NULL);
88 
90  void detach_matrix ();
91 
93  Logic get_status_of_matrix () const;
94 
96  void set_fill_mode (ZtvFillMode fm);
97 
99  ZtvFillMode get_fill_mode () const;
100 
102  virtual void redraw ();
103 
106  virtual ZInputStatus input (const XEvent* xev);
107 
109  virtual const char* class_id () const;
110 
111 protected:
112 
113  /* Common data */
114  float *matrix;
115  ZCMatixAccess mafunc;
116  void *mafptr;
117  ZDimension stpol;
118  FloatAr xc, yc;
121  ZtvFillMode fill_mode;
122 
125  float x_prec, y_prec;
126 
128  ZtCMPixelItemAr xpiar;
129 
131  ZtCMPixelItemAr ypiar;
132 
135 
137  float get_height (unsigned xi, unsigned yi);
138 
140  Logic find_cell (unsigned& xi, unsigned& yi,
141  float x, float y,
142  float x_pr = 0.0, float y_pr = 0.0) const;
143 
145  void draw_pixel (unsigned xpi, unsigned ypi);
146 
147 
151  static void prepare_pixel_list (const ZNCoordSlave& ns,
152  const ZPCoordSlave& ps,
153  const FloatAr& car,
154  ZtCMPixelItemAr& piar);
155 
157  static Logic in_range (Logic ascent, float c1, float c, float c2);
158 
160  static float restrict_range (Logic ascent, float c1, float c, float c2);
161 
162 };
163 
164 
165 #endif /* ZtColoredMatrix.H */
static float restrict_range(Logic ascent, float c1, float c, float c2)
float x_prec
Definition: ZtColoredMatrix.H:125
float get_height(unsigned xi, unsigned yi)
ZBarDraw * fdm
Definition: ZtColoredMatrix.H:134
Definition: ZtMain.H:32
unsigned ic_beg
Definition: ZtColoredMatrix.H:27
ZtvFillMode fill_mode
Definition: ZtColoredMatrix.H:121
Logic find_cell(unsigned &xi, unsigned &yi, float x, float y, float x_pr=0.0, float y_pr=0.0) const
void attach_xc(unsigned xc_n, float *pXC)
Definition: ZPixelCoord.H:102
virtual ~ZtColoredMatrix()
void attach_yc(unsigned yc_n, float *pYC)
FloatAr yc
Definition: ZtColoredMatrix.H:118
Logic get_status_of_matrix() const
float c_plus
Definition: ZtColoredMatrix.H:36
virtual const char * class_id() const
void attach_matrix(ZDimension storage_policy, float *pMatrix)
Definition: ZtColoredMatrix.H:19
ZtCMPixelItemAr xpiar
Definition: ZtColoredMatrix.H:128
Definition: ZtColoredMatrix.H:57
Definition: FloatAr.H:15
ZtvFillMode get_fill_mode() const
static void prepare_pixel_list(const ZNCoordSlave &ns, const ZPCoordSlave &ps, const FloatAr &car, ZtCMPixelItemAr &piar)
virtual ZInputStatus input(const XEvent *xev)
Definition: ZtObject.H:57
int p
Definition: ZtColoredMatrix.H:22
ZtCMPixelItemAr ypiar
Definition: ZtColoredMatrix.H:131
static Logic in_range(Logic ascent, float c1, float c, float c2)
ZDimension stpol
Definition: ZtColoredMatrix.H:117
Definition: ZScaledPalette.H:15
ZtColoredMatrix(ZtMain *pManager, ZGroupId pxid, ZGroupId pyid, ZGroupId nxid, ZGroupId nyid)
Definition: ZBarDraw.H:19
float * matrix
Definition: ZtColoredMatrix.H:114
float c
Definition: ZtColoredMatrix.H:33
virtual void redraw()
void detach_matrix()
void set_fill_mode(ZtvFillMode fm)
void draw_pixel(unsigned xpi, unsigned ypi)
Definition: ZNaturalCoord.H:88
double k
Definition: ZtColoredMatrix.H:30
void * mafptr
Definition: ZtColoredMatrix.H:116
ZCMatixAccess mafunc
Definition: ZtColoredMatrix.H:115