Package jsynoptic.plugins.syn3d.xith3d

Source Code of jsynoptic.plugins.syn3d.xith3d.Xith3DPlugin3D

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
*     Corporate:
*         Astrium SAS
*     Individual:
*         Ronan Ogor
*
* $Id: Xith3DPlugin3D.java,v 1.4 2005/12/20 10:49:42 cazenave Exp $
*
* Changes
* -------
* 10 juin 2005 : Creation date (RO);
*
*/
package jsynoptic.plugins.syn3d.xith3d;

import java.util.StringTokenizer;

import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;

import jsynoptic.base.Plugin;
import jsynoptic.ui.Run;
import simtools.diagram.DiagramComponent;
import simtools.shapes.AbstractShape;
import simtools.ui.NamedElementContainer;
import simtools.ui.UserProperties;

import syn3d.base.PluginManager;
import syn3d.base.xith3d.Xith3DPluginManager;
import syn3d.builtin.xith3d.Xith3DSyn3DBuiltin;
import syn3d.ui.SceneGraphEditor;
import syn3d.ui.SceneGraphModel;
import syn3d.ui.SceneGraphTree;
import syn3d.ui.xith3d.SceneGraphModelXith3D;
import syn3d.base.Syn3DPlugin;


/**
* The Plugin3D class is the starting point to add 3D scenes in Jsynoptic.
* A Java3DPlugin3D class is related to a Java3D  viewer.
*
* @author Ronan OGOR
*
*/
public class Xith3DPlugin3D extends Plugin{
  protected SceneGraphTree sceneTree;
  protected SceneGraphEditor editor;
    protected PluginManager pluginManager;
    protected String pluginName;
    protected Syn3DPlugin mainBuiltin;
    protected SceneGraphModel tm;
   
  public Xith3DPlugin3D(){
   
    pluginName = new String("Xith 3D Viewer");
    pluginManager = ((PluginManager) new Xith3DPluginManager());
   
    mainBuiltin = (Syn3DPlugin)pluginManager.getPlugin(Xith3DSyn3DBuiltin.class);
   
    tm = ((SceneGraphModel)new SceneGraphModelXith3D());
   
    // Others builtins related to the Java 3D plugin
    UserProperties p=Run.getProperties();
    String plugins=p.getProperty("syn3d.plugins.xith3d");
   
   
    // TODO placer dans la classe m�re ?
    if(plugins!=null){
      StringTokenizer st=new StringTokenizer(plugins,",;");
      while(st.hasMoreTokens()){
        String pn=st.nextToken();
        pluginManager.register(pn);
      }
    } 
  }
 
  /* (non-Javadoc)
   * @see jsynoptic.base.Plugin#getShapes()
   */
  public String[] getShapes() {
    return new String[] {"3D View"};
  }
 
 
  public  AbstractShape createShape(String name, DiagramComponent diagram){
    if (name.equals("3D View")) return new Xith3DView3DShape(this,0,0,400,300);
    return null;
  }
 
 
  /* (non-Javadoc)
   * @see jsynoptic.base.Plugin#newSourceComponent(simtools.ui.NamedElementContainer)
   */
  public void newSourceComponent(NamedElementContainer nec) {
    if(sceneTree==null){     
      mainBuiltin.createFromKey("Scene",tm.getRootNode());
      sceneTree = new SceneGraphTree(tm);
      sceneTree.setName(pluginName);
      sceneTree.setAutoHighlight(true);
      editor=new SceneGraphEditor(sceneTree, pluginManager);
      JScrollPane sp = new JScrollPane(sceneTree);
      nec.addElement(sp, pluginName);
    }
  }
 
  public SceneGraphTree getSceneTree() {
    return sceneTree;
  }
 
  public SceneGraphEditor getEditor() {
    return editor;
  }
 
  public PluginManager getPluginManager(){
    return pluginManager;
  }
 
 
 
}

TOP

Related Classes of jsynoptic.plugins.syn3d.xith3d.Xith3DPlugin3D

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.