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 20080 2009-12-15 15:57:52Z vlad $ */
3 #ifndef __zq_surface_hpp
4 #define __zq_surface_hpp
5 
6 
7 #include <vector>
8 
9 #include <qpen.h>
10 
11 #include "zq_view.hpp"
12 #include "zq_scaled_palette.hpp"
13 #include "zqb_scaled_palette.hpp"
14 #include "zqb_natgroup.hpp"
15 #include "zqb_bar_draw.hpp"
16 #include "zd_function3d.hpp"
17 
18 
30 class ZqSurface : public ZqView
31 {
32 public:
33 
35  enum FillMode {
36  ThinLines,
37  FillPositive,
38  FillNegative,
39  FillBoth
40  };
41 
42 public:
43 
46  ZqSurface (ZqbNatGroup& rArgHor, ZqbNatGroup& rArgVer,
47  const char* szName = NULL);
48 
51  ZqSurface (ZqbNatGroup& rArgHor, ZqbNatGroup& rArgVer,
52  ZqbPlaceholder* pPh, const char* szName = NULL);
53 
54 
58 
62 
63 
64  /*
65  * Run-time type identification facility
66  */
67 
71  virtual bool compatibleDoc (const ZdDocument* pDoc) const;
72 
73 
74  /*
75  * Data access
76  */
77 
82  virtual void attachData (ZdFunction3D* pData,
83  ZdFunc3DArgDir eArgDir = Z_F3D_XHOR_YVER);
84 
87  virtual void detachDoc ();
88 
91  virtual ZdFunction3D* data ();
92 
95  virtual ZdFunc3DArgDir argDir () const;
96 
97 
98  /*
99  * Properties
100  */
101 
103  virtual void setFillMode (FillMode eFillMode);
104 
106  virtual FillMode getFillMode () const;
107 
109  virtual void setPalette (const ZqbScaledPalette& scpal);
110 
114  virtual void attachPalette (ZqScaledPalette* zscpal);
115 
118  virtual const ZqbScaledPalette& getPalette () const;
119 
120 
121  /*
122  * Polymorphic methods
123  */
124 
126  virtual void redraw (QPainter& paint);
127 
128 protected:
129 
133  ZdFunc3DArgDir m_eArgDir;
134 
137 
140 
144 
146  struct PixelItem
147  {
149  int p;
150 
154  unsigned ic_beg, ic_end;
155 
157  double k;
158 
160  double c;
161 
163  double c_plus, c_minus;
164 
165  };
166 
168  typedef std::vector<PixelItem> PixelItems;
169 
172 
175 
176 
179  void drawPixel (ZqbBarDraw& fdm, PixelItem& xpit, PixelItem& ypit);
180 
184  void preparePixelList (const ZqbNatGrpMember& ngm,
185  const ZqbPixGrpMember& pgm,
186  std::vector<double>& car,
187  PixelItems& piar);
188 
190  static bool inRange (bool bAscent, double c1, double c, double c2);
191 
193  static double restrictRange (bool bAscent, double c1, double c, double c2);
194 
195 private:
196 
198  static int s_iNameCounter;
199 
200 };
201 
202 
203 #include "zq_surface_inline.hpp"
204 
205 
206 #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:168
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