Package jsynoptic.plugins.java3d.edit

Source Code of jsynoptic.plugins.java3d.edit.Transform3DEdit$Group

/* ========================
* 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-2007, by :
*     Corporate:
*         EADS Astrium
*     Individual:
*         Claude Cazenave
*
* $Id: Transform3DEdit.java,v 1.3 2008/10/22 16:02:11 cazenave Exp $
*
* Changes
* -------
* 23 janv. 08  : Initial public release
*
*/
package jsynoptic.plugins.java3d.edit;

import javax.media.j3d.SceneGraphObject;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;

import jsynoptic.plugins.java3d.TransformAnimator;
import jsynoptic.plugins.java3d.AnimatorFactory.Parameters;
import jsynoptic.plugins.java3d.util.TransformValues;

public abstract class Transform3DEdit<T extends SceneGraphObject> extends
        PropertyEdit<T, Transform3D> {

    public static final String Transform = "Transform";

    public Transform3DEdit(T object) {
        super(object, Transform);
    }

    public double[] getOldValues(TransformValues[] kind) {
        return TransformValues.get(_oldValue, kind);
    }

    public void setNewValues(double[] values, TransformValues kind) {
        if (_newValue == null) {
            _newValue = new Transform3D();
        }
        kind.set(_newValue, values);
        compare();
        if (_changed)
            setPropertyValue(_newValue);
    }

    public static class Group extends Transform3DEdit<TransformGroup> {

        public Group(TransformGroup object) {
            super(object);
        }

        public double[] getPropertyValues(TransformValues[] kind) {
            return TransformValues.get(getPropertyValue(), kind);
        }

        @Override
        public Transform3D getPropertyValue() {
            Transform3D t1 = new Transform3D();
            _object.getTransform(t1);
            return t1;
        }

        @Override
        public void setPropertyValue(Transform3D value) {
            boolean forced=forceCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            _object.setTransform(value);
            if(forced) restoreCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        }

        @Override
        public String getDisplayClassName() {
            return "jsynoptic.plugins.java3d.panels.TransformTable";
        }
       
        /* (non-Javadoc)
         * @see jsynoptic.plugins.java3d.edit.PropertyEdit#getAnimatorParameters()
         */
        @Override
        public Parameters getAnimatorParameters() {
            return new Parameters(TransformAnimator.class);
        }

    }
}
TOP

Related Classes of jsynoptic.plugins.java3d.edit.Transform3DEdit$Group

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.