]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/meshtex/GeneralFunctionDialog.h
Merge branch 'NateEag-master-patch-12920' into 'master'
[xonotic/netradiant.git] / contrib / meshtex / GeneralFunctionDialog.h
1 /**
2  * @file GeneralFunctionDialog.h
3  * Declares the GeneralFunctionDialog class.
4  * @ingroup meshtex-ui
5  */
6
7 /*
8  * Copyright 2012 Joel Baxter
9  *
10  * This file is part of MeshTex.
11  *
12  * MeshTex is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * MeshTex is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with MeshTex.  If not, see <http://www.gnu.org/licenses/>.
24  */
25
26 #if !defined(INCLUDED_GENERALFUNCTIONDIALOG_H)
27 #define INCLUDED_GENERALFUNCTIONDIALOG_H
28
29 #include "GenericDialog.h"
30 #include "MeshVisitor.h"
31
32 /**
33  * Subclass of GenericDialog that implements the window summoned by selecting
34  * the General Function menu entry. This window is used to specify equations
35  * for setting S and T values as a linear combination of various factors.
36  *
37  * @image html genfunc.png
38  * 
39  * @ingroup meshtex-ui
40  */
41 class GeneralFunctionDialog : public GenericDialog
42 {
43 private: // private types
44
45    /**
46     * Visitor for applying the chosen equation to a mesh.
47     */
48    class GeneralFunctionVisitor : public MeshVisitor
49    {
50    public:
51       GeneralFunctionVisitor(const MeshEntity::GeneralFunctionFactors *sFactors,
52                              const MeshEntity::GeneralFunctionFactors *tFactors,
53                              const MeshEntity::SliceDesignation *alignRow,
54                              const MeshEntity::SliceDesignation *alignCol,
55                              const MeshEntity::RefSliceDescriptor *refRow,
56                              const MeshEntity::RefSliceDescriptor *refCol,
57                              bool surfaceValues);
58    private:
59       bool Execute(MeshEntity& meshEntity) const;
60    private:
61       const MeshEntity::GeneralFunctionFactors *_sFactors;
62       const MeshEntity::GeneralFunctionFactors *_tFactors;
63       const MeshEntity::SliceDesignation *_alignRow;
64       const MeshEntity::SliceDesignation *_alignCol;
65       const MeshEntity::RefSliceDescriptor *_refRow;
66       const MeshEntity::RefSliceDescriptor *_refCol;
67       bool _surfaceValues;
68    };
69
70 public: // public methods
71
72    GeneralFunctionDialog(const std::string& key);
73    ~GeneralFunctionDialog();
74    bool Apply();
75
76 private: // private member vars
77
78    /**
79     * Action-less mesh visitor used purely to count the number of selected mesh
80     * entities.
81     */
82    SmartPointer<MeshVisitor> _nullVisitor;
83 };
84
85 #endif // #if !defined(INCLUDED_GENERALFUNCTIONDIALOG_H)