File: qwt3d_surfaceplot.h

package info (click to toggle)
qtiplot 0.9.8.9-15
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 36,196 kB
  • ctags: 15,690
  • sloc: cpp: 129,846; ansic: 5,781; python: 861; makefile: 56
file content (191 lines) | stat: -rw-r--r-- 6,302 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#ifndef qwt3d_SurfacePlot_h__2004_03_05_11_36_begin_guarded_code
#define qwt3d_SurfacePlot_h__2004_03_05_11_36_begin_guarded_code

#include "qwt3d_plot.h"

namespace Qwt3D
{
//! A class representing  Surfaces
/**
	A SurfacePlot ...
	
*/
class QWT3D_EXPORT SurfacePlot : public Plot3D
{
    Q_OBJECT

public:
#if QT_VERSION < 0x040000
  SurfacePlot( QWidget* parent = 0, const char* name = 0 );
#else
  SurfacePlot( QWidget* parent = 0, const QGLWidget* shareWidget = 0 );
#endif  
  ~SurfacePlot();
	void updateNormals(); //!< Recalculates surface normals;
	int	resolution() const {return resolution_p;} //!< Returns data resolution (1 means all data)
	std::pair<int,int> facets() const; //!< Returns the number of mesh cells for the ORIGINAL data
  bool loadFromData(Qwt3D::Triple** data, unsigned int columns, unsigned int rows
    , bool uperiodic = false, bool vperiodic = false);
	bool loadFromData(double** data, unsigned int columns, unsigned int rows
																		,double minx, double maxx, double miny, double maxy);
	bool loadFromData(Qwt3D::TripleField const& data, Qwt3D::CellField const& poly);
 	
  
  //! Equivalent to loadFromData();
  /**
  \deprecated  Use loadFromData instead
  */
  bool createDataRepresentation(Qwt3D::Triple** data, unsigned int columns, unsigned int rows
    , bool uperiodic = false, bool vperiodic = false)
  {
    return loadFromData(data, columns, rows, uperiodic, vperiodic);
  }
  //! Equivalent to loadFromData();
  /**
  \deprecated  Use loadFromData instead
  */
	bool createDataRepresentation(double** data, unsigned int columns, unsigned int rows
																		,double minx, double maxx, double miny, double maxy)
  {
    return loadFromData(data, columns, rows, minx, maxx, miny, maxy);
  }
  //! Equivalent to loadFromData();
  /**
  \deprecated  Use loadFromData instead
  */
	bool createDataRepresentation(Qwt3D::TripleField const& data, Qwt3D::CellField const& poly)
	{
		return loadFromData(data, poly);
	}

	Qwt3D::FLOORSTYLE floorStyle() const		{ return floorstyle_; }		//!< Return floor style
	void setFloorStyle(Qwt3D::FLOORSTYLE val)	{ floorstyle_ = val; }		//!< Sets floor style
	void showNormals(bool); 												//!< Draw normals to every vertex
	bool normals() const						{ return datanormals_p; }	//!< Returns \c true, if normal drawing is on
	
	void setNormalLength(double val);			//!< Sets length of normals in percent per hull diagonale
	double normalLength() const					{ return normalLength_p; }	//!< Returns relative length of normals
	void setNormalQuality(int val);				//!< Increases plotting quality of normal arrows
	int normalQuality() const					{ return normalQuality_p; }	//!< Returns plotting quality of normal arrows

	double** getData(int *cols, int *rows);
	CellField* getCellData(int *cells);
	TripleField* getNodeData(int *nodes);
	
	void deleteData(double**data, int columns);
	void deleteData(CellField* poly);
	void deleteData(TripleField* data);

	void setDataProjection(bool toggle = true)	{ datapoints_ = toggle; }
	bool dataProjected() const					{ return datapoints_; }
	void setProjection(Qwt3D::PROJECTMODE val, bool toggle = true)
	{
		switch(val) {
			case Qwt3D::FACE:
				facemode_  = toggle; break;
			case Qwt3D::SIDE:
				sidemode_  = toggle; break;
			case Qwt3D::BASE:
				floormode_ = toggle; break;
		}
	} //!< Sets projection modes

signals:
	void resolutionChanged(int);

public slots:
	void setResolution( int );

protected:
	bool datanormals_p;
	double normalLength_p;
	int normalQuality_p;
  
	virtual	void calculateHull();
	virtual void createData();
	virtual void createEnrichment(Qwt3D::Enrichment& p);
	virtual void createFloorData();
	virtual void createSideData();
	virtual void createFaceData();

	void drawVertex(Triple& vertex, double shift, unsigned int comp = 3);
	virtual void drawIntersections(std::vector<Triple>& intersection, double shift, unsigned int comp,
								   bool projected, std::vector<RGBA>* colour = 0);

	void createNormals();
	void createPoints();

	int resolution_p;

	void readIn(Qwt3D::GridData& gdata, Triple** data, unsigned int columns, unsigned int rows);
	void readIn(Qwt3D::GridData& gdata, double** data, unsigned int columns, unsigned int rows, 
				double minx, double maxx, double miny, double maxy);
	void calcNormals(GridData& gdata);
	void sewPeriodic(GridData& gdata);

	void animateData(double** data);
	void animateData(TripleField* data, CellField* poly);
	void animateData(TripleField* data);
//	void calcLowResolution();

private:

//	void Data2Floor();
//	void Isolines2Floor();

	Qwt3D::FLOORSTYLE floorstyle_;
	unsigned int point_size_;
	bool datapoints_;
	bool facemode_;
	bool sidemode_;
	bool floormode_;

	// grid plot
	Qwt3D::GridData* actualDataG_;
	virtual void createDataG();
	virtual void createFaceDataG();
	virtual void createSideDataG();
	virtual void createFloorDataG();
	void createNormalsG();

	void Data2FloorG()		{ DatamapG(2); }
	void Data2FrontG()		{ DatamapG(1); }
	void Data2SideG()		{ DatamapG(0); }
	void DatamapG(unsigned int comp);
	
	void Isolines2FloorG(bool projected = false)		{ IsolinesG(2, projected); }
	void Isolines2FrontG(bool projected = false)		{ IsolinesG(1, projected); }
	void Isolines2SideG(bool projected = false)			{ IsolinesG(0, projected); }
	void IsolinesG(unsigned int comp, bool projected);

	void setColorFromVertexG(int ix, int iy, bool skip = false);

	void DataPointsG(unsigned int comp, bool projected);
	void DataPoints2SideG(bool projected = false)		{ DataPointsG(0, projected); }
	void DataPoints2BackG(bool projected = false)		{ DataPointsG(1, projected); }

	// mesh plot
	Qwt3D::CellData* actualDataC_;
	virtual void createDataC();
	virtual void createFaceDataC();
	virtual void createSideDataC();
	virtual void createFloorDataC();
	void createNormalsC();

	void Data2FloorC()		{ DatamapC(2); }
	void Data2FrontC()		{ DatamapC(1); }
	void Data2SideC()		{ DatamapC(0); }
	void DatamapC(unsigned int comp);

	void Isolines2FloorC(bool projected = false)		{ IsolinesC(2, projected); }
	void Isolines2FrontC(bool projected = false)		{ IsolinesC(1, projected); }
	void Isolines2SideC(bool projected = false)			{ IsolinesC(0, projected); }
	void IsolinesC(unsigned int comp, bool projected);
	
	void setColorFromVertexC(int node, bool skip = false);
};

} // ns


#endif