Package syn3d.nodes.java3d

Source Code of syn3d.nodes.java3d.LoaderNodeJava3D

/* ========================
* 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-2004, by :
*     Corporate:
*         EADS Astrium SAS
*         EADS CRC
*     Individual:
*         Claude Cazenave
*
* $Id: LoaderNodeJava3D.java,v 1.2 2005/06/14 13:12:59 ogor Exp $
*
* Changes
* -------
* 19 mars 2005 : Initial public release (CC);
*
*/
package syn3d.nodes.java3d;

import java.util.Hashtable;
import java.util.Iterator;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Group;
import syn3d.base.ActiveNode;
import syn3d.nodes.LoaderNode;
import syn3d.nodes.java3d.LoaderHandlerJava3D;
import syn3d.nodes.LoaderHandler;

/**
* A node to manage 3D files using various formats thanks to java3D Loader
* abstraction
*
* @author cazenave_c
*/
public class LoaderNodeJava3D extends LoaderNode {

  BranchGroup branchGroup;

  /**
   * @param parent
   */
  public LoaderNodeJava3D(ActiveNode parent, LoaderHandler handler){
    super(parent,handler);
   
    LoaderHandlerJava3D jlh= (LoaderHandlerJava3D)handler;
    branchGroup=jlh.scene.getSceneGroup();
    branchGroup.setUserData(this);
    SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), branchGroup);
    Hashtable m=jlh.scene.getNamedObjects();
    if(m!=null && m.size()>0){
      // TODO map these objects into corresponding ActiveNode
      // or do it for all the branchgroup sub nodes
      System.out.println("Scene contains :");
      Iterator it=m.keySet().iterator();
      while(it.hasNext()){
        Object v=it.next();
        System.out.println(v+"<=>"+m.get(v));
      }
    } 
  }

  /* (non-Javadoc)
   * @see syn3d.base.ActiveNode#get3DObject()
   */
  public Object get3DObject() {
    return branchGroup;
  }
}
TOP

Related Classes of syn3d.nodes.java3d.LoaderNodeJava3D

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.