Пример #1
0
/*
 * createButtonBox - Create a box to hold buttons.
 *
 * parameter animationDialog - GLMotif::RowColumn*&
 * return - GLMotif::RowColumn*
 */
GLMotif::RowColumn* AnimationDialog::createButtonBox(
  GLMotif::RowColumn*& animationDialog)
{
  GLMotif::RowColumn* buttonBox =
    new GLMotif::RowColumn("ButtonBox", animationDialog, false);
  buttonBox->setOrientation(GLMotif::RowColumn::HORIZONTAL);
  buttonBox->setPacking(GLMotif::RowColumn::PACK_GRID);
  GLMotif::Button* firstButton = new GLMotif::Button(
    "First", buttonBox, "First Frame");
  firstButton->getSelectCallbacks().add(this,
    &AnimationDialog::renderFrameCallback);
  GLMotif::Button* previousButton = new GLMotif::Button(
    "Previous", buttonBox, "Previous Frame");
  previousButton->getSelectCallbacks().add(this,
    &AnimationDialog::renderFrameCallback);
  playButton = new GLMotif::Button(
    "PlayPause", buttonBox, "Play");
  playButton->getSelectCallbacks().add(this,
    &AnimationDialog::playPauseCallback);
  GLMotif::Button* nextButton = new GLMotif::Button(
    "Next", buttonBox, "Next Frame");
  nextButton->getSelectCallbacks().add(this,
    &AnimationDialog::renderFrameCallback);
  GLMotif::Button* lastButton = new GLMotif::Button(
    "Last", buttonBox, "Last Frame");
  lastButton->getSelectCallbacks().add(this,
    &AnimationDialog::renderFrameCallback);
  return buttonBox;
}
/*
 * initialize - Initialize the GUI for the DownSampling class.
 */
void DownSampling::initialize(void) {
    const GLMotif::StyleSheet& styleSheet = *Vrui::getWidgetManager()->getStyleSheet();
    GLMotif::RowColumn* downSamplingDialog = new GLMotif::RowColumn("DownSamplingDialog", this, false);
    createSlicingScaleSlider(styleSheet, downSamplingDialog);
    createXStepSlider(styleSheet, downSamplingDialog);
    createYStepSlider(styleSheet, downSamplingDialog);
    createZStepSlider(styleSheet, downSamplingDialog);
    downSamplingDialog->manageChild();
}
Пример #3
0
/*
 * createXYZContours - Create x, y and z slice widgets.
 *
 * parameter styleSheet - const GLMotif::StyleSheet&
 * parameter colorMapDialog - GLMotif::RowColumn*&
 */
void Contours::createXYZContours(const GLMotif::StyleSheet& styleSheet, GLMotif::RowColumn*& colorMapDialog) {
    GLMotif::RowColumn * xyzContoursRowColumn = new GLMotif::RowColumn("XYZContoursRowColumn", colorMapDialog, false);
    xyzContoursRowColumn->setOrientation(GLMotif::RowColumn::VERTICAL);
    xyzContoursRowColumn->setNumMinorWidgets(GLsizei(3));
    createXContours(xyzContoursRowColumn, styleSheet);
    createYContours(xyzContoursRowColumn, styleSheet);
    createZContours(xyzContoursRowColumn, styleSheet);

    xyzContoursRowColumn->manageChild();
} // end createXYZContours()createXYZContours
Пример #4
0
/*
 * createButtonBox - Create a box to hold buttons.
 *
 * parameter colorMapDialog - GLMotif::RowColumn * &
 * return - GLMotif::RowColumn *
 */
GLMotif::RowColumn * Contours::createButtonBox(GLMotif::RowColumn * & colorMapDialog) {
    GLMotif::RowColumn * buttonBox = new GLMotif::RowColumn("ButtonBox", colorMapDialog, false);
    buttonBox->setOrientation(GLMotif::RowColumn::HORIZONTAL);
    GLMotif::ToggleButton * showContoursToggle = new GLMotif::ToggleButton(
      "ShowContoursToggle", buttonBox, "Show Contours");
    showContoursToggle->setToggle(true);
    showContoursToggle->getValueChangedCallbacks().add(this, &Contours::toggleSelectCallback);
    showContoursToggle->setToggleWidth(0.1f);
    GLMotif::Button * removeControlPointButton =
            new GLMotif::Button("RemoveControlPointButton", buttonBox, "Remove Control Point");
    removeControlPointButton->getSelectCallbacks().add(this, &Contours::removeControlPointCallback);
    return buttonBox;
}
Пример #5
0
ArfWindow::ArfWindow(Mycelia* application)
    : Window(application), layout(application->getDynamicLayout())
{
    window = new GLMotif::PopupWindow("AttributeWindow", Vrui::getWidgetManager(), "Layout Parameters");
    
    GLMotif::RowColumn* dialog = new GLMotif::RowColumn("ArfDialog", window, false);
    dialog->setNumMinorWidgets(3);
    
    // damping
    ParamPair p = VruiHelp::createParameter("Damping", -10, -1, layout->dampingConstant, dialog);
    dampingField = p.first;
    dampingSlider = p.second;
    dampingSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    // step size
    p = VruiHelp::createParameter("Step Size", 0.001, 0.05, layout->deltaTime, dialog);
    stepsizeField = p.first;
    stepsizeSlider = p.second;
    stepsizeSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    // beta
    p = VruiHelp::createParameter("Repulsion Falloff", -0.6, -0.1, layout->beta, dialog);
    betaField = p.first;
    betaSlider = p.second;
    betaSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    // strongly connected constant slider
    p = VruiHelp::createParameter("Strongly Connected Const", -5, -1, layout->stronglyConnectedSpringConstant, dialog);
    stronglyConnectedConstantField = p.first;
    stronglyConnectedConstantSlider = p.second;
    stronglyConnectedConstantSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    // connected constant slider
    p = VruiHelp::createParameter("Connected Const", -5, -1, layout->connectedSpringConstant, dialog);
    connectedConstantField = p.first;
    connectedConstantSlider = p.second;
    connectedConstantSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    // unconnected constant slider
    p = VruiHelp::createParameter("Unconnected Const", -5, -1, layout->unconnectedSpringConstant, dialog);
    unconnectedConstantField = p.first;
    unconnectedConstantSlider = p.second;
    unconnectedConstantSlider->getValueChangedCallbacks().add(this, &ArfWindow::sliderCallback);
    
    GLMotif::Button* navButton = new GLMotif::Button("NavButton", dialog, "Center Graph");
    navButton->getSelectCallbacks().add(application, &Mycelia::resetNavigationCallback);
    
    dialog->manageChild();
}
Пример #6
0
/*
 * createContoursDialog - Create color map dialog.
 *
 * parameter styleSheet - const GLMotif::StyleSheet&
 */
void Contours::createContoursDialog(const GLMotif::StyleSheet& styleSheet) {
    GLMotif::RowColumn* contoursDialog =
      new GLMotif::RowColumn("ContoursDialog", this, false);
    GLMotif::Label * contourLabel = new GLMotif::Label(
      "ContourLabel", contoursDialog, "Contours");
    contourLabel->setString("Contour");
    createAlphaComponent(styleSheet, contoursDialog);
    GLMotif::RowColumn* buttonBox = createButtonBox(contoursDialog);
    buttonBox->manageChild();
    GLMotif::Label * sliceContourLabel = new GLMotif::Label(
      "SliceContourLabel", contoursDialog, "SliceContours");
    sliceContourLabel->setString("Slice Contours");
    createXYZContours(styleSheet, contoursDialog);
    contoursDialog->manageChild();
}
/*
 * createYStepSlider
 *
 * parameter styleSheet - const GLMotif::StyleSheet&
 * parameter downSamplingDialog - GLMotif::RowColumn*&
 */
void DownSampling::createYStepSlider(const GLMotif::StyleSheet& styleSheet, GLMotif::RowColumn*& downSamplingDialog) {
    GLMotif::RowColumn* yStepSliderRowColumn = new GLMotif::RowColumn("YStepSliderRowColumn", downSamplingDialog, false);
    yStepSliderRowColumn->setOrientation(GLMotif::RowColumn::HORIZONTAL);
    yStepSliderRowColumn->setPacking(GLMotif::RowColumn::PACK_TIGHT);
    GLMotif::Label * yStepLabel = new GLMotif::Label("YStepLabel", yStepSliderRowColumn, "Y");
    yStepLabel->setLabel("Y");
    yStepTextField = new GLMotif::TextField("YStepTextField", yStepSliderRowColumn, 6);
    yStepTextField->setFieldWidth(4);
    yStepTextField->setPrecision(3);
    yStepTextField->setValue(yStep);
    yStepSlider = new GLMotif::Slider("YStepSlider", yStepSliderRowColumn, GLMotif::Slider::HORIZONTAL, styleSheet.fontHeight
            * 5.0f);
    yStepSlider->setSliderColor(GLMotif::Color(0.5f, 0.5f, 0.5f));
    yStepSlider->setValueRange(1, stepMaximum, 1);
    yStepSlider->setValue(yStep);
    yStepSlider->getValueChangedCallbacks().add(this, &DownSampling::yStepSliderCallback);
    yStepSliderRowColumn->manageChild();
} // end createYStepSlider()
Пример #8
0
void VerticalScaleDialog::init()
{
  Dialog::init();

  const GLMotif::StyleSheet* style = Vrui::getWidgetManager()->getStyleSheet();

  GLMotif::RowColumn* root = new GLMotif::RowColumn("ScaleRoot", dialog, false);

  GLMotif::Slider* slider = new GLMotif::Slider(
    "ScaleSlider", root, GLMotif::Slider::HORIZONTAL,
    10.0 * style->fontHeight);
  slider->setValue(0.0);
  slider->setValueRange(-0.5, 2.5, 0.00001);
  slider->getValueChangedCallbacks().add(
    this,
    &VerticalScaleDialog::changeScaleCallback);

  scaleLabel = new GLMotif::Label("ScaleLabel", root, "1.0x");

  root->setNumMinorWidgets(2);
  root->manageChild();
}
Пример #9
0
/*
 * createTimeStepBox - Create a box to hold timestep buttons
 *
 * parameter animationDialog - GLMotif::RowColumn*&
 * return - GLMotif::RowColumn*
 */
GLMotif::RowColumn* AnimationDialog::createTimeStepBox(
  GLMotif::RowColumn*& animationDialog)
{
  GLMotif::RowColumn* buttonBox =
    new GLMotif::RowColumn("ButtonBox", animationDialog, false);
  buttonBox->setOrientation(GLMotif::RowColumn::HORIZONTAL);
  buttonBox->setPacking(GLMotif::RowColumn::PACK_GRID);
  GLMotif::ToggleButton* loopButton = new GLMotif::ToggleButton(
    "Loop", buttonBox, "Loop");
  loopButton->setToggle(false);
  loopButton->getValueChangedCallbacks().add(this,
    &AnimationDialog::loopPlayCallback);
  std::stringstream stimeStepRange;
  stimeStepRange << "Step (" << std::setprecision(4) <<
    0 << " - " << this->numberOfTimeSteps - 1 << "):";
  GLMotif::Label* timeStepLabel = new GLMotif::Label(
    "TimeStep", buttonBox, stimeStepRange.str().c_str());
  timeStepLabel->setHAlignment(GLFont::Center);
  this->stepField = new GLMotif::TextField(
    "TimeStepField", buttonBox, 6);
  this->stepField->setHAlignment(GLFont::Center);
  this->stepField->setEditable(false);
  this->stepField->setValue(0);
  std::stringstream stimeValueRange;
  stimeValueRange << "Time (" << std::setprecision(4) <<
    this->minTime << " - " << this->maxTime << "):";
  GLMotif::Label* timeValueLabel = new GLMotif::Label(
    "TimeValue", buttonBox, stimeValueRange.str().c_str());
  timeValueLabel->setHAlignment(GLFont::Center);
  this->timeField = new GLMotif::TextField(
    "TimeValueField", buttonBox, 6);
  this->timeField->setHAlignment(GLFont::Center);
  this->timeField->setEditable(false);
  this->timeField->setPrecision(4);
  this->timeField->setValue(0.0f);
  return buttonBox;
}
Пример #10
0
void OpacityDialog::init()
{
  Dialog::init();

  const GLMotif::StyleSheet* style = Vrui::getWidgetManager()->getStyleSheet();

  GLMotif::RowColumn* root = new GLMotif::RowColumn("OpacityRoot", dialog, false);

  GLMotif::Slider* slider = new GLMotif::Slider(
    "OpacitySlider",
    root,
    GLMotif::Slider::HORIZONTAL,
    10.0 * style->fontHeight);
  slider->setValue(1.0);
  slider->setValueRange(0.0, 1.0, 0.01);
  slider->getValueChangedCallbacks().add(
    this,
    &OpacityDialog::changeOpacityCallback);

  opacityLabel = new GLMotif::Label("OpacityLabel", root, "1.0");

  root->setNumMinorWidgets(2);
  root->manageChild();
}
Пример #11
0
/*
 * createAnimationDialog - Create animation dialog.
 *
 * parameter styleSheet - const GLMotif::StyleSheet&
 */
void AnimationDialog::createAnimationDialog(const GLMotif::StyleSheet& styleSheet)
{
  GLMotif::RowColumn* animationDialog =
    new GLMotif::RowColumn("AnimationDialog", this, false);
  GLMotif::RowColumn* buttonBox = createButtonBox(animationDialog);
  buttonBox->manageChild();
  GLMotif::RowColumn* timeStepBox = createTimeStepBox(animationDialog);
  timeStepBox->manageChild();
  animationDialog->manageChild();
}
void TerrainColorSettingsDialog::init()
{
  Dialog::init();

  const GLMotif::StyleSheet* style = Vrui::getWidgetManager()->getStyleSheet();

  colorPicker.setCloseButton(true);
  colorPicker.getColorPicker()->getColorChangedCallbacks().add(this, &TerrainColorSettingsDialog::colorChangedCallback);

  GLMotif::RowColumn* root = new GLMotif::RowColumn("TCSRoot", dialog, false);
  root->setNumMinorWidgets(2);

  GLMotif::Button* button = NULL;

//- Emissive Color
  new GLMotif::Label("TCSEmissive", root, "Emissive:");
  button = new GLMotif::Button("TSCEmissiveButton", root, "");
  button->setBackgroundColor(SETTINGS->terrainEmissiveColor);
  button->getSelectCallbacks().add(this, &TerrainColorSettingsDialog::colorButtonCallback);

//- Ambient Color
  new GLMotif::Label("TCSAmbient", root, "Ambient:");
  button = new GLMotif::Button("TSCAmbientButton", root, "");
  button->setBackgroundColor(SETTINGS->terrainAmbientColor);
  button->getSelectCallbacks().add(this, &TerrainColorSettingsDialog::colorButtonCallback);

//- Diffuse Color
  new GLMotif::Label("TCSDiffuse", root, "Diffuse:");
  button = new GLMotif::Button("TSCDiffuseButton", root, "");
  button->setBackgroundColor(SETTINGS->terrainDiffuseColor);
  button->getSelectCallbacks().add(this, &TerrainColorSettingsDialog::colorButtonCallback);

//- Specular Color
  new GLMotif::Label("TCSSpecular", root, "Specular:");
  button = new GLMotif::Button("TSCSpecularButton", root, "");
  button->setBackgroundColor(SETTINGS->terrainSpecularColor);
  button->getSelectCallbacks().add(this, &TerrainColorSettingsDialog::colorButtonCallback);

//- Specular Shininess
  new GLMotif::Label("TCSShininess", root, "Shininess:");
  GLMotif::RowColumn* shininessRoot = new GLMotif::RowColumn("TCSShininessRoot", root, false);
  shininessRoot->setNumMinorWidgets(2);

  GLMotif::Slider* slider = new GLMotif::Slider(
    "TCSShininessSlider",
    shininessRoot,
    GLMotif::Slider::HORIZONTAL,
    5.0 * style->fontHeight);
  slider->setValue(SETTINGS->terrainShininess);
  slider->setValueRange(0.0f, 128.0f, 1.0f);
  slider->getValueChangedCallbacks().add(this, &TerrainColorSettingsDialog::shininessChangedCallback);
  shininessField = new GLMotif::TextField(
    "SSShininessField",
    shininessRoot,
    3);
  shininessField->setPrecision(3);
  shininessField->setValue(SETTINGS->terrainShininess);

  shininessRoot->manageChild();

  root->manageChild();
}