/**
  * Returns a Content instance if there is one registered
  *
  * @param <T>
  * @param clazz the class of the plug-in
  * @return a plug-in instance or null if no such plug-in was registered
  */
 public static Content getContentPlugin(Controller c) {
   List<Content> candidates = c.getPlugins(Content.class);
   if (candidates.size() != 0) {
     sort(candidates, new ContentPriorityComparator());
     return c.getPlugin(candidates.get(0).getClass());
   } else {
     return c.getPlugin(defaultContentClass);
   }
 }
Example #2
0
 @Override
 public void uninstall(Controller c) throws Exception {
   super.uninstall(c);
   Scene scene = c.getPlugin(Scene.class);
   scene.getBackdropComponent().removeChild(terrain);
   viewPreferences.removeColorPickerChangedListener(this);
   VRPanel vp = c.getPlugin(VRPanel.class);
   vp.removeAll(getClass());
 }
 @Override
 public void install(Controller c) throws Exception {
   super.install(c);
   Scene scene = c.getPlugin(Scene.class);
   setContentSize(contentSize);
   setVerticalOffset(verticalOffset);
   transformationComponent = scene.getContentComponent();
   scalingComponent.setTransformation(new Transformation("scaling trafo"));
   transformationComponent.addChild(scalingComponent);
   SceneGraphPath newEmptyPick = scene.getContentPath().pushNew(scalingComponent);
   scene.setEmptyPickPath(newEmptyPick);
   createGUI();
   MainPanel msp = c.getPlugin(MainPanel.class);
   msp.addComponent(getClass(), panel, 0.0, "Content");
 }
 @Override
 public void uninstall(Controller c) throws Exception {
   MainPanel msp = c.getPlugin(MainPanel.class);
   msp.removeAll(getClass());
   transformationComponent.removeChild(scalingComponent);
   super.uninstall(c);
 }
Example #5
0
 @Override
 public void restoreStates(Controller c) throws Exception {
   setFaceColor(c.getProperty(getClass(), "faceColor", DEFAULT_TERRAIN_COLOR));
   setTransparency(c.getProperty(getClass(), "transparency", DEFAULT_TRANSPARENCY));
   setTransparencyEnabled(
       c.getProperty(getClass(), "transparencyEnabled", DEFAULT_TRANSPARENCY_ENABLED));
   setFacesReflecting(c.getProperty(getClass(), "facesReflecting", DEFAULT_FACES_REFLECTING));
   setFaceReflection(c.getProperty(getClass(), "faceReflection", DEFAULT_FACE_REFLECTION));
   setReflectSceneContent(c.getProperty(getClass(), "reflectSceneContent", false));
   textureInspector.setTextures(c.getProperty(getClass(), "textures", textures));
   textureInspector.setTexture(c.getProperty(getClass(), "texture", DEFAULT_TEXTURE));
   textureInspector.setTextureUScale(
       c.getProperty(getClass(), "textureScale", DEFAULT_TEXTURE_SCALE));
   setVisible(c.getProperty(getClass(), "visible", true));
   updateAll();
   super.restoreStates(c);
 }
Example #6
0
  @Override
  public void install(Controller c) throws Exception {
    super.install(c);

    // scene
    Scene scene = c.getPlugin(Scene.class);
    scene.getBackdropComponent().addChild(terrain);
    scene.setAutomaticClippingPlanes(false);

    viewPreferences = c.getPlugin(ViewPreferences.class);
    viewPreferences.addColorPickerChangedListener(this);
    faceColorChooser.getColorPanel().setMode(viewPreferences.getColorPickerMode());

    textureInspector.setAppearance(appearance);
    updateFaceColor();
    updateFacesReflecting();
    updateFaceReflection();
    updateTransparencyEnabled();
    updateTransparency();
    VRPanel vp = c.getPlugin(VRPanel.class);
    vp.addComponent(getClass(), shrinkPanel, 1.0, "VR");
  }
Example #7
0
 @Override
 public void install(Controller c) throws Exception {
   super.install(c);
   viewMenuBar = c.getPlugin(ViewMenuBar.class);
   View view = c.getPlugin(View.class);
   ViewerSwitch viewer = view.getViewer();
   Component parent = viewer.getViewingComponent();
   exportMenu.setIcon(ImageHook.getIcon("disk.png"));
   exportMenu.add(new ExportImage("Image", viewer, parent));
   exportMenu.add(new ExportScreenshot("Screenshot", viewer, parent));
   exportMenu.add(new ExportRIB("RIB", viewer, parent));
   exportMenu.add(new ExportSVG("SVG", viewer, parent));
   exportMenu.add(new ExportPS("PS", viewer, parent));
   exportMenu.add(new ExportVRML("VRML", viewer, parent));
   exportMenu.add(new ExportSTL("STL", viewer, parent));
   exportMenu.add(new ExportOBJ("OBJ", viewer, parent));
   exportMenu.add(new ExportU3D("U3D", viewer, parent));
   exportMenu.add(exportPDF = new ExportPDF("PDF", viewer, parent));
   exportMenu.add(new SunflowMenu(viewer));
   SaveScene saveSceneAction = new SaveScene("Save Scene", viewer, parent);
   saveSceneAction.setIcon(ImageHook.getIcon("disk.png"));
   viewMenuBar.addMenuItem(getClass(), 1, saveSceneAction, "File");
   viewMenuBar.addMenuItem(getClass(), 2, exportMenu, "File");
 }
 @Override
 public void storeStates(Controller c) throws Exception {
   c.storeProperty(getClass(), "size", getContentSize());
   c.storeProperty(getClass(), "offset", getVerticalOffset());
   super.storeStates(c);
 }
 @Override
 public void restoreStates(Controller c) throws Exception {
   setContentSize(c.getProperty(getClass(), "size", DEFAULT_CONTENT_SIZE));
   setVerticalOffset(c.getProperty(getClass(), "offset", DEFAULT_VERTICAL_OFFSET));
   super.restoreStates(c);
 }
Example #10
0
 @Override
 public void storeStates(Controller c) throws Exception {
   c.storeProperty(getClass(), "textures", textureInspector.getTextures());
   c.storeProperty(getClass(), "texture", textureInspector.getActiveTexture());
   c.storeProperty(getClass(), "textureScale", textureInspector.getTextureUScale());
   c.storeProperty(getClass(), "visible", isVisible());
   c.storeProperty(getClass(), "faceColor", getFaceColor());
   c.storeProperty(getClass(), "transparency", getTransparency());
   c.storeProperty(getClass(), "transparencyEnabled", isTransparencyEnabled());
   c.storeProperty(getClass(), "facesReflecting", isFacesReflecting());
   c.storeProperty(getClass(), "faceReflection", getFaceReflection());
   c.storeProperty(getClass(), "reflectSceneContent", isReflectSceneContent());
   c.storeProperty(getClass(), "visible", isVisible());
   super.storeStates(c);
 }