UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zq_surface.hpp
1 /* zq_surface.hpp */
2 /* $Id: zq_surface.hpp,v 1.4 2008/03/13 07:06:02 vlad Exp $ */
3 #ifndef __zq_surface_hpp
4 #define __zq_surface_hpp
5 
6 
7 #include <vector>
8 
9 #include <qpen.h>
10 #include <qpointarray.h>
11 
12 #include "zq_view.hpp"
13 #include "zq_scaled_palette.hpp"
14 #include "zqb_scaled_palette.hpp"
15 #include "zqb_natgroup.hpp"
16 #include "zqb_bar_draw.hpp"
17 #include "zd_function3d.hpp"
18 
19 
31 class ZqSurface : public ZqView
32 {
33 public:
34 
36  enum FillMode {
37  ThinLines,
38  FillPositive,
39  FillNegative,
40  FillBoth
41  };
42 
43 public:
44 
47  ZqSurface (ZqbNatGroup& rArgHor, ZqbNatGroup& rArgVer,
48  const char* szName = NULL);
49 
52  ZqSurface (ZqbNatGroup& rArgHor, ZqbNatGroup& rArgVer,
53  ZqbPlaceholder* pPh, const char* szName = NULL);
54 
55 
59 
63 
64 
65  /*
66  * Run-time type identification facility
67  */
68 
72  virtual bool compatibleDoc (const ZdDocument* pDoc) const;
73 
74 
75  /*
76  * Data access
77  */
78 
83  virtual void attachData (ZdFunction3D* pData,
84  ZdFunc3DArgDir eArgDir = Z_F3D_XHOR_YVER);
85 
88  virtual void detachDoc ();
89 
92  virtual ZdFunction3D* data ();
93 
96  virtual ZdFunc3DArgDir argDir () const;
97 
98 
99  /*
100  * Properties
101  */
102 
104  virtual void setFillMode (FillMode eFillMode);
105 
107  virtual FillMode getFillMode () const;
108 
110  virtual void setPalette (const ZqbScaledPalette& scpal);
111 
115  virtual void attachPalette (ZqScaledPalette* zscpal);
116 
119  virtual const ZqbScaledPalette& getPalette () const;
120 
121 
122  /*
123  * Polymorphic methods
124  */
125 
127  virtual void redraw (QPainter& paint);
128 
129 protected:
130 
134  ZdFunc3DArgDir m_eArgDir;
135 
138 
141 
145 
147  struct PixelItem
148  {
150  int p;
151 
155  unsigned ic_beg, ic_end;
156 
158  double k;
159 
161  double c;
162 
164  double c_plus, c_minus;
165 
166  };
167 
169  typedef std::vector<PixelItem> PixelItems;
170 
173 
176 
177 
180  void drawPixel (ZqbBarDraw& fdm, PixelItem& xpit, PixelItem& ypit);
181 
185  void preparePixelList (const ZqbNatGrpMember& ngm,
186  const ZqbPixGrpMember& pgm,
187  std::vector<double>& car,
188  PixelItems& piar);
189 
191  static bool inRange (bool bAscent, double c1, double c, double c2);
192 
194  static double restrictRange (bool bAscent, double c1, double c, double c2);
195 
196 private:
197 
199  static int s_iNameCounter;
200 
201 };
202 
203 
204 #include "zq_surface_inline.hpp"
205 
206 
207 #endif /* zq_surface.hpp */
virtual void setFillMode(FillMode eFillMode)
Definition: zq_surface_inline.hpp:24
virtual bool compatibleDoc(const ZdDocument *pDoc) const
Definition: zq_surface_inline.hpp:88
virtual ZdFunc3DArgDir argDir() const
Definition: zq_surface_inline.hpp:105
ZqbScaledPalette m_ScPal
Definition: zq_surface.hpp:140
static bool inRange(bool bAscent, double c1, double c, double c2)
Definition: zq_scaled_palette.hpp:23
Definition: zqb_scaled_palette.hpp:15
double c
Definition: zq_surface.hpp:161
virtual const ZqbScaledPalette & getPalette() const
Definition: zq_surface_inline.hpp:70
Definition: zqb_natgroup.hpp:35
Definition: zqb_placeholder.hpp:25
virtual void attachPalette(ZqScaledPalette *zscpal)
Definition: zq_surface_inline.hpp:58
int p
Definition: zq_surface.hpp:150
ZqbNatGrpMember m_ArgVer
Definition: zq_surface.hpp:62
Definition: zq_surface.hpp:31
ZdFunc3DArgDir m_eArgDir
Definition: zq_surface.hpp:134
FillMode m_eFillMode
Definition: zq_surface.hpp:137
Definition: zq_view.hpp:18
ZqSurface(ZqbNatGroup &rArgHor, ZqbNatGroup &rArgVer, const char *szName=NULL)
ZqScaledPalette * m_zqScPal
Definition: zq_surface.hpp:144
FillMode
Definition: zq_surface.hpp:36
PixelItems m_xPiar
Definition: zq_surface.hpp:172
Definition: zd_document.hpp:16
virtual void redraw()
Definition: zqb_visible.hpp:82
double k
Definition: zq_surface.hpp:158
PixelItems m_yPiar
Definition: zq_surface.hpp:175
ZqbNatGrpMember m_ArgHor
Definition: zq_surface.hpp:58
Definition: zqb_pixgrpmember.hpp:24
virtual ZdFunction3D * data()
Definition: zq_surface_inline.hpp:117
std::vector< PixelItem > PixelItems
Definition: zq_surface.hpp:169
virtual void setPalette(const ZqbScaledPalette &scpal)
Definition: zq_surface_inline.hpp:46
virtual void attachData(ZdFunction3D *pData, ZdFunc3DArgDir eArgDir=Z_F3D_XHOR_YVER)
Definition: zq_surface.hpp:147
virtual FillMode getFillMode() const
Definition: zq_surface_inline.hpp:35
Definition: zqb_bar_draw.hpp:17
unsigned ic_beg
Definition: zq_surface.hpp:155
void drawPixel(ZqbBarDraw &fdm, PixelItem &xpit, PixelItem &ypit)
Definition: zqb_natgrpmember.hpp:26
double c_plus
Definition: zq_surface.hpp:164
virtual void detachDoc()
void preparePixelList(const ZqbNatGrpMember &ngm, const ZqbPixGrpMember &pgm, std::vector< double > &car, PixelItems &piar)
static double restrictRange(bool bAscent, double c1, double c, double c2)
Definition: zd_function3d.hpp:29