simplified blayer generation
[engrid.git] / src / edgelengthsource.h
blobdd256086324071ee5eec3a7a9194e141dfe3fd51
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #ifndef EDGELENGTHSOURCE_H
25 #define EDGELENGTHSOURCE_H
27 class EdgeLengthSource;
28 template <class UI> class GuiEdgeLengthSourceDlg;
29 template <class UI> class GuiEdgeLengthSource;
31 #include "egvtkobject.h"
34 class EdgeLengthSource : public EgVtkObject
37 protected: // attributes
39 QString m_Name;
42 public:
44 virtual bool read(QString txt) = 0;
45 virtual QString write() = 0;
46 virtual void config() = 0;
47 virtual double edgeLength(vec3_t x) = 0;
49 virtual void setName(QString name) = 0;
50 QString name() { return m_Name; }
54 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 template <class UI>
57 class GuiEdgeLengthSourceDlg : public QDialog
60 friend class GuiEdgeLengthSource<UI>;
62 protected: // attributes
64 UI m_UI; ///< The user interface definition from QtDesigner
67 public: // methods
69 GuiEdgeLengthSourceDlg();
73 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75 template <class UI>
76 GuiEdgeLengthSourceDlg<UI>::GuiEdgeLengthSourceDlg()
78 m_UI.setupUi(this);
82 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
84 template <class UI>
85 class GuiEdgeLengthSource : public EdgeLengthSource
88 protected: // attributes
90 GuiEdgeLengthSourceDlg<UI> *m_Dlg;
93 protected: // methods
95 UI& ui() { return m_Dlg->m_UI; };
98 public:
100 GuiEdgeLengthSource();
101 virtual void config();
102 virtual void setName(QString name);
103 virtual void setDlgFields() = 0;
104 virtual void readDlgFields() = 0;
108 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
111 template <class UI>
112 GuiEdgeLengthSource<UI>::GuiEdgeLengthSource()
114 m_Name = "unnamed";
117 template <class UI>
118 void GuiEdgeLengthSource<UI>::config()
120 m_Dlg = new GuiEdgeLengthSourceDlg<UI>;
121 setDlgFields();
122 if (m_Dlg->exec()) {
123 readDlgFields();
125 delete m_Dlg;
128 template <class UI>
129 void GuiEdgeLengthSource<UI>::setName(QString name)
131 m_Name = name;
135 #endif // EDGELENGTHSOURCE_H