-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathVisualizer.h
192 lines (174 loc) · 8.35 KB
/
Visualizer.h
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
192
/***********************************************************************
Visualizer - Test application for the new visualization component
framework.
Copyright (c) 2005-2017 Oliver Kreylos
This file is part of the 3D Data Visualizer (Visualizer).
The 3D Data Visualizer is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
The 3D Data Visualizer is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with the 3D Data Visualizer; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
#ifndef VISUALIZER_INCLUDED
#define VISUALIZER_INCLUDED
#include <string>
#include <vector>
#include <Plugins/FactoryManager.h>
#include <GL/GLColor.h>
#include <GLMotif/Menu.h>
#include <GLMotif/ToggleButton.h>
#include <GLMotif/RadioBox.h>
#include <GLMotif/Slider.h>
#include <GLMotif/FileSelectionDialog.h>
#include <SceneGraph/GroupNode.h>
#include <Vrui/Geometry.h>
#include <Vrui/ToolManager.h>
#include <Vrui/Application.h>
/* Forward declarations: */
namespace GLMotif {
class Widget;
class PopupMenu;
class PopupWindow;
class RowColumn;
class TextField;
class ToggleButton;
}
#ifdef VISUALIZER_USE_COLLABORATION
namespace Collaboration {
class CollaborationClient;
}
#endif
namespace Visualization {
namespace Abstract {
class DataSet;
class VariableManager;
class DataSetRenderer;
class Parameters;
class Algorithm;
class Element;
class CoordinateTransformer;
class Module;
}
}
struct CuttingPlane;
#ifdef VISUALIZER_USE_COLLABORATION
class SharedVisualizationClient;
#endif
class BaseLocator;
class ElementList;
class Visualizer:public Vrui::Application
{
/* Embedded classes: */
private:
typedef Visualization::Abstract::DataSet DataSet;
typedef Visualization::Abstract::VariableManager VariableManager;
typedef Visualization::Abstract::DataSetRenderer DataSetRenderer;
typedef Visualization::Abstract::Parameters Parameters;
typedef Visualization::Abstract::Algorithm Algorithm;
typedef Visualization::Abstract::Element Element;
typedef Visualization::Abstract::CoordinateTransformer CoordinateTransformer;
typedef Visualization::Abstract::Module Module;
typedef Plugins::FactoryManager<Module> ModuleManager;
struct SG // Structure for additional scene graphs
{
/* Elements: */
public:
SceneGraph::GroupNodePointer root; // Scene graph root
std::string name; // Name of the scene graph
bool render; // Flag if the scene graph is being rendered
};
typedef std::vector<BaseLocator*> BaseLocatorList;
#ifdef VISUALIZER_USE_COLLABORATION
friend class SharedVisualizationClient;
#endif
friend class BaseLocator;
friend class CuttingPlaneLocator;
friend class EvaluationLocator;
friend class ScalarEvaluationLocator;
friend class VectorEvaluationLocator;
friend class ExtractorLocator;
/* Elements: */
private:
ModuleManager moduleManager; // Manager to load 3D visualization modules from dynamic libraries
Module* module; // Visualization module
DataSet* dataSet; // Data set to visualize
VariableManager* variableManager; // Manager to organize data sets and scalar and vector variables
bool renderDataSet; // Flag whether to render the data set
GLColor<GLfloat,4> dataSetRenderColor; // Color to use when rendering the data set
DataSetRenderer* dataSetRenderer; // Renderer for the data set
std::vector<SG> sceneGraphs; // List of additional scene graphs
bool renderSceneGraphs; // Flag indicating whether any scene graphs are supposed to be rendered
CoordinateTransformer* coordinateTransformer; // Transformer from Cartesian coordinates back to data set coordinates
int firstScalarAlgorithmIndex; // Index of first module-provided scalar algorithm in algorithm menu
int firstVectorAlgorithmIndex; // Index of first module-provided vector algorithm in algorithm menu
#ifdef VISUALIZER_USE_COLLABORATION
Collaboration::CollaborationClient* collaborationClient; // Client module to support collaborative visualization in spatially distributed VR environments
SharedVisualizationClient* sharedVisualizationClient; // Protocol plug-in for shared Visualizer protocol
#endif
size_t numCuttingPlanes; // Maximum number of cutting planes supported
CuttingPlane* cuttingPlanes; // Array of available cutting planes
BaseLocatorList baseLocators; // List of active locators
ElementList* elementList; // List of previously extracted visualization elements
int algorithm; // The currently selected algorithm
GLMotif::PopupMenu* mainMenu; // The main menu widget
GLMotif::ToggleButton* showColorBarToggle; // Toggle button to show the color bar
GLMotif::ToggleButton* showPaletteEditorToggle; // Toggle button to show the palette editor
GLMotif::ToggleButton* showElementListToggle; // Toggle button to show the element list dialog
GLMotif::ToggleButton* showClientDialogToggle; // Toggle button to show the collaboration client dialog
/* Lock flags for modal dialogs: */
bool inLoadPalette; // Flag whether the user is currently selecting a palette to load
bool inLoadElements; // Flag whether the user is currently selecting an element file to load
/* Private methods: */
GLMotif::PopupMenu* createRenderingModesMenu(void);
GLMotif::PopupMenu* createScalarVariablesMenu(void);
GLMotif::PopupMenu* createVectorVariablesMenu(void);
GLMotif::PopupMenu* createAlgorithmsMenu(void);
GLMotif::PopupMenu* createElementsMenu(void);
GLMotif::PopupMenu* createStandardLuminancePalettesMenu(void);
GLMotif::PopupMenu* createStandardSaturationPalettesMenu(void);
GLMotif::PopupMenu* createColorMenu(void);
GLMotif::PopupMenu* createMainMenu(void);
void loadElements(const char* elementFileName,bool ascii); // Loads all visualization elements defined in the given file
/* Constructors and destructors: */
public:
Visualizer(int& argc,char**& argv);
virtual ~Visualizer(void);
/* Methods from Vrui::Application: */
virtual void toolCreationCallback(Vrui::ToolManager::ToolCreationCallbackData* cbData);
virtual void toolDestructionCallback(Vrui::ToolManager::ToolDestructionCallbackData* cbData);
virtual void frame();
virtual void display(GLContextData& contextData) const;
virtual void sound(ALContextData& contextData) const;
virtual void resetNavigation(void);
/* New methods: */
void changeRenderingModeCallback(GLMotif::RadioBox::ValueChangedCallbackData* cbData);
void toggleSceneGraphCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData,const int& sceneGraphIndex);
void changeScalarVariableCallback(GLMotif::RadioBox::ValueChangedCallbackData* cbData);
void changeVectorVariableCallback(GLMotif::RadioBox::ValueChangedCallbackData* cbData);
void changeAlgorithmCallback(GLMotif::RadioBox::ValueChangedCallbackData* cbData);
void loadPaletteCallback(Misc::CallbackData* cbData);
void loadPaletteOKCallback(GLMotif::FileSelectionDialog::OKCallbackData* cbData);
void loadPaletteCancelCallback(GLMotif::FileSelectionDialog::CancelCallbackData* cbData);
void showColorBarCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData);
void colorBarClosedCallback(Misc::CallbackData* cbData);
void showPaletteEditorCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData);
void paletteEditorClosedCallback(Misc::CallbackData* cbData);
void createStandardLuminancePaletteCallback(GLMotif::Menu::EntrySelectCallbackData* cbData);
void createStandardSaturationPaletteCallback(GLMotif::Menu::EntrySelectCallbackData* cbData);
void showElementListCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData);
void elementListClosedCallback(Misc::CallbackData* cbData);
void loadElementsCallback(Misc::CallbackData* cbData);
void loadElementsOKCallback(GLMotif::FileSelectionDialog::OKCallbackData* cbData);
void loadElementsCancelCallback(GLMotif::FileSelectionDialog::CancelCallbackData* cbData);
void saveElementsCallback(Misc::CallbackData* cbData);
void clearElementsCallback(Misc::CallbackData* cbData);
void showClientDialogCallback(GLMotif::ToggleButton::ValueChangedCallbackData* cbData);
void clientDialogClosedCallback(Misc::CallbackData* cbData);
};
#endif