Example #1
0
  private void doUpdate() {
    if (restorePending) {
      return; // we will get called again
      // after the restore is
      // complete
    }
    canvas.stopRenderer();
    canvas.setDoubleBufferEnable(doubleBufferAttr.getValue());
    if (coordSysAttr.getValue()) {
      coordSwitch.setWhichChild(Switch.CHILD_ALL);
    } else {
      coordSwitch.setWhichChild(Switch.CHILD_NONE);
    }
    if (getAnnotationsAttr().getValue()) {
      staticBackAnnotationSwitch.setWhichChild(Switch.CHILD_ALL);
      dynamicBackAnnotationSwitch.setWhichChild(Switch.CHILD_ALL);
      staticFrontAnnotationSwitch.setWhichChild(Switch.CHILD_ALL);
      dynamicFrontAnnotationSwitch.setWhichChild(Switch.CHILD_ALL);
    } else {
      staticBackAnnotationSwitch.setWhichChild(Switch.CHILD_NONE);
      dynamicBackAnnotationSwitch.setWhichChild(Switch.CHILD_NONE);
      staticFrontAnnotationSwitch.setWhichChild(Switch.CHILD_NONE);
      dynamicFrontAnnotationSwitch.setWhichChild(Switch.CHILD_NONE);
    }
    if (perspectiveAttr.getValue()) {
      view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
    } else {
      view.setProjectionPolicy(View.PARALLEL_PROJECTION);
    }
    if (renderer != renderers[rendererAttr.getValue()]) {
      // TODO: renderer.clear();
      // TODO: handle gui
      try {
        System.out.println("Clearing Attached : VolRend-doUpdate()");
        clearAttach();

      } catch (Exception e) {
        e.printStackTrace();
      }
      renderer = renderers[rendererAttr.getValue()];
      renderer.attach(dynamicAttachGroup, staticAttachGroup);
    }
    try {
      renderer.update();
      annotations.update();
    } catch (Exception e) {

      e.printStackTrace();
    } catch (OutOfMemoryError e) {
      JOptionPane.showMessageDialog(
          null, "Ran out of memory!", "Render Error", JOptionPane.ERROR_MESSAGE);
    }
    int newVolEditId;
    if ((newVolEditId = volume.update()) != volEditId) {
      updateCenter(volume.minCoord, volume.maxCoord);
      newVolEditId = volEditId;
    }
    eyePtChanged();
    canvas.startRenderer();
  }