updated to modern VTK
[engrid-github.git] / src / libengrid / edgelengthsource.h
blob0c90b6f73e43de58812b67ad1a39ac565ee13030
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
11 // + +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
16 // + +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #ifndef EDGELENGTHSOURCE_H
23 #define EDGELENGTHSOURCE_H
25 class EdgeLengthSource;
26 template <class UI> class GuiEdgeLengthSourceDlg;
27 template <class UI> class GuiEdgeLengthSource;
29 #include "egvtkobject.h"
32 class EdgeLengthSource : public EgVtkObject
35 protected: // attributes
37 QString m_Name;
40 public:
42 virtual bool read(QString) { return false; }
43 virtual QString write() { return QString(); }
44 virtual void config() {}
45 virtual double edgeLength(vec3_t x) = 0;
47 void setName(QString name) { m_Name = name; }
48 QString name() { return m_Name; }
52 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 template <class UI>
55 class GuiEdgeLengthSourceDlg : public QDialog
58 friend class GuiEdgeLengthSource<UI>;
60 protected: // attributes
62 UI m_UI; ///< The user interface definition from QtDesigner
65 public: // methods
67 GuiEdgeLengthSourceDlg();
71 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73 template <class UI>
74 GuiEdgeLengthSourceDlg<UI>::GuiEdgeLengthSourceDlg()
76 m_UI.setupUi(this);
80 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82 template <class UI>
83 class GuiEdgeLengthSource : public EdgeLengthSource
86 protected: // attributes
88 GuiEdgeLengthSourceDlg<UI> *m_Dlg;
91 protected: // methods
93 UI& ui() { return m_Dlg->m_UI; }
96 public:
98 GuiEdgeLengthSource();
99 virtual void config();
100 virtual void setDlgFields() = 0;
101 virtual void readDlgFields() = 0;
105 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
108 template <class UI>
109 GuiEdgeLengthSource<UI>::GuiEdgeLengthSource()
111 m_Name = "unnamed";
114 template <class UI>
115 void GuiEdgeLengthSource<UI>::config()
117 m_Dlg = new GuiEdgeLengthSourceDlg<UI>;
118 setDlgFields();
119 if (m_Dlg->exec()) {
120 readDlgFields();
122 delete m_Dlg;
126 #endif // EDGELENGTHSOURCE_H