/* ========================
* 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: TransformGroupNodeJava3D.java,v 1.5 2006/06/08 09:50:21 ogor Exp $$
*
* Changes
* -------
* ${date} : Initial public release (CC);
*
*/
package syn3d.nodes.java3d;
import java.io.Serializable;
import javax.media.j3d.Group;
import javax.media.j3d.TransformGroup;
import syn3d.base.ActiveNode;
import syn3d.data.java3d.TransformDataJava3d;
import syn3d.nodes.TransformGroupNode;
/**
*
*/
public class TransformGroupNodeJava3D extends TransformGroupNode implements Serializable {
static final long serialVersionUID = 898489193644627592L;
protected transient TransformGroup transformGroup;
public TransformGroupNodeJava3D(ActiveNode parent) {
super(parent);
transformGroup = new TransformGroup();
transformGroup.setUserData(this);
transformGroup.setPickable(true);
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), transformGroup);
data = new TransformDataJava3d(transformGroup, this);
initData();
}
public void remove() {
SceneNodeJava3D.removeChildFromParentGroup(transformGroup);
super.remove();
}
public Object get3DObject() {
return transformGroup;
}
public void restoreReferences(ActiveNode parent) {
super.restoreReferences(parent);
((TransformDataJava3d)data).restoreTransform(transformGroup, this);
SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), transformGroup);
}
private void readObject(java.io.ObjectInputStream in) throws java.lang.ClassNotFoundException, java.io.IOException {
in.defaultReadObject();
transformGroup = new TransformGroup();
transformGroup.setUserData(this);
transformGroup.setPickable(true);
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
}
}