1 /*
2 *	Copyright (C) 2008,2009,2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
3 *
4 *	This program is free software: you can redistribute it and/or modify
5 *	it under the terms of the GNU Lesser General Public License as published
6 *	by the Free Software Foundation, either version 3 of the License, or
7 *	(at your option) any later version.
8 *
9 *	This program is distributed in the hope that it will be useful,
10 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *	GNU Lesser General Public License for more details.
13 *
14 *	You should have received a copy of the GNU Lesser General Public License
15 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef _QCSGRIDEDITOR_H_
19 #define _QCSGRIDEDITOR_H_
20 
21 #include <QWidget>
22 #include <QToolBar>
23 #include <QString>
24 #include <QVector>
25 #include <QSlider>
26 #include <QLabel>
27 #include <QLineEdit>
28 
29 class CSRectGrid;
30 
31 class QCSGridEditor : public QWidget
32 {
33 	Q_OBJECT
34 public:
35 	QCSGridEditor(CSRectGrid* grid, QWidget* parent = 0);
36 	virtual ~QCSGridEditor();
37 
38 	QToolBar* BuildToolbar();
39 	QWidget* BuildPlanePosWidget();
40 
41 	QString GetDirName(int ny);
42 	QString GetNormName(int ny);
43 
44 	int GetOpacity();
45 
46 signals:
47 	void OpacityChange(int);
48 	void signalDetectEdges(int);
49 	void GridChanged();
50 	void GridPlaneXChanged(int);
51 	void GridPlaneYChanged(int);
52 	void GridPlaneZChanged(int);
53 
54 public slots:
55 	void Update();
56 	void SetOpacity(int val);
57 	void EditX();
58 	void EditY();
59 	void EditZ();
60 	void Edit(int direct);
61 	void SetGridPlaneX(int pos);
62 	void SetGridPlaneY(int pos);
63 	void SetGridPlaneZ(int pos);
64 
65 protected slots:
66 	void BuildHomogenDisc();
67 	void BuildInHomogenDisc();
68 	void IncreaseResolution();
69 	void DetectEdges();
70 	void SetDeltaUnit(QString val);
71 
72 protected:
73 	CSRectGrid* clGrid;
74 	QVector<QLabel*> SimBox;
75 	QVector<QLabel*> NodeQty;
76 	//QComboBox* UnitLength;
77 	QLineEdit* UnitLength;
78 	QSlider* OpacitySlider;
79 	QLabel* m_DirNames[3];
80 	QSlider* m_PlanePos[3];
81 	QLabel* m_NormNames[3];
82 	QLabel* m_PlanePosValue[3];
83 
84 	double* GetDoubleArrayFromString(int *count, QString qsValue);
85 };
86 
87 #endif //_QCSGRIDEDITOR_H_
88