void IsosurfaceEditor::apply() { std::vector<float> isovalues; for (unsigned int i=0; i<isovalueWidgets.size(); i++) { if (isovalueWidgets[i]->getIsovalueEnabled()) isovalues.push_back(isovalueWidgets[i]->getIsovalue()); } emit(isovaluesChanged(isovalues)); }
void VolumeViewer::initUserInterfaceWidgets() { // Create a toolbar at the top of the window. QToolBar *toolbar = addToolBar("toolbar"); // Add preferences widget and callback. PreferencesDialog *preferencesDialog = new PreferencesDialog(this, boundingBox); QAction *showPreferencesAction = new QAction("Preferences", this); connect(showPreferencesAction, SIGNAL(triggered()), preferencesDialog, SLOT(show())); toolbar->addAction(showPreferencesAction); // Add the "auto rotate" widget and callback. autoRotateAction = new QAction("Auto rotate", this); autoRotateAction->setCheckable(true); connect(autoRotateAction, SIGNAL(toggled(bool)), this, SLOT(autoRotate(bool))); toolbar->addAction(autoRotateAction); // Add the "next timestep" widget and callback. QAction *nextTimeStepAction = new QAction("Next timestep", this); connect(nextTimeStepAction, SIGNAL(triggered()), this, SLOT(nextTimeStep())); toolbar->addAction(nextTimeStepAction); // Add the "play timesteps" widget and callback. QAction *playTimeStepsAction = new QAction("Play timesteps", this); playTimeStepsAction->setCheckable(true); connect(playTimeStepsAction, SIGNAL(toggled(bool)), this, SLOT(playTimeSteps(bool))); toolbar->addAction(playTimeStepsAction); // Connect the "play timesteps" timer. connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep())); // Add the "add geometry" widget and callback. QAction *addGeometryAction = new QAction("Add geometry", this); connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry())); toolbar->addAction(addGeometryAction); // Add the "screenshot" widget and callback. QAction *screenshotAction = new QAction("Screenshot", this); connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot())); toolbar->addAction(screenshotAction); // Create the transfer function editor dock widget, this widget modifies the transfer function directly. QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this); transferFunctionEditor = new TransferFunctionEditor(transferFunction); transferFunctionEditorDockWidget->setWidget(transferFunctionEditor); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(commitVolumes())); connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, transferFunctionEditorDockWidget); // Set the transfer function editor widget to its minimum allowed height, to leave room for other dock widgets. transferFunctionEditor->setMaximumHeight(transferFunctionEditor->minimumSize().height()); // Create slice editor dock widget. QDockWidget *sliceEditorDockWidget = new QDockWidget("Slices", this); sliceEditor = new SliceEditor(boundingBox); sliceEditorDockWidget->setWidget(sliceEditor); connect(sliceEditor, SIGNAL(slicesChanged(std::vector<SliceParameters>)), this, SLOT(setSlices(std::vector<SliceParameters>))); addDockWidget(Qt::LeftDockWidgetArea, sliceEditorDockWidget); // Create isosurface editor dock widget. QDockWidget *isosurfaceEditorDockWidget = new QDockWidget("Isosurfaces", this); isosurfaceEditor = new IsosurfaceEditor(); isosurfaceEditorDockWidget->setWidget(isosurfaceEditor); connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>))); addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget); // Create the light editor dock widget, this widget modifies the light directly. QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this); LightEditor *lightEditor = new LightEditor(ambientLight, directionalLight); lightEditorDockWidget->setWidget(lightEditor); connect(lightEditor, SIGNAL(lightsChanged()), this, SLOT(render())); addDockWidget(Qt::LeftDockWidgetArea, lightEditorDockWidget); // Create the probe dock widget. QDockWidget *probeDockWidget = new QDockWidget("Probe", this); probeWidget = new ProbeWidget(this); probeDockWidget->setWidget(probeWidget); addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget); // Tabify dock widgets. tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget); tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget); // Tabs on top. setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); // Default to showing transfer function tab widget. transferFunctionEditorDockWidget->raise(); // Add the current OSPRay object file label to the bottom status bar. statusBar()->addWidget(¤tFilenameInfoLabel); }