Package syn3d.nodes.java3d

Source Code of syn3d.nodes.java3d.SwitchNodeJava3D

/* ========================
* 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 Corporate Research Center
*     Individual:
*         Nicolas Brodu
*
* $Id: SwitchNodeJava3D.java,v 1.6 2006/06/08 09:50:21 ogor Exp $
*
* Changes
* -------
* 19-Mar-2004 : Creation date (NB);
*
*/
package syn3d.nodes.java3d;
import java.io.Serializable;
import javax.media.j3d.Group;
import javax.media.j3d.Switch;

import syn3d.base.ActiveNode;
import syn3d.nodes.SwitchNode;

/**
*
*/
public class SwitchNodeJava3D extends SwitchNode implements Serializable {

  static final long serialVersionUID = -6243346502581751808L;
 
    protected transient Switch sw;
   
    public SwitchNodeJava3D(ActiveNode parent) {
        super(parent);
        sw = new Switch(Switch.CHILD_MASK);
        sw.setUserData(this);
        sw.setPickable(true);
        sw.setCapability(Switch.ALLOW_SWITCH_WRITE);
        SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), sw);
    }

    /* (non-Javadoc)
     * @see syn3d.base.ActiveNode#remove()
     */
    public void remove() {
      SceneNodeJava3D.removeChildFromParentGroup(sw);
        super.remove();
    }
   
    public Object get3DObject() {
        return sw;
    }
   
 
  /* (non-Javadoc)
   * @see syn3d.base.ActiveNode#notifyInternalChange()
   */
  public void notifyInternalChange() {
    sw.setChildMask(status);
    super.notifyInternalChange();
  }
    
    public void restoreReferences(ActiveNode parent) {
        super.restoreReferences(parent);
        SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), sw);
    }

   
    private void readObject(java.io.ObjectInputStream in) throws java.lang.ClassNotFoundException, java.io.IOException {
      in.defaultReadObject();
      sw = new Switch(Switch.CHILD_MASK);
      sw.setUserData(this);
      sw.setPickable(true);
      sw.setCapability(Switch.ALLOW_SWITCH_WRITE);
      sw.setChildMask(status);
    }
   
   
}
TOP

Related Classes of syn3d.nodes.java3d.SwitchNodeJava3D

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.